From: Pankaj Gupta <pagupta@vmware.com>
To: jbehrens@vmware.com, yongwang@vmware.com
Cc: dev@dpdk.org, pagupta@vmware.com
Subject: [PATCH 3/8] vmxnet3: add rx queue usage count utility
Date: Mon, 2 May 2022 15:45:52 -0400 [thread overview]
Message-ID: <20220502194557.16016-4-pagupta@vmware.com> (raw)
In-Reply-To: <20220502194557.16016-1-pagupta@vmware.com>
Count the number of entries in the rx queue for debugging.
Tested, using testpmd, for different hardware version on ESXi 7.0 Update 2
Signed-off-by: Pankaj Gupta <pagupta@vmware.com>
---
drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 +
drivers/net/vmxnet3/vmxnet3_ethdev.h | 3 +++
drivers/net/vmxnet3/vmxnet3_rxtx.c | 30 ++++++++++++++++++++++++++++
3 files changed, 34 insertions(+)
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index eb65499cf2..a76796716b 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -294,6 +294,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
eth_dev->rx_pkt_burst = &vmxnet3_recv_pkts;
eth_dev->tx_pkt_burst = &vmxnet3_xmit_pkts;
eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
+ eth_dev->rx_queue_count = vmxnet3_dev_rx_queue_count,
pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
/* extra mbuf field is required to guess MSS */
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h
index 7ec3b2e1f0..ceaeb66392 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.h
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h
@@ -193,6 +193,9 @@ int vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
uint16_t nb_rx_desc, unsigned int socket_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
+
+uint32_t vmxnet3_dev_rx_queue_count(void *rx_queue);
+
int vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
uint16_t nb_tx_desc, unsigned int socket_id,
const struct rte_eth_txconf *tx_conf);
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index d745064bc4..e15b377d8c 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -1019,6 +1019,36 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
return nb_rx;
}
+uint32_t
+vmxnet3_dev_rx_queue_count(void *rx_queue)
+{
+ const vmxnet3_rx_queue_t *rxq;
+ const Vmxnet3_RxCompDesc *rcd;
+ uint32_t idx, nb_rxd = 0;
+ uint8_t gen;
+
+ rxq = rx_queue;
+ if (unlikely(rxq->stopped)) {
+ PMD_RX_LOG(DEBUG, "Rx queue is stopped.");
+ return 0;
+ }
+
+ gen = rxq->comp_ring.gen;
+ idx = rxq->comp_ring.next2proc;
+ rcd = &rxq->comp_ring.base[idx].rcd;
+ while (rcd->gen == gen) {
+ if (rcd->eop)
+ ++nb_rxd;
+ if (++idx == rxq->comp_ring.size) {
+ idx = 0;
+ gen ^= 1;
+ }
+ rcd = &rxq->comp_ring.base[idx].rcd;
+ }
+
+ return nb_rxd;
+}
+
int
vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev,
uint16_t queue_idx,
--
2.17.1
next prev parent reply other threads:[~2022-05-02 19:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-02 19:45 [PATCH 0/8] vmxnet3: V5 and V6 Pankaj Gupta
2022-05-02 19:45 ` [PATCH 1/8] vmxnet3: Added V5 support Pankaj Gupta
2022-05-02 19:45 ` [PATCH 2/8] vmxnet3: implement reta query and reta update Pankaj Gupta
2022-05-02 19:45 ` Pankaj Gupta [this message]
2022-05-02 19:45 ` [PATCH 4/8] vmxnet3: add get hw version api Pankaj Gupta
2022-05-02 19:45 ` [PATCH 5/8] vmxnet3, version 6 Pankaj Gupta
2022-05-02 19:45 ` [PATCH 6/8] vmxnet3: set reta size Pankaj Gupta
2022-05-02 19:45 ` [PATCH 7/8] vmxnet3: Set packet for fragmented packet Pankaj Gupta
2022-05-02 19:45 ` [PATCH 8/8] vmxnet3: Fix merge error in initialization for rxDataRing feature Pankaj Gupta
2022-05-03 4:22 [PATCH 0/8] vmxnet3 version V5 and V6 Pankaj Gupta
2022-05-03 4:22 ` [PATCH 3/8] vmxnet3: add rx queue usage count utility Pankaj Gupta
2022-05-04 14:27 ` Andrew Rybchenko
2022-05-04 14:35 ` Morten Brørup
2022-05-04 17:58 ` Pankaj Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220502194557.16016-4-pagupta@vmware.com \
--to=pagupta@vmware.com \
--cc=dev@dpdk.org \
--cc=jbehrens@vmware.com \
--cc=yongwang@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).