950-0104-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch 2.1 KB

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