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 6D5612C37 for ; Sun, 28 Oct 2018 09:58:35 +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 1D0E9280B; Sun, 28 Oct 2018 09:58:35 +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 6Zmy2_v1eLCV; Sun, 28 Oct 2018 09:58:34 +0100 (CET) Received: from exdb02.ug.kth.se (unknown [192.168.32.112]) by smtp-4.sys.kth.se (Postfix) with ESMTPS id 36E1A1D9D; Sun, 28 Oct 2018 09:58:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kth.se; s=default; t=1540717114; bh=r+C/uOeSWf2dCoLpdg7rcSHe1ZsgVkq2hG5i4hWKf1Q=; h=From:To:CC:Subject:Date:References:In-Reply-To; b=FPi/60+GXQTV0L2aRaFMDtY1l5Mptsr4Pf1bH9aSJMndJzblaLn8GCyGVCGWPDu+E Tj1HthY+3vFBcfgaDfa+gr2OdESVTOZtrO2wFAk+Oz+pczdBpTb3YZymXW1nYcWM3w fZ9+VocGcVfPDBsq0mfaW3uUO4wwVFQ2brTQnht8= 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; Sun, 28 Oct 2018 09:58:33 +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; Sun, 28 Oct 2018 09:58:33 +0100 From: Tom Barbette To: "dev@dpdk.org" CC: "shahafs@mellanox.com" , "yskoh@mellanox.com" Thread-Topic: [PATCH v4] mlx5: Support for rte_eth_rx_queue_count Thread-Index: AQHUbgdDPtmLhezfi0WmV0F+xn+z/KU0W/v/ Date: Sun, 28 Oct 2018 08:58:32 +0000 Message-ID: <1540717110736.67621@kth.se> References: <1540653055-67051-1-git-send-email-barbette@kth.se> In-Reply-To: <1540653055-67051-1-git-send-email-barbette@kth.se> 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: [83.249.19.225] 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: Sun, 28 Oct 2018 08:58:35 -0000 Thank you Yongseok for your comments ! Everything should be integrated in = v4.=0A= =0A= However, it seems I was in vector mode... So now I cannot get my queue coun= t. But the count seemed actually more or less correct. Are we speaking of a= 4 packet error when in vector mode? Maybe we can actually accept that...= =0A= =0A= Tom=0A= ________________________________________=0A= De : Tom Barbette =0A= Envoy=E9 : samedi 27 octobre 2018 17:10=0A= =C0 : dev@dpdk.org=0A= Cc : shahafs@mellanox.com; yskoh@mellanox.com; Tom Barbette=0A= Objet : [PATCH v4] mlx5: Support for rte_eth_rx_queue_count=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= 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=0A= index 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, uint16_t of= fset)=0A= }=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 qu= eue=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);=0A= @@ -461,12 +458,73 @@ mlx5_rx_descriptor_status(void *rx_queue, uint16_t of= fset)=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= +{=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= +{=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 rte_mb= uf **pkts,=0A= uint16_t pkts_n);=0A= int mlx5_rx_descriptor_status(void *rx_queue, uint16_t offset);=0A= int mlx5_tx_descriptor_status(void *tx_queue, uint16_t offset);=0A= +uint32_t mlx5_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id= );=0A= =0A= /* Vectorized version of mlx5_rxtx.c */=0A= int mlx5_check_raw_vec_tx_support(struct rte_eth_dev *dev);=0A= --=0A= 2.7.4=0A= =0A=