2020-08-07 06:44:53

by Ronak Doshi

[permalink] [raw]
Subject: [PATCH net-next] vmxnet3: use correct tcp hdr length when packet is encapsulated

'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 <[email protected]>
Acked-by: Guolin Yang <[email protected]>
---
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


2020-08-07 15:24:12

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH net-next] vmxnet3: use correct tcp hdr length when packet is encapsulated

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 <[email protected]>
> Acked-by: Guolin Yang <[email protected]>
> ---
> 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. */