Commit 1ed74a5b authored by Rob Taglang's avatar Rob Taglang Committed by Greg Kroah-Hartman

net: ethernet: sun: niu set correct packet size in skb

[ Upstream commit 14224923 ]

Currently, skb->len and skb->data_len are set to the page size, not
the packet size. This causes the frame check sequence to not be
located at the "end" of the packet resulting in ethernet frame check
errors. The driver does work currently, but stricter kernel facing
networking solutions like OpenVSwitch will drop these packets as
invalid.

These changes set the packet size correctly so that these errors no
longer occur. The length does not include the frame check sequence, so
that subtraction was removed.

Tested on Oracle/SUN Multithreaded 10-Gigabit Ethernet Network
Controller [108e:abcd] and validated in wireshark.
Signed-off-by: default avatarRob Taglang <rob@taglang.io>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cf7ef0af
...@@ -3442,7 +3442,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, ...@@ -3442,7 +3442,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
len = (val & RCR_ENTRY_L2_LEN) >> len = (val & RCR_ENTRY_L2_LEN) >>
RCR_ENTRY_L2_LEN_SHIFT; RCR_ENTRY_L2_LEN_SHIFT;
len -= ETH_FCS_LEN; append_size = len + ETH_HLEN + ETH_FCS_LEN;
addr = (val & RCR_ENTRY_PKT_BUF_ADDR) << addr = (val & RCR_ENTRY_PKT_BUF_ADDR) <<
RCR_ENTRY_PKT_BUF_ADDR_SHIFT; RCR_ENTRY_PKT_BUF_ADDR_SHIFT;
...@@ -3452,7 +3452,6 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, ...@@ -3452,7 +3452,6 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
RCR_ENTRY_PKTBUFSZ_SHIFT]; RCR_ENTRY_PKTBUFSZ_SHIFT];
off = addr & ~PAGE_MASK; off = addr & ~PAGE_MASK;
append_size = rcr_size;
if (num_rcr == 1) { if (num_rcr == 1) {
int ptype; int ptype;
...@@ -3465,7 +3464,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, ...@@ -3465,7 +3464,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
else else
skb_checksum_none_assert(skb); skb_checksum_none_assert(skb);
} else if (!(val & RCR_ENTRY_MULTI)) } else if (!(val & RCR_ENTRY_MULTI))
append_size = len - skb->len; append_size = append_size - skb->len;
niu_rx_skb_append(skb, page, off, append_size, rcr_size); niu_rx_skb_append(skb, page, off, append_size, rcr_size);
if ((page->index + rp->rbr_block_size) - rcr_size == addr) { if ((page->index + rp->rbr_block_size) - rcr_size == addr) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment