[Intel-wired-lan] [PATCH 03/10] igc: Refactor igc_clean_rx_ring()
Andre Guedes
andre.guedes at intel.com
Thu Dec 17 20:24:08 UTC 2020
This patch refactors igc_clean_rx_ring() helper, preparing the code for
AF_XDP zero-copy support which is added by upcoming patches.
The refactor consists of encapsulating page-shared specific code into
its own helper and leave common code that will be shared by both
page-shared and xsk pool in igc_clean_rx_ring().
Signed-off-by: Andre Guedes <andre.guedes at intel.com>
---
drivers/net/ethernet/intel/igc/igc_main.c | 25 ++++++++++++++---------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 56b791b356dc..d591c1e0581f 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -346,16 +346,10 @@ static int igc_setup_all_tx_resources(struct igc_adapter *adapter)
return err;
}
-/**
- * igc_clean_rx_ring - Free Rx Buffers per Queue
- * @rx_ring: ring to free buffers from
- */
-static void igc_clean_rx_ring(struct igc_ring *rx_ring)
+static void igc_clean_rx_ring_page_shared(struct igc_ring *rx_ring)
{
u16 i = rx_ring->next_to_clean;
- clear_ring_uses_large_buffer(rx_ring);
-
dev_kfree_skb(rx_ring->skb);
rx_ring->skb = NULL;
@@ -385,10 +379,21 @@ static void igc_clean_rx_ring(struct igc_ring *rx_ring)
if (i == rx_ring->count)
i = 0;
}
+}
- rx_ring->next_to_alloc = 0;
- rx_ring->next_to_clean = 0;
- rx_ring->next_to_use = 0;
+/**
+ * igc_clean_rx_ring - Free Rx Buffers per Queue
+ * @ring: ring to free buffers from
+ */
+static void igc_clean_rx_ring(struct igc_ring *ring)
+{
+ clear_ring_uses_large_buffer(ring);
+
+ igc_clean_rx_ring_page_shared(ring);
+
+ ring->next_to_alloc = 0;
+ ring->next_to_clean = 0;
+ ring->next_to_use = 0;
}
/**
--
2.29.2
More information about the Intel-wired-lan
mailing list