From patchwork Wed Dec 16 09:28:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 58489 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp578633lbb; Wed, 16 Dec 2015 01:32:15 -0800 (PST) X-Received: by 10.140.230.8 with SMTP id a8mr53802795qhc.31.1450258335850; Wed, 16 Dec 2015 01:32:15 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e184si5835999qkb.28.2015.12.16.01.32.15; Wed, 16 Dec 2015 01:32:15 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 5E0F861CD1; Wed, 16 Dec 2015 09:32:15 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=FHVtnGdT; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 2942A61A08; Wed, 16 Dec 2015 09:30:46 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C741D61D0D; Wed, 16 Dec 2015 09:30:35 +0000 (UTC) Received: from mail-ig0-f176.google.com (mail-ig0-f176.google.com [209.85.213.176]) by lists.linaro.org (Postfix) with ESMTPS id AA5536183D for ; Wed, 16 Dec 2015 09:29:11 +0000 (UTC) Received: by mail-ig0-f176.google.com with SMTP id mv3so126519486igc.0 for ; Wed, 16 Dec 2015 01:29:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+SZPXsrStpI1gd4EMMwVckJY7UVdtkhW4DsFakgNdc8=; b=FHVtnGdTSPrFcWVETJZ80GkQQXguVAWTNcsf2+rzquPeDDwuuC/0WyJcg263K4V0xL XNtcmU+LvCpyW0+PMjUXP2Uds3EF8itDbYfrahji1qFG0x8ZEaxYE9MxHaNsRkvHXHmC nVSX72YGg3fQfACV2wuwIt464vmNUXxJMwQ04= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+SZPXsrStpI1gd4EMMwVckJY7UVdtkhW4DsFakgNdc8=; b=XADHlvp6iRtDX3+cG/CEBsxnUeXunBaA5hREmWxBOS7vbjZtpXhQ/9Zjkdl3lAEBur zFGJk0VIj8JzPVKivM8IAVbkF8EcaNIgp/mGDY2HM2RMFvyGNMUyDZ7Evhp8P9oJOnoW cy1DT3vpebL9Sf5mPF+zefdLbA0nVUE05fhenZoRCiDbKWHK7jdHjMZKdJ3tpTuMFego iHg/YL0dtjm4ot7I45PnUqmsgQ8/P2R4TojVZqgOnr7BblE+UVDI0cPMtSvXKutmhD6c y943wahlo0oapox3OvkRTDsVEgctAaQXSqwPlZUuQc9yqpR348S/gwuzRqvXqcCVqQ8e FPUQ== X-Gm-Message-State: ALoCoQnnQgPKp/kSi5gkNONmOPbDynnSPP1ckENcou8uM2cgg/RL1Q/A5AVyKk67IqfEwMcOM5w5kQbQZAfmqAloCl2u57hWGQ== X-Received: by 10.107.10.94 with SMTP id u91mr45205807ioi.169.1450258151297; Wed, 16 Dec 2015 01:29:11 -0800 (PST) Received: from bala-Vostro-2520.caveonetworks.com ([111.93.218.67]) by smtp.gmail.com with ESMTPSA id o86sm2549486ioi.36.2015.12.16.01.29.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Dec 2015 01:29:10 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Wed, 16 Dec 2015 14:58:49 +0530 Message-Id: <1450258133-3375-2-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450258133-3375-1-git-send-email-bala.manoharan@linaro.org> References: <1450258133-3375-1-git-send-email-bala.manoharan@linaro.org> X-Topics: Classification patch Subject: [lng-odp] [API-NEXT/PATCHv2 2/6] linux-generic: classification: implement class of service create api X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Implements odp_cls_cos_create() and odp_cls_cos_param_init() functions Signed-off-by: Balasubramanian Manoharan --- platform/linux-generic/odp_classification.c | 31 ++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index b1f51af..da6123e 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -154,9 +154,32 @@ int odp_classification_term_global(void) return rc; } -odp_cos_t odp_cos_create(const char *name) +void odp_cls_cos_param_init(odp_cls_cos_param_t *param) +{ + param->queue = ODP_QUEUE_INVALID; + param->pool = ODP_POOL_INVALID; + param->drop_policy = ODP_COS_DROP_NEVER; +} + +odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param) { int i; + queue_entry_t *queue; + pool_entry_t *pool; + odp_drop_e drop_policy; + + /* Packets are dropped if Queue or Pool is invalid*/ + if (param->queue == ODP_QUEUE_INVALID) + queue = NULL; + else + queue = queue_to_qentry(param->queue); + + if (param->pool == ODP_POOL_INVALID) + pool = NULL; + else + pool = odp_pool_to_entry(param->pool); + + drop_policy = param->drop_policy; for (i = 0; i < ODP_COS_MAX_ENTRY; i++) { LOCK(&cos_tbl->cos_entry[i].s.lock); @@ -166,16 +189,18 @@ odp_cos_t odp_cos_create(const char *name) cos_tbl->cos_entry[i].s.name[ODP_COS_NAME_LEN - 1] = 0; cos_tbl->cos_entry[i].s.pmr = NULL; cos_tbl->cos_entry[i].s.linked_cos = NULL; - cos_tbl->cos_entry[i].s.queue = NULL; - cos_tbl->cos_entry[i].s.pool = NULL; + cos_tbl->cos_entry[i].s.queue = queue; + cos_tbl->cos_entry[i].s.pool = pool; cos_tbl->cos_entry[i].s.flow_set = 0; cos_tbl->cos_entry[i].s.headroom = 0; cos_tbl->cos_entry[i].s.valid = 1; + cos_tbl->cos_entry[i].s.drop_policy = drop_policy; UNLOCK(&cos_tbl->cos_entry[i].s.lock); return _odp_cast_scalar(odp_cos_t, i); } UNLOCK(&cos_tbl->cos_entry[i].s.lock); } + ODP_ERR("ODP_COS_MAX_ENTRY reached"); return ODP_COS_INVALID; }