All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: sun: niu set correct packet size in skb
@ 2018-05-03 21:13 Rob Taglang
  2018-05-04 16:56 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Rob Taglang @ 2018-05-03 21:13 UTC (permalink / raw)
  To: netdev; +Cc: davem

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) {

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] net: ethernet: sun: niu set correct packet size in skb
  2018-05-03 21:13 [PATCH] net: ethernet: sun: niu set correct packet size in skb Rob Taglang
@ 2018-05-04 16:56 ` David Miller
       [not found]   ` <1525453674.10031.0@server175.web-hosting.com>
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2018-05-04 16:56 UTC (permalink / raw)
  To: rob; +Cc: netdev

From: Rob Taglang <rob@taglang.io>
Date: Thu, 03 May 2018 17:13:06 -0400

> 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,

Still corrupted.  Your email client is chopping up long lines.

Please, send a test patch to yourself and make sure you can apply the
patch that arrives in that test email.

Thank you.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net: ethernet: sun: niu set correct packet size in skb
       [not found]   ` <1525453674.10031.0@server175.web-hosting.com>
@ 2018-05-04 17:09     ` David Miller
  2018-05-04 17:22       ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2018-05-04 17:09 UTC (permalink / raw)
  To: rob; +Cc: netdev

From: Rob Taglang <rob@taglang.io>
Date: Fri, 04 May 2018 13:07:54 -0400

>> Still corrupted.  Your email client is chopping up long lines.
>> Please, send a test patch to yourself and make sure you can apply the
>> patch that arrives in that test email.
>> Thank you.
> 
> Hi David,
> 
> I did go through the process of sending myself a test email before
> submitting.
> 
> I can copy-paste the patch from my message on the archive:
> https://www.spinics.net/lists/netdev/msg500099.html
> and apply it successfully, so I'm not sure what you need me to do
> differently.
> 
> Any help is appreciated.

Weird, let me sort this out.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net: ethernet: sun: niu set correct packet size in skb
  2018-05-04 17:09     ` David Miller
@ 2018-05-04 17:22       ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2018-05-04 17:22 UTC (permalink / raw)
  To: rob; +Cc: netdev

From: David Miller <davem@davemloft.net>
Date: Fri, 04 May 2018 13:09:50 -0400 (EDT)

> From: Rob Taglang <rob@taglang.io>
> Date: Fri, 04 May 2018 13:07:54 -0400
> 
>>> Still corrupted.  Your email client is chopping up long lines.
>>> Please, send a test patch to yourself and make sure you can apply the
>>> patch that arrives in that test email.
>>> Thank you.
>> 
>> Hi David,
>> 
>> I did go through the process of sending myself a test email before
>> submitting.
>> 
>> I can copy-paste the patch from my message on the archive:
>> https://www.spinics.net/lists/netdev/msg500099.html
>> and apply it successfully, so I'm not sure what you need me to do
>> differently.
>> 
>> Any help is appreciated.
> 
> Weird, let me sort this out.

I ended up fixing it up by hand.  I have no idea why the copy that showed
up on spinics looks completely different to what I received directly in
my inbox and what showed up on patchwork.ozlabs.org

Anyways, applied and queued up for -stable, thank you.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net: ethernet: sun: niu set correct packet size in skb
  2018-05-03 20:38   ` rob
@ 2018-05-03 20:55     ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2018-05-03 20:55 UTC (permalink / raw)
  To: rob; +Cc: netdev, netdev-owner

From: rob@taglang.io
Date: Thu, 03 May 2018 16:38:04 -0400

> Ah, gotcha. Should I make a new thread?

Yes, please do.

Thank you.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net: ethernet: sun: niu set correct packet size in skb
  2018-05-03 20:04 ` David Miller
@ 2018-05-03 20:38   ` rob
  2018-05-03 20:55     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: rob @ 2018-05-03 20:38 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, netdev-owner

Ah, gotcha. Should I make a new thread?

Patch should be properly formatted below.

Thanks,
Rob

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) {


On 2018-05-03 16:04, David Miller wrote:
> From: Rob Taglang <rob@taglang.io>
> Date: Thu, 03 May 2018 11:06:04 -0400
> 
>> 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].
>> 
>> This is a resubmission after subscribing to the list; I think it got
>> caught in a spam filter since I can't see my message in the archive,
>> but if not and this is just pissing off a maintainer I'm really sorry.
>> 
>> 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;
> 
> This patch is severely corrupted by your email client.
> 
> Please fix this, send the patch to yourself as a test, and only repost
> the patch here on the list once you can successfully apply the patch
> contained in the test email.
> 
> Thanks.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] net: ethernet: sun: niu set correct packet size in skb
       [not found] <1525359964.11695.1@server175.web-hosting.com>
@ 2018-05-03 20:04 ` David Miller
  2018-05-03 20:38   ` rob
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2018-05-03 20:04 UTC (permalink / raw)
  To: rob; +Cc: netdev

From: Rob Taglang <rob@taglang.io>
Date: Thu, 03 May 2018 11:06:04 -0400

> 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].
> 
> This is a resubmission after subscribing to the list; I think it got
> caught in a spam filter since I can't see my message in the archive,
> but if not and this is just pissing off a maintainer I'm really sorry.
> 
> 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;

This patch is severely corrupted by your email client.

Please fix this, send the patch to yourself as a test, and only repost
the patch here on the list once you can successfully apply the patch
contained in the test email.

Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-05-04 17:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 21:13 [PATCH] net: ethernet: sun: niu set correct packet size in skb Rob Taglang
2018-05-04 16:56 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.