Skip to contentSkip to conversation

igb: cope with large MAX_SKB_FRAGS.

PATCH Superseded Corinna Vinschen 3 participants 7 messages Apr 23, 2024

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igb: cope with large MAX_SKB_FRAGS.

From: Paolo Abeni <[email protected]>

Sabrina reports that the igb driver does not cope well with large MAX_SKB_FRAG values: setting MAX_SKB_FRAG to 45 causes payload corruption on TX.

The root cause of the issue is that the driver does not take into account properly the (possibly large) shared info size when selecting the ring layout, and will try to fit two packets inside the same 4K page even when the 1st fraglist will trump over the 2nd head.

Address the issue forcing the driver to fit a single packet per page, leaving there enough room to store the (currently) largest possible skb_shared_info.

Fixes 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAG")
---
 drivers/net/ethernet/intel/igb/igb_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/igb/igb_main.c +1 -0
index a3f100769e39..22fb2c322bca 100644
@@ -4833,6 +4833,7 @@ static void igb_set_rx_buffer_len(struct igb_adapter *adapter,
 
 #if (PAGE_SIZE < 8192)
 	if (adapter->max_frame_size > IGB_MAX_FRAME_BUILD_SKB ||
+	    SKB_HEAD_ALIGN(adapter->max_frame_size) > (PAGE_SIZE / 2) ||
 	    rd32(E1000_RCTL) & E1000_RCTL_SBP)
 		set_ring_uses_large_buffer(rx_ring);
 #endif
Signature · 1 line
2.44.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Tue, Apr 23, 2024 at 12:24:46PM CEST, [email protected] wrote:

From: Paolo Abeni <[email protected]>

Sabrina reports that the igb driver does not cope well with large MAX_SKB_FRAG values: setting MAX_SKB_FRAG to 45 causes payload corruption on TX.

The root cause of the issue is that the driver does not take into account properly the (possibly large) shared info size when selecting the ring layout, and will try to fit two packets inside the same 4K page even when the 1st fraglist will trump over the 2nd head.

Address the issue forcing the driver to fit a single packet per page, leaving there enough room to store the (currently) largest possible skb_shared_info.

Quoted 7 lines
Fixes 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAG")

Next time, please indicate target tree (net) in [patch] brackets.

Quoted 20 lines

---
drivers/net/ethernet/intel/igb/igb_main.c | 1 +

1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/igb/igb_main.c +1 -0
index a3f100769e39..22fb2c322bca 100644
@@ -4833,6 +4833,7 @@ static void igb_set_rx_buffer_len(struct igb_adapter *adapter,
 
 #if (PAGE_SIZE < 8192)
 	if (adapter->max_frame_size > IGB_MAX_FRAME_BUILD_SKB ||
+	    SKB_HEAD_ALIGN(adapter->max_frame_size) > (PAGE_SIZE / 2) ||
 	    rd32(E1000_RCTL) & E1000_RCTL_SBP)
 		set_ring_uses_large_buffer(rx_ring);
 #endif
Signature · 1 line
2.44.0
#2 lore raw
In reply to Corinna Vinschen
Quoted 22 lines · Tue, Apr 23, 2024 at 12:24:46PM CEST, [email protected] wrote:

From: Paolo Abeni <[email protected]>

Sabrina reports that the igb driver does not cope well with large MAX_SKB_FRAG values: setting MAX_SKB_FRAG to 45 causes payload corruption on TX.

The root cause of the issue is that the driver does not take into account properly the (possibly large) shared info size when selecting the ring layout, and will try to fit two packets inside the same 4K page even when the 1st fraglist will trump over the 2nd head.

Address the issue forcing the driver to fit a single packet per page, leaving there enough room to store the (currently) largest possible skb_shared_info.

Fixes 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAG")
Quoted 2 lines

---
drivers/net/ethernet/intel/igb/igb_main.c | 1 +

Also, please use get_maintainer.pl script to get cclist.

#5 lore raw
In reply to Corinna Vinschen

Dear Corinna,

Thank you for the patch.

Am 23.04.24 um 12:24 schrieb Corinna Vinschen:

Quoted 1 line

From: Paolo Abeni <[email protected]>

It’d be great if you removed the trailing dot/period in the commit message summary.

Quoted 4 lines

Sabrina reports that the igb driver does not cope well with large MAX_SKB_FRAG values: setting MAX_SKB_FRAG to 45 causes payload corruption on TX.

Quoted 8 lines

The root cause of the issue is that the driver does not take into account properly the (possibly large) shared info size when selecting the ring layout, and will try to fit two packets inside the same 4K page even when the 1st fraglist will trump over the 2nd head.

Address the issue forcing the driver to fit a single packet per page, leaving there enough room to store the (currently) largest possible skb_shared_info.

If you have a reproducer for this, it’d be great if you could document it in the commit message.

Quoted 16 lines
Fixes 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAG")
---
  drivers/net/ethernet/intel/igb/igb_main.c | 1 +
  1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/igb/igb_main.c +0 -0
index a3f100769e39..22fb2c322bca 100644

drivers/net/ethernet/intel/igb/igb_main.c static void igb_set_rx_buffer_len(struct igb_adapter *adapter, · line 4839

Quoted 7 lines
drivers/net/ethernet/intel/igb/igb_main.c +1 -0
@@ -4833,6 +4833,7 @@ static void igb_set_rx_buffer_len(struct igb_adapter *adapter,
 
  #if (PAGE_SIZE < 8192)
  	if (adapter->max_frame_size > IGB_MAX_FRAME_BUILD_SKB ||
+	    SKB_HEAD_ALIGN(adapter->max_frame_size) > (PAGE_SIZE / 2) ||
  	    rd32(E1000_RCTL) & E1000_RCTL_SBP)
  		set_ring_uses_large_buffer(rx_ring);
  #endif

Kind regards,

Paul

#6 lore raw

Hi Paul,

Quoted 21 lines · Paul Menzel

Dear Corinna,

Thank you for the patch.

Am 23.04.24 um 12:24 schrieb Corinna Vinschen:

Quoted 1 line

From: Paolo Abeni <[email protected]>

It’d be great if you removed the trailing dot/period in the commit message summary.

Quoted 9 lines

Sabrina reports that the igb driver does not cope well with large MAX_SKB_FRAG values: setting MAX_SKB_FRAG to 45 causes payload corruption on TX.

The root cause of the issue is that the driver does not take into account properly the (possibly large) shared info size when selecting the ring layout, and will try to fit two packets inside the same 4K page even when the 1st fraglist will trump over the 2nd head.

Quoted 6 lines
Quoted 3 lines

Address the issue forcing the driver to fit a single packet per page, leaving there enough room to store the (currently) largest possible skb_shared_info.

If you have a reproducer for this, it’d be great if you could document it in the commit message.

I fixed the trailing dot and added a reproducer.

Thanks,
Corinna

#3 lore raw
In reply to Jiri Pirko

Hi Jiri,

Quoted 26 lines · Jiri Pirko
Quoted 22 lines · Tue, Apr 23, 2024 at 12:24:46PM CEST, [email protected] wrote:

From: Paolo Abeni <[email protected]>

Sabrina reports that the igb driver does not cope well with large MAX_SKB_FRAG values: setting MAX_SKB_FRAG to 45 causes payload corruption on TX.

The root cause of the issue is that the driver does not take into account properly the (possibly large) shared info size when selecting the ring layout, and will try to fit two packets inside the same 4K page even when the 1st fraglist will trump over the 2nd head.

Address the issue forcing the driver to fit a single packet per page, leaving there enough room to store the (currently) largest possible skb_shared_info.

Fixes 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAG")
Quoted 2 lines

---
drivers/net/ethernet/intel/igb/igb_main.c | 1 +

Quoted 1 line

Also, please use get_maintainer.pl script to get cclist.

done and done in v2 (for which I forgot the "in-reply-to" now, d'uh)

Thanks,
Corinna

#4 lore raw
Quoted 29 lines · Tue, Apr 23, 2024 at 03:54:05PM CEST, [email protected] wrote:

Hi Jiri,

Quoted 26 lines · Jiri Pirko
Quoted 24 lines · Tue, Apr 23, 2024 at 12:24:46PM CEST, [email protected] wrote:

From: Paolo Abeni <[email protected]>

Sabrina reports that the igb driver does not cope well with large MAX_SKB_FRAG values: setting MAX_SKB_FRAG to 45 causes payload corruption on TX.

The root cause of the issue is that the driver does not take into account properly the (possibly large) shared info size when selecting the ring layout, and will try to fit two packets inside the same 4K page even when the 1st fraglist will trump over the 2nd head.

Address the issue forcing the driver to fit a single packet per page, leaving there enough room to store the (currently) largest possible skb_shared_info.

Fixes 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAG")

---
drivers/net/ethernet/intel/igb/igb_main.c | 1 +

Quoted 3 lines
Quoted 1 line

Also, please use get_maintainer.pl script to get cclist.

done and done in v2 (for which I forgot the "in-reply-to" now, d'uh)

In-reply-to is not needed. Send each V to separate thread.

Quoted 5 lines

Thanks,
Corinna