Skip to contentSkip to conversation

xen-netfront: add support for IPv6 offloads

PATCH In review Paul Durrant 3 participants 9 messages Jan 15, 2014

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

PATCH 1/1 xen-netfront: add support for IPv6 offloads

This patch adds support for IPv6 checksum offload and GSO when those features are available in the backend.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netfront.c |   48 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 43 insertions(+), 5 deletions(-)
drivers/net/xen-netfront.c +43 -5
index c41537b..321759f 100644
@@ -617,7 +617,9 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		tx->flags |= XEN_NETTXF_extra_info;
 
 		gso->u.gso.size = skb_shinfo(skb)->gso_size;
-		gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
+		gso->u.gso.type = (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) ?
+			XEN_NETIF_GSO_TYPE_TCPV6 :
+			XEN_NETIF_GSO_TYPE_TCPV4;
 		gso->u.gso.pad = 0;
 		gso->u.gso.features = 0;
 
@@ -809,15 +811,18 @@ static int xennet_set_skb_gso(struct sk_buff *skb,
 		return -EINVAL;
 	}
 
-	/* Currently only TCPv4 S.O. is supported. */
-	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4 &&
+	    gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV6) {
 		if (net_ratelimit())
 			pr_warn("Bad GSO type %d\n", gso->u.gso.type);
 		return -EINVAL;
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+	skb_shinfo(skb)->gso_type =
+		(gso->u.gso.type == XEN_NETIF_GSO_TYPE_TCPV4) ?
+		SKB_GSO_TCPV4 :
+		SKB_GSO_TCPV6;
 
 	/* Header must be checked, and gso_segs computed. */
 	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
@@ -1191,6 +1196,15 @@ static netdev_features_t xennet_fix_features(struct net_device *dev,
 			features &= ~NETIF_F_SG;
 	}
 
+	if (features & NETIF_F_IPV6_CSUM) {
+		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+				 "feature-ipv6-csum-offload", "%d", &val) < 0)
+			val = 0;
+
+		if (!val)
+			features &= ~NETIF_F_IPV6_CSUM;
+	}
+
 	if (features & NETIF_F_TSO) {
 		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
 				 "feature-gso-tcpv4", "%d", &val) < 0)
@@ -1200,6 +1214,15 @@ static netdev_features_t xennet_fix_features(struct net_device *dev,
 			features &= ~NETIF_F_TSO;
 	}
 
+	if (features & NETIF_F_TSO6) {
+		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+				 "feature-gso-tcpv6", "%d", &val) < 0)
+			val = 0;
+
+		if (!val)
+			features &= ~NETIF_F_TSO6;
+	}
+
 	return features;
 }
 
@@ -1338,7 +1361,9 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_SG |
+				  NETIF_F_IPV6_CSUM |
+				  NETIF_F_TSO | NETIF_F_TSO6;
 
 	/*
          * Assume that all hw features are available for now. This set
@@ -1716,6 +1741,19 @@ again:
 		goto abort_transaction;
 	}
 
+	err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6", "%d", 1);
+	if (err) {
+		message = "writing feature-gso-tcpv6";
+		goto abort_transaction;
+	}
+
+	err = xenbus_printf(xbt, dev->nodename, "feature-ipv6-csum-offload",
+			    "%d", 1);
+	if (err) {
+		message = "writing feature-ipv6-csum-offload";
+		goto abort_transaction;
+	}
+
 	err = xenbus_transaction_end(xbt, 0);
 	if (err) {
 		if (err == -EAGAIN)
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 92 lines · Paul Durrant

This patch adds support for IPv6 checksum offload and GSO when those features are available in the backend.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netfront.c |   48 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 43 insertions(+), 5 deletions(-)
drivers/net/xen-netfront.c +30 -5
index c41537b..321759f 100644
@@ -617,7 +617,9 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		tx->flags |= XEN_NETTXF_extra_info;
 
 		gso->u.gso.size = skb_shinfo(skb)->gso_size;
-		gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
+		gso->u.gso.type = (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) ?
+			XEN_NETIF_GSO_TYPE_TCPV6 :
+			XEN_NETIF_GSO_TYPE_TCPV4;
 		gso->u.gso.pad = 0;
 		gso->u.gso.features = 0;
 
@@ -809,15 +811,18 @@ static int xennet_set_skb_gso(struct sk_buff *skb,
 		return -EINVAL;
 	}
 
-	/* Currently only TCPv4 S.O. is supported. */
-	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4 &&
+	    gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV6) {
 		if (net_ratelimit())
 			pr_warn("Bad GSO type %d\n", gso->u.gso.type);
 		return -EINVAL;
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+	skb_shinfo(skb)->gso_type =
+		(gso->u.gso.type == XEN_NETIF_GSO_TYPE_TCPV4) ?
+		SKB_GSO_TCPV4 :
+		SKB_GSO_TCPV6;
 
 	/* Header must be checked, and gso_segs computed. */
 	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
@@ -1191,6 +1196,15 @@ static netdev_features_t xennet_fix_features(struct net_device *dev,
 			features &= ~NETIF_F_SG;
 	}
 
+	if (features & NETIF_F_IPV6_CSUM) {
+		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+				 "feature-ipv6-csum-offload", "%d", &val) < 0)
+			val = 0;
+
+		if (!val)
+			features &= ~NETIF_F_IPV6_CSUM;
+	}
+
 	if (features & NETIF_F_TSO) {
 		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
 				 "feature-gso-tcpv4", "%d", &val) < 0)
@@ -1200,6 +1214,15 @@ static netdev_features_t xennet_fix_features(struct net_device *dev,
 			features &= ~NETIF_F_TSO;
 	}
 
+	if (features & NETIF_F_TSO6) {
+		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+				 "feature-gso-tcpv6", "%d", &val) < 0)
+			val = 0;
+
+		if (!val)
+			features &= ~NETIF_F_TSO6;
+	}
+
 	return features;
 }
 
@@ -1338,7 +1361,9 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_SG |
+				  NETIF_F_IPV6_CSUM |
+				  NETIF_F_TSO | NETIF_F_TSO6;
 
 	/*
          * Assume that all hw features are available for now. This set

drivers/net/xen-netfront.c again: · line 1744

Quoted 4 lines
drivers/net/xen-netfront.c +1 -0
@@ -1716,6 +1741,19 @@ again:
 		goto abort_transaction;
 	}
 
+	err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6", "%d", 1);

"%d", 1 results in a constant string. xenbus_write() would avoid a transitory memory allocation.

~Andrew

Quoted 15 lines
drivers/net/xen-netfront.c +12 -0
+	if (err) {
+		message = "writing feature-gso-tcpv6";
+		goto abort_transaction;
+	}
+
+	err = xenbus_printf(xbt, dev->nodename, "feature-ipv6-csum-offload",
+			    "%d", 1);
+	if (err) {
+		message = "writing feature-ipv6-csum-offload";
+		goto abort_transaction;
+	}
+
 	err = xenbus_transaction_end(xbt, 0);
 	if (err) {
 		if (err == -EAGAIN)
#2 lore raw
In reply to Paul Durrant
Quoted 92 lines · Paul Durrant

This patch adds support for IPv6 checksum offload and GSO when those features are available in the backend.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netfront.c |   48 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 43 insertions(+), 5 deletions(-)
drivers/net/xen-netfront.c +30 -5
index c41537b..321759f 100644
@@ -617,7 +617,9 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		tx->flags |= XEN_NETTXF_extra_info;
 
 		gso->u.gso.size = skb_shinfo(skb)->gso_size;
-		gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
+		gso->u.gso.type = (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) ?
+			XEN_NETIF_GSO_TYPE_TCPV6 :
+			XEN_NETIF_GSO_TYPE_TCPV4;
 		gso->u.gso.pad = 0;
 		gso->u.gso.features = 0;
 
@@ -809,15 +811,18 @@ static int xennet_set_skb_gso(struct sk_buff *skb,
 		return -EINVAL;
 	}
 
-	/* Currently only TCPv4 S.O. is supported. */
-	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4 &&
+	    gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV6) {
 		if (net_ratelimit())
 			pr_warn("Bad GSO type %d\n", gso->u.gso.type);
 		return -EINVAL;
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+	skb_shinfo(skb)->gso_type =
+		(gso->u.gso.type == XEN_NETIF_GSO_TYPE_TCPV4) ?
+		SKB_GSO_TCPV4 :
+		SKB_GSO_TCPV6;
 
 	/* Header must be checked, and gso_segs computed. */
 	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
@@ -1191,6 +1196,15 @@ static netdev_features_t xennet_fix_features(struct net_device *dev,
 			features &= ~NETIF_F_SG;
 	}
 
+	if (features & NETIF_F_IPV6_CSUM) {
+		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+				 "feature-ipv6-csum-offload", "%d", &val) < 0)
+			val = 0;
+
+		if (!val)
+			features &= ~NETIF_F_IPV6_CSUM;
+	}
+
 	if (features & NETIF_F_TSO) {
 		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
 				 "feature-gso-tcpv4", "%d", &val) < 0)
@@ -1200,6 +1214,15 @@ static netdev_features_t xennet_fix_features(struct net_device *dev,
 			features &= ~NETIF_F_TSO;
 	}
 
+	if (features & NETIF_F_TSO6) {
+		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+				 "feature-gso-tcpv6", "%d", &val) < 0)
+			val = 0;
+
+		if (!val)
+			features &= ~NETIF_F_TSO6;
+	}
+
 	return features;
 }
 
@@ -1338,7 +1361,9 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_SG |
+				  NETIF_F_IPV6_CSUM |
+				  NETIF_F_TSO | NETIF_F_TSO6;
 
 	/*
          * Assume that all hw features are available for now. This set

drivers/net/xen-netfront.c again: · line 1744

Quoted 4 lines
drivers/net/xen-netfront.c +1 -0
@@ -1716,6 +1741,19 @@ again:
 		goto abort_transaction;
 	}
 
+	err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6", "%d", 1);

"%d", 1 results in a constant string. xenbus_write() would avoid a transitory memory allocation.

~Andrew

Quoted 15 lines
drivers/net/xen-netfront.c +12 -0
+	if (err) {
+		message = "writing feature-gso-tcpv6";
+		goto abort_transaction;
+	}
+
+	err = xenbus_printf(xbt, dev->nodename, "feature-ipv6-csum-offload",
+			    "%d", 1);
+	if (err) {
+		message = "writing feature-ipv6-csum-offload";
+		goto abort_transaction;
+	}
+
 	err = xenbus_transaction_end(xbt, 0);
 	if (err) {
 		if (err == -EAGAIN)
#3 lore raw
Quoted 114 lines

-----Original Message-----
From: Andrew Cooper [mailto:[email protected]]
Sent: 15 January 2014 15:25
To: Paul Durrant
Cc: [email protected]; [email protected]; Boris Ostrovsky; David Vrabel
Subject: Re: [Xen-devel] [PATCH net-next] xen-netfront: add support for IPv6 offloads

Quoted 9 lines · Paul Durrant

This patch adds support for IPv6 checksum offload and GSO when those features are available in the backend.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netfront.c |   48

+++++++++++++++++++++++++++++++++++++++-----

drivers/net/xen-netfront.c static int xennet_start_xmit(struct sk_buff *skb,

Quoted 7 lines
 1 file changed, 43 insertions(+), 5 deletions(-)
drivers/net/xen-netfront.c +0 -0
index c41537b..321759f 100644
@@ -617,7 +617,9 @@ static int xennet_start_xmit(struct sk_buff *skb,

struct net_device *dev)

drivers/net/xen-netfront.c static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)

Quoted 5 lines
drivers/net/xen-netfront.c +1 -1
 		tx->flags |= XEN_NETTXF_extra_info;
 
 		gso->u.gso.size = skb_shinfo(skb)->gso_size;
-		gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
+		gso->u.gso.type = (skb_shinfo(skb)->gso_type &

SKB_GSO_TCPV6) ?

drivers/net/xen-netfront.c static int xennet_set_skb_gso(struct sk_buff

Quoted 6 lines
drivers/net/xen-netfront.c +2 -0
+			XEN_NETIF_GSO_TYPE_TCPV6 :
+			XEN_NETIF_GSO_TYPE_TCPV4;
 		gso->u.gso.pad = 0;
 		gso->u.gso.features = 0;
 
@@ -809,15 +811,18 @@ static int xennet_set_skb_gso(struct sk_buff

*skb,

drivers/net/xen-netfront.c static netdev_features_t

Quoted 22 lines
drivers/net/xen-netfront.c +6 -3
 		return -EINVAL;
 	}
 
-	/* Currently only TCPv4 S.O. is supported. */
-	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4 &&
+	    gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV6) {
 		if (net_ratelimit())
 			pr_warn("Bad GSO type %d\n", gso->u.gso.type);
 		return -EINVAL;
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+	skb_shinfo(skb)->gso_type =
+		(gso->u.gso.type == XEN_NETIF_GSO_TYPE_TCPV4) ?
+		SKB_GSO_TCPV4 :
+		SKB_GSO_TCPV6;
 
 	/* Header must be checked, and gso_segs computed. */
 	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
@@ -1191,6 +1196,15 @@ static netdev_features_t

xennet_fix_features(struct net_device *dev,

drivers/net/xen-netfront.c static netdev_features_t xennet_fix_features(struct net_device *dev,

Quoted 6 lines
drivers/net/xen-netfront.c +3 -0
 			features &= ~NETIF_F_SG;
 	}
 
+	if (features & NETIF_F_IPV6_CSUM) {
+		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+				 "feature-ipv6-csum-offload", "%d", &val) <

0)

drivers/net/xen-netfront.c static netdev_features_t

Quoted 10 lines
drivers/net/xen-netfront.c +6 -0
+			val = 0;
+
+		if (!val)
+			features &= ~NETIF_F_IPV6_CSUM;
+	}
+
 	if (features & NETIF_F_TSO) {
 		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
 				 "feature-gso-tcpv4", "%d", &val) < 0)
@@ -1200,6 +1214,15 @@ static netdev_features_t

xennet_fix_features(struct net_device *dev,

drivers/net/xen-netfront.c static struct net_device

Quoted 16 lines
drivers/net/xen-netfront.c +9 -0
 			features &= ~NETIF_F_TSO;
 	}
 
+	if (features & NETIF_F_TSO6) {
+		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+				 "feature-gso-tcpv6", "%d", &val) < 0)
+			val = 0;
+
+		if (!val)
+			features &= ~NETIF_F_TSO6;
+	}
+
 	return features;
 }
 
@@ -1338,7 +1361,9 @@ static struct net_device

*xennet_create_dev(struct xenbus_device *dev)

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev)

Quoted 4 lines
drivers/net/xen-netfront.c +0 -1
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG |

NETIF_F_TSO;

Quoted 10 lines
drivers/net/xen-netfront.c +3 -0
+	netdev->hw_features	= NETIF_F_SG |
+				  NETIF_F_IPV6_CSUM |
+				  NETIF_F_TSO | NETIF_F_TSO6;
 
 	/*
          * Assume that all hw features are available for now. This set
@@ -1716,6 +1741,19 @@ again:
 		goto abort_transaction;
 	}
 
Quoted 8 lines

drivers/net/xen-netfront.c again: · line 1744

Quoted 1 line
drivers/net/xen-netfront.c +1 -0
+	err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6",

"%d", 1);

"%d", 1 results in a constant string. xenbus_write() would avoid a transitory memory allocation.

~Andrew

This code is consistent with all the other xenbus_printf()s in the neighbourhood and does it really matter?

Paul

Quoted 16 lines

drivers/net/xen-netfront.c again:

Quoted 6 lines
drivers/net/xen-netfront.c +6 -0
+	if (err) {
+		message = "writing feature-gso-tcpv6";
+		goto abort_transaction;
+	}
+
+	err = xenbus_printf(xbt, dev->nodename, "feature-ipv6-csum-

offload",

Quoted 9 lines
drivers/net/xen-netfront.c +6 -0
+			    "%d", 1);
+	if (err) {
+		message = "writing feature-ipv6-csum-offload";
+		goto abort_transaction;
+	}
+
 	err = xenbus_transaction_end(xbt, 0);
 	if (err) {
 		if (err == -EAGAIN)
#4 lore raw
In reply to Andrew Cooper
Quoted 114 lines

-----Original Message-----
From: Andrew Cooper [mailto:[email protected]]
Sent: 15 January 2014 15:25
To: Paul Durrant
Cc: [email protected]; [email protected]; Boris Ostrovsky; David Vrabel
Subject: Re: [Xen-devel] [PATCH net-next] xen-netfront: add support for IPv6 offloads

Quoted 9 lines · Paul Durrant

This patch adds support for IPv6 checksum offload and GSO when those features are available in the backend.

Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc David Vrabel <[email protected]>
---
 drivers/net/xen-netfront.c |   48

+++++++++++++++++++++++++++++++++++++++-----

drivers/net/xen-netfront.c static int xennet_start_xmit(struct sk_buff *skb,

Quoted 7 lines
 1 file changed, 43 insertions(+), 5 deletions(-)
drivers/net/xen-netfront.c +0 -0
index c41537b..321759f 100644
@@ -617,7 +617,9 @@ static int xennet_start_xmit(struct sk_buff *skb,

struct net_device *dev)

drivers/net/xen-netfront.c static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)

Quoted 5 lines
drivers/net/xen-netfront.c +1 -1
 		tx->flags |= XEN_NETTXF_extra_info;
 
 		gso->u.gso.size = skb_shinfo(skb)->gso_size;
-		gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
+		gso->u.gso.type = (skb_shinfo(skb)->gso_type &

SKB_GSO_TCPV6) ?

drivers/net/xen-netfront.c static int xennet_set_skb_gso(struct sk_buff

Quoted 6 lines
drivers/net/xen-netfront.c +2 -0
+			XEN_NETIF_GSO_TYPE_TCPV6 :
+			XEN_NETIF_GSO_TYPE_TCPV4;
 		gso->u.gso.pad = 0;
 		gso->u.gso.features = 0;
 
@@ -809,15 +811,18 @@ static int xennet_set_skb_gso(struct sk_buff

*skb,

drivers/net/xen-netfront.c static netdev_features_t

Quoted 22 lines
drivers/net/xen-netfront.c +6 -3
 		return -EINVAL;
 	}
 
-	/* Currently only TCPv4 S.O. is supported. */
-	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4 &&
+	    gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV6) {
 		if (net_ratelimit())
 			pr_warn("Bad GSO type %d\n", gso->u.gso.type);
 		return -EINVAL;
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+	skb_shinfo(skb)->gso_type =
+		(gso->u.gso.type == XEN_NETIF_GSO_TYPE_TCPV4) ?
+		SKB_GSO_TCPV4 :
+		SKB_GSO_TCPV6;
 
 	/* Header must be checked, and gso_segs computed. */
 	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
@@ -1191,6 +1196,15 @@ static netdev_features_t

xennet_fix_features(struct net_device *dev,

drivers/net/xen-netfront.c static netdev_features_t xennet_fix_features(struct net_device *dev,

Quoted 6 lines
drivers/net/xen-netfront.c +3 -0
 			features &= ~NETIF_F_SG;
 	}
 
+	if (features & NETIF_F_IPV6_CSUM) {
+		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+				 "feature-ipv6-csum-offload", "%d", &val) <

0)

drivers/net/xen-netfront.c static netdev_features_t

Quoted 10 lines
drivers/net/xen-netfront.c +6 -0
+			val = 0;
+
+		if (!val)
+			features &= ~NETIF_F_IPV6_CSUM;
+	}
+
 	if (features & NETIF_F_TSO) {
 		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
 				 "feature-gso-tcpv4", "%d", &val) < 0)
@@ -1200,6 +1214,15 @@ static netdev_features_t

xennet_fix_features(struct net_device *dev,

drivers/net/xen-netfront.c static struct net_device

Quoted 16 lines
drivers/net/xen-netfront.c +9 -0
 			features &= ~NETIF_F_TSO;
 	}
 
+	if (features & NETIF_F_TSO6) {
+		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
+				 "feature-gso-tcpv6", "%d", &val) < 0)
+			val = 0;
+
+		if (!val)
+			features &= ~NETIF_F_TSO6;
+	}
+
 	return features;
 }
 
@@ -1338,7 +1361,9 @@ static struct net_device

*xennet_create_dev(struct xenbus_device *dev)

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev)

Quoted 4 lines
drivers/net/xen-netfront.c +0 -1
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG |

NETIF_F_TSO;

Quoted 10 lines
drivers/net/xen-netfront.c +3 -0
+	netdev->hw_features	= NETIF_F_SG |
+				  NETIF_F_IPV6_CSUM |
+				  NETIF_F_TSO | NETIF_F_TSO6;
 
 	/*
          * Assume that all hw features are available for now. This set
@@ -1716,6 +1741,19 @@ again:
 		goto abort_transaction;
 	}
 
Quoted 8 lines

drivers/net/xen-netfront.c again: · line 1744

Quoted 1 line
drivers/net/xen-netfront.c +1 -0
+	err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6",

"%d", 1);

"%d", 1 results in a constant string. xenbus_write() would avoid a transitory memory allocation.

~Andrew

This code is consistent with all the other xenbus_printf()s in the neighbourhood and does it really matter?

Paul

Quoted 16 lines

drivers/net/xen-netfront.c again:

Quoted 6 lines
drivers/net/xen-netfront.c +6 -0
+	if (err) {
+		message = "writing feature-gso-tcpv6";
+		goto abort_transaction;
+	}
+
+	err = xenbus_printf(xbt, dev->nodename, "feature-ipv6-csum-

offload",

Quoted 9 lines
drivers/net/xen-netfront.c +6 -0
+			    "%d", 1);
+	if (err) {
+		message = "writing feature-ipv6-csum-offload";
+		goto abort_transaction;
+	}
+
 	err = xenbus_transaction_end(xbt, 0);
 	if (err) {
 		if (err == -EAGAIN)
#5 lore raw
Quoted 10 lines
Quoted 7 lines
Quoted 1 line · Paul Durrant

From: Andrew Cooper [mailto:[email protected]]

drivers/net/xen-netfront.c again: · line 1744

Quoted 1 line · Paul Durrant
drivers/net/xen-netfront.c +1 -0
+	err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6", "%d", 1);

"%d", 1 results in a constant string. xenbus_write() would avoid a transitory memory allocation.

This code is consistent with all the other xenbus_printf()s in the neighbourhood and does it really matter?

I think we should always strive to have the simplest possible code that fulfills the purpose. And hence we shouldn't be setting further bad precedents. (In fact I have a patch queued to replace all the unnecessary xenbus_printf()s with xenbus_write()s on linux-2.6.18-xen.hg, and may look into porting this to the respective upstream components.)

Jan

#6 lore raw
In reply to Paul Durrant
Quoted 10 lines
Quoted 7 lines
Quoted 1 line · Paul Durrant

From: Andrew Cooper [mailto:[email protected]]

drivers/net/xen-netfront.c again: · line 1744

Quoted 1 line · Paul Durrant
drivers/net/xen-netfront.c +1 -0
+	err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6", "%d", 1);

"%d", 1 results in a constant string. xenbus_write() would avoid a transitory memory allocation.

This code is consistent with all the other xenbus_printf()s in the neighbourhood and does it really matter?

I think we should always strive to have the simplest possible code that fulfills the purpose. And hence we shouldn't be setting further bad precedents. (In fact I have a patch queued to replace all the unnecessary xenbus_printf()s with xenbus_write()s on linux-2.6.18-xen.hg, and may look into porting this to the respective upstream components.)

Jan

#7 lore raw
Quoted 21 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 15 January 2014 16:04
To: Andrew Cooper; Paul Durrant
Cc: David Vrabel; [email protected]; Boris Ostrovsky; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next] xen-netfront: add support for IPv6 offloads

Quoted 4 lines
Quoted 4 lines
Quoted 1 line · Paul Durrant

From: Andrew Cooper [mailto:[email protected]]

Review

Quoted 1 line · Paul Durrant
(quoted diff) +1 -0
+	err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6",

"%d", 1);

Quoted 6 lines
Quoted 3 lines

"%d", 1 results in a constant string. xenbus_write() would avoid a transitory memory allocation.

This code is consistent with all the other xenbus_printf()s in the neighbourhood and does it really matter?

Quoted 7 lines

I think we should always strive to have the simplest possible code that fulfills the purpose. And hence we shouldn't be setting further bad precedents. (In fact I have a patch queued to replace all the unnecessary xenbus_printf()s with xenbus_write()s on linux-2.6.18-xen.hg, and may look into porting this to the respective upstream components.)

Ok. Personally I'd go for code consistency with this patch and then a full replacement... but I'll re-work it.

Paul

#8 lore raw
In reply to Jan Beulich
Quoted 21 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 15 January 2014 16:04
To: Andrew Cooper; Paul Durrant
Cc: David Vrabel; [email protected]; Boris Ostrovsky; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next] xen-netfront: add support for IPv6 offloads

Quoted 4 lines
Quoted 4 lines
Quoted 1 line · Paul Durrant

From: Andrew Cooper [mailto:[email protected]]

Review

Quoted 1 line · Paul Durrant
(quoted diff) +1 -0
+	err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6",

"%d", 1);

Quoted 6 lines
Quoted 3 lines

"%d", 1 results in a constant string. xenbus_write() would avoid a transitory memory allocation.

This code is consistent with all the other xenbus_printf()s in the neighbourhood and does it really matter?

Quoted 7 lines

I think we should always strive to have the simplest possible code that fulfills the purpose. And hence we shouldn't be setting further bad precedents. (In fact I have a patch queued to replace all the unnecessary xenbus_printf()s with xenbus_write()s on linux-2.6.18-xen.hg, and may look into porting this to the respective upstream components.)

Ok. Personally I'd go for code consistency with this patch and then a full replacement... but I'll re-work it.

Paul