[05/10] net/enetc: improve batching Rx ring refill

Message ID 20200302143209.11854-6-hemant.agrawal@nxp.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/enetc: optimization and cleanup |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Hemant Agrawal March 2, 2020, 2:32 p.m. UTC
  From: Alex Marginean <alexandru.marginean@nxp.com>

Move from doing batch refill of Rx ring from bundles of 8 to once per
enetc_clean_rx_ring call.  One benefit is that we're cleaning up all the
BDs that we just processed, which should still be cached.  The other is
that hardware Rx index stays a little back and doesn't cause contention on
the BDs processed in the Rx loop.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
---
 drivers/net/enetc/enetc_rxtx.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
  

Patch

diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c
index 958e3a21d..262ed8a0f 100644
--- a/drivers/net/enetc/enetc_rxtx.c
+++ b/drivers/net/enetc/enetc_rxtx.c
@@ -14,8 +14,6 @@ 
 #include "enetc.h"
 #include "enetc_logs.h"
 
-#define ENETC_RXBD_BUNDLE 8 /* Number of BDs to update at once */
-
 static int
 enetc_clean_tx_ring(struct enetc_bdr *tx_ring)
 {
@@ -305,12 +303,6 @@  enetc_clean_rx_ring(struct enetc_bdr *rx_ring,
 		union enetc_rx_bd *rxbd;
 		uint32_t bd_status;
 
-		if (cleaned_cnt >= ENETC_RXBD_BUNDLE) {
-			int count = enetc_refill_rx_ring(rx_ring, cleaned_cnt);
-
-			cleaned_cnt -= count;
-		}
-
 		rxbd = ENETC_RXBD(*rx_ring, i);
 		bd_status = rte_le_to_cpu_32(rxbd->r.lstatus);
 		if (!bd_status)
@@ -337,6 +329,8 @@  enetc_clean_rx_ring(struct enetc_bdr *rx_ring,
 		rx_frm_cnt++;
 	}
 
+	enetc_refill_rx_ring(rx_ring, cleaned_cnt);
+
 	return rx_frm_cnt;
 }