0158-smsx95xx-Add-option-to-disable-the-crimes-against-tr.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From fc2a68dea3c04061fa6f237dac63e7a8cdc7c1e4 Mon Sep 17 00:00:00 2001
  2. From: popcornmix <popcornmix@gmail.com>
  3. Date: Wed, 20 Jan 2016 17:50:09 +0000
  4. Subject: [PATCH] smsx95xx: Add option to disable the crimes against truesize
  5. fix
  6. It may improve iperf numbers on Pi 1, but may generate dmesg warnings and possibly cause network issues
  7. See issue 1248.
  8. ---
  9. drivers/net/usb/smsc95xx.c | 8 ++++++++
  10. 1 file changed, 8 insertions(+)
  11. mode change 100755 => 100644 drivers/net/usb/smsc95xx.c
  12. --- a/drivers/net/usb/smsc95xx.c
  13. +++ b/drivers/net/usb/smsc95xx.c
  14. @@ -75,6 +75,10 @@ static bool turbo_mode = false;
  15. module_param(turbo_mode, bool, 0644);
  16. MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction");
  17. +static bool truesize_mode = false;
  18. +module_param(truesize_mode, bool, 0644);
  19. +MODULE_PARM_DESC(truesize_mode, "Report larger truesize value");
  20. +
  21. static char *macaddr = ":";
  22. module_param(macaddr, charp, 0);
  23. MODULE_PARM_DESC(macaddr, "MAC address");
  24. @@ -1844,6 +1848,8 @@ static int smsc95xx_rx_fixup(struct usbn
  25. if (dev->net->features & NETIF_F_RXCSUM)
  26. smsc95xx_rx_csum_offload(skb);
  27. skb_trim(skb, skb->len - 4); /* remove fcs */
  28. + if (truesize_mode)
  29. + skb->truesize = size + sizeof(struct sk_buff);
  30. return 1;
  31. }
  32. @@ -1861,6 +1867,8 @@ static int smsc95xx_rx_fixup(struct usbn
  33. if (dev->net->features & NETIF_F_RXCSUM)
  34. smsc95xx_rx_csum_offload(ax_skb);
  35. skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */
  36. + if (truesize_mode)
  37. + ax_skb->truesize = size + sizeof(struct sk_buff);
  38. usbnet_skb_return(dev, ax_skb);
  39. }