]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.27.46/r8169-fix-receive-buffer-length-when-mtu-is-between-1515-and-1536.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.27.46 / r8169-fix-receive-buffer-length-when-mtu-is-between-1515-and-1536.patch
CommitLineData
8043cbef
GKH
1From 8812304cf1110ae16b0778680f6022216cf4716a Mon Sep 17 00:00:00 2001
2From: Raimonds Cicans <ray@apollo.lv>
3Date: Fri, 13 Nov 2009 10:52:19 +0000
4Subject: r8169: Fix receive buffer length when MTU is between 1515 and 1536
5
6From: Raimonds Cicans <ray@apollo.lv>
7
8commit 8812304cf1110ae16b0778680f6022216cf4716a upstream.
9
10In r8169 driver MTU is used to calculate receive buffer size.
11Receive buffer size is used to configure hardware incoming packet filter.
12
13For jumbo frames:
14Receive buffer size = Max frame size = MTU + 14 (ethernet header) + 4
15(vlan header) + 4 (ethernet checksum) = MTU + 22
16
17Bug:
18driver for all MTU up to 1536 use receive buffer size 1536
19
20As you can see from formula, this mean all IP packets > 1536 - 22
21(for vlan tagged, 1536 - 18 for not tagged) are dropped by hardware
22filter.
23
24Example:
25
26host_good> ifconfig eth0 mtu 1536
27host_r8169> ifconfig eth0 mtu 1536
28host_good> ping host_r8169
29Ok
30host_good> ping -s 1500 host_r8169
31Fail
32host_good> ifconfig eth0 mtu 7000
33host_r8169> ifconfig eth0 mtu 7000
34host_good> ping -s 1500 host_r8169
35Ok
36
37Bonus: got rid of magic number 8
38
39Signed-off-by: Raimonds Cicans <ray@apollo.lv>
40Signed-off-by: David S. Miller <davem@davemloft.net>
41Cc: Jean Delvare <khali@linux-fr.org>
42Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
43
44---
45 drivers/net/r8169.c | 4 ++--
46 1 file changed, 2 insertions(+), 2 deletions(-)
47
48--- a/drivers/net/r8169.c
49+++ b/drivers/net/r8169.c
50@@ -1842,9 +1842,9 @@ static void __devexit rtl8169_remove_one
51 static void rtl8169_set_rxbufsize(struct rtl8169_private *tp,
52 struct net_device *dev)
53 {
54- unsigned int mtu = dev->mtu;
55+ unsigned int max_frame = dev->mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;
56
57- tp->rx_buf_sz = (mtu > RX_BUF_SIZE) ? mtu + ETH_HLEN + 8 : RX_BUF_SIZE;
58+ tp->rx_buf_sz = (max_frame > RX_BUF_SIZE) ? max_frame : RX_BUF_SIZE;
59 }
60
61 static int rtl8169_open(struct net_device *dev)