netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Taglang <rob@taglang.io>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net
Subject: [PATCH] net: ethernet: sun: niu set correct packet size in skb
Date: Thu, 03 May 2018 17:13:06 -0400	[thread overview]
Message-ID: <60bfe424f5c1427633fc67443d9c538c@taglang.io> (raw)

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 <rob@taglang.io>
---
  drivers/net/ethernet/sun/niu.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/sun/niu.c 
b/drivers/net/ethernet/sun/niu.c
index f081de4..88c1247 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -3443,7 +3443,7 @@ static int niu_process_rx_pkt(struct napi_struct 
*napi, struct niu *np,

  		len = (val & RCR_ENTRY_L2_LEN) >>
  			RCR_ENTRY_L2_LEN_SHIFT;
-		len -= ETH_FCS_LEN;
+		append_size = len + ETH_HLEN + ETH_FCS_LEN;

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

  		off = addr & ~PAGE_MASK;
-		append_size = rcr_size;
  		if (num_rcr == 1) {
  			int ptype;

@@ -3466,7 +3465,7 @@ static int niu_process_rx_pkt(struct napi_struct 
*napi, struct niu *np,
  			else
  				skb_checksum_none_assert(skb);
  		} 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);
  		if ((page->index + rp->rbr_block_size) - rcr_size == addr) {

             reply	other threads:[~2018-05-03 21:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 21:13 Rob Taglang [this message]
2018-05-04 16:56 ` [PATCH] net: ethernet: sun: niu set correct packet size in skb David Miller
     [not found]   ` <1525453674.10031.0@server175.web-hosting.com>
2018-05-04 17:09     ` David Miller
2018-05-04 17:22       ` David Miller
     [not found] <1525359964.11695.1@server175.web-hosting.com>
2018-05-03 20:04 ` David Miller
2018-05-03 20:38   ` rob
2018-05-03 20:55     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60bfe424f5c1427633fc67443d9c538c@taglang.io \
    --to=rob@taglang.io \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).