DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wei Hu <weh@microsoft.com>
To: dev@dpdk.org, ferruh.yigit@amd.com,
	andrew.rybchenko@oktetlabs.ru, Long Li <longli@microsoft.com>,
	Wei Hu <weh@microsoft.com>
Cc: stable@dpdk.org
Subject: [PATCH 1/1] net/mana: do not ring short doorbell for every mbuf allocation
Date: Thu,  6 Feb 2025 02:07:43 -0800	[thread overview]
Message-ID: <20250206100744.734612-1-weh@microsoft.com> (raw)

In the 32bit rx path, it rings short doorbell after receiving
one packet and alocating the new mbuf. This significantly
impacets the rx performance. Fix this problem by ringing the
short doorbell in batch.

Fixes: eeb37809601b ("net/mana: use bulk mbuf allocation for Rx WQEs")
Cc: stable@dpdk.org

Signed-off-by: Wei Hu <weh@microsoft.com>
---
 drivers/net/mana/rx.c | 30 ++++--------------------------
 1 file changed, 4 insertions(+), 26 deletions(-)

diff --git a/drivers/net/mana/rx.c b/drivers/net/mana/rx.c
index 0c26702b73..f196d43aee 100644
--- a/drivers/net/mana/rx.c
+++ b/drivers/net/mana/rx.c
@@ -121,6 +121,10 @@ mana_alloc_and_post_rx_wqes(struct mana_rxq *rxq, uint32_t count)
 	uint32_t i, batch_count;
 	struct rte_mbuf *mbufs[MANA_MBUF_BULK];
 
+#ifdef RTE_ARCH_32
+	rxq->wqe_cnt_to_short_db = 0;
+#endif
+
 more_mbufs:
 	batch_count = RTE_MIN(count, MANA_MBUF_BULK);
 	ret = rte_pktmbuf_alloc_bulk(rxq->mp, mbufs, batch_count);
@@ -132,9 +136,6 @@ mana_alloc_and_post_rx_wqes(struct mana_rxq *rxq, uint32_t count)
 		goto out;
 	}
 
-#ifdef RTE_ARCH_32
-	rxq->wqe_cnt_to_short_db = 0;
-#endif
 	for (i = 0; i < batch_count; i++) {
 		ret = mana_post_rx_wqe(rxq, mbufs[i]);
 		if (ret) {
@@ -448,10 +449,6 @@ mana_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 	uint32_t i;
 	int polled = 0;
 
-#ifdef RTE_ARCH_32
-	rxq->wqe_cnt_to_short_db = 0;
-#endif
-
 repoll:
 	/* Polling on new completions if we have no backlog */
 	if (rxq->comp_buf_idx == rxq->comp_buf_len) {
@@ -570,25 +567,6 @@ mana_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 		wqe_consumed++;
 		if (pkt_received == pkts_n)
 			break;
-
-#ifdef RTE_ARCH_32
-		/* Always post WQE as soon as it's consumed for short DB */
-		ret = mana_alloc_and_post_rx_wqes(rxq, wqe_consumed);
-		if (ret) {
-			DRV_LOG(ERR, "failed to post %d WQEs, ret %d",
-				wqe_consumed, ret);
-			return pkt_received;
-		}
-		wqe_consumed = 0;
-
-		/* Ring short doorbell if approaching the wqe increment
-		 * limit.
-		 */
-		if (rxq->wqe_cnt_to_short_db > RX_WQE_SHORT_DB_THRESHOLD) {
-			mana_rq_ring_doorbell(rxq);
-			rxq->wqe_cnt_to_short_db = 0;
-		}
-#endif
 	}
 
 	rxq->backlog_idx = pkt_idx;
-- 
2.34.1


                 reply	other threads:[~2025-02-06 10:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250206100744.734612-1-weh@microsoft.com \
    --to=weh@microsoft.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=longli@microsoft.com \
    --cc=stable@dpdk.org \
    /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).