From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9B319A0547; Thu, 21 Oct 2021 11:51:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E6E4411F4; Thu, 21 Oct 2021 11:50:46 +0200 (CEST) Received: from smtpbguseast2.qq.com (smtpbguseast2.qq.com [54.204.34.130]) by mails.dpdk.org (Postfix) with ESMTP id E10E0411E4 for ; Thu, 21 Oct 2021 11:50:41 +0200 (CEST) X-QQ-mid: bizesmtp38t1634809837tydm5dhh Received: from jiawenwu.trustnetic.com (unknown [183.129.236.74]) by esmtp6.qq.com (ESMTP) with id ; Thu, 21 Oct 2021 17:50:37 +0800 (CST) X-QQ-SSF: 01400000000000E0I000000A0000000 X-QQ-FEAT: rn/rQ7Qm5gWT8YhKKbEg7FIKu5lTWn9xvlXeeU0WwUSuquObJpNbAe4+YvpvE E+nF2Gw0LY4BWkikAXu/p7Mm0VbvCeBbw760oDfyDdRWsw/t3yYqLQeSGVEuK1338mkEs2h b8ont83qHLfJFWcgjIgBUEsFdWMExlt4plDWSBP2nhnhFcMmRSoB6rAWCcyBS52RdTe4fBn MEUYpP81v+iQZDFw1VMc6BwcJWZ06TrrGC/w0eCiyY9eAsKK6+BxM20jvE417J0+biJR4Mb kIdUDqLqzBsqQ8xeNjKlBSVHyN3mPKayFVizVx/sJMrYdmUNlofO5q3HoNw80RfQA4HMFgB jHVgkuW2kB0tNnzoiNK8P0HS8683D+loOjnAOdg X-QQ-GoodBg: 2 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu Date: Thu, 21 Oct 2021 17:50:02 +0800 Message-Id: <20211021095023.18288-6-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20211021095023.18288-1-jiawenwu@trustnetic.com> References: <20211021095023.18288-1-jiawenwu@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybgforeign:qybgforeign5 X-QQ-Bgrelay: 1 Subject: [dpdk-dev] [PATCH v2 05/26] net/ngbe: support Rx/Tx burst mode info X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Support to get Rx/Tx burst mode info. Signed-off-by: Jiawen Wu --- doc/guides/nics/features/ngbe.ini | 1 + drivers/net/ngbe/ngbe_ethdev.c | 2 ++ drivers/net/ngbe/ngbe_ethdev.h | 7 ++++ drivers/net/ngbe/ngbe_rxtx.c | 58 +++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+) diff --git a/doc/guides/nics/features/ngbe.ini b/doc/guides/nics/features/ngbe.ini index d23e7f084f..70bf91e6a1 100644 --- a/doc/guides/nics/features/ngbe.ini +++ b/doc/guides/nics/features/ngbe.ini @@ -8,6 +8,7 @@ Speed capabilities = Y Link status = Y Link status event = Y Queue start/stop = Y +Burst mode info = Y Scattered Rx = Y TSO = Y L3 checksum offload = Y diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c index ce3f254e33..5d5967d617 100644 --- a/drivers/net/ngbe/ngbe_ethdev.c +++ b/drivers/net/ngbe/ngbe_ethdev.c @@ -1199,6 +1199,8 @@ static const struct eth_dev_ops ngbe_eth_dev_ops = { .rx_queue_release = ngbe_dev_rx_queue_release, .tx_queue_setup = ngbe_dev_tx_queue_setup, .tx_queue_release = ngbe_dev_tx_queue_release, + .rx_burst_mode_get = ngbe_rx_burst_mode_get, + .tx_burst_mode_get = ngbe_tx_burst_mode_get, }; RTE_PMD_REGISTER_PCI(net_ngbe, rte_ngbe_pmd); diff --git a/drivers/net/ngbe/ngbe_ethdev.h b/drivers/net/ngbe/ngbe_ethdev.h index 7b085f070f..286cb893d6 100644 --- a/drivers/net/ngbe/ngbe_ethdev.h +++ b/drivers/net/ngbe/ngbe_ethdev.h @@ -103,6 +103,13 @@ int ngbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id); int ngbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); +int +ngbe_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode); +int +ngbe_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode); + uint16_t ngbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); diff --git a/drivers/net/ngbe/ngbe_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c index d6a5b1d895..fdddd48f34 100644 --- a/drivers/net/ngbe/ngbe_rxtx.c +++ b/drivers/net/ngbe/ngbe_rxtx.c @@ -1689,6 +1689,34 @@ ngbe_set_tx_function(struct rte_eth_dev *dev, struct ngbe_tx_queue *txq) } } +static const struct { + eth_tx_burst_t pkt_burst; + const char *info; +} ngbe_tx_burst_infos[] = { + { ngbe_xmit_pkts_simple, "Scalar Simple"}, + { ngbe_xmit_pkts, "Scalar"}, +}; + +int +ngbe_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_tx_burst_t pkt_burst = dev->tx_pkt_burst; + int ret = -EINVAL; + unsigned int i; + + for (i = 0; i < RTE_DIM(ngbe_tx_burst_infos); ++i) { + if (pkt_burst == ngbe_tx_burst_infos[i].pkt_burst) { + snprintf(mode->info, sizeof(mode->info), "%s", + ngbe_tx_burst_infos[i].info); + ret = 0; + break; + } + } + + return ret; +} + uint64_t ngbe_get_tx_port_offloads(struct rte_eth_dev *dev) { @@ -2239,6 +2267,36 @@ ngbe_set_rx_function(struct rte_eth_dev *dev) } } +static const struct { + eth_rx_burst_t pkt_burst; + const char *info; +} ngbe_rx_burst_infos[] = { + { ngbe_recv_pkts_sc_single_alloc, "Scalar Scattered"}, + { ngbe_recv_pkts_sc_bulk_alloc, "Scalar Scattered Bulk Alloc"}, + { ngbe_recv_pkts_bulk_alloc, "Scalar Bulk Alloc"}, + { ngbe_recv_pkts, "Scalar"}, +}; + +int +ngbe_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_rx_burst_t pkt_burst = dev->rx_pkt_burst; + int ret = -EINVAL; + unsigned int i; + + for (i = 0; i < RTE_DIM(ngbe_rx_burst_infos); ++i) { + if (pkt_burst == ngbe_rx_burst_infos[i].pkt_burst) { + snprintf(mode->info, sizeof(mode->info), "%s", + ngbe_rx_burst_infos[i].info); + ret = 0; + break; + } + } + + return ret; +} + /* * Initializes Receive Unit. */ -- 2.21.0.windows.1