Skip to contentSkip to conversation

xen-netback: fix gso_prefix check

PATCH In review Paul Durrant 3 participants 7 messages Dec 12, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-netback: fix gso_prefix check

There is a mistake in checking the gso_prefix mask when passing large packets to a guest. The wrong shift is applied to the bit - the raw skb gso type is used rather then the translated one. This leads to large packets being handed to the guest without the GSO metadata. This patch fixes the check.

The mistake manifested as errors whilst running Microsoft HCK large packet offload tests between a pair of Windows 8 VMs. I have verified this patch fixes those errors.

Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netback/netback.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/netback.c +1 -1
index 56c3e5a..999e290 100644
@@ -452,7 +452,7 @@ static int xenvif_gop_skb(struct sk_buff *skb,
 	}
 
 	/* Set up a GSO prefix descriptor, if necessary */
-	if ((1 << skb_shinfo(skb)->gso_type) & vif->gso_prefix_mask) {
+	if ((1 << gso_type) & vif->gso_prefix_mask) {
 		req = RING_GET_REQUEST(&vif->rx, vif->rx.req_cons++);
 		meta = npo->meta + npo->meta_prod++;
 		meta->gso_type = gso_type;
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Paul Durrant

There is a mistake in checking the gso_prefix mask when passing large packets to a guest. The wrong shift is applied to the bit - the raw skb gso type is used rather then the translated one. This leads to large packets being handed to the guest without the GSO metadata. This patch fixes the check.

The mistake manifested as errors whilst running Microsoft HCK large packet offload tests between a pair of Windows 8 VMs. I have verified this patch fixes those errors.

Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netback/netback.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/netback.c +0 -0
index 56c3e5a..999e290 100644

drivers/net/xen-netback/netback.c static int xenvif_gop_skb(struct sk_buff *skb, · line 455

Quoted 5 lines
drivers/net/xen-netback/netback.c +1 -1
@@ -452,7 +452,7 @@ static int xenvif_gop_skb(struct sk_buff *skb,
 	}
 
 	/* Set up a GSO prefix descriptor, if necessary */
-	if ((1 << skb_shinfo(skb)->gso_type) & vif->gso_prefix_mask) {
+	if ((1 << gso_type) & vif->gso_prefix_mask) {

gso_type here is XEN_NETIF_GSO_TYPE_TCPV4, vif->gso_prefix_mask is initialised with GSO_BIT(TCPV4) et al. Where

        #define GSO_BIT(type) \
                (1 << XEN_NETIF_GSO_TYPE_ ## type)

So,

But it might be nice to use BIT() from bitops.h for both GSO_BIT and the check, since it took me quite a bit of wandering around to figure out how these ended up the same.

Ian.

Acked-by on v1 1/1
#2 lore raw
In reply to Paul Durrant
Quoted 23 lines · Paul Durrant

There is a mistake in checking the gso_prefix mask when passing large packets to a guest. The wrong shift is applied to the bit - the raw skb gso type is used rather then the translated one. This leads to large packets being handed to the guest without the GSO metadata. This patch fixes the check.

The mistake manifested as errors whilst running Microsoft HCK large packet offload tests between a pair of Windows 8 VMs. I have verified this patch fixes those errors.

Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netback/netback.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/netback.c +0 -0
index 56c3e5a..999e290 100644

drivers/net/xen-netback/netback.c static int xenvif_gop_skb(struct sk_buff *skb, · line 455

Quoted 5 lines
drivers/net/xen-netback/netback.c +1 -1
@@ -452,7 +452,7 @@ static int xenvif_gop_skb(struct sk_buff *skb,
 	}
 
 	/* Set up a GSO prefix descriptor, if necessary */
-	if ((1 << skb_shinfo(skb)->gso_type) & vif->gso_prefix_mask) {
+	if ((1 << gso_type) & vif->gso_prefix_mask) {

gso_type here is XEN_NETIF_GSO_TYPE_TCPV4, vif->gso_prefix_mask is initialised with GSO_BIT(TCPV4) et al. Where

        #define GSO_BIT(type) \
                (1 << XEN_NETIF_GSO_TYPE_ ## type)

So,

But it might be nice to use BIT() from bitops.h for both GSO_BIT and the check, since it took me quite a bit of wandering around to figure out how these ended up the same.

Ian.

#3 lore raw
Quoted 43 lines

-----Original Message-----
From: Ian Campbell
Sent: 12 December 2013 14:42
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net] xen-netback: fix gso_prefix check

drivers/net/xen-

Quoted 19 lines · Paul Durrant

There is a mistake in checking the gso_prefix mask when passing large packets to a guest. The wrong shift is applied to the bit - the raw skb gso type is used rather then the translated one. This leads to large packets being handed to the guest without the GSO metadata. This patch fixes the check.

The mistake manifested as errors whilst running Microsoft HCK large packet offload tests between a pair of Windows 8 VMs. I have verified this patch fixes those errors.

Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netback/netback.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen- renamed from drivers/net/xen-netback/netback.c +0 -0

netback/netback.c

drivers/net/xen-netback/netback.c static int xenvif_gop_skb(struct sk_buff *skb, · line 455

Quoted 9 lines

index 56c3e5a..999e290 100644

drivers/net/xen-netback/netback.c +1 -1
@@ -452,7 +452,7 @@ static int xenvif_gop_skb(struct sk_buff *skb,
 	}
 
 	/* Set up a GSO prefix descriptor, if necessary */
-	if ((1 << skb_shinfo(skb)->gso_type) & vif->gso_prefix_mask) {
+	if ((1 << gso_type) & vif->gso_prefix_mask) {

gso_type here is XEN_NETIF_GSO_TYPE_TCPV4, vif->gso_prefix_mask is initialised with GSO_BIT(TCPV4) et al. Where

        #define GSO_BIT(type) \
                (1 << XEN_NETIF_GSO_TYPE_ ## type)
Quoted 7 lines

So,

But it might be nice to use BIT() from bitops.h for both GSO_BIT and the check, since it took me quite a bit of wandering around to figure out how these ended up the same.

Ok. I'll come up with a separate patch for that.

Paul

#4 lore raw
In reply to Ian Campbell
Quoted 43 lines

-----Original Message-----
From: Ian Campbell
Sent: 12 December 2013 14:42
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net] xen-netback: fix gso_prefix check

drivers/net/xen-

Quoted 19 lines · Paul Durrant

There is a mistake in checking the gso_prefix mask when passing large packets to a guest. The wrong shift is applied to the bit - the raw skb gso type is used rather then the translated one. This leads to large packets being handed to the guest without the GSO metadata. This patch fixes the check.

The mistake manifested as errors whilst running Microsoft HCK large packet offload tests between a pair of Windows 8 VMs. I have verified this patch fixes those errors.

Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netback/netback.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen- renamed from drivers/net/xen-netback/netback.c +0 -0

netback/netback.c

drivers/net/xen-netback/netback.c static int xenvif_gop_skb(struct sk_buff *skb, · line 455

Quoted 9 lines

index 56c3e5a..999e290 100644

drivers/net/xen-netback/netback.c +1 -1
@@ -452,7 +452,7 @@ static int xenvif_gop_skb(struct sk_buff *skb,
 	}
 
 	/* Set up a GSO prefix descriptor, if necessary */
-	if ((1 << skb_shinfo(skb)->gso_type) & vif->gso_prefix_mask) {
+	if ((1 << gso_type) & vif->gso_prefix_mask) {

gso_type here is XEN_NETIF_GSO_TYPE_TCPV4, vif->gso_prefix_mask is initialised with GSO_BIT(TCPV4) et al. Where

        #define GSO_BIT(type) \
                (1 << XEN_NETIF_GSO_TYPE_ ## type)
Quoted 7 lines

So,

But it might be nice to use BIT() from bitops.h for both GSO_BIT and the check, since it took me quite a bit of wandering around to figure out how these ended up the same.

Ok. I'll come up with a separate patch for that.

Paul

maintainer
#5 lore raw
In reply to Ian Campbell

From: Ian Campbell <[email protected]>
Date: Thu, 12 Dec 2013 14:42:22 +0000

Quoted 32 lines · Paul Durrant
Quoted 23 lines

There is a mistake in checking the gso_prefix mask when passing large packets to a guest. The wrong shift is applied to the bit - the raw skb gso type is used rather then the translated one. This leads to large packets being handed to the guest without the GSO metadata. This patch fixes the check.

The mistake manifested as errors whilst running Microsoft HCK large packet offload tests between a pair of Windows 8 VMs. I have verified this patch fixes those errors.

Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netback/netback.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/netback.c +0 -0
index 56c3e5a..999e290 100644

drivers/net/xen-netback/netback.c static int xenvif_gop_skb(struct sk_buff *skb, · line 455

Quoted 5 lines
drivers/net/xen-netback/netback.c +1 -1
@@ -452,7 +452,7 @@ static int xenvif_gop_skb(struct sk_buff *skb,
 	}
 
 	/* Set up a GSO prefix descriptor, if necessary */
-	if ((1 << skb_shinfo(skb)->gso_type) & vif->gso_prefix_mask) {
+	if ((1 << gso_type) & vif->gso_prefix_mask) {

gso_type here is XEN_NETIF_GSO_TYPE_TCPV4, vif->gso_prefix_mask is initialised with GSO_BIT(TCPV4) et al. Where

Quoted 5 lines
        #define GSO_BIT(type) \
                (1 << XEN_NETIF_GSO_TYPE_ ## type)

So,

Applied and queued up for -stable, thanks.

maintainer
#6 lore raw
In reply to Ian Campbell

From: Ian Campbell <[email protected]>
Date: Thu, 12 Dec 2013 14:42:22 +0000

Quoted 32 lines · Paul Durrant
Quoted 23 lines

There is a mistake in checking the gso_prefix mask when passing large packets to a guest. The wrong shift is applied to the bit - the raw skb gso type is used rather then the translated one. This leads to large packets being handed to the guest without the GSO metadata. This patch fixes the check.

The mistake manifested as errors whilst running Microsoft HCK large packet offload tests between a pair of Windows 8 VMs. I have verified this patch fixes those errors.

Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netback/netback.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/netback.c +0 -0
index 56c3e5a..999e290 100644

drivers/net/xen-netback/netback.c static int xenvif_gop_skb(struct sk_buff *skb, · line 455

Quoted 5 lines
drivers/net/xen-netback/netback.c +1 -1
@@ -452,7 +452,7 @@ static int xenvif_gop_skb(struct sk_buff *skb,
 	}
 
 	/* Set up a GSO prefix descriptor, if necessary */
-	if ((1 << skb_shinfo(skb)->gso_type) & vif->gso_prefix_mask) {
+	if ((1 << gso_type) & vif->gso_prefix_mask) {

gso_type here is XEN_NETIF_GSO_TYPE_TCPV4, vif->gso_prefix_mask is initialised with GSO_BIT(TCPV4) et al. Where

Quoted 5 lines
        #define GSO_BIT(type) \
                (1 << XEN_NETIF_GSO_TYPE_ ## type)

So,

Applied and queued up for -stable, thanks.