linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] vmxnet3: use correct tcp hdr length when packet is encapsulated
@ 2020-08-07  6:43 Ronak Doshi
  2020-08-07 15:23 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Ronak Doshi @ 2020-08-07  6:43 UTC (permalink / raw)
  To: netdev
  Cc: Ronak Doshi, VMware, Inc., David S. Miller, Jakub Kicinski, open list

'Commit dacce2be3312 ("vmxnet3: add geneve and vxlan tunnel offload
support")' added support for encapsulation offload. However, while
calculating tcp hdr length, it does not take into account if the
packet is encapsulated or not.

This patch fixes this issue by using correct reference for inner
tcp header.

Fixes: dacce2be3312 ("vmxnet3: add geneve and vxlan tunnel offload
support")
Signed-off-by: Ronak Doshi <doshir@vmware.com>
Acked-by: Guolin Yang <gyang@vmware.com>
---
 drivers/net/vmxnet3/vmxnet3_drv.c | 3 ++-
 drivers/net/vmxnet3/vmxnet3_int.h | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index ca395f9679d0..2818015324b8 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -886,7 +886,8 @@ vmxnet3_parse_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
 
 			switch (protocol) {
 			case IPPROTO_TCP:
-				ctx->l4_hdr_size = tcp_hdrlen(skb);
+				ctx->l4_hdr_size = skb->encapsulation ? inner_tcp_hdrlen(skb) :
+						   tcp_hdrlen(skb);
 				break;
 			case IPPROTO_UDP:
 				ctx->l4_hdr_size = sizeof(struct udphdr);
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index 5d2b062215a2..f99e3327a7b0 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -69,12 +69,12 @@
 /*
  * Version numbers
  */
-#define VMXNET3_DRIVER_VERSION_STRING   "1.5.0.0-k"
+#define VMXNET3_DRIVER_VERSION_STRING   "1.5.1.0-k"
 
 /* Each byte of this 32-bit integer encodes a version number in
  * VMXNET3_DRIVER_VERSION_STRING.
  */
-#define VMXNET3_DRIVER_VERSION_NUM      0x01050000
+#define VMXNET3_DRIVER_VERSION_NUM      0x01050100
 
 #if defined(CONFIG_PCI_MSI)
 	/* RSS only makes sense if MSI-X is supported. */
-- 
2.11.0


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

* Re: [PATCH net-next] vmxnet3: use correct tcp hdr length when packet is encapsulated
  2020-08-07  6:43 [PATCH net-next] vmxnet3: use correct tcp hdr length when packet is encapsulated Ronak Doshi
@ 2020-08-07 15:23 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-08-07 15:23 UTC (permalink / raw)
  To: Ronak Doshi; +Cc: netdev, VMware, Inc., David S. Miller, open list

On Thu, 6 Aug 2020 23:43:45 -0700 Ronak Doshi wrote:
> 'Commit dacce2be3312 ("vmxnet3: add geneve and vxlan tunnel offload
> support")' added support for encapsulation offload. However, while

nit: no need for the quotes around commit xzy ("")

> calculating tcp hdr length, it does not take into account if the
> packet is encapsulated or not.
> 
> This patch fixes this issue by using correct reference for inner
> tcp header.
> 
> Fixes: dacce2be3312 ("vmxnet3: add geneve and vxlan tunnel offload
> support")

Please don't wrap Fixes tags, let it overflow the line.

> Signed-off-by: Ronak Doshi <doshir@vmware.com>
> Acked-by: Guolin Yang <gyang@vmware.com>
> ---
>  drivers/net/vmxnet3/vmxnet3_drv.c | 3 ++-
>  drivers/net/vmxnet3/vmxnet3_int.h | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
> index ca395f9679d0..2818015324b8 100644
> --- a/drivers/net/vmxnet3/vmxnet3_drv.c
> +++ b/drivers/net/vmxnet3/vmxnet3_drv.c
> @@ -886,7 +886,8 @@ vmxnet3_parse_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
>  
>  			switch (protocol) {
>  			case IPPROTO_TCP:
> -				ctx->l4_hdr_size = tcp_hdrlen(skb);
> +				ctx->l4_hdr_size = skb->encapsulation ? inner_tcp_hdrlen(skb) :
> +						   tcp_hdrlen(skb);
>  				break;
>  			case IPPROTO_UDP:
>  				ctx->l4_hdr_size = sizeof(struct udphdr);
> diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
> index 5d2b062215a2..f99e3327a7b0 100644
> --- a/drivers/net/vmxnet3/vmxnet3_int.h
> +++ b/drivers/net/vmxnet3/vmxnet3_int.h
> @@ -69,12 +69,12 @@
>  /*
>   * Version numbers
>   */
> -#define VMXNET3_DRIVER_VERSION_STRING   "1.5.0.0-k"
> +#define VMXNET3_DRIVER_VERSION_STRING   "1.5.1.0-k"

Please don't do this.

We are working on removing all the driver version strings from the
kernel because upstream they are strictly inferior to the kernel
version alone.

For a fix like this it's especially bad to bump the version, as it
could cause a conflict during backporting. I'm not saying it will in
this case, but as a general rule fixes should be minimal in size.

>  /* Each byte of this 32-bit integer encodes a version number in
>   * VMXNET3_DRIVER_VERSION_STRING.
>   */
> -#define VMXNET3_DRIVER_VERSION_NUM      0x01050000
> +#define VMXNET3_DRIVER_VERSION_NUM      0x01050100
>  
>  #if defined(CONFIG_PCI_MSI)
>  	/* RSS only makes sense if MSI-X is supported. */


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

end of thread, other threads:[~2020-08-07 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07  6:43 [PATCH net-next] vmxnet3: use correct tcp hdr length when packet is encapsulated Ronak Doshi
2020-08-07 15:23 ` Jakub Kicinski

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