From patchwork Tue Dec 8 10:21:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 57840 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp1698667lbb; Tue, 8 Dec 2015 02:22:47 -0800 (PST) X-Received: by 10.140.106.201 with SMTP id e67mr3344418qgf.80.1449570167669; Tue, 08 Dec 2015 02:22:47 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id k1si2747820qkl.107.2015.12.08.02.22.47; Tue, 08 Dec 2015 02:22:47 -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.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id 4939F6198A; Tue, 8 Dec 2015 10:22:47 +0000 (UTC) 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 9606161CC8; Tue, 8 Dec 2015 10:22:42 +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 51BA061CE1; Tue, 8 Dec 2015 10:22:39 +0000 (UTC) Received: from mail-pf0-f171.google.com (mail-pf0-f171.google.com [209.85.192.171]) by lists.linaro.org (Postfix) with ESMTPS id 0D99E61CCD for ; Tue, 8 Dec 2015 10:22:10 +0000 (UTC) Received: by pfu207 with SMTP id 207so10164315pfu.2 for ; Tue, 08 Dec 2015 02:22:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+SZPXsrStpI1gd4EMMwVckJY7UVdtkhW4DsFakgNdc8=; b=ANKZaC3oI3QaIA/6WvylUxtib5ioYYh3uUFpcq7ny40WOU2VIl/06aWVMQYd0kR8Uz +79/d/pDIsLTcN/kLO2IuyG9lJiNjeipBWZpqMSERr/u9VRo//eQPfHr9zdQOj4JPmx5 3sDVKung9/sK5Ds96CSeJ+nq2E/YanHuA/jJGDqT7NTyMDqCE2D2h5OEdn/SlrcFNa3D fy6srs3jmT3n2SSQjWv6eBbYBnSMgPY3a3HBz2+CeamhE4PPJ6bYklBEnbZx89tMYhuc x1I3N+1UCXDZCmrPyGP78DhfSmp2ZbzH/yukkqgAbbWWntOSwEZkzjA2Q1d9TSyhTeGX Epcg== 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=hIu6SkxkcUE/Sc21YiBbp9KaZPNY49tfxFLjXNQ+OuEPtbztVMW5P+bzjmUWvMIfL4 7hVKfoLL/1m4aII+jf5HLX9mHkFg5Eo5PvsveCGNDqCG3dlgPLR0/EwXpzdkptHZThbF 6MJh9hgD7K4HWx8JwiXDSth19aCqvYNScpLQV4Ll/GdSVgPz+4jfynEPu9xqJs/FoeiP BWBFFuI3CevayHCvMaEWLUGDvQZzLxu+TXHc3vpqrToeEKRRBNSIDkUfhuTS1KxhvmBJ 96mZrv6FsOZeSYKr2y4NLW9UB7TIqsTnU5p89xqm4YUrAPQAfS8YavUghog517SBnshD FigQ== X-Gm-Message-State: ALoCoQkEfcgL5UnXPOi5Rfm9p1eSzyNhicntQgOYZpVSgCd9XarKJbEfAUeeFRNvTkvjF5F40FIVddz/AGqHtha5oZgtPq6/RA== X-Received: by 10.98.7.91 with SMTP id b88mr3796096pfd.48.1449570129357; Tue, 08 Dec 2015 02:22:09 -0800 (PST) Received: from localhost.localdomain ([122.166.219.57]) by smtp.gmail.com with ESMTPSA id ah10sm3802119pad.23.2015.12.08.02.22.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 02:22:08 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Tue, 8 Dec 2015 15:51:50 +0530 Message-Id: <1449570112-5486-2-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449570112-5486-1-git-send-email-bala.manoharan@linaro.org> References: <1449570112-5486-1-git-send-email-bala.manoharan@linaro.org> X-Topics: Classification patch Cc: petri.savolainen@nokia.com Subject: [lng-odp] [API-NEXT/PATCHv1 2/4] 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; }