From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-4.sys.kth.se (smtp-4.sys.kth.se [130.237.48.193]) by dpdk.org (Postfix) with ESMTP id E899FDED for ; Wed, 31 Oct 2018 10:01:30 +0100 (CET) Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id 96D022CB; Wed, 31 Oct 2018 10:01:30 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Xm1rzVdsaOPh; Wed, 31 Oct 2018 10:01:21 +0100 (CET) Received: from exdb02.ug.kth.se (unknown [192.168.32.112]) by smtp-4.sys.kth.se (Postfix) with ESMTPS id 6D0A42E1E; Wed, 31 Oct 2018 10:01:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kth.se; s=default; t=1540976481; bh=ngZ7+6gb27lE/73D9ZRcz6LSYj0wrt/Mt+PUKCvgsg4=; h=From:To:CC:Subject:Date:References:In-Reply-To; b=DA/+pL/KmQKBWvlV7ghJ+TfABGXRlW/85ALqsoqQ9gkzFmeM119C2ssdNcRjtT6xo fLi9ZiPzxU5q0jXgk7dEXkhGC3gCjj43ibKCBdOg4GFBpO0dpO3bderipXzUyjepUq dU/RKUZyX2PC7YnjXFnHSPbQgAAxruEHBUUk5p5U= Received: from exdb05.ug.kth.se (192.168.32.115) by exdb02.ug.kth.se (192.168.32.112) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 31 Oct 2018 10:01:16 +0100 Received: from exdb05.ug.kth.se ([192.168.32.115]) by exdb05.ug.kth.se ([192.168.32.115]) with mapi id 15.00.1367.000; Wed, 31 Oct 2018 10:01:16 +0100 From: Tom Barbette To: Shahaf Shuler , "dev@dpdk.org" , Ferruh Yigit , Thomas Monjalon , Andrew Rybchenko , "olivier.matz@6wind.com" CC: Yongseok Koh Thread-Topic: [PATCH v4] mlx5: Support for rte_eth_rx_queue_count Thread-Index: AQHUbgdDPtmLhezfi0WmV0F+xn+z/KU0VsIAgAS5ces= Date: Wed, 31 Oct 2018 09:01:16 +0000 Message-ID: <1540976475938.69727@kth.se> References: <1540653055-67051-1-git-send-email-barbette@kth.se>, In-Reply-To: Accept-Language: fr-FR, sv-SE, en-US Content-Language: fr-FR X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [130.237.20.142] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4] mlx5: Support for rte_eth_rx_queue_count 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: , X-List-Received-Date: Wed, 31 Oct 2018 09:01:31 -0000 Hi Shahaf,=0A= =0A= I don't see how rte_eth_rx_descriptor_status can actually give me the numbe= r of packets in the RX queue? It will tell me the status of a packet at a g= iven offset, right?=0A= =0A= About the goal: we have a full view of a network (switches and servers), an= d we want to know where the queueing is happening. So queues from switches= and servers are reported to the controller to deduce latency, congestion, = ....=0A= On top of that, as CPU occupancy is somehow erratic with PMDs (ie we use ap= proximations), the queuing helps to make better scheduling decisions about = which servers could accept more load.=0A= =0A= Considering the advance of Smart NICs, being able to monitor NICs as any ne= tworking equipment in a network is of even more importance (if I still need= to make that point?).=0A= =0A= =0A= Tom=0A= =0A= =0A= =0A= =0A= ________________________________________=0A= De : Shahaf Shuler =0A= Envoy=E9 : dimanche 28 octobre 2018 10:37=0A= =C0 : Tom Barbette; dev@dpdk.org; Ferruh Yigit; Thomas Monjalon; Andrew Ryb= chenko; olivier.matz@6wind.com=0A= Cc : Yongseok Koh=0A= Objet : RE: [PATCH v4] mlx5: Support for rte_eth_rx_queue_count=0A= =0A= Hi Tom,=0A= =0A= Adding ethdev maintainers and Oliver as the author of the new API.=0A= =0A= =0A= Saturday, October 27, 2018 6:11 PM, Tom Barbette:=0A= > Subject: [PATCH v4] mlx5: Support for rte_eth_rx_queue_count=0A= >=0A= =0A= I have a more basic question.=0A= The rte_eth_rx_queue_count is a very old API, more or less from the beginni= ng of DPDK.=0A= We progressed from then and a newer API to check the descriptor status was = introduced @DPDK17.05 : rte_eth_rx_descriptor_status, see commit[1].=0A= There is also a plan to deprecate it once all drivers will support the new = API.=0A= =0A= With the new API you can check the number of available descriptors on a sim= ilar way.=0A= So my question is, is the new API enough for your functionality? If not, wh= at it is missing? I would prefer to improve the new one instead of starting= to support the old one.=0A= =0A= =0A= [1]=0A= commit b1b700ce7d6fe0db9152f73e8e00394fc2756e60=0A= Author: Olivier Matz =0A= Date: Wed Mar 29 10:36:28 2017 +0200=0A= =0A= ethdev: add descriptor status API=0A= =0A= Introduce a new API to get the status of a descriptor.=0A= =0A= For Rx, it is almost similar to rx_descriptor_done API, except it=0A= differentiates "used" descriptors (which are hold by the driver and not= =0A= returned to the hardware).=0A= =0A= For Tx, it is a new API.=0A= =0A= The descriptor_done() API, and probably the rx_queue_count() API could= =0A= be replaced by this new API as soon as it is implemented on all PMDs.= =0A= =0A= Signed-off-by: Olivier Matz =0A= Reviewed-by: Andrew Rybchenko =0A= =0A= =0A= > This patch adds support for the rx_queue_count API in mlx5 driver=0A= >=0A= > Changes in v2:=0A= > * Fixed styling issues=0A= > * Fix missing return=0A= >=0A= > Changes in v3:=0A= > * Fix styling comments and checks as per Yongseok Koh=0A= > comments. Thanks !=0A= >=0A= > Changes in v4:=0A= > * Fix compiling issue because of a line that disappeared in v3=0A= >=0A= > Signed-off-by: Tom Barbette =0A= > ---=0A= > drivers/net/mlx5/mlx5.c | 1 +=0A= > drivers/net/mlx5/mlx5_rxtx.c | 78=0A= > ++++++++++++++++++++++++++++++++++++++------=0A= > drivers/net/mlx5/mlx5_rxtx.h | 1 +=0A= > 3 files changed, 70 insertions(+), 10 deletions(-)=0A= >=0A= > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index=0A= > ec63bc6..6fccadd 100644=0A= > --- a/drivers/net/mlx5/mlx5.c=0A= > +++ b/drivers/net/mlx5/mlx5.c=0A= > @@ -375,6 +375,7 @@ const struct eth_dev_ops mlx5_dev_ops =3D {=0A= > .filter_ctrl =3D mlx5_dev_filter_ctrl,=0A= > .rx_descriptor_status =3D mlx5_rx_descriptor_status,=0A= > .tx_descriptor_status =3D mlx5_tx_descriptor_status,=0A= > + .rx_queue_count =3D mlx5_rx_queue_count,=0A= > .rx_queue_intr_enable =3D mlx5_rx_intr_enable,=0A= > .rx_queue_intr_disable =3D mlx5_rx_intr_disable,=0A= > .is_removed =3D mlx5_is_removed,=0A= > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c= =0A= > index 2d14f8a..2126205 100644=0A= > --- a/drivers/net/mlx5/mlx5_rxtx.c=0A= > +++ b/drivers/net/mlx5/mlx5_rxtx.c=0A= > @@ -417,20 +417,17 @@ mlx5_tx_descriptor_status(void *tx_queue,=0A= > uint16_t offset) }=0A= >=0A= > /**=0A= > - * DPDK callback to check the status of a rx descriptor.=0A= > + * Internal function to compute the number of used descriptors in an RX= =0A= > + queue=0A= > *=0A= > - * @param rx_queue=0A= > - * The rx queue.=0A= > - * @param[in] offset=0A= > - * The index of the descriptor in the ring.=0A= > + * @param rxq=0A= > + * The Rx queue.=0A= > *=0A= > * @return=0A= > - * The status of the tx descriptor.=0A= > + * The number of used rx descriptor.=0A= > */=0A= > -int=0A= > -mlx5_rx_descriptor_status(void *rx_queue, uint16_t offset)=0A= > +static uint32_t=0A= > +rx_queue_count(struct mlx5_rxq_data *rxq)=0A= > {=0A= > - struct mlx5_rxq_data *rxq =3D rx_queue;=0A= > struct rxq_zip *zip =3D &rxq->zip;=0A= > volatile struct mlx5_cqe *cqe;=0A= > const unsigned int cqe_n =3D (1 << rxq->cqe_n); @@ -461,12 +458,73= =0A= > @@ mlx5_rx_descriptor_status(void *rx_queue, uint16_t offset)=0A= > cqe =3D &(*rxq->cqes)[cq_ci & cqe_cnt];=0A= > }=0A= > used =3D RTE_MIN(used, (1U << rxq->elts_n) - 1);=0A= > - if (offset < used)=0A= > + return used;=0A= > +}=0A= > +=0A= > +/**=0A= > + * DPDK callback to check the status of a rx descriptor.=0A= > + *=0A= > + * @param rx_queue=0A= > + * The Rx queue.=0A= > + * @param[in] offset=0A= > + * The index of the descriptor in the ring.=0A= > + *=0A= > + * @return=0A= > + * The status of the tx descriptor.=0A= > + */=0A= > +int=0A= > +mlx5_rx_descriptor_status(void *rx_queue, uint16_t offset) {=0A= > + struct mlx5_rxq_data *rxq =3D rx_queue;=0A= > + struct mlx5_rxq_ctrl *rxq_ctrl =3D=0A= > + container_of(rxq, struct mlx5_rxq_ctrl, rxq);=0A= > + struct rte_eth_dev *dev =3D ETH_DEV(rxq_ctrl->priv);=0A= > +=0A= > + if (dev->rx_pkt_burst !=3D mlx5_rx_burst) {=0A= > + rte_errno =3D ENOTSUP;=0A= > + return -rte_errno;=0A= > + }=0A= > + if (offset >=3D (1 << rxq->elts_n)) {=0A= > + rte_errno =3D EINVAL;=0A= > + return -rte_errno;=0A= > + }=0A= > + if (offset < rx_queue_count(rxq))=0A= > return RTE_ETH_RX_DESC_DONE;=0A= > return RTE_ETH_RX_DESC_AVAIL;=0A= > }=0A= >=0A= > /**=0A= > + * DPDK callback to get the number of used descriptors in a RX queue=0A= > + *=0A= > + * @param dev=0A= > + * Pointer to the device structure.=0A= > + *=0A= > + * @param rx_queue_id=0A= > + * The Rx queue.=0A= > + *=0A= > + * @return=0A= > + * The number of used rx descriptor.=0A= > + * -EINVAL if the queue is invalid=0A= > + */=0A= > +uint32_t=0A= > +mlx5_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id) {=0A= > + struct priv *priv =3D dev->data->dev_private;=0A= > + struct mlx5_rxq_data *rxq;=0A= > +=0A= > + if (dev->rx_pkt_burst !=3D mlx5_rx_burst) {=0A= > + rte_errno =3D ENOTSUP;=0A= > + return -rte_errno;=0A= > + }=0A= > + rxq =3D (*priv->rxqs)[rx_queue_id];=0A= > + if (!rxq) {=0A= > + rte_errno =3D EINVAL;=0A= > + return -rte_errno;=0A= > + }=0A= > + return rx_queue_count(rxq);=0A= > +}=0A= > +=0A= > +/**=0A= > * DPDK callback for TX.=0A= > *=0A= > * @param dpdk_txq=0A= > diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h= =0A= > index 48ed2b2..c82059b 100644=0A= > --- a/drivers/net/mlx5/mlx5_rxtx.h=0A= > +++ b/drivers/net/mlx5/mlx5_rxtx.h=0A= > @@ -345,6 +345,7 @@ uint16_t removed_rx_burst(void *dpdk_rxq, struct=0A= > rte_mbuf **pkts,=0A= > uint16_t pkts_n);=0A= > int mlx5_rx_descriptor_status(void *rx_queue, uint16_t offset); int=0A= > mlx5_tx_descriptor_status(void *tx_queue, uint16_t offset);=0A= > +uint32_t mlx5_rx_queue_count(struct rte_eth_dev *dev, uint16_t=0A= > +rx_queue_id);=0A= >=0A= > /* Vectorized version of mlx5_rxtx.c */ int=0A= > mlx5_check_raw_vec_tx_support(struct rte_eth_dev *dev);=0A= > --=0A= > 2.7.4=0A= =0A=