From patchwork Wed Aug 2 08:00:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 109194 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp5933529obm; Wed, 2 Aug 2017 01:02:59 -0700 (PDT) X-Received: by 10.233.222.131 with SMTP id s125mr28772676qkf.91.1501660979172; Wed, 02 Aug 2017 01:02:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501660979; cv=none; d=google.com; s=arc-20160816; b=FzMxccPkJBhBsWFEmrZBq2tl8KncP4JDxP/+BRokUwY676RA84K0Gchvb5Ss4cdcA2 7HuFwLySGI3yOtof7dMB2wgO8jTTcQv0uTH7ctPrsDCAQQjb8TpnLDpRFy7+ljKtd8g9 4JHbJv0WUEtgqXHlrh37eB7RQoF1OeqCdZcWxDGXOLl+gyG9Om7qGE7kRKhwW2WPCj1u oeijXJXHStA0l7VZwCcFXk/XK8kW7gvSdSMEeAdh0iEoeyIhr873VBdwiLdpwkFz+UCB 779/iiavihBjtqU7ajqX/V2muaotUPgeUQ6fFX9TFFOHNQcqNoruS/68c0XfSHxWvxSP Nhkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=Yt6Vt7FXJ/VBBvcA/UNW4CtKL1Rcc/KSTA7Y0qI5Zy0=; b=ONURo3ZL8riZo92OMBNxWS2lVsaYxdr4z/nLvgT/DBSWuf6OBvGoygqQkPjtdEv7uE 41m9vicit7wBXBzw+LME0bE4of5Cueozf52rLauIlpY/XHf+fQvurDVKjiqEnJ840nic TjD3wgprczGp2Rr5W7lMvOBW5CyDY2+BGfwUjBGuwGU6FGx45qtxmxe8FZiDJ7DR1Wnd 5fJzTzAENP6Zx4b6dhM8egR1b+dHE1AhmnoujtGjicNX4KdH9qr+e1cwppkRXKsZGlxg jMezysGWaFnp6Hqumi8rCsDODBLG9U6G0wHtEZaAsF99ZVqk7NM3Zm+lxHWtWjaoRIby rBGQ== ARC-Authentication-Results: i=1; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id y83si28273722qkb.301.2017.08.02.01.02.58; Wed, 02 Aug 2017 01:02:59 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id C20B965C10; Wed, 2 Aug 2017 08:02:58 +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.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,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 7751A65BE0; Wed, 2 Aug 2017 08:02:27 +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 11FD565BE0; Wed, 2 Aug 2017 08:02:22 +0000 (UTC) Received: from forward4o.cmail.yandex.net (forward4o.cmail.yandex.net [37.9.109.248]) by lists.linaro.org (Postfix) with ESMTPS id 83BB160D6F for ; Wed, 2 Aug 2017 08:01:49 +0000 (UTC) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::26]) by forward4o.cmail.yandex.net (Yandex) with ESMTP id B4729203A8 for ; Wed, 2 Aug 2017 11:01:47 +0300 (MSK) Received: from smtp2o.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp2o.mail.yandex.net (Yandex) with ESMTP id 00A2A50815DE for ; Wed, 2 Aug 2017 11:00:17 +0300 (MSK) Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id MYw6aDAhRa-0FXOefAo; Wed, 02 Aug 2017 11:00:15 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Suid-Status: 1 0 From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 2 Aug 2017 11:00:06 +0300 Message-Id: <1501660807-19189-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501660807-19189-1-git-send-email-odpbot@yandex.ru> References: <1501660807-19189-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 100 Subject: [lng-odp] [PATCH API-NEXT v2 2/3] api: classification: add support for packet hashing in classification 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Balasubramanian Manoharan Enable packet hashing per CoS to be able to distribute incoming packets to multiple queues linked with a CoS. Signed-off-by: Balasubramanian Manoharan --- /** Email created from pull request 100 (bala-manoharan:cls-queue-hashing3) ** https://github.com/Linaro/odp/pull/100 ** Patch: https://github.com/Linaro/odp/pull/100.patch ** Base sha: 30ed14c05ac17406c2f7890b34c4ac580b5e7a45 ** Merge commit sha: 90274f3fdf71c22f5acea7fec74851518fd7ab61 **/ include/odp/api/spec/classification.h | 91 +++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 5 deletions(-) diff --git a/include/odp/api/spec/classification.h b/include/odp/api/spec/classification.h index 39831b24..0c4a95c5 100644 --- a/include/odp/api/spec/classification.h +++ b/include/odp/api/spec/classification.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * @@ -19,12 +18,13 @@ extern "C" { #endif +#include +#include /** @defgroup odp_classification ODP CLASSIFICATION * Classification operations. * @{ */ - /** * @typedef odp_cos_t * ODP Class of service handle @@ -126,6 +126,13 @@ typedef struct odp_cls_capability_t { /** Maximum number of CoS supported */ unsigned max_cos; + /** Maximun number of queue supported per CoS + * if the value is 1, then hashing is not supported*/ + unsigned max_hash_queues; + + /** Protocol header combination supported for Hashing */ + odp_pktin_hash_proto_t hash_protocols; + /** A Boolean to denote support of PMR range */ odp_bool_t pmr_range_supported; } odp_cls_capability_t; @@ -164,9 +171,41 @@ typedef enum { * 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_cls_drop_t drop_policy; /**< Drop policy associated with CoS */ + /** Number of queues to be linked to this CoS. + * If the number is greater than 1 then hashing is enabled. + * If number is equal to 1 then hashing is disabled. + * When hashing is enabled the queues are created by the implementation + * and application need not configure any queue to the class of service. + * When hashing is disabled application has to configure the queue to + * the class of service. + * Depening on the implementation this number might be rounded-off to + * nearest supported value (e.g power of 2) + */ + uint32_t num_queue; + + /** Variant mapping for queue hash configurataion */ + union { + /** Mapping used when num_queue = 1, hashing is disabled in + * this case and application has to configure this queue and + * packets are delivered to this queue */ + odp_queue_t queue; + + /** Mapping used when num_queue > 1, hashing is enabled in + * this case and queues are created by the implementation */ + struct { + /** Queue parameters */ + odp_queue_param_t queue_param; + + /** Protocol header fields which are included in + * packet input hash calculation */ + odp_pktin_hash_proto_t hash_proto; + }; + }; + /** Pool associated with CoS */ + odp_pool_t pool; + + /** Drop policy associated with CoS */ + odp_cls_drop_t drop_policy; } odp_cls_cos_param_t; /** @@ -209,6 +248,23 @@ int odp_cls_capability(odp_cls_capability_t *capability); odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param); /** + * Queue hash result + * Returns the queue within a CoS in which a particular packet will be enqueued + * based on the packet parameters and hash protocol field configured with the + * class of service. + * + * @param cos class of service + * @param packet Packet handle + * + * @retval Returns the queue handle on which this packet will be + * enqueued. + * @retval ODP_QUEUE_INVALID for error case + * + * @note The packet has to be updated with valid header pointers L2, L3 and L4. + */ +odp_queue_t odp_cls_hash_result(odp_cos_t cos, odp_packet_t packet); + +/** * Discard a class-of-service along with all its associated resources * * @param[in] cos_id class-of-service instance. @@ -245,6 +301,31 @@ int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id); odp_queue_t odp_cos_queue(odp_cos_t cos_id); /** + * Get the number of queues linked with the specific class-of-service + * + * @param cos_id class-of-service instance. + * + * @return Number of queues linked with the class-of-service. + */ +uint32_t odp_cls_cos_num_queue(odp_cos_t cos_id); + +/** + * Get the list of queue associated with the specific class-of-service + * + * @param[in] cos_id class-of-service instance. + * + * @param[out] queue Array of queue handles associated + * with the class-of-service. + * + * @param[in] num Maximum number of queue handles to output. + * + * @return Number of queues linked with CoS + * @retval 0 on failure + */ +uint32_t odp_cls_cos_queues(odp_cos_t cos_id, odp_queue_t queue[], + uint32_t num); + +/** * Assign packet drop policy for specific class-of-service * * @param[in] cos_id class-of-service instance.