From patchwork Wed Dec 16 09:28:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 58488 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp578395lbb; Wed, 16 Dec 2015 01:31:41 -0800 (PST) X-Received: by 10.55.71.82 with SMTP id u79mr11693262qka.55.1450258301345; Wed, 16 Dec 2015 01:31:41 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 16si5797347qhb.99.2015.12.16.01.31.40; Wed, 16 Dec 2015 01:31:41 -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 9825F61D33; Wed, 16 Dec 2015 09:31:40 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=RfAQyzYp; 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 DC50761D0A; Wed, 16 Dec 2015 09:30:32 +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 6B1C661CF0; Wed, 16 Dec 2015 09:30:29 +0000 (UTC) Received: from mail-ig0-f172.google.com (mail-ig0-f172.google.com [209.85.213.172]) by lists.linaro.org (Postfix) with ESMTPS id B67A661099 for ; Wed, 16 Dec 2015 09:29:06 +0000 (UTC) Received: by mail-ig0-f172.google.com with SMTP id to4so56422108igc.0 for ; Wed, 16 Dec 2015 01:29:06 -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; bh=HnI/p5vk/aClZlDq5IhotYlYFPWfcFaWbgWytVqJxJ4=; b=RfAQyzYpIPou3bj0MJ+MDKgL3uHMI+2czbLVrk6blfkolNK4KZH3MzioE/7NnGE9O8 SW3H6smXV/erWfWh2wzkxYQ/+kLYYzj7Zo+y8AOjjh8if+rpkm3OHSwP+DQMB+olKYPp dUZSLJ9LaUP7l7fR2zDkUaBVgDgvKzVhQ+O1g= 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; bh=HnI/p5vk/aClZlDq5IhotYlYFPWfcFaWbgWytVqJxJ4=; b=ITOWDYTIvIiaSAsdevF5pc+DDZaW034JbUQyWwE7caylG/Pg5Q0hvLb4M+gWATad4T DVqfAM4NNeDo4QZwux37USSz6XXONbmnMePYRFgMsCBJsn8wpgR9VxsI0NMUu6oWGcME UjP1lmCiZhhE6bJZJcYdFuDve3PY3j5WKqUMNuS0CZsHM5jFq6aLi8Qf66Ka1bLy2h7n +EKVE7R0znzgoF1n8rrmf42r1FdSQpBWMQ04pBAwmgluz1Oj/gUqLXmQUOrXxMzMX0S5 sup5EIU1vpBHg5JUlGhW3MBBgJ/92EzUdNUlFLe2HGURZaL3DLPEYFju4cVFLjRI7gp/ B+qA== X-Gm-Message-State: ALoCoQmz00HmCMo40tpcQVs5Z3VccT0Ly+++ZLeZ3TkfjP7DtLWKbYyjJucEirEdafM2bHTEDk49/DQn4BDaQTjo+FImn/oyAg== X-Received: by 10.107.26.144 with SMTP id a138mr41232455ioa.100.1450258146302; Wed, 16 Dec 2015 01:29:06 -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.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Dec 2015 01:29:05 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Wed, 16 Dec 2015 14:58:48 +0530 Message-Id: <1450258133-3375-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: Classification patch Subject: [lng-odp] [API-NEXT/PATCHv2 1/6] api: classification: add class of serivce 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" class of service create function now takes pool, queue, drop policy and name as input parameters. Adds class of service parameter structure odp_cls_cos_param_t and initialization function odp_cls_cos_param_init() Signed-off-by: Balasubramanian Manoharan --- v2: additional documentation and review comments from Petri include/odp/api/classification.h | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h index 725e1ab..4db5bf0 100644 --- a/include/odp/api/classification.h +++ b/include/odp/api/classification.h @@ -37,7 +37,7 @@ extern "C" { /** * @def ODP_COS_INVALID - * This value is returned from odp_cos_create() on failure, + * This value is returned from odp_cls_cos_create() on failure, * May also be used as a sink class of service that * results in packets being discarded. */ @@ -60,9 +60,9 @@ extern "C" { */ /** - * Class-of-service packet drop policies + * class of service packet drop policies */ -typedef enum odp_cos_drop { +typedef enum odp_cls_drop { ODP_COS_DROP_POOL, /**< Follow buffer pool drop policy */ ODP_COS_DROP_NEVER, /**< Never drop, ignoring buffer pool policy */ } odp_drop_e; @@ -89,14 +89,39 @@ typedef enum odp_cos_hdr_flow_fields { } odp_cos_hdr_flow_fields_e; /** + * Class of service parameters + * Used to communicate class of service creation options + */ +typedef struct odp_cls_cos_param { + odp_queue_t queue; /**< Queue associated with CoS */ + odp_pool_t pool; /**< Pool associated with CoS */ + odp_drop_e drop_policy; /**< Drop policy associated with CoS */ +} odp_cls_cos_param_t; + +/** + * Initialize class of service parameters + * + * Initialize an odp_cls_cos_param_t to its default value for all fields + * + * @param param Address of the odp_cls_cos_param_t to be initialized + */ +void odp_cls_cos_param_init(odp_cls_cos_param_t *param); + +/** * Create a class-of-service * - * @param[in] name String intended for debugging purposes. + * @param name String intended for debugging purposes. * - * @return Class of service instance identifier + * @param param class of service parameters + * + * @retval class of service handle * @retval ODP_COS_INVALID on failure. + * + * @note ODP_QUEUE_INVALID and ODP_POOL_INVALID are valid values for queue + * and pool associated with a class of service and when any one of these values + * are configured as INVALID then the packets assigned to the CoS gets dropped. */ -odp_cos_t odp_cos_create(const char *name); +odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param); /** * Discard a class-of-service along with all its associated resources