DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/1] net/mana: do not ring short doorbell for every mbuf allocation
@ 2025-02-06 10:07 Wei Hu
  0 siblings, 0 replies; only message in thread
From: Wei Hu @ 2025-02-06 10:07 UTC (permalink / raw)
  To: dev, ferruh.yigit, andrew.rybchenko, Long Li, Wei Hu; +Cc: stable

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-02-06 10:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-06 10:07 [PATCH 1/1] net/mana: do not ring short doorbell for every mbuf allocation Wei Hu

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).