28515c9d0925893edab532f31e46d43d7c9be5c9
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.19 / 950-0127-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch
1 From 59555269e09f06ae0ded9007c4aa02fa55ce71ca Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Wed, 13 Jun 2018 15:21:10 +0100
4 Subject: [PATCH] net: lan78xx: Disable TCP Segmentation Offload (TSO)
5
6 TSO seems to be having issues when packets are dropped and the
7 remote end uses Selective Acknowledge (SACK) to denote that
8 data is missing. The missing data is never resent, so the
9 connection eventually stalls.
10
11 There is a module parameter of enable_tso added to allow
12 further debugging without forcing a rebuild of the kernel.
13
14 https://github.com/raspberrypi/linux/issues/2449
15 https://github.com/raspberrypi/linux/issues/2482
16
17 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
18 ---
19 drivers/net/usb/lan78xx.c | 19 +++++++++++++++++--
20 1 file changed, 17 insertions(+), 2 deletions(-)
21
22 --- a/drivers/net/usb/lan78xx.c
23 +++ b/drivers/net/usb/lan78xx.c
24 @@ -439,6 +439,15 @@ static int msg_level = -1;
25 module_param(msg_level, int, 0);
26 MODULE_PARM_DESC(msg_level, "Override default message level");
27
28 +/* TSO seems to be having some issue with Selective Acknowledge (SACK) that
29 + * results in lost data never being retransmitted.
30 + * Disable it by default now, but adds a module parameter to enable it for
31 + * debug purposes (the full cause is not currently understood).
32 + */
33 +static bool enable_tso;
34 +module_param(enable_tso, bool, 0644);
35 +MODULE_PARM_DESC(enable_tso, "Enables TCP segmentation offload");
36 +
37 static int lan78xx_read_reg(struct lan78xx_net *dev, u32 index, u32 *data)
38 {
39 u32 *buf = kmalloc(sizeof(u32), GFP_KERNEL);
40 @@ -3009,8 +3018,14 @@ static int lan78xx_bind(struct lan78xx_n
41 if (DEFAULT_RX_CSUM_ENABLE)
42 dev->net->features |= NETIF_F_RXCSUM;
43
44 - if (DEFAULT_TSO_CSUM_ENABLE)
45 - dev->net->features |= NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG;
46 + if (DEFAULT_TSO_CSUM_ENABLE) {
47 + dev->net->features |= NETIF_F_SG;
48 + /* Use module parameter to control TCP segmentation offload as
49 + * it appears to cause issues.
50 + */
51 + if (enable_tso)
52 + dev->net->features |= NETIF_F_TSO | NETIF_F_TSO6;
53 + }
54
55 if (DEFAULT_VLAN_RX_OFFLOAD)
56 dev->net->features |= NETIF_F_HW_VLAN_CTAG_RX;