[1/1] net/mana: do not ring short doorbell for every mbuf allocation

Message ID 20250206100744.734612-1-weh@microsoft.com (mailing list archive)
State Accepted
Delegated to: Stephen Hemminger
Headers
Series [1/1] net/mana: do not ring short doorbell for every mbuf allocation |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Wei Hu Feb. 6, 2025, 10:07 a.m. UTC
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(-)
  

Comments

Stephen Hemminger Feb. 7, 2025, 1:22 a.m. UTC | #1
On Thu,  6 Feb 2025 02:07:43 -0800
Wei Hu <weh@microsoft.com> wrote:

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

Applied to next-net with spelling fixes to the commit message.
  

Patch

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;