950-0142-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From 63776a20617d4a5ffa5abd35d1d531892a347f36 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. @@ -609,6 +609,15 @@ static int lan78xx_alloc_tx_resources(st
  20. dev->n_tx_urbs, dev->tx_urb_size, dev);
  21. }
  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. @@ -3471,8 +3480,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;