Skip to contentSkip to conversation

r8169: fix driver drop incoming packets >= 1515 if MTU is set between 1515 and 1536

PATCH Raimonds Cicans 2 participants 5 messages Nov 11, 2009

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

Driver drop incoming packets >= 1515(1) if MTU is set between 1515(1) and 1536.

1) exact number depends on some factors:
- VLAN tagged or not
- patch "r8169: Fix card drop incoming VLAN tagged MTU byte large jumbo frames" applied or not

Bonus: got rid of magic number 8

---

drivers/net/r8169.c renamed from drivers/net/r8169.c.orig +2 -2
@@ -2229,9 +2229,9 @@ static void __devexit rtl8169_remove_one
 static void rtl8169_set_rxbufsize(struct rtl8169_private *tp,
 				  struct net_device *dev)
 {
-	unsigned int mtu = dev->mtu;
+	unsigned int max_frame = dev->mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;
 
-	tp->rx_buf_sz = (mtu > RX_BUF_SIZE) ? mtu + ETH_HLEN + 8 : RX_BUF_SIZE;
+	tp->rx_buf_sz = (max_frame > RX_BUF_SIZE) ? max_frame : RX_BUF_SIZE;
 }
 
 static int rtl8169_open(struct net_device *dev)
#1 lore raw
Quoted 6 lines · Raimonds Cicans

Driver drop incoming packets >= 1515(1) if MTU is set between 1515(1) and 1536.

1) exact number depends on some factors:
- VLAN tagged or not
- patch "r8169: Fix card drop incoming VLAN tagged MTU byte large jumbo frames" applied or not

[...]

MTU is a limit on transmission; it is not required to limit received frames.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#2 lore raw

Ben Hutchings:

Quoted 11 lines · Raimonds Cicans
Quoted 6 lines

Driver drop incoming packets >= 1515(1) if MTU is set between 1515(1) and 1536.

1) exact number depends on some factors:
- VLAN tagged or not
- patch "r8169: Fix card drop incoming VLAN tagged MTU byte large jumbo frames" applied or not

[...]

MTU is a limit on transmission; it is not required to limit received frames.

???

In r8169 driver MTU is used to calculate receive buffer size. Receive buffer size is used to configure hardware incoming packet filter.

For jumbo frames:
Receive buffer size = Max frame size = MTU + 14 (ethernet header) + 4 (vlan header) + 4 (ethernet checksum) = MTU + 22

Bug:
driver for all MTU up to 1536 use receive buffer size 1536

As you can see from formula, this mean all IP packets > 1536 - 22 (for vlan tagged, 1536 - 18 for not tagged) are dropped by hardware filter.

Example:

host_good> ifconfig eth0 mtu 1536
host_r8169> ifconfig eth0 mtu 1536
host_good> ping host_r8169
Ok
host_good> ping -s 1500 host_r8169
Fail
host_good> ifconfig eth0 mtu 7000
host_r8169> ifconfig eth0 mtu 7000
host_good> ping -s 1500 host_r8169
Ok

Raimonds Cicans

#3 lore raw
Quoted 18 lines · Raimonds Cicans

Ben Hutchings:

Quoted 11 lines · Raimonds Cicans
Quoted 6 lines

Driver drop incoming packets >= 1515(1) if MTU is set between 1515(1) and 1536.

1) exact number depends on some factors:
- VLAN tagged or not
- patch "r8169: Fix card drop incoming VLAN tagged MTU byte large jumbo frames" applied or not

[...]

MTU is a limit on transmission; it is not required to limit received frames.

???

In r8169 driver MTU is used to calculate receive buffer size. Receive buffer size is used to configure hardware incoming packet filter.

Quoted 6 lines

For jumbo frames:
Receive buffer size = Max frame size = MTU + 14 (ethernet header) + 4 (vlan header) + 4 (ethernet checksum) = MTU + 22

Bug:
driver for all MTU up to 1536 use receive buffer size 1536

[...]

OK, now I understand. The subject line you used is not grammatical and I originally thought you considered it a bug that the driver might accept packets with payload greater than MTU.

To make it clear, perhaps you could change the subject to:
'r8169: Fix receive buffer length when MTU is between 1515 and 1536' and then explain the current behaviour below that.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#4 lore raw

Ben Hutchings:

Quoted 22 lines · Raimonds Cicans
Quoted 21 lines

Ben Hutchings:

Quoted 11 lines · Raimonds Cicans
Quoted 6 lines

Driver drop incoming packets >= 1515(1) if MTU is set between 1515(1) and 1536.

1) exact number depends on some factors:
- VLAN tagged or not
- patch "r8169: Fix card drop incoming VLAN tagged MTU byte large jumbo frames" applied or not

[...]

MTU is a limit on transmission; it is not required to limit received frames.

???

In r8169 driver MTU is used to calculate receive buffer size. Receive buffer size is used to configure hardware incoming packet filter.

For jumbo frames:
Receive buffer size = Max frame size = MTU + 14 (ethernet header) + 4 (vlan header) + 4 (ethernet checksum) = MTU + 22

Quoted 7 lines
Quoted 2 lines

Bug:
driver for all MTU up to 1536 use receive buffer size 1536

[...]

OK, now I understand. The subject line you used is not grammatical and I originally thought you considered it a bug that the driver might accept packets with payload greater than MTU.

Sorry for my poor English.

Quoted 3 lines

To make it clear, perhaps you could change the subject to:
'r8169: Fix receive buffer length when MTU is between 1515 and 1536' and then explain the current behaviour below that.

Ok. I will try to make new version tomorrow.

Raimonds Cicans