Skip to contentSkip to conversation

igc: Don't clear the large buffer bit before memory release

PATCH New Vedang Patel 2 participants 2 messages Jan 7, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igc: Don't clear the large buffer bit before memory release

When XDP is enabled, it uses large buffers to accomodate headroom and tailroom required by XDP infrastructure. But, it clears the large buffer bit before unmapping the buffer.

dma_unmap_page_attrs() (called by igc_clean_rx_ring_page_shared()) needs size of the buffer to unmap. If the large buffer bit is cleared before calling igc_clean_rx_ring_page_shared(), all of the memory won't be unmapped.

Fixes 2e739318416b ("igc: Add initial XDP support")
---
 drivers/net/ethernet/intel/igc/igc_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +2 -2
index 0bcdf05d03f0..b96b745fdb65 100644
@@ -418,13 +418,13 @@ static void igc_clean_rx_ring_xsk_pool(struct igc_ring *ring)
  */
 static void igc_clean_rx_ring(struct igc_ring *ring)
 {
-	clear_ring_uses_large_buffer(ring);
-
 	if (ring->xsk_pool)
 		igc_clean_rx_ring_xsk_pool(ring);
 	else
 		igc_clean_rx_ring_page_shared(ring);
 
+	clear_ring_uses_large_buffer(ring);
+
 	ring->next_to_alloc = 0;
 	ring->next_to_clean = 0;
 	ring->next_to_use = 0;
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 igc: Don't clear the large buffer bit before memory release

Quoted 21 lines · Vedang Patel

When XDP is enabled, it uses large buffers to accomodate headroom and tailroom required by XDP infrastructure. But, it clears the large buffer bit before unmapping the buffer.

dma_unmap_page_attrs() (called by igc_clean_rx_ring_page_shared()) needs size of the buffer to unmap. If the large buffer bit is cleared before calling igc_clean_rx_ring_page_shared(), all of the memory won't be unmapped.

Fixes 2e739318416b ("igc: Add initial XDP support")
---
 drivers/net/ethernet/intel/igc/igc_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +0 -0
index 0bcdf05d03f0..b96b745fdb65 100644

drivers/net/ethernet/intel/igc/igc_main.c static void igc_clean_rx_ring_xsk_pool(struct igc_ring *ring) · line 424

Quoted 9 lines
drivers/net/ethernet/intel/igc/igc_main.c +0 -2
@@ -418,13 +418,13 @@ static void igc_clean_rx_ring_xsk_pool(struct igc_ring *ring)
  */
 static void igc_clean_rx_ring(struct igc_ring *ring)
 {
-	clear_ring_uses_large_buffer(ring);
-
 	if (ring->xsk_pool)
 		igc_clean_rx_ring_xsk_pool(ring);
 	else
 		igc_clean_rx_ring_page_shared(ring);

This code is not yet upstreamed AFAICT. Probably you should ask Andre to include this fix onto igc's AFXDP support?

Quoted 13 lines
drivers/net/ethernet/intel/igc/igc_main.c +2 -0
+	clear_ring_uses_large_buffer(ring);
+
 	ring->next_to_alloc = 0;
 	ring->next_to_clean = 0;
 	ring->next_to_use = 0;
Signature · 6 lines
2.17.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan