Skip to content

Commit 1422492

Browse files
lasalvavidadavem330
authored andcommitted
net: ethernet: sun: niu set correct packet size in skb
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: Rob Taglang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ae552ac commit 1422492

File tree

1 file changed

+2
-3
lines changed
  • drivers/net/ethernet/sun

1 file changed

+2
-3
lines changed

drivers/net/ethernet/sun/niu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3443,7 +3443,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
34433443

34443444
len = (val & RCR_ENTRY_L2_LEN) >>
34453445
RCR_ENTRY_L2_LEN_SHIFT;
3446-
len -= ETH_FCS_LEN;
3446+
append_size = len + ETH_HLEN + ETH_FCS_LEN;
34473447

34483448
addr = (val & RCR_ENTRY_PKT_BUF_ADDR) <<
34493449
RCR_ENTRY_PKT_BUF_ADDR_SHIFT;
@@ -3453,7 +3453,6 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
34533453
RCR_ENTRY_PKTBUFSZ_SHIFT];
34543454

34553455
off = addr & ~PAGE_MASK;
3456-
append_size = rcr_size;
34573456
if (num_rcr == 1) {
34583457
int ptype;
34593458

@@ -3466,7 +3465,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
34663465
else
34673466
skb_checksum_none_assert(skb);
34683467
} else if (!(val & RCR_ENTRY_MULTI))
3469-
append_size = len - skb->len;
3468+
append_size = append_size - skb->len;
34703469

34713470
niu_rx_skb_append(skb, page, off, append_size, rcr_size);
34723471
if ((page->index + rp->rbr_block_size) - rcr_size == addr) {

0 commit comments

Comments
 (0)