Skip to contentSkip to conversation

vmxnet3: use correct tcp hdr length when packet is encapsulated

PATCH Superseded Ronak Doshi 2 participants 2 messages Aug 7, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")

---
 drivers/net/vmxnet3/vmxnet3_drv.c | 3 ++-
 drivers/net/vmxnet3/vmxnet3_int.h | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/vmxnet3/vmxnet3_drv.c +2 -1
index ca395f9679d0..2818015324b8 100644
@@ -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);
drivers/net/vmxnet3/vmxnet3_int.h +2 -2
index 5d2b062215a2..f99e3327a7b0 100644
@@ -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. */
Signature · 1 line
2.11.0
maintainer
#1 lore raw
Quoted 2 lines · 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 ("")

Quoted 8 lines

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.

Quoted 26 lines
---
 drivers/net/vmxnet3/vmxnet3_drv.c | 3 ++-
 drivers/net/vmxnet3/vmxnet3_int.h | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/vmxnet3/vmxnet3_drv.c +2 -1
index ca395f9679d0..2818015324b8 100644
@@ -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);
drivers/net/vmxnet3/vmxnet3_int.h +0 -0
index 5d2b062215a2..f99e3327a7b0 100644

drivers/net/vmxnet3/vmxnet3_int.h line 72

Quoted 5 lines
drivers/net/vmxnet3/vmxnet3_int.h +1 -1
@@ -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.

Quoted 8 lines
drivers/net/vmxnet3/vmxnet3_int.h +1 -1
 /* 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. */