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 E2BFBA04DB; Thu, 15 Oct 2020 15:09:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 811C91E8F2; Thu, 15 Oct 2020 15:09:33 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 26B601E8EF for ; Thu, 15 Oct 2020 15:09:29 +0200 (CEST) From: Bing Zhao To: thomas@monjalon.net, orika@nvidia.com, ferruh.yigit@intel.com, arybchenko@solarflare.com, mdr@ashroe.eu, nhorman@tuxdriver.com, bernard.iremonger@intel.com, beilei.xing@intel.com, wenzhuo.lu@intel.com Cc: dev@dpdk.org Date: Thu, 15 Oct 2020 21:08:52 +0800 Message-Id: <1602767335-433464-3-git-send-email-bingz@nvidia.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1602767335-433464-1-git-send-email-bingz@nvidia.com> References: <1601511962-21532-1-git-send-email-bingz@nvidia.com> <1602767335-433464-1-git-send-email-bingz@nvidia.com> Subject: [dpdk-dev] [PATCH v6 2/5] ethdev: add new attributes to hairpin config 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" To support two ports hairpin mode and keep the backward compatibility for the application, two new attribute members of the hairpin queue configuration structure will be added. `tx_explicit` means if the application itself will insert the Tx part flow rules. If not set, PMD will insert the rules implicitly. `manual_bind` means if the hairpin Tx queue and peer Rx queue will be bound automatically during the device start stage. Different Tx and Rx queue pairs could have different values, but it is highly recommended that all paired queues between one egress and its peer ingress ports have the same values, in order not to bring any chaos to the system. The actual support of these attribute parameters will be checked and decided by the PMD drivers. In the single port hairpin, if both are zero without any setting, the behavior will remain the same as before. It means that no bind API needs to be called and no Tx flow rules need to be inserted manually by the application. Signed-off-by: Bing Zhao Acked-by: Ori Kam Acked-by: Thomas Monjalon --- v6: Using unnecessary comment and using "Rx" & "Tx" v4: squash document update and more info for the two new attributes v2: optimize the structure and remove unused macros --- doc/guides/prog_guide/rte_flow.rst | 3 +++ doc/guides/rel_notes/release_20_11.rst | 7 +++++++ lib/librte_ethdev/rte_ethdev.c | 8 ++++---- lib/librte_ethdev/rte_ethdev.h | 27 ++++++++++++++++++++++++++- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 55497c9..3df005a 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2618,6 +2618,9 @@ set, unpredictable value will be seen depending on driver implementation. For loopback/hairpin packet, metadata set on Rx/Tx may or may not be propagated to the other path depending on HW capability. +In hairpin case with Tx explicit flow mode, metadata could (not mandatory) be +used to connect the Rx and Tx flows if it can be propagated from Rx to Tx path. + .. _table_rte_flow_action_set_meta: .. table:: SET_META diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index 02bf7ca..2f23e6f 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -92,6 +92,7 @@ New Features * **Updated the ethdev library to support hairpin between two ports.** New APIs are introduced to support binding / unbinding 2 ports hairpin. + Hairpin Tx part flow rules can be inserted explicitly. * **Updated Broadcom bnxt driver.** @@ -396,6 +397,12 @@ ABI Changes Applications should use the new values for identification of existing extensions in the packet header. + * ``struct rte_eth_hairpin_conf`` has two new members: + + * ``uint32_t tx_explicit:1;`` + * ``uint32_t manual_bind:1;`` + + Known Issues ------------ diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 57cf4a7..bcbee30 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -2003,13 +2003,13 @@ struct rte_eth_dev * } if (conf->peer_count > cap.max_rx_2_tx) { RTE_ETHDEV_LOG(ERR, - "Invalid value for number of peers for Rx queue(=%hu), should be: <= %hu", + "Invalid value for number of peers for Rx queue(=%u), should be: <= %hu", conf->peer_count, cap.max_rx_2_tx); return -EINVAL; } if (conf->peer_count == 0) { RTE_ETHDEV_LOG(ERR, - "Invalid value for number of peers for Rx queue(=%hu), should be: > 0", + "Invalid value for number of peers for Rx queue(=%u), should be: > 0", conf->peer_count); return -EINVAL; } @@ -2174,13 +2174,13 @@ struct rte_eth_dev * } if (conf->peer_count > cap.max_tx_2_rx) { RTE_ETHDEV_LOG(ERR, - "Invalid value for number of peers for Tx queue(=%hu), should be: <= %hu", + "Invalid value for number of peers for Tx queue(=%u), should be: <= %hu", conf->peer_count, cap.max_tx_2_rx); return -EINVAL; } if (conf->peer_count == 0) { RTE_ETHDEV_LOG(ERR, - "Invalid value for number of peers for Tx queue(=%hu), should be: > 0", + "Invalid value for number of peers for Tx queue(=%u), should be: > 0", conf->peer_count); return -EINVAL; } diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 10eb626..a8e5cdc 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -1045,7 +1045,32 @@ struct rte_eth_hairpin_peer { * A structure used to configure hairpin binding. */ struct rte_eth_hairpin_conf { - uint16_t peer_count; /**< The number of peers. */ + uint32_t peer_count:16; /**< The number of peers. */ + + /** + * Explicit Tx flow rule mode. + * One hairpin pair of queues should have the same attribute. + * + * - When set, the user should be responsible for inserting the hairpin + * Tx part flows and removing them. + * - When clear, the PMD will try to handle the Tx part of the flows, + * e.g., by splitting one flow into two parts. + */ + uint32_t tx_explicit:1; + + /** + * Manually bind hairpin queues. + * One hairpin pair of queues should have the same attribute. + * + * - When set, to enable hairpin, the user should call the hairpin bind + * function after all the queues are set up properly and the ports are + * started. Also, the hairpin unbind function should be called + * accordingly before stopping a port that with hairpin configured. + * - When clear, the PMD will try to enable the hairpin with the queues + * configured automatically during port start. + */ + uint32_t manual_bind:1; + uint32_t reserved:14; /**< Reserved bits. */ struct rte_eth_hairpin_peer peers[RTE_ETH_MAX_HAIRPIN_PEERS]; }; -- 1.8.3.1