From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A33C5A2EFC for ; Tue, 15 Oct 2019 11:52:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 68F871EB42; Tue, 15 Oct 2019 11:52:42 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id B5ECB1EB2F for ; Tue, 15 Oct 2019 11:52:39 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x9F9isw0001963; Tue, 15 Oct 2019 02:52:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=/A6XPBXYBH4OOOMTN4PtEnLeu0EUvIQW5Vx8hdfz1yE=; b=ANn5xQLsqc7kxRRMX7AtQZDMdbO/fsxauWLnpPS5krh+fWzd0DGh1c2VCneN79tz3ull FidMlNl+1QcJ3inFYO+HrC7cHU6qGOO5Ca5BbjfA5PnUzKsCqIWeiVK3HHbfWi+zTZHV qwXJQM8OGNC6k3LYTx1hvppIfL7Z7qGqOZHdrayT7HN8OczUiwPJuXlQF8vRr7QLe1jJ Bl5u2Rfq8bmRg0b1d+0WX15E87yRt934XZcBJ6OTDtqD9Lsag7GD6079RZcp585ifXiQ BGWXX6wdsfUTW+Kl4ak13A1skRyS8HOaa1f1D8WpnOaIqp62B2AiRjJhGljkEZNyzFpe AQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2vkc6ra17a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Oct 2019 02:52:38 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 15 Oct 2019 02:52:37 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 15 Oct 2019 02:52:37 -0700 Received: from hyd1vattunuru-dt.caveonetworks.com (unknown [10.29.52.72]) by maili.marvell.com (Postfix) with ESMTP id 0C6CB3F7041; Tue, 15 Oct 2019 02:52:34 -0700 (PDT) From: To: CC: , , , , Vamsi Attunuru Date: Tue, 15 Oct 2019 15:22:05 +0530 Message-ID: <20191015095207.13249-2-vattunuru@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20191015095207.13249-1-vattunuru@marvell.com> References: <20190914055247.3841-2-vattunuru@marvell.com> <20191015095207.13249-1-vattunuru@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-15_04:2019-10-15,2019-10-15 signatures=0 Subject: [dpdk-dev] [PATCH v2 1/3] lib/ethdev: add ethdev op to get hash index X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Vamsi Attunuru Some networking devices may use custom algos for computing hash indices and spread the packets accordingly. Patch adds an eth_dev op to get the hash index correspond to the given hash value received in the initial packet on the given port. Some of the applications compute hash index from the hash value received in the initial packet and than configure the rxq to lcore mapping to make sure the mapped lcore/rxq would receive the upcoming traffic that has similar hash. Such applications may use these API to get the hash index used by the PMD for spreading those traffic. Signed-off-by: Vamsi Attunuru --- lib/librte_ethdev/rte_ethdev.c | 13 +++++++++++++ lib/librte_ethdev/rte_ethdev.h | 20 ++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_core.h | 5 +++++ lib/librte_ethdev/rte_ethdev_version.map | 3 +++ 4 files changed, 41 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index af82360..ed02168 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -3140,6 +3140,19 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id, } int +rte_eth_dev_rss_hash_index_get(uint16_t port_id, + uint32_t hash, uint32_t *hash_idx) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_index_get, -ENOTSUP); + return eth_err(port_id, (*dev->dev_ops->rss_hash_index_get)(dev, hash, + hash_idx)); +} + +int rte_eth_dev_udp_tunnel_port_add(uint16_t port_id, struct rte_eth_udp_tunnel *udp_tunnel) { diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index d937fb4..8198130 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -3306,6 +3306,26 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id, struct rte_eth_rss_conf *rss_conf); /** + * Get hash index of the given hash value that received in mbuf from this port. + * + * @param port_id + * The port identifier of the Ethernet device. + * @param hash + * The hash value used to compute hash_idx. + * @param hash_idx + * Where to store the computed hash_idx + * @return + * - (0) if successful. + * - (-ENODEV) if port identifier is invalid. + * - (-EIO) if device is removed. + * - (-ENOTSUP) if hardware doesn't support RSS. + */ +__rte_experimental +int +rte_eth_dev_rss_hash_index_get(uint16_t port_id, + uint32_t hash, uint32_t *hash_idx); + + /** * Add UDP tunneling port for a specific type of tunnel. * The packets with this UDP port will be identified as this type of tunnel. * Before enabling any offloading function for a tunnel, users can call this API diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index dcb5ae6..ad6cdc5 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -364,6 +364,10 @@ typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); /**< @internal Get current RSS hash configuration of an Ethernet device */ +typedef int (*rss_hash_index_get_t)(struct rte_eth_dev *dev, + uint32_t hash, uint32_t *hash_idx); +/**< @internal Get RSS hash id of given hash value */ + typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev); /**< @internal Turn on SW controllable LED on an Ethernet device */ @@ -595,6 +599,7 @@ struct eth_dev_ops { rss_hash_update_t rss_hash_update; /** Configure RSS hash protocols. */ rss_hash_conf_get_t rss_hash_conf_get; /** Get current RSS hash configuration. */ + rss_hash_index_get_t rss_hash_index_get; /** Get RSS hash idx. */ reta_update_t reta_update; /** Update redirection table. */ reta_query_t reta_query; /** Query redirection table. */ diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map index 6df42a4..ea6d1bf 100644 --- a/lib/librte_ethdev/rte_ethdev_version.map +++ b/lib/librte_ethdev/rte_ethdev_version.map @@ -283,4 +283,7 @@ EXPERIMENTAL { # added in 19.08 rte_eth_read_clock; + + # added in 19.11 + rte_eth_dev_rss_hash_index_get; }; -- 2.8.4