099-0001-usbnet-allow-mini-drivers-to-consume-L2-headers.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. From 81e0ce79f2919dbd5f025894d29aa806af8695c7 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>
  3. Date: Thu, 3 Dec 2015 19:24:20 +0100
  4. Subject: [PATCH] usbnet: allow mini-drivers to consume L2 headers
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Assume the minidriver has taken care of all L2 header parsing
  9. if it sets skb->protocol. This allows the minidriver to
  10. support non-ethernet L2 headers, and even operate without
  11. any L2 header at all.
  12. Signed-off-by: Bjørn Mork <bjorn@mork.no>
  13. Acked-by: Oliver Neukum <oneukum@suse.com>
  14. Signed-off-by: David S. Miller <davem@davemloft.net>
  15. ---
  16. drivers/net/usb/usbnet.c | 5 ++++-
  17. 1 file changed, 4 insertions(+), 1 deletion(-)
  18. --- a/drivers/net/usb/usbnet.c
  19. +++ b/drivers/net/usb/usbnet.c
  20. @@ -324,7 +324,10 @@ void usbnet_skb_return (struct usbnet *d
  21. return;
  22. }
  23. - skb->protocol = eth_type_trans (skb, dev->net);
  24. + /* only update if unset to allow minidriver rx_fixup override */
  25. + if (skb->protocol == 0)
  26. + skb->protocol = eth_type_trans (skb, dev->net);
  27. +
  28. dev->net->stats.rx_packets++;
  29. dev->net->stats.rx_bytes += skb->len;