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 00EF7A32A1 for ; Thu, 24 Oct 2019 09:55:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B9FB31D44D; Thu, 24 Oct 2019 09:54:53 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 5E61A1D44D for ; Thu, 24 Oct 2019 09:54:52 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id AEAA3480055; Thu, 24 Oct 2019 07:54:50 +0000 (UTC) Received: from [192.168.38.17] (91.220.146.112) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 24 Oct 2019 08:54:41 +0100 To: Ori Kam , Thomas Monjalon , Ferruh Yigit CC: , , References: <1569479349-36962-1-git-send-email-orika@mellanox.com> <1571837852-45975-1-git-send-email-orika@mellanox.com> <1571837852-45975-3-git-send-email-orika@mellanox.com> From: Andrew Rybchenko Message-ID: <473249c0-4f96-7f64-83a4-be612ede1dd3@solarflare.com> Date: Thu, 24 Oct 2019 10:54:38 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <1571837852-45975-3-git-send-email-orika@mellanox.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB X-Originating-IP: [91.220.146.112] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24998.003 X-TM-AS-Result: No-11.358900-8.000000-10 X-TMASE-MatchedRID: 6otD/cJAac2WFjFUJMrS404eFUkH5CFcbiA4btzHF9sM74Nf6tTB9oGr elyM0yD6CPiaotXrLtG06xFdgTnYRvJpYN2UUHMHg75YT2hz4LCRAgbvhPsYZiNGK7UC7ElMu/q +tuzAwMyA0Ma+ABkRgzdvtpAbyNn3AyPdSNDdGO8D2WXLXdz+AcMA9JsxaUa3GUs9b7xvtJocUn IIyt02SXgxbNUXAncYQ9MH1lw6ATp60j/UbRmWKCme9wbpQbK5fLNHMurfykhSMUnCl2ZytNIkl xunVj5bT1Lpx45+MkUPhCd9MH67INbvvLfNmsgd9Ib/6w+1lWR9LQinZ4QefL6qvLNjDYTwsuf7 RWbvUtyrusVRy4an8SAHAopEd76v8Ya9NpHOnXNa5r2XPXVOWza7u5D3WvAFaQ5QJV/b2cwJlsA Ow5I1uQ== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--11.358900-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24998.003 X-MDID: 1571903691-1sXHdF-EuP7k Subject: Re: [dpdk-dev] [PATCH v5 02/15] ethdev: add support for hairpin queue 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" Hi Ori, thanks for review notes applied. Please, see below. On 10/23/19 4:37 PM, Ori Kam wrote: > This commit introduce hairpin queue type. > > The hairpin queue in build from Rx queue binded to Tx queue. > It is used to offload traffic coming from the wire and redirect it back > to the wire. > > There are 3 new functions: > - rte_eth_dev_hairpin_capability_get > - rte_eth_rx_hairpin_queue_setup > - rte_eth_tx_hairpin_queue_setup > > In order to use the queue, there is a need to create rte_flow > with queue / RSS action that targets one or more of the Rx queues. > > Signed-off-by: Ori Kam Just a bit below Reviewed-by: Andrew Rybchenko [snip] > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c > index 78da293..199e96e 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -923,6 +923,13 @@ struct rte_eth_dev * > > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP); > > + if (rte_eth_dev_is_rx_hairpin_queue(dev, rx_queue_id) == 1) { I think the function should return bool and it results should be used as is without == 1 or something like this. Everyrwhere in the patch. [snip] > diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h > index c404f17..98023d7 100644 > --- a/lib/librte_ethdev/rte_ethdev_driver.h > +++ b/lib/librte_ethdev/rte_ethdev_driver.h > @@ -26,6 +26,50 @@ > */ > #define RTE_ETH_QUEUE_STATE_STOPPED 0 > #define RTE_ETH_QUEUE_STATE_STARTED 1 > +#define RTE_ETH_QUEUE_STATE_HAIRPIN 2 > + > +/** > + * @internal > + * Check if the selected Rx queue is hairpin queue. > + * > + * @param dev > + * Pointer to the selected device. > + * @param queue_id > + * The selected queue. > + * > + * @return > + * - (1) if the queue is hairpin queue, 0 otherwise. > + */ > +static inline int I think the function should return bool (and stdbool.h should be included). Return value description should be updated. > +rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id) > +{ > + if (dev->data->rx_queue_state[queue_id] == > + RTE_ETH_QUEUE_STATE_HAIRPIN) > + return 1; > + return 0; > +} > + > + > +/** > + * @internal > + * Check if the selected Tx queue is hairpin queue. > + * > + * @param dev > + * Pointer to the selected device. > + * @param queue_id > + * The selected queue. > + * > + * @return > + * - (1) if the queue is hairpin queue, 0 otherwise. > + */ > +static inline int Same here. > +rte_eth_dev_is_tx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id) > +{ > + if (dev->data->tx_queue_state[queue_id] == > + RTE_ETH_QUEUE_STATE_HAIRPIN) > + return 1; > + return 0; > +} > > /** > * @internal [snip]