aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Guedes <[email protected]>2021-04-22 23:25:49 -0700
committerTony Nguyen <[email protected]>2021-05-20 10:17:06 -0700
commitf485164867d3b960e811d94fc83e12d5a687ef05 (patch)
tree18538f2cd7371870dd876538370b9f687304009d
parent73a6e3721261524567eb5e319d5dc8e37b5f18dc (diff)
igc: Refactor igc_clean_rx_ring()
Refactor 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, leaving common code that will be shared by both page-shared and xsk pool in igc_clean_rx_ring(). Signed-off-by: Andre Guedes <[email protected]> Signed-off-by: Vedang Patel <[email protected]> Signed-off-by: Jithu Joseph <[email protected]> Reviewed-by: Maciej Fijalkowski <[email protected]> Tested-by: Dvora Fuxbrumer <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
-rw-r--r--drivers/net/ethernet/intel/igc/igc_main.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 1961cc667c3b..5024f8dc98f9 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -346,11 +346,7 @@ 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;
@@ -383,12 +379,21 @@ static void igc_clean_rx_ring(struct igc_ring *rx_ring)
if (i == rx_ring->count)
i = 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)
+{
+ igc_clean_rx_ring_page_shared(ring);
- clear_ring_uses_large_buffer(rx_ring);
+ clear_ring_uses_large_buffer(ring);
- rx_ring->next_to_alloc = 0;
- rx_ring->next_to_clean = 0;
- rx_ring->next_to_use = 0;
+ ring->next_to_alloc = 0;
+ ring->next_to_clean = 0;
+ ring->next_to_use = 0;
}
/**