0008-net-ethernet-sun-niu-set-correct-packet-size-in-skb.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Rob Taglang <[email protected]>
  3. Date: Thu, 3 May 2018 17:13:06 -0400
  4. Subject: [PATCH] net: ethernet: sun: niu set correct packet size in skb
  5. Currently, skb->len and skb->data_len are set to the page size, not
  6. the packet size. This causes the frame check sequence to not be
  7. located at the "end" of the packet resulting in ethernet frame check
  8. errors. The driver does work currently, but stricter kernel facing
  9. networking solutions like OpenVSwitch will drop these packets as
  10. invalid.
  11. These changes set the packet size correctly so that these errors no
  12. longer occur. The length does not include the frame check sequence, so
  13. that subtraction was removed.
  14. Tested on Oracle/SUN Multithreaded 10-Gigabit Ethernet Network
  15. Controller [108e:abcd] and validated in wireshark.
  16. Signed-off-by: Rob Taglang <[email protected]>
  17. Signed-off-by: David S. Miller <[email protected]>
  18. Signed-off-by: Thomas Lamprecht <[email protected]>
  19. ---
  20. drivers/net/ethernet/sun/niu.c | 5 ++---
  21. 1 file changed, 2 insertions(+), 3 deletions(-)
  22. diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
  23. index 06001bacbe0f..64f1b3a3afa8 100644
  24. --- a/drivers/net/ethernet/sun/niu.c
  25. +++ b/drivers/net/ethernet/sun/niu.c
  26. @@ -3442,7 +3442,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
  27. len = (val & RCR_ENTRY_L2_LEN) >>
  28. RCR_ENTRY_L2_LEN_SHIFT;
  29. - len -= ETH_FCS_LEN;
  30. + append_size = len + ETH_HLEN + ETH_FCS_LEN;
  31. addr = (val & RCR_ENTRY_PKT_BUF_ADDR) <<
  32. RCR_ENTRY_PKT_BUF_ADDR_SHIFT;
  33. @@ -3452,7 +3452,6 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
  34. RCR_ENTRY_PKTBUFSZ_SHIFT];
  35. off = addr & ~PAGE_MASK;
  36. - append_size = rcr_size;
  37. if (num_rcr == 1) {
  38. int ptype;
  39. @@ -3465,7 +3464,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
  40. else
  41. skb_checksum_none_assert(skb);
  42. } else if (!(val & RCR_ENTRY_MULTI))
  43. - append_size = len - skb->len;
  44. + append_size = append_size - skb->len;
  45. niu_rx_skb_append(skb, page, off, append_size, rcr_size);
  46. if ((page->index + rp->rbr_block_size) - rcr_size == addr) {