Skip to contentSkip to conversation

xen-netback: IPv6 offload support

PATCH Superseded Paul Durrant 4 participants 55 messages Oct 11, 2013 – Oct 17, 2013

Subsystems (4)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#1 lore raw

PATCH v4 1/5 xen-netback: add support for IPv6 checksum offload to guest

In reply to Paul Durrant

Check xenstore flag feature-ipv6-csum-offload to determine if a guest is happy to accept IPv6 packets with only partial checksum. Also check analogous feature-ip-csum-offload to determine if a guest is happy to accept IPv4 packets with only partial checksum as a replacement for a negated feature-no-csum-offload value and add a comment to deprecate use of feature-no-csum-offload.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/common.h    |    3 ++-
 drivers/net/xen-netback/interface.c |   10 +++++++---
 drivers/net/xen-netback/xenbus.c    |   24 +++++++++++++++++++++++-
 include/xen/interface/io/netif.h    |   10 ++++++++++
 4 files changed, 42 insertions(+), 5 deletions(-)
drivers/net/xen-netback/common.h +2 -1
index 5715318..b4a9a3c 100644
@@ -153,7 +153,8 @@ struct xenvif {
 	u8 can_sg:1;
 	u8 gso:1;
 	u8 gso_prefix:1;
-	u8 csum:1;
+	u8 ip_csum:1;
+	u8 ipv6_csum:1;
 
 	/* Internal feature information. */
 	u8 can_queue:1;	    /* can queue packets for receiver? */
drivers/net/xen-netback/interface.c +7 -3
index 01bb854..8e92783 100644
@@ -216,8 +216,10 @@ static netdev_features_t xenvif_fix_features(struct net_device *dev,
 		features &= ~NETIF_F_SG;
 	if (!vif->gso && !vif->gso_prefix)
 		features &= ~NETIF_F_TSO;
-	if (!vif->csum)
+	if (!vif->ip_csum)
 		features &= ~NETIF_F_IP_CSUM;
+	if (!vif->ipv6_csum)
+		features &= ~NETIF_F_IPV6_CSUM;
 
 	return features;
 }
@@ -306,7 +308,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	vif->domid  = domid;
 	vif->handle = handle;
 	vif->can_sg = 1;
-	vif->csum = 1;
+	vif->ip_csum = 1;
 	vif->dev = dev;
 
 	vif->credit_bytes = vif->remaining_credit = ~0UL;
@@ -316,7 +318,9 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	vif->credit_timeout.expires = jiffies;
 
 	dev->netdev_ops	= &xenvif_netdev_ops;
-	dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
+	dev->hw_features = NETIF_F_SG |
+		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+		NETIF_F_TSO;
 	dev->features = dev->hw_features;
 	SET_ETHTOOL_OPS(dev, &xenvif_ethtool_ops);
 
drivers/net/xen-netback/xenbus.c +23 -1
index 1b08d87..99343ca 100644
@@ -571,10 +571,32 @@ static int connect_rings(struct backend_info *be)
 		val = 0;
 	vif->gso_prefix = !!val;
 
+	/* Before feature-ipv6-csum-offload was introduced, checksum offload
+	 * was turned on by a zero value in (or lack of)
+	 * feature-no-csum-offload. Therefore, for compatibility, assume
+	 * that if feature-ip-csum-offload is missing that IP (v4) offload
+	 * is turned on. If this is not the case then the flag will be
+	 * cleared when we subsequently sample feature-no-csum-offload.
+	 */
+	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-ip-csum-offload",
+			 "%d", &val) < 0)
+		val = 1;
+	vif->ip_csum = !!val;
+
+	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-ipv6-csum-offload",
+			 "%d", &val) < 0)
+		val = 0;
+	vif->ipv6_csum = !!val;
+
+	/* This is deprecated. Frontends should set IP v4 and v6 checksum
+	 * offload using feature-ip-csum-offload and
+	 * feature-ipv6-csum-offload respectively.
+	 */
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-no-csum-offload",
 			 "%d", &val) < 0)
 		val = 0;
-	vif->csum = !val;
+	if (val)
+		vif->ip_csum = 0;
 
 	/* Map the shared frame, irq etc. */
 	err = xenvif_connect(vif, tx_ring_ref, rx_ring_ref,
include/xen/interface/io/netif.h +10 -0
index eb262e3..d9fb44739 100644
@@ -51,6 +51,16 @@
  */
 
 /*
+ * "feature-no-csum-offload" was used to turn off IPv4 TCP/UDP checksum
+ * offload but is now deprecated. Two new feature flags should now be used
+ * to control checksum offload:
+ * "feature-ip-csum-offload" should be used to turn IPv4 TCP/UDP checksum
+ * offload on or off. If it is missing then the feature is assumed to be on.
+ * "feature-ipv6-csum-offload" should be used to turn IPv6 TCP/UDP checksum
+ * offload on or off. If it is missing then the feature is assumed to be off.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has XEN_NETTXF_extra_info)
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH v4 2/5 xen-netback: add support for IPv6 checksum offload from guest

In reply to Paul Durrant

For performance of VM to VM traffic on a single host it is better to avoid calculation of TCP/UDP checksum in the sending frontend. To allow this this patch adds the code necessary to set up partial checksum for IPv6 packets and xenstore flag feature-ipv6-csum-offload to advertise that fact to frontends.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/netback.c |  233 ++++++++++++++++++++++++++++++-------
 drivers/net/xen-netback/xenbus.c  |    9 ++
 2 files changed, 203 insertions(+), 39 deletions(-)
drivers/net/xen-netback/netback.c +194 -39
index f3e591c..74c13b9 100644
@@ -109,15 +109,10 @@ static inline unsigned long idx_to_kaddr(struct xenvif *vif,
 	return (unsigned long)pfn_to_kaddr(idx_to_pfn(vif, idx));
 }
 
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */
-#define PKT_PROT_LEN    (ETH_HLEN + \
-			 VLAN_HLEN + \
-			 sizeof(struct iphdr) + MAX_IPOPTLEN + \
-			 sizeof(struct tcphdr) + MAX_TCP_OPTION_SPACE)
+#define PKT_PROT_LEN 128
 
 static u16 frag_get_pending_idx(skb_frag_t *frag)
 {
@@ -1118,61 +1113,74 @@ static int xenvif_set_skb_gso(struct xenvif *vif,
 	return 0;
 }
 
-static int checksum_setup(struct xenvif *vif, struct sk_buff *skb)
+static inline void maybe_pull_tail(struct sk_buff *skb, unsigned int len)
+{
+	if (skb_is_nonlinear(skb) && skb_headlen(skb) < len) {
+		/* If we need to pullup then pullup to the max, so we
+		 * won't need to do it again.
+		 */
+		int target = min_t(int, skb->len, MAX_TCP_HEADER);
+		__pskb_pull_tail(skb, target - skb_headlen(skb));
+	}
+}
+
+static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb,
+			     int recalculate_partial_csum)
 {
-	struct iphdr *iph;
+	struct iphdr *iph = (void *)skb->data;
+	unsigned int header_size;
+	unsigned int off;
 	int err = -EPROTO;
-	int recalculate_partial_csum = 0;
 
-	/*
-	 * A GSO SKB must be CHECKSUM_PARTIAL. However some buggy
-	 * peers can fail to set NETRXF_csum_blank when sending a GSO
-	 * frame. In this case force the SKB to CHECKSUM_PARTIAL and
-	 * recalculate the partial checksum.
-	 */
-	if (skb->ip_summed != CHECKSUM_PARTIAL && skb_is_gso(skb)) {
-		vif->rx_gso_checksum_fixup++;
-		skb->ip_summed = CHECKSUM_PARTIAL;
-		recalculate_partial_csum = 1;
-	}
+	off = sizeof(struct iphdr);
 
-	/* A non-CHECKSUM_PARTIAL SKB does not require setup. */
-	if (skb->ip_summed != CHECKSUM_PARTIAL)
-		return 0;
+	header_size = skb->network_header + off + MAX_IPOPTLEN;
+	maybe_pull_tail(skb, header_size);
 
-	if (skb->protocol != htons(ETH_P_IP))
-		goto out;
+	off = iph->ihl * 4;
 
-	iph = (void *)skb->data;
 	switch (iph->protocol) {
 	case IPPROTO_TCP:
-		if (!skb_partial_csum_set(skb, 4 * iph->ihl,
+		if (!skb_partial_csum_set(skb, off,
 					  offsetof(struct tcphdr, check)))
 			goto out;
 
 		if (recalculate_partial_csum) {
 			struct tcphdr *tcph = tcp_hdr(skb);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct tcphdr);
+			maybe_pull_tail(skb, header_size);
+
 			tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
-							 skb->len - iph->ihl*4,
+							 skb->len - off,
 							 IPPROTO_TCP, 0);
 		}
 		break;
 	case IPPROTO_UDP:
-		if (!skb_partial_csum_set(skb, 4 * iph->ihl,
+		if (!skb_partial_csum_set(skb, off,
 					  offsetof(struct udphdr, check)))
 			goto out;
 
 		if (recalculate_partial_csum) {
 			struct udphdr *udph = udp_hdr(skb);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct udphdr);
+			maybe_pull_tail(skb, header_size);
+
 			udph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
-							 skb->len - iph->ihl*4,
+							 skb->len - off,
 							 IPPROTO_UDP, 0);
 		}
 		break;
 	default:
 		if (net_ratelimit())
 			netdev_err(vif->dev,
-				   "Attempting to checksum a non-TCP/UDP packet, dropping a protocol %d packet\n",
+				   "Attempting to checksum a non-TCP/UDP packet, "
+				   "dropping a protocol %d packet\n",
 				   iph->protocol);
 		goto out;
 	}
@@ -1183,6 +1191,158 @@ out:
 	return err;
 }
 
+static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb,
+			       int recalculate_partial_csum)
+{
+	int err = -EPROTO;
+	struct ipv6hdr *ipv6h = (void *)skb->data;
+	u8 nexthdr;
+	unsigned int header_size;
+	unsigned int off;
+	bool fragment;
+	bool done;
+
+	done = false;
+
+	off = sizeof(struct ipv6hdr);
+
+	header_size = skb->network_header + off;
+	maybe_pull_tail(skb, header_size);
+
+	nexthdr = ipv6h->nexthdr;
+
+	while ((off <= sizeof(struct ipv6hdr) + ntohs(ipv6h->payload_len)) &&
+	       !done) {
+		switch (nexthdr) {
+		case IPPROTO_DSTOPTS:
+		case IPPROTO_HOPOPTS:
+		case IPPROTO_ROUTING: {
+			struct ipv6_opt_hdr *hp = (void *)(skb->data + off);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct ipv6_opt_hdr);
+			maybe_pull_tail(skb, header_size);
+
+			nexthdr = hp->nexthdr;
+			off += ipv6_optlen(hp);
+			break;
+		}
+		case IPPROTO_AH: {
+			struct ip_auth_hdr *hp = (void *)(skb->data + off);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct ip_auth_hdr);
+			maybe_pull_tail(skb, header_size);
+
+			nexthdr = hp->nexthdr;
+			off += (hp->hdrlen+2)<<2;
+			break;
+		}
+		case IPPROTO_FRAGMENT:
+			fragment = true;
+			/* fall through */
+		default:
+			done = true;
+			break;
+		}
+	}
+
+	if (!done) {
+		if (net_ratelimit())
+			netdev_err(vif->dev, "Failed to parse packet header\n");
+		goto out;
+	}
+
+	if (fragment) {
+		if (net_ratelimit())
+			netdev_err(vif->dev, "Packet is a fragment!\n");
+		goto out;
+	}
+
+	switch (nexthdr) {
+	case IPPROTO_TCP:
+		if (!skb_partial_csum_set(skb, off,
+					  offsetof(struct tcphdr, check)))
+			goto out;
+
+		if (recalculate_partial_csum) {
+			struct tcphdr *tcph = tcp_hdr(skb);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct tcphdr);
+			maybe_pull_tail(skb, header_size);
+
+			tcph->check = ~csum_ipv6_magic(&ipv6h->saddr,
+						       &ipv6h->daddr,
+						       skb->len - off,
+						       IPPROTO_TCP, 0);
+		}
+		break;
+	case IPPROTO_UDP:
+		if (!skb_partial_csum_set(skb, off,
+					  offsetof(struct udphdr, check)))
+			goto out;
+
+		if (recalculate_partial_csum) {
+			struct udphdr *udph = udp_hdr(skb);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct udphdr);
+			maybe_pull_tail(skb, header_size);
+
+			udph->check = ~csum_ipv6_magic(&ipv6h->saddr,
+						       &ipv6h->daddr,
+						       skb->len - off,
+						       IPPROTO_UDP, 0);
+		}
+		break;
+	default:
+		if (net_ratelimit())
+			netdev_err(vif->dev,
+				   "Attempting to checksum a non-TCP/UDP packet, "
+				   "dropping a protocol %d packet\n",
+				   nexthdr);
+		goto out;
+	}
+
+	err = 0;
+
+out:
+	return err;
+}
+
+static int checksum_setup(struct xenvif *vif, struct sk_buff *skb)
+{
+	int err = -EPROTO;
+	int recalculate_partial_csum = 0;
+
+	/* A GSO SKB must be CHECKSUM_PARTIAL. However some buggy
+	 * peers can fail to set NETRXF_csum_blank when sending a GSO
+	 * frame. In this case force the SKB to CHECKSUM_PARTIAL and
+	 * recalculate the partial checksum.
+	 */
+	if (skb->ip_summed != CHECKSUM_PARTIAL && skb_is_gso(skb)) {
+		vif->rx_gso_checksum_fixup++;
+		skb->ip_summed = CHECKSUM_PARTIAL;
+		recalculate_partial_csum = 1;
+	}
+
+	/* A non-CHECKSUM_PARTIAL SKB does not require setup. */
+	if (skb->ip_summed != CHECKSUM_PARTIAL)
+		return 0;
+
+	if (skb->protocol == htons(ETH_P_IP))
+		err = checksum_setup_ip(vif, skb, recalculate_partial_csum);
+	else if (skb->protocol == htons(ETH_P_IPV6))
+		err = checksum_setup_ipv6(vif, skb, recalculate_partial_csum);
+
+	return err;
+}
+
 static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
 {
 	unsigned long now = jiffies;
@@ -1428,12 +1588,7 @@ static int xenvif_tx_submit(struct xenvif *vif, int budget)
 
 		xenvif_fill_frags(vif, skb);
 
-		/*
-		 * If the initial fragment was < PKT_PROT_LEN then
-		 * pull through some bytes from the other fragments to
-		 * increase the linear region to PKT_PROT_LEN bytes.
-		 */
-		if (skb_headlen(skb) < PKT_PROT_LEN && skb_is_nonlinear(skb)) {
+		if (skb_is_nonlinear(skb) && skb_headlen(skb) < PKT_PROT_LEN) {
 			int target = min_t(int, skb->len, PKT_PROT_LEN);
 			__pskb_pull_tail(skb, target - skb_headlen(skb));
 		}
drivers/net/xen-netback/xenbus.c +9 -0
index 99343ca..9c9b37d 100644
@@ -105,6 +105,15 @@ static int netback_probe(struct xenbus_device *dev,
 			goto abort_transaction;
 		}
 
+		/* We support partial checksum setup for IPv6 packets */
+		err = xenbus_printf(xbt, dev->nodename,
+				    "feature-ipv6-csum-offload",
+				    "%d", 1);
+		if (err) {
+			message = "writing feature-ipv6-csum-offload";
+			goto abort_transaction;
+		}
+
 		/* We support rx-copy path. */
 		err = xenbus_printf(xbt, dev->nodename,
 				    "feature-rx-copy", "%d", 1);
Signature · 1 line
1.7.10.4
#27 lore raw

PATCH v4 3/5 xen-netback: Unconditionally set NETIF_F_RXCSUM

In reply to Paul Durrant

There is no mechanism to insist that a guest always generates a packet with good checksum (at least for IPv4) so we must handle checksum offloading from the guest and hence should set NETIF_F_RXCSUM.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/interface.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/interface.c +1 -1
index 8e92783..cb0d8ea 100644
@@ -321,7 +321,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	dev->hw_features = NETIF_F_SG |
 		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 		NETIF_F_TSO;
-	dev->features = dev->hw_features;
+	dev->features = dev->hw_features | NETIF_F_RXCSUM;
 	SET_ETHTOOL_OPS(dev, &xenvif_ethtool_ops);
 
 	dev->tx_queue_len = XENVIF_QUEUE_LENGTH;
Signature · 1 line
1.7.10.4
#33 lore raw

PATCH v4 4/5 xen-netback: handle IPv6 TCP GSO packets from the guest

In reply to Paul Durrant

This patch adds a xenstore feature flag, festure-gso-tcpv6, to advertise that netback can handle IPv6 TCP GSO packets. It creates SKB_GSO_TCPV6 skbs if the frontend passes an extra segment with the new type XEN_NETIF_GSO_TYPE_TCPV6 added to netif.h.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/netback.c |   11 ++++++++---
 drivers/net/xen-netback/xenbus.c  |    7 +++++++
 include/xen/interface/io/netif.h  |   10 +++++++++-
 3 files changed, 24 insertions(+), 4 deletions(-)
drivers/net/xen-netback/netback.c +8 -3
index 74c13b9..65f04e7 100644
@@ -1096,15 +1096,20 @@ static int xenvif_set_skb_gso(struct xenvif *vif,
 		return -EINVAL;
 	}
 
-	/* Currently only TCPv4 S.O. is supported. */
-	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+	switch (gso->u.gso.type) {
+	case XEN_NETIF_GSO_TYPE_TCPV4:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+		break;
+	case XEN_NETIF_GSO_TYPE_TCPV6:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+		break;
+	default:
 		netdev_err(vif->dev, "Bad GSO type %d.\n", gso->u.gso.type);
 		xenvif_fatal_tx_err(vif);
 		return -EINVAL;
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
 
 	/* Header must be checked, and gso_segs computed. */
 	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
drivers/net/xen-netback/xenbus.c +7 -0
index 9c9b37d..7e4dcc9 100644
@@ -105,6 +105,13 @@ static int netback_probe(struct xenbus_device *dev,
 			goto abort_transaction;
 		}
 
+		err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6",
+				    "%d", sg);
+		if (err) {
+			message = "writing feature-gso-tcpv6";
+			goto abort_transaction;
+		}
+
 		/* We support partial checksum setup for IPv6 packets */
 		err = xenbus_printf(xbt, dev->nodename,
 				    "feature-ipv6-csum-offload",
include/xen/interface/io/netif.h +9 -1
index d9fb44739..d7dd8d7 100644
@@ -61,6 +61,13 @@
  */
 
 /*
+ * "feature-gso-tcpv4" and "feature-gso-tcpv6" advertise the capability to
+ * handle large TCP packets (in IPv4 or IPv6 form respectively). Neither
+ * frontends nor backends are assumed to be capable unless the flags are
+ * present.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has XEN_NETTXF_extra_info)
@@ -105,8 +112,9 @@ struct xen_netif_tx_request {
 #define _XEN_NETIF_EXTRA_FLAG_MORE	(0)
 #define  XEN_NETIF_EXTRA_FLAG_MORE	(1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
 
-/* GSO types - only TCPv4 currently supported. */
+/* GSO types */
 #define XEN_NETIF_GSO_TYPE_TCPV4	(1)
+#define XEN_NETIF_GSO_TYPE_TCPV6	(2)
 
 /*
  * This structure needs to fit within both netif_tx_request and
Signature · 1 line
1.7.10.4
#39 lore raw

PATCH v4 5/5 xen-netback: enable IPv6 TCP GSO to the guest

In reply to Paul Durrant

This patch adds code to handle SKB_GSO_TCPV6 skbs and construct appropriate extra or prefix segments to pass the large packet to the frontend. New xenstore flags, feature-gso-tcpv6 and feature-gso-tcpv6-prefix, are sampled to determine if the frontend is capable of handling such packets.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/common.h    |    9 +++++--
 drivers/net/xen-netback/interface.c |    6 +++--
 drivers/net/xen-netback/netback.c   |   48 +++++++++++++++++++++++++++--------
 drivers/net/xen-netback/xenbus.c    |   29 +++++++++++++++++++--
 include/xen/interface/io/netif.h    |    1 +
 5 files changed, 77 insertions(+), 16 deletions(-)
drivers/net/xen-netback/common.h +7 -2
index b4a9a3c..55b8dec 100644
@@ -87,9 +87,13 @@ struct pending_tx_info {
 struct xenvif_rx_meta {
 	int id;
 	int size;
+	int gso_type;
 	int gso_size;
 };
 
+#define GSO_BIT(type) \
+	(1 << XEN_NETIF_GSO_TYPE_ ## type)
+
 /* Discriminate from any valid pending_idx value. */
 #define INVALID_PENDING_IDX 0xFFFF
 
@@ -150,9 +154,10 @@ struct xenvif {
 	u8               fe_dev_addr[6];
 
 	/* Frontend feature information. */
+	int gso_mask;
+	int gso_prefix_mask;
+
 	u8 can_sg:1;
-	u8 gso:1;
-	u8 gso_prefix:1;
 	u8 ip_csum:1;
 	u8 ipv6_csum:1;
 
drivers/net/xen-netback/interface.c +4 -2
index cb0d8ea..e4aa267 100644
@@ -214,8 +214,10 @@ static netdev_features_t xenvif_fix_features(struct net_device *dev,
 
 	if (!vif->can_sg)
 		features &= ~NETIF_F_SG;
-	if (!vif->gso && !vif->gso_prefix)
+	if (~(vif->gso_mask | vif->gso_prefix_mask) & GSO_BIT(TCPV4))
 		features &= ~NETIF_F_TSO;
+	if (~(vif->gso_mask | vif->gso_prefix_mask) & GSO_BIT(TCPV6))
+		features &= ~NETIF_F_TSO6;
 	if (!vif->ip_csum)
 		features &= ~NETIF_F_IP_CSUM;
 	if (!vif->ipv6_csum)
@@ -320,7 +322,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	dev->netdev_ops	= &xenvif_netdev_ops;
 	dev->hw_features = NETIF_F_SG |
 		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
-		NETIF_F_TSO;
+		NETIF_F_TSO | NETIF_F_TSO6;
 	dev->features = dev->hw_features | NETIF_F_RXCSUM;
 	SET_ETHTOOL_OPS(dev, &xenvif_ethtool_ops);
 
drivers/net/xen-netback/netback.c +38 -10

110 lines not on this page · raw message

drivers/net/xen-netback/xenbus.c +27 -2
index 7e4dcc9..6a005f1 100644
@@ -577,15 +577,40 @@ static int connect_rings(struct backend_info *be)
 		val = 0;
 	vif->can_sg = !!val;
 
+	vif->gso_mask = 0;
+	vif->gso_prefix_mask = 0;
+
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4",
 			 "%d", &val) < 0)
 		val = 0;
-	vif->gso = !!val;
+	if (val)
+		vif->gso_mask |= GSO_BIT(TCPV4);
 
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4-prefix",
 			 "%d", &val) < 0)
 		val = 0;
-	vif->gso_prefix = !!val;
+	if (val)
+		vif->gso_prefix_mask |= GSO_BIT(TCPV4);
+
+	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv6",
+			 "%d", &val) < 0)
+		val = 0;
+	if (val)
+		vif->gso_mask |= GSO_BIT(TCPV6);
+
+	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv6-prefix",
+			 "%d", &val) < 0)
+		val = 0;
+	if (val)
+		vif->gso_prefix_mask |= GSO_BIT(TCPV6);
+
+	if (vif->gso_mask & vif->gso_prefix_mask) {
+		xenbus_dev_fatal(dev, err,
+				 "%s: gso and gso prefix flags are not "
+				 "mutually exclusive",
+				 dev->otherend);
+		return -EOPNOTSUPP;
+	}
 
 	/* Before feature-ipv6-csum-offload was introduced, checksum offload
 	 * was turned on by a zero value in (or lack of)
include/xen/interface/io/netif.h +1 -0
index d7dd8d7..be341f9 100644
@@ -113,6 +113,7 @@ struct xen_netif_tx_request {
 #define  XEN_NETIF_EXTRA_FLAG_MORE	(1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
 
 /* GSO types */
+#define XEN_NETIF_GSO_TYPE_NONE		(0)
 #define XEN_NETIF_GSO_TYPE_TCPV4	(1)
 #define XEN_NETIF_GSO_TYPE_TCPV6	(2)
 
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v4 1/5 xen-netback: add support for IPv6 checksum offload to guest

In reply to Paul Durrant

Check xenstore flag feature-ipv6-csum-offload to determine if a guest is happy to accept IPv6 packets with only partial checksum. Also check analogous feature-ip-csum-offload to determine if a guest is happy to accept IPv4 packets with only partial checksum as a replacement for a negated feature-no-csum-offload value and add a comment to deprecate use of feature-no-csum-offload.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/common.h    |    3 ++-
 drivers/net/xen-netback/interface.c |   10 +++++++---
 drivers/net/xen-netback/xenbus.c    |   24 +++++++++++++++++++++++-
 include/xen/interface/io/netif.h    |   10 ++++++++++
 4 files changed, 42 insertions(+), 5 deletions(-)
drivers/net/xen-netback/common.h +2 -1
index 5715318..b4a9a3c 100644
@@ -153,7 +153,8 @@ struct xenvif {
 	u8 can_sg:1;
 	u8 gso:1;
 	u8 gso_prefix:1;
-	u8 csum:1;
+	u8 ip_csum:1;
+	u8 ipv6_csum:1;
 
 	/* Internal feature information. */
 	u8 can_queue:1;	    /* can queue packets for receiver? */
drivers/net/xen-netback/interface.c +7 -3
index 01bb854..8e92783 100644
@@ -216,8 +216,10 @@ static netdev_features_t xenvif_fix_features(struct net_device *dev,
 		features &= ~NETIF_F_SG;
 	if (!vif->gso && !vif->gso_prefix)
 		features &= ~NETIF_F_TSO;
-	if (!vif->csum)
+	if (!vif->ip_csum)
 		features &= ~NETIF_F_IP_CSUM;
+	if (!vif->ipv6_csum)
+		features &= ~NETIF_F_IPV6_CSUM;
 
 	return features;
 }
@@ -306,7 +308,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	vif->domid  = domid;
 	vif->handle = handle;
 	vif->can_sg = 1;
-	vif->csum = 1;
+	vif->ip_csum = 1;
 	vif->dev = dev;
 
 	vif->credit_bytes = vif->remaining_credit = ~0UL;
@@ -316,7 +318,9 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	vif->credit_timeout.expires = jiffies;
 
 	dev->netdev_ops	= &xenvif_netdev_ops;
-	dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
+	dev->hw_features = NETIF_F_SG |
+		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+		NETIF_F_TSO;
 	dev->features = dev->hw_features;
 	SET_ETHTOOL_OPS(dev, &xenvif_ethtool_ops);
 
drivers/net/xen-netback/xenbus.c +23 -1
index 1b08d87..99343ca 100644
@@ -571,10 +571,32 @@ static int connect_rings(struct backend_info *be)
 		val = 0;
 	vif->gso_prefix = !!val;
 
+	/* Before feature-ipv6-csum-offload was introduced, checksum offload
+	 * was turned on by a zero value in (or lack of)
+	 * feature-no-csum-offload. Therefore, for compatibility, assume
+	 * that if feature-ip-csum-offload is missing that IP (v4) offload
+	 * is turned on. If this is not the case then the flag will be
+	 * cleared when we subsequently sample feature-no-csum-offload.
+	 */
+	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-ip-csum-offload",
+			 "%d", &val) < 0)
+		val = 1;
+	vif->ip_csum = !!val;
+
+	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-ipv6-csum-offload",
+			 "%d", &val) < 0)
+		val = 0;
+	vif->ipv6_csum = !!val;
+
+	/* This is deprecated. Frontends should set IP v4 and v6 checksum
+	 * offload using feature-ip-csum-offload and
+	 * feature-ipv6-csum-offload respectively.
+	 */
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-no-csum-offload",
 			 "%d", &val) < 0)
 		val = 0;
-	vif->csum = !val;
+	if (val)
+		vif->ip_csum = 0;
 
 	/* Map the shared frame, irq etc. */
 	err = xenvif_connect(vif, tx_ring_ref, rx_ring_ref,
include/xen/interface/io/netif.h +10 -0
index eb262e3..d9fb44739 100644
@@ -51,6 +51,16 @@
  */
 
 /*
+ * "feature-no-csum-offload" was used to turn off IPv4 TCP/UDP checksum
+ * offload but is now deprecated. Two new feature flags should now be used
+ * to control checksum offload:
+ * "feature-ip-csum-offload" should be used to turn IPv4 TCP/UDP checksum
+ * offload on or off. If it is missing then the feature is assumed to be on.
+ * "feature-ipv6-csum-offload" should be used to turn IPv6 TCP/UDP checksum
+ * offload on or off. If it is missing then the feature is assumed to be off.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has XEN_NETTXF_extra_info)
Signature · 1 line
1.7.10.4
#10 lore raw

PATCH v4 2/5 xen-netback: add support for IPv6 checksum offload from guest

In reply to Paul Durrant

For performance of VM to VM traffic on a single host it is better to avoid calculation of TCP/UDP checksum in the sending frontend. To allow this this patch adds the code necessary to set up partial checksum for IPv6 packets and xenstore flag feature-ipv6-csum-offload to advertise that fact to frontends.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/netback.c |  233 ++++++++++++++++++++++++++++++-------
 drivers/net/xen-netback/xenbus.c  |    9 ++
 2 files changed, 203 insertions(+), 39 deletions(-)
drivers/net/xen-netback/netback.c +194 -39
index f3e591c..74c13b9 100644
@@ -109,15 +109,10 @@ static inline unsigned long idx_to_kaddr(struct xenvif *vif,
 	return (unsigned long)pfn_to_kaddr(idx_to_pfn(vif, idx));
 }
 
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */
-#define PKT_PROT_LEN    (ETH_HLEN + \
-			 VLAN_HLEN + \
-			 sizeof(struct iphdr) + MAX_IPOPTLEN + \
-			 sizeof(struct tcphdr) + MAX_TCP_OPTION_SPACE)
+#define PKT_PROT_LEN 128
 
 static u16 frag_get_pending_idx(skb_frag_t *frag)
 {
@@ -1118,61 +1113,74 @@ static int xenvif_set_skb_gso(struct xenvif *vif,
 	return 0;
 }
 
-static int checksum_setup(struct xenvif *vif, struct sk_buff *skb)
+static inline void maybe_pull_tail(struct sk_buff *skb, unsigned int len)
+{
+	if (skb_is_nonlinear(skb) && skb_headlen(skb) < len) {
+		/* If we need to pullup then pullup to the max, so we
+		 * won't need to do it again.
+		 */
+		int target = min_t(int, skb->len, MAX_TCP_HEADER);
+		__pskb_pull_tail(skb, target - skb_headlen(skb));
+	}
+}
+
+static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb,
+			     int recalculate_partial_csum)
 {
-	struct iphdr *iph;
+	struct iphdr *iph = (void *)skb->data;
+	unsigned int header_size;
+	unsigned int off;
 	int err = -EPROTO;
-	int recalculate_partial_csum = 0;
 
-	/*
-	 * A GSO SKB must be CHECKSUM_PARTIAL. However some buggy
-	 * peers can fail to set NETRXF_csum_blank when sending a GSO
-	 * frame. In this case force the SKB to CHECKSUM_PARTIAL and
-	 * recalculate the partial checksum.
-	 */
-	if (skb->ip_summed != CHECKSUM_PARTIAL && skb_is_gso(skb)) {
-		vif->rx_gso_checksum_fixup++;
-		skb->ip_summed = CHECKSUM_PARTIAL;
-		recalculate_partial_csum = 1;
-	}
+	off = sizeof(struct iphdr);
 
-	/* A non-CHECKSUM_PARTIAL SKB does not require setup. */
-	if (skb->ip_summed != CHECKSUM_PARTIAL)
-		return 0;
+	header_size = skb->network_header + off + MAX_IPOPTLEN;
+	maybe_pull_tail(skb, header_size);
 
-	if (skb->protocol != htons(ETH_P_IP))
-		goto out;
+	off = iph->ihl * 4;
 
-	iph = (void *)skb->data;
 	switch (iph->protocol) {
 	case IPPROTO_TCP:
-		if (!skb_partial_csum_set(skb, 4 * iph->ihl,
+		if (!skb_partial_csum_set(skb, off,
 					  offsetof(struct tcphdr, check)))
 			goto out;
 
 		if (recalculate_partial_csum) {
 			struct tcphdr *tcph = tcp_hdr(skb);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct tcphdr);
+			maybe_pull_tail(skb, header_size);
+
 			tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
-							 skb->len - iph->ihl*4,
+							 skb->len - off,
 							 IPPROTO_TCP, 0);
 		}
 		break;
 	case IPPROTO_UDP:
-		if (!skb_partial_csum_set(skb, 4 * iph->ihl,
+		if (!skb_partial_csum_set(skb, off,
 					  offsetof(struct udphdr, check)))
 			goto out;
 
 		if (recalculate_partial_csum) {
 			struct udphdr *udph = udp_hdr(skb);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct udphdr);
+			maybe_pull_tail(skb, header_size);
+
 			udph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
-							 skb->len - iph->ihl*4,
+							 skb->len - off,
 							 IPPROTO_UDP, 0);
 		}
 		break;
 	default:
 		if (net_ratelimit())
 			netdev_err(vif->dev,
-				   "Attempting to checksum a non-TCP/UDP packet, dropping a protocol %d packet\n",
+				   "Attempting to checksum a non-TCP/UDP packet, "
+				   "dropping a protocol %d packet\n",
 				   iph->protocol);
 		goto out;
 	}
@@ -1183,6 +1191,158 @@ out:
 	return err;
 }
 
+static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb,
+			       int recalculate_partial_csum)
+{
+	int err = -EPROTO;
+	struct ipv6hdr *ipv6h = (void *)skb->data;
+	u8 nexthdr;
+	unsigned int header_size;
+	unsigned int off;
+	bool fragment;
+	bool done;
+
+	done = false;
+
+	off = sizeof(struct ipv6hdr);
+
+	header_size = skb->network_header + off;
+	maybe_pull_tail(skb, header_size);
+
+	nexthdr = ipv6h->nexthdr;
+
+	while ((off <= sizeof(struct ipv6hdr) + ntohs(ipv6h->payload_len)) &&
+	       !done) {
+		switch (nexthdr) {
+		case IPPROTO_DSTOPTS:
+		case IPPROTO_HOPOPTS:
+		case IPPROTO_ROUTING: {
+			struct ipv6_opt_hdr *hp = (void *)(skb->data + off);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct ipv6_opt_hdr);
+			maybe_pull_tail(skb, header_size);
+
+			nexthdr = hp->nexthdr;
+			off += ipv6_optlen(hp);
+			break;
+		}
+		case IPPROTO_AH: {
+			struct ip_auth_hdr *hp = (void *)(skb->data + off);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct ip_auth_hdr);
+			maybe_pull_tail(skb, header_size);
+
+			nexthdr = hp->nexthdr;
+			off += (hp->hdrlen+2)<<2;
+			break;
+		}
+		case IPPROTO_FRAGMENT:
+			fragment = true;
+			/* fall through */
+		default:
+			done = true;
+			break;
+		}
+	}
+
+	if (!done) {
+		if (net_ratelimit())
+			netdev_err(vif->dev, "Failed to parse packet header\n");
+		goto out;
+	}
+
+	if (fragment) {
+		if (net_ratelimit())
+			netdev_err(vif->dev, "Packet is a fragment!\n");
+		goto out;
+	}
+
+	switch (nexthdr) {
+	case IPPROTO_TCP:
+		if (!skb_partial_csum_set(skb, off,
+					  offsetof(struct tcphdr, check)))
+			goto out;
+
+		if (recalculate_partial_csum) {
+			struct tcphdr *tcph = tcp_hdr(skb);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct tcphdr);
+			maybe_pull_tail(skb, header_size);
+
+			tcph->check = ~csum_ipv6_magic(&ipv6h->saddr,
+						       &ipv6h->daddr,
+						       skb->len - off,
+						       IPPROTO_TCP, 0);
+		}
+		break;
+	case IPPROTO_UDP:
+		if (!skb_partial_csum_set(skb, off,
+					  offsetof(struct udphdr, check)))
+			goto out;
+
+		if (recalculate_partial_csum) {
+			struct udphdr *udph = udp_hdr(skb);
+
+			header_size = skb->network_header +
+				off +
+				sizeof(struct udphdr);
+			maybe_pull_tail(skb, header_size);
+
+			udph->check = ~csum_ipv6_magic(&ipv6h->saddr,
+						       &ipv6h->daddr,
+						       skb->len - off,
+						       IPPROTO_UDP, 0);
+		}
+		break;
+	default:
+		if (net_ratelimit())
+			netdev_err(vif->dev,
+				   "Attempting to checksum a non-TCP/UDP packet, "
+				   "dropping a protocol %d packet\n",
+				   nexthdr);
+		goto out;
+	}
+
+	err = 0;
+
+out:
+	return err;
+}
+
+static int checksum_setup(struct xenvif *vif, struct sk_buff *skb)
+{
+	int err = -EPROTO;
+	int recalculate_partial_csum = 0;
+
+	/* A GSO SKB must be CHECKSUM_PARTIAL. However some buggy
+	 * peers can fail to set NETRXF_csum_blank when sending a GSO
+	 * frame. In this case force the SKB to CHECKSUM_PARTIAL and
+	 * recalculate the partial checksum.
+	 */
+	if (skb->ip_summed != CHECKSUM_PARTIAL && skb_is_gso(skb)) {
+		vif->rx_gso_checksum_fixup++;
+		skb->ip_summed = CHECKSUM_PARTIAL;
+		recalculate_partial_csum = 1;
+	}
+
+	/* A non-CHECKSUM_PARTIAL SKB does not require setup. */
+	if (skb->ip_summed != CHECKSUM_PARTIAL)
+		return 0;
+
+	if (skb->protocol == htons(ETH_P_IP))
+		err = checksum_setup_ip(vif, skb, recalculate_partial_csum);
+	else if (skb->protocol == htons(ETH_P_IPV6))
+		err = checksum_setup_ipv6(vif, skb, recalculate_partial_csum);
+
+	return err;
+}
+
 static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
 {
 	unsigned long now = jiffies;
@@ -1428,12 +1588,7 @@ static int xenvif_tx_submit(struct xenvif *vif, int budget)
 
 		xenvif_fill_frags(vif, skb);
 
-		/*
-		 * If the initial fragment was < PKT_PROT_LEN then
-		 * pull through some bytes from the other fragments to
-		 * increase the linear region to PKT_PROT_LEN bytes.
-		 */
-		if (skb_headlen(skb) < PKT_PROT_LEN && skb_is_nonlinear(skb)) {
+		if (skb_is_nonlinear(skb) && skb_headlen(skb) < PKT_PROT_LEN) {
 			int target = min_t(int, skb->len, PKT_PROT_LEN);
 			__pskb_pull_tail(skb, target - skb_headlen(skb));
 		}
drivers/net/xen-netback/xenbus.c +9 -0
index 99343ca..9c9b37d 100644
@@ -105,6 +105,15 @@ static int netback_probe(struct xenbus_device *dev,
 			goto abort_transaction;
 		}
 
+		/* We support partial checksum setup for IPv6 packets */
+		err = xenbus_printf(xbt, dev->nodename,
+				    "feature-ipv6-csum-offload",
+				    "%d", 1);
+		if (err) {
+			message = "writing feature-ipv6-csum-offload";
+			goto abort_transaction;
+		}
+
 		/* We support rx-copy path. */
 		err = xenbus_printf(xbt, dev->nodename,
 				    "feature-rx-copy", "%d", 1);
Signature · 1 line
1.7.10.4
#28 lore raw

PATCH v4 3/5 xen-netback: Unconditionally set NETIF_F_RXCSUM

In reply to Paul Durrant

There is no mechanism to insist that a guest always generates a packet with good checksum (at least for IPv4) so we must handle checksum offloading from the guest and hence should set NETIF_F_RXCSUM.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/interface.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/interface.c +1 -1
index 8e92783..cb0d8ea 100644
@@ -321,7 +321,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	dev->hw_features = NETIF_F_SG |
 		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 		NETIF_F_TSO;
-	dev->features = dev->hw_features;
+	dev->features = dev->hw_features | NETIF_F_RXCSUM;
 	SET_ETHTOOL_OPS(dev, &xenvif_ethtool_ops);
 
 	dev->tx_queue_len = XENVIF_QUEUE_LENGTH;
Signature · 1 line
1.7.10.4
#34 lore raw

PATCH v4 4/5 xen-netback: handle IPv6 TCP GSO packets from the guest

In reply to Paul Durrant

This patch adds a xenstore feature flag, festure-gso-tcpv6, to advertise that netback can handle IPv6 TCP GSO packets. It creates SKB_GSO_TCPV6 skbs if the frontend passes an extra segment with the new type XEN_NETIF_GSO_TYPE_TCPV6 added to netif.h.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/netback.c |   11 ++++++++---
 drivers/net/xen-netback/xenbus.c  |    7 +++++++
 include/xen/interface/io/netif.h  |   10 +++++++++-
 3 files changed, 24 insertions(+), 4 deletions(-)
drivers/net/xen-netback/netback.c +8 -3
index 74c13b9..65f04e7 100644
@@ -1096,15 +1096,20 @@ static int xenvif_set_skb_gso(struct xenvif *vif,
 		return -EINVAL;
 	}
 
-	/* Currently only TCPv4 S.O. is supported. */
-	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+	switch (gso->u.gso.type) {
+	case XEN_NETIF_GSO_TYPE_TCPV4:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+		break;
+	case XEN_NETIF_GSO_TYPE_TCPV6:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+		break;
+	default:
 		netdev_err(vif->dev, "Bad GSO type %d.\n", gso->u.gso.type);
 		xenvif_fatal_tx_err(vif);
 		return -EINVAL;
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
 
 	/* Header must be checked, and gso_segs computed. */
 	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
drivers/net/xen-netback/xenbus.c +7 -0
index 9c9b37d..7e4dcc9 100644
@@ -105,6 +105,13 @@ static int netback_probe(struct xenbus_device *dev,
 			goto abort_transaction;
 		}
 
+		err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6",
+				    "%d", sg);
+		if (err) {
+			message = "writing feature-gso-tcpv6";
+			goto abort_transaction;
+		}
+
 		/* We support partial checksum setup for IPv6 packets */
 		err = xenbus_printf(xbt, dev->nodename,
 				    "feature-ipv6-csum-offload",
include/xen/interface/io/netif.h +9 -1
index d9fb44739..d7dd8d7 100644
@@ -61,6 +61,13 @@
  */
 
 /*
+ * "feature-gso-tcpv4" and "feature-gso-tcpv6" advertise the capability to
+ * handle large TCP packets (in IPv4 or IPv6 form respectively). Neither
+ * frontends nor backends are assumed to be capable unless the flags are
+ * present.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has XEN_NETTXF_extra_info)
@@ -105,8 +112,9 @@ struct xen_netif_tx_request {
 #define _XEN_NETIF_EXTRA_FLAG_MORE	(0)
 #define  XEN_NETIF_EXTRA_FLAG_MORE	(1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
 
-/* GSO types - only TCPv4 currently supported. */
+/* GSO types */
 #define XEN_NETIF_GSO_TYPE_TCPV4	(1)
+#define XEN_NETIF_GSO_TYPE_TCPV6	(2)
 
 /*
  * This structure needs to fit within both netif_tx_request and
Signature · 1 line
1.7.10.4
#0 lore raw

v4 cover xen-netback: IPv6 offload support

This patch series adds support for checksum and large packet offloads into xen-netback.
Testing has mainly been done using the Microsoft network hardware certification suite running in Server 2008R2 VMs with Citrix PV frontends.

v2:
- Fixed Wei's email address in Cc lines

v3:
- Responded to Wei's comments:
- netif.h now updated with comments and a definition of XEN_NETIF_GSO_TYPE_NONE.
- limited number of pullups
- Responded to Annie's comments:
- New GSO_BIT macro

v4:
- Responded to more of Wei's comments
- Remove parsing of IPv6 fragment header and added warning

#40 lore raw

PATCH v4 5/5 xen-netback: enable IPv6 TCP GSO to the guest

This patch adds code to handle SKB_GSO_TCPV6 skbs and construct appropriate extra or prefix segments to pass the large packet to the frontend. New xenstore flags, feature-gso-tcpv6 and feature-gso-tcpv6-prefix, are sampled to determine if the frontend is capable of handling such packets.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/common.h    |    9 +++++--
 drivers/net/xen-netback/interface.c |    6 +++--
 drivers/net/xen-netback/netback.c   |   48 +++++++++++++++++++++++++++--------
 drivers/net/xen-netback/xenbus.c    |   29 +++++++++++++++++++--
 include/xen/interface/io/netif.h    |    1 +
 5 files changed, 77 insertions(+), 16 deletions(-)
drivers/net/xen-netback/common.h +7 -2
index b4a9a3c..55b8dec 100644
@@ -87,9 +87,13 @@ struct pending_tx_info {
 struct xenvif_rx_meta {
 	int id;
 	int size;
+	int gso_type;
 	int gso_size;
 };
 
+#define GSO_BIT(type) \
+	(1 << XEN_NETIF_GSO_TYPE_ ## type)
+
 /* Discriminate from any valid pending_idx value. */
 #define INVALID_PENDING_IDX 0xFFFF
 
@@ -150,9 +154,10 @@ struct xenvif {
 	u8               fe_dev_addr[6];
 
 	/* Frontend feature information. */
+	int gso_mask;
+	int gso_prefix_mask;
+
 	u8 can_sg:1;
-	u8 gso:1;
-	u8 gso_prefix:1;
 	u8 ip_csum:1;
 	u8 ipv6_csum:1;
 
drivers/net/xen-netback/interface.c +4 -2
index cb0d8ea..e4aa267 100644
@@ -214,8 +214,10 @@ static netdev_features_t xenvif_fix_features(struct net_device *dev,
 
 	if (!vif->can_sg)
 		features &= ~NETIF_F_SG;
-	if (!vif->gso && !vif->gso_prefix)
+	if (~(vif->gso_mask | vif->gso_prefix_mask) & GSO_BIT(TCPV4))
 		features &= ~NETIF_F_TSO;
+	if (~(vif->gso_mask | vif->gso_prefix_mask) & GSO_BIT(TCPV6))
+		features &= ~NETIF_F_TSO6;
 	if (!vif->ip_csum)
 		features &= ~NETIF_F_IP_CSUM;
 	if (!vif->ipv6_csum)
@@ -320,7 +322,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	dev->netdev_ops	= &xenvif_netdev_ops;
 	dev->hw_features = NETIF_F_SG |
 		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
-		NETIF_F_TSO;
+		NETIF_F_TSO | NETIF_F_TSO6;
 	dev->features = dev->hw_features | NETIF_F_RXCSUM;
 	SET_ETHTOOL_OPS(dev, &xenvif_ethtool_ops);
 
drivers/net/xen-netback/netback.c +38 -10

110 lines not on this page · raw message

drivers/net/xen-netback/xenbus.c +27 -2
index 7e4dcc9..6a005f1 100644
@@ -577,15 +577,40 @@ static int connect_rings(struct backend_info *be)
 		val = 0;
 	vif->can_sg = !!val;
 
+	vif->gso_mask = 0;
+	vif->gso_prefix_mask = 0;
+
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4",
 			 "%d", &val) < 0)
 		val = 0;
-	vif->gso = !!val;
+	if (val)
+		vif->gso_mask |= GSO_BIT(TCPV4);
 
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4-prefix",
 			 "%d", &val) < 0)
 		val = 0;
-	vif->gso_prefix = !!val;
+	if (val)
+		vif->gso_prefix_mask |= GSO_BIT(TCPV4);
+
+	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv6",
+			 "%d", &val) < 0)
+		val = 0;
+	if (val)
+		vif->gso_mask |= GSO_BIT(TCPV6);
+
+	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv6-prefix",
+			 "%d", &val) < 0)
+		val = 0;
+	if (val)
+		vif->gso_prefix_mask |= GSO_BIT(TCPV6);
+
+	if (vif->gso_mask & vif->gso_prefix_mask) {
+		xenbus_dev_fatal(dev, err,
+				 "%s: gso and gso prefix flags are not "
+				 "mutually exclusive",
+				 dev->otherend);
+		return -EOPNOTSUPP;
+	}
 
 	/* Before feature-ipv6-csum-offload was introduced, checksum offload
 	 * was turned on by a zero value in (or lack of)
include/xen/interface/io/netif.h +1 -0
index d7dd8d7..be341f9 100644
@@ -113,6 +113,7 @@ struct xen_netif_tx_request {
 #define  XEN_NETIF_EXTRA_FLAG_MORE	(1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
 
 /* GSO types */
+#define XEN_NETIF_GSO_TYPE_NONE		(0)
 #define XEN_NETIF_GSO_TYPE_TCPV4	(1)
 #define XEN_NETIF_GSO_TYPE_TCPV6	(2)
 
Signature · 1 line
1.7.10.4
#11 lore raw

Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Paul Durrant

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Wei.

#12 lore raw

Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Paul Durrant

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Wei.

#13 lore raw

Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

Quoted 11 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel; Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Is that not sufficient explanation? What sort of thing are you looking for?

Paul

#14 lore raw

RE: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Wei Liu
Quoted 11 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel; Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Is that not sufficient explanation? What sort of thing are you looking for?

Paul

#3 lore raw

Re: [PATCH net-next v4 1/5] xen-netback: add support for IPv6 checksum offload to guest

In reply to Paul Durrant
Quoted 11 lines · Paul Durrant

Check xenstore flag feature-ipv6-csum-offload to determine if a guest is happy to accept IPv6 packets with only partial checksum. Also check analogous feature-ip-csum-offload to determine if a guest is happy to accept IPv4 packets with only partial checksum as a replacement for a negated feature-no-csum-offload value and add a comment to deprecate use of feature-no-csum-offload.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>

Shouldn't this come later in the series, i.e. after netback is actually able to cope with ipv6 offloads?

drivers/net/xen-netback/common.h struct xenvif { · line 157

Quoted 11 lines
drivers/net/xen-netback/common.h +2 -1
index 5715318..b4a9a3c 100644
@@ -153,7 +153,8 @@ struct xenvif {
 	u8 can_sg:1;
 	u8 gso:1;
 	u8 gso_prefix:1;
-	u8 csum:1;
+	u8 ip_csum:1;
+	u8 ipv6_csum:1;

Why not ipv4_csum for consistency/unambiguity?

include/xen/interface/io/netif.h line 56

Quoted 11 lines
include/xen/interface/io/netif.h +3 -0
index eb262e3..d9fb44739 100644
@@ -51,6 +51,16 @@
  */
 
 /*
+ * "feature-no-csum-offload" was used to turn off IPv4 TCP/UDP checksum
+ * offload but is now deprecated. Two new feature flags should now be used
+ * to control checksum offload:

How is a frontend to know which sort of backend it is talking too? Is there going to be a feature flag to indicate support for these new flags?

In particular a new frontend running on an old backend needs to know that it needs to set no-csum-offload instead of ip-csum-offload somehow.

include/xen/interface/io/netif.h line 57

Quoted 1 line
include/xen/interface/io/netif.h +1 -0
+ * "feature-ip-csum-offload" should be used to turn IPv4 TCP/UDP checksum

"ipv4" again?

Quoted 9 lines
include/xen/interface/io/netif.h +6 -0
+ * offload on or off. If it is missing then the feature is assumed to be on.
+ * "feature-ipv6-csum-offload" should be used to turn IPv6 TCP/UDP checksum
+ * offload on or off. If it is missing then the feature is assumed to be off.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has XEN_NETTXF_extra_info)
#4 lore raw

Re: [PATCH net-next v4 1/5] xen-netback: add support for IPv6 checksum offload to guest

In reply to Paul Durrant
Quoted 11 lines · Paul Durrant

Check xenstore flag feature-ipv6-csum-offload to determine if a guest is happy to accept IPv6 packets with only partial checksum. Also check analogous feature-ip-csum-offload to determine if a guest is happy to accept IPv4 packets with only partial checksum as a replacement for a negated feature-no-csum-offload value and add a comment to deprecate use of feature-no-csum-offload.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>

Shouldn't this come later in the series, i.e. after netback is actually able to cope with ipv6 offloads?

drivers/net/xen-netback/common.h struct xenvif { · line 157

Quoted 11 lines
drivers/net/xen-netback/common.h +2 -1
index 5715318..b4a9a3c 100644
@@ -153,7 +153,8 @@ struct xenvif {
 	u8 can_sg:1;
 	u8 gso:1;
 	u8 gso_prefix:1;
-	u8 csum:1;
+	u8 ip_csum:1;
+	u8 ipv6_csum:1;

Why not ipv4_csum for consistency/unambiguity?

include/xen/interface/io/netif.h line 56

Quoted 11 lines
include/xen/interface/io/netif.h +3 -0
index eb262e3..d9fb44739 100644
@@ -51,6 +51,16 @@
  */
 
 /*
+ * "feature-no-csum-offload" was used to turn off IPv4 TCP/UDP checksum
+ * offload but is now deprecated. Two new feature flags should now be used
+ * to control checksum offload:

How is a frontend to know which sort of backend it is talking too? Is there going to be a feature flag to indicate support for these new flags?

In particular a new frontend running on an old backend needs to know that it needs to set no-csum-offload instead of ip-csum-offload somehow.

include/xen/interface/io/netif.h line 57

Quoted 1 line
include/xen/interface/io/netif.h +1 -0
+ * "feature-ip-csum-offload" should be used to turn IPv4 TCP/UDP checksum

"ipv4" again?

Quoted 9 lines
include/xen/interface/io/netif.h +6 -0
+ * offload on or off. If it is missing then the feature is assumed to be on.
+ * "feature-ipv6-csum-offload" should be used to turn IPv6 TCP/UDP checksum
+ * offload on or off. If it is missing then the feature is assumed to be off.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has XEN_NETTXF_extra_info)
#15 lore raw

Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Paul Durrant
Quoted 21 lines · Paul Durrant
Quoted 11 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel; Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Quoted 7 lines

Is that not sufficient explanation? What sort of thing are you looking for?

From the second version of this patch, we had a conversation.

Where does 128 come from?

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Wei.

#16 lore raw

Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Paul Durrant
Quoted 21 lines · Paul Durrant
Quoted 11 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel; Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Quoted 7 lines

Is that not sufficient explanation? What sort of thing are you looking for?

From the second version of this patch, we had a conversation.

Where does 128 come from?

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Wei.

#29 lore raw

Re: [PATCH net-next v4 3/5] xen-netback: Unconditionally set NETIF_F_RXCSUM

In reply to Paul Durrant
Quoted 2 lines · Paul Durrant

There is no mechanism to insist that a guest always generates a packet with good checksum (at least for IPv4)

Isn't this what feature-no-csum-offload is?

Quoted 24 lines

so we must handle checksum
offloading from the guest and hence should set NETIF_F_RXCSUM.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/interface.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/interface.c +1 -1
index 8e92783..cb0d8ea 100644
@@ -321,7 +321,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	dev->hw_features = NETIF_F_SG |
 		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 		NETIF_F_TSO;
-	dev->features = dev->hw_features;
+	dev->features = dev->hw_features | NETIF_F_RXCSUM;
 	SET_ETHTOOL_OPS(dev, &xenvif_ethtool_ops);
 
 	dev->tx_queue_len = XENVIF_QUEUE_LENGTH;
#30 lore raw

Re: [PATCH net-next v4 3/5] xen-netback: Unconditionally set NETIF_F_RXCSUM

In reply to Paul Durrant
Quoted 2 lines · Paul Durrant

There is no mechanism to insist that a guest always generates a packet with good checksum (at least for IPv4)

Isn't this what feature-no-csum-offload is?

Quoted 24 lines

so we must handle checksum
offloading from the guest and hence should set NETIF_F_RXCSUM.

Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/interface.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/interface.c +1 -1
index 8e92783..cb0d8ea 100644
@@ -321,7 +321,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	dev->hw_features = NETIF_F_SG |
 		NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 		NETIF_F_TSO;
-	dev->features = dev->hw_features;
+	dev->features = dev->hw_features | NETIF_F_RXCSUM;
 	SET_ETHTOOL_OPS(dev, &xenvif_ethtool_ops);
 
 	dev->tx_queue_len = XENVIF_QUEUE_LENGTH;
#17 lore raw

Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Wei Liu
Quoted 37 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:55
To: Paul Durrant
Cc: Wei Liu; [email protected]; [email protected]; David Vrabel; Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

Quoted 5 lines · Paul Durrant
Quoted 5 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David

Vrabel;

Quoted 16 lines
Quoted 6 lines

Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Quoted 2 lines

Is that not sufficient explanation? What sort of thing are you looking for?

From the second version of this patch, we had a conversation.

Quoted 9 lines
Quoted 2 lines

Where does 128 come from?

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Ok. I figured that was implied by "set up checksum offsets" but I can be more explicit.

Paul

#18 lore raw

RE: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Wei Liu
Quoted 37 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:55
To: Paul Durrant
Cc: Wei Liu; [email protected]; [email protected]; David Vrabel; Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

Quoted 5 lines · Paul Durrant
Quoted 5 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David

Vrabel;

Quoted 16 lines
Quoted 6 lines

Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Quoted 2 lines

Is that not sufficient explanation? What sort of thing are you looking for?

From the second version of this patch, we had a conversation.

Quoted 9 lines
Quoted 2 lines

Where does 128 come from?

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Ok. I figured that was implied by "set up checksum offsets" but I can be more explicit.

Paul

#31 lore raw

Re: [PATCH net-next v4 3/5] xen-netback: Unconditionally set NETIF_F_RXCSUM

In reply to Ian Campbell
Quoted 8 lines

-----Original Message-----
From: Ian Campbell
Sent: 14 October 2013 11:56
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net-next v4 3/5] xen-netback: Unconditionally set NETIF_F_RXCSUM

Quoted 6 lines
Quoted 2 lines · Paul Durrant

There is no mechanism to insist that a guest always generates a packet with good checksum (at least for IPv4)

Isn't this what feature-no-csum-offload is?

Theoretically, yes, but netback does not have code to advertise that flag (and never has?) and I don't see anything in xen-netfront that checks such a flag so I think we have to assume it's not going to be honoured even if we were to introduce it now.

Paul

#32 lore raw

RE: [PATCH net-next v4 3/5] xen-netback: Unconditionally set NETIF_F_RXCSUM

In reply to Ian Campbell
Quoted 8 lines

-----Original Message-----
From: Ian Campbell
Sent: 14 October 2013 11:56
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net-next v4 3/5] xen-netback: Unconditionally set NETIF_F_RXCSUM

Quoted 6 lines
Quoted 2 lines · Paul Durrant

There is no mechanism to insist that a guest always generates a packet with good checksum (at least for IPv4)

Isn't this what feature-no-csum-offload is?

Theoretically, yes, but netback does not have code to advertise that flag (and never has?) and I don't see anything in xen-netfront that checks such a flag so I think we have to assume it's not going to be honoured even if we were to introduce it now.

Paul

#5 lore raw

Re: [PATCH net-next v4 1/5] xen-netback: add support for IPv6 checksum offload to guest

In reply to Ian Campbell
Quoted 16 lines

-----Original Message-----
From: Ian Campbell
Sent: 14 October 2013 11:54
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net-next v4 1/5] xen-netback: add support for IPv6 checksum offload to guest

Quoted 7 lines · Paul Durrant

Check xenstore flag feature-ipv6-csum-offload to determine if a guest is happy to accept IPv6 packets with only partial checksum. Also check analogous feature-ip-csum-offload to determine if a guest is happy to accept IPv4 packets with only partial checksum as a replacement for a negated feature-no-csum-offload value and add a comment to deprecate use of feature-no-csum-offload.

Quoted 8 lines
Quoted 4 lines
Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>

Shouldn't this come later in the series, i.e. after netback is actually able to cope with ipv6 offloads?

I guess that's debatable. The patches don't have any dependency relation; offloads to and from the guest are quite independent.

Quoted 15 lines

drivers/net/xen-

Quoted 1 line
drivers/net/xen- renamed from drivers/net/xen-netback/common.h +0 -0

netback/common.h

drivers/net/xen-netback/common.h struct xenvif { · line 157

Quoted 10 lines

index 5715318..b4a9a3c 100644

drivers/net/xen-netback/common.h +2 -1
@@ -153,7 +153,8 @@ struct xenvif {
 	u8 can_sg:1;
 	u8 gso:1;
 	u8 gso_prefix:1;
-	u8 csum:1;
+	u8 ip_csum:1;
+	u8 ipv6_csum:1;

Why not ipv4_csum for consistency/unambiguity?

I followed general linux naming conventions e.g. ip_hdr and ipv6_hdr.

Quoted 13 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/include/xen/interface/io/netif.h

include/xen/interface/io/netif.h line 54

Quoted 8 lines

index eb262e3..d9fb44739 100644

include/xen/interface/io/netif.h +1 -0
@@ -51,6 +51,16 @@
  */
 
 /*
+ * "feature-no-csum-offload" was used to turn off IPv4 TCP/UDP

checksum

include/xen/interface/io/netif.h line 55

Quoted 1 line
include/xen/interface/io/netif.h +1 -0
+ * offload but is now deprecated. Two new feature flags should now be

used

Quoted 9 lines

include/xen/interface/io/netif.h line 56

Quoted 1 line
include/xen/interface/io/netif.h +1 -0
+ * to control checksum offload:

How is a frontend to know which sort of backend it is talking too? Is there going to be a feature flag to indicate support for these new flags?

In particular a new frontend running on an old backend needs to know that it needs to set no-csum-offload instead of ip-csum-offload somehow.

Good point. Without any version I guess we have to live with the old flag forever. I'll stick with it for v4 and just leave the new one for v6.

Paul

Quoted 17 lines

include/xen/interface/io/netif.h line 57

Quoted 1 line
include/xen/interface/io/netif.h +1 -0
+ * "feature-ip-csum-offload" should be used to turn IPv4 TCP/UDP

checksum

"ipv4" again?

include/xen/interface/io/netif.h line 59

Quoted 2 lines
include/xen/interface/io/netif.h +2 -0
+ * offload on or off. If it is missing then the feature is assumed to be on.
+ * "feature-ipv6-csum-offload" should be used to turn IPv6 TCP/UDP

checksum

include/xen/interface/io/netif.h

Quoted 7 lines
include/xen/interface/io/netif.h +4 -0
+ * offload on or off. If it is missing then the feature is assumed to be off.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has

XEN_NETTXF_extra_info)

#6 lore raw

RE: [PATCH net-next v4 1/5] xen-netback: add support for IPv6 checksum offload to guest

In reply to Ian Campbell
Quoted 16 lines

-----Original Message-----
From: Ian Campbell
Sent: 14 October 2013 11:54
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net-next v4 1/5] xen-netback: add support for IPv6 checksum offload to guest

Quoted 7 lines · Paul Durrant

Check xenstore flag feature-ipv6-csum-offload to determine if a guest is happy to accept IPv6 packets with only partial checksum. Also check analogous feature-ip-csum-offload to determine if a guest is happy to accept IPv4 packets with only partial checksum as a replacement for a negated feature-no-csum-offload value and add a comment to deprecate use of feature-no-csum-offload.

Quoted 8 lines
Quoted 4 lines
Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>

Shouldn't this come later in the series, i.e. after netback is actually able to cope with ipv6 offloads?

I guess that's debatable. The patches don't have any dependency relation; offloads to and from the guest are quite independent.

Quoted 15 lines

drivers/net/xen-

Quoted 1 line
drivers/net/xen- renamed from drivers/net/xen-netback/common.h +0 -0

netback/common.h

drivers/net/xen-netback/common.h struct xenvif { · line 157

Quoted 10 lines

index 5715318..b4a9a3c 100644

drivers/net/xen-netback/common.h +2 -1
@@ -153,7 +153,8 @@ struct xenvif {
 	u8 can_sg:1;
 	u8 gso:1;
 	u8 gso_prefix:1;
-	u8 csum:1;
+	u8 ip_csum:1;
+	u8 ipv6_csum:1;

Why not ipv4_csum for consistency/unambiguity?

I followed general linux naming conventions e.g. ip_hdr and ipv6_hdr.

Quoted 13 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/include/xen/interface/io/netif.h

include/xen/interface/io/netif.h line 54

Quoted 8 lines

index eb262e3..d9fb44739 100644

include/xen/interface/io/netif.h +1 -0
@@ -51,6 +51,16 @@
  */
 
 /*
+ * "feature-no-csum-offload" was used to turn off IPv4 TCP/UDP

checksum

include/xen/interface/io/netif.h line 55

Quoted 1 line
include/xen/interface/io/netif.h +1 -0
+ * offload but is now deprecated. Two new feature flags should now be

used

Quoted 9 lines

include/xen/interface/io/netif.h line 56

Quoted 1 line
include/xen/interface/io/netif.h +1 -0
+ * to control checksum offload:

How is a frontend to know which sort of backend it is talking too? Is there going to be a feature flag to indicate support for these new flags?

In particular a new frontend running on an old backend needs to know that it needs to set no-csum-offload instead of ip-csum-offload somehow.

Good point. Without any version I guess we have to live with the old flag forever. I'll stick with it for v4 and just leave the new one for v6.

Paul

Quoted 17 lines

include/xen/interface/io/netif.h line 57

Quoted 1 line
include/xen/interface/io/netif.h +1 -0
+ * "feature-ip-csum-offload" should be used to turn IPv4 TCP/UDP

checksum

"ipv4" again?

include/xen/interface/io/netif.h line 59

Quoted 2 lines
include/xen/interface/io/netif.h +2 -0
+ * offload on or off. If it is missing then the feature is assumed to be on.
+ * "feature-ipv6-csum-offload" should be used to turn IPv6 TCP/UDP

checksum

include/xen/interface/io/netif.h

Quoted 7 lines
include/xen/interface/io/netif.h +4 -0
+ * offload on or off. If it is missing then the feature is assumed to be off.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has

XEN_NETTXF_extra_info)

#19 lore raw

Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Wei Liu
Quoted 27 lines · Wei Liu
Quoted 25 lines · Paul Durrant
Quoted 11 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel; Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Is that not sufficient explanation? What sort of thing are you looking for?

From the second version of this patch, we had a conversation.

Quoted 8 lines
Quoted 2 lines

Where does 128 come from?

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Is "most IPv6 headers" actually good enough? Don't we need to ensure netback copies all IP headers?

David

#20 lore raw

Re: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Wei Liu
Quoted 27 lines · Wei Liu
Quoted 25 lines · Paul Durrant
Quoted 11 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel; Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Is that not sufficient explanation? What sort of thing are you looking for?

From the second version of this patch, we had a conversation.

Quoted 8 lines
Quoted 2 lines

Where does 128 come from?

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Is "most IPv6 headers" actually good enough? Don't we need to ensure netback copies all IP headers?

David

#21 lore raw

Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

Quoted 41 lines

-----Original Message-----
From: David Vrabel
Sent: 14 October 2013 13:19
To: Wei Liu
Cc: Paul Durrant; [email protected]; Ian Campbell; David Vrabel; xen- [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

Quoted 6 lines · Wei Liu
Quoted 5 lines · Paul Durrant
Quoted 5 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David

Vrabel;

Quoted 24 lines
Quoted 23 lines
Quoted 6 lines

Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Is that not sufficient explanation? What sort of thing are you looking for?

From the second version of this patch, we had a conversation.

Where does 128 come from?

Quoted 9 lines
Quoted 5 lines

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Is "most IPv6 headers" actually good enough? Don't we need to ensure netback copies all IP headers?

It will do if checksum offload is in use, but perhaps the pull as far as the transport header needs to be done anyway? I'm unsure of the expectations of other code.

Paul

#22 lore raw

RE: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to David Vrabel
Quoted 41 lines

-----Original Message-----
From: David Vrabel
Sent: 14 October 2013 13:19
To: Wei Liu
Cc: Paul Durrant; [email protected]; Ian Campbell; David Vrabel; xen- [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

Quoted 6 lines · Wei Liu
Quoted 5 lines · Paul Durrant
Quoted 5 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David

Vrabel;

Quoted 24 lines
Quoted 23 lines
Quoted 6 lines

Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Is that not sufficient explanation? What sort of thing are you looking for?

From the second version of this patch, we had a conversation.

Where does 128 come from?

Quoted 9 lines
Quoted 5 lines

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Is "most IPv6 headers" actually good enough? Don't we need to ensure netback copies all IP headers?

It will do if checksum offload is in use, but perhaps the pull as far as the transport header needs to be done anyway? I'm unsure of the expectations of other code.

Paul

#7 lore raw

Re: [PATCH net-next v4 1/5] xen-netback: add support for IPv6 checksum offload to guest

In reply to Paul Durrant
Quoted 43 lines · Paul Durrant
Quoted 16 lines

-----Original Message-----
From: Ian Campbell
Sent: 14 October 2013 11:54
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net-next v4 1/5] xen-netback: add support for IPv6 checksum offload to guest

Quoted 7 lines · Paul Durrant

Check xenstore flag feature-ipv6-csum-offload to determine if a guest is happy to accept IPv6 packets with only partial checksum. Also check analogous feature-ip-csum-offload to determine if a guest is happy to accept IPv4 packets with only partial checksum as a replacement for a negated feature-no-csum-offload value and add a comment to deprecate use of feature-no-csum-offload.

Quoted 8 lines
Quoted 4 lines
Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>

Shouldn't this come later in the series, i.e. after netback is actually able to cope with ipv6 offloads?

I guess that's debatable. The patches don't have any dependency relation; offloads to and from the guest are quite independent.

Quoted 15 lines

drivers/net/xen-

Quoted 1 line
drivers/net/xen- renamed from drivers/net/xen-netback/common.h +0 -0

netback/common.h

drivers/net/xen-netback/common.h struct xenvif { · line 157

Quoted 10 lines

index 5715318..b4a9a3c 100644

drivers/net/xen-netback/common.h +2 -1
@@ -153,7 +153,8 @@ struct xenvif {
 	u8 can_sg:1;
 	u8 gso:1;
 	u8 gso_prefix:1;
-	u8 csum:1;
+	u8 ip_csum:1;
+	u8 ipv6_csum:1;

Why not ipv4_csum for consistency/unambiguity?

Quoted 1 line

I followed general linux naming conventions e.g. ip_hdr and ipv6_hdr.

True. I would be more concerned about the netif.h name, but I think you now intend to drop the v4 variant of that, so no worries.

#8 lore raw

Re: [PATCH net-next v4 1/5] xen-netback: add support for IPv6 checksum offload to guest

In reply to Paul Durrant
Quoted 43 lines · Paul Durrant
Quoted 16 lines

-----Original Message-----
From: Ian Campbell
Sent: 14 October 2013 11:54
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net-next v4 1/5] xen-netback: add support for IPv6 checksum offload to guest

Quoted 7 lines · Paul Durrant

Check xenstore flag feature-ipv6-csum-offload to determine if a guest is happy to accept IPv6 packets with only partial checksum. Also check analogous feature-ip-csum-offload to determine if a guest is happy to accept IPv4 packets with only partial checksum as a replacement for a negated feature-no-csum-offload value and add a comment to deprecate use of feature-no-csum-offload.

Quoted 8 lines
Quoted 4 lines
Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>

Shouldn't this come later in the series, i.e. after netback is actually able to cope with ipv6 offloads?

I guess that's debatable. The patches don't have any dependency relation; offloads to and from the guest are quite independent.

Quoted 15 lines

drivers/net/xen-

Quoted 1 line
drivers/net/xen- renamed from drivers/net/xen-netback/common.h +0 -0

netback/common.h

drivers/net/xen-netback/common.h struct xenvif { · line 157

Quoted 10 lines

index 5715318..b4a9a3c 100644

drivers/net/xen-netback/common.h +2 -1
@@ -153,7 +153,8 @@ struct xenvif {
 	u8 can_sg:1;
 	u8 gso:1;
 	u8 gso_prefix:1;
-	u8 csum:1;
+	u8 ip_csum:1;
+	u8 ipv6_csum:1;

Why not ipv4_csum for consistency/unambiguity?

Quoted 1 line

I followed general linux naming conventions e.g. ip_hdr and ipv6_hdr.

True. I would be more concerned about the netif.h name, but I think you now intend to drop the v4 variant of that, so no worries.

#23 lore raw

Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Paul Durrant
Quoted 47 lines · Paul Durrant
Quoted 47 lines

-----Original Message-----
From: David Vrabel
Sent: 14 October 2013 13:19
To: Wei Liu
Cc: Paul Durrant; [email protected]; Ian Campbell; David Vrabel; xen- [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

Quoted 6 lines · Wei Liu
Quoted 5 lines · Paul Durrant
Quoted 5 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David

Vrabel;

Quoted 29 lines
Quoted 16 lines
Quoted 6 lines

Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Quoted 7 lines

Is that not sufficient explanation? What sort of thing are you looking for?

From the second version of this patch, we had a conversation.

Where does 128 come from?

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Quoted 7 lines
Quoted 3 lines

Is "most IPv6 headers" actually good enough? Don't we need to ensure netback copies all IP headers?

It will do if checksum offload is in use, but perhaps the pull as far as the transport header needs to be done anyway? I'm unsure of the expectations of other code.

I've always been under the impression that transport headers needed pulling up too, for the benefit of netfilter perhaps?

AIUI the frags should be pure "payload". I may be wrong about that though...

Ian.

#24 lore raw

Re: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Paul Durrant
Quoted 47 lines · Paul Durrant
Quoted 47 lines

-----Original Message-----
From: David Vrabel
Sent: 14 October 2013 13:19
To: Wei Liu
Cc: Paul Durrant; [email protected]; Ian Campbell; David Vrabel; xen- [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

Quoted 6 lines · Wei Liu
Quoted 5 lines · Paul Durrant
Quoted 5 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David

Vrabel;

Quoted 29 lines
Quoted 16 lines
Quoted 6 lines

Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 9 lines

drivers/net/xen-netback/netback.c static inline unsigned long idx_to_kaddr(struct xenvif *vif, · line 114

Quoted 7 lines
drivers/net/xen-netback/netback.c +2 -4
-/*
- * This is the amount of packet we copy rather than map, so that the
- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc).
+/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets.
  */

You seem to forget to explain why 128 is chosen. :-)

Quoted 7 lines

Is that not sufficient explanation? What sort of thing are you looking for?

From the second version of this patch, we had a conversation.

Where does 128 come from?

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Quoted 7 lines
Quoted 3 lines

Is "most IPv6 headers" actually good enough? Don't we need to ensure netback copies all IP headers?

It will do if checksum offload is in use, but perhaps the pull as far as the transport header needs to be done anyway? I'm unsure of the expectations of other code.

I've always been under the impression that transport headers needed pulling up too, for the benefit of netfilter perhaps?

AIUI the frags should be pure "payload". I may be wrong about that though...

Ian.

#35 lore raw

Re: [PATCH net-next v4 4/5] xen-netback: handle IPv6 TCP GSO packets from the guest

In reply to Paul Durrant
Quoted 6 lines · Paul Durrant

This patch adds a xenstore feature flag, festure-gso-tcpv6, to advertise that netback can handle IPv6 TCP GSO packets. It creates SKB_GSO_TCPV6 skbs if the frontend passes an extra segment with the new type XEN_NETIF_GSO_TYPE_TCPV6 added to netif.h.

This patch looks fine but should it not be after the following patch which actually causes the necessary pull ups to happen?

Quoted 84 lines
Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/netback.c |   11 ++++++++---
 drivers/net/xen-netback/xenbus.c  |    7 +++++++
 include/xen/interface/io/netif.h  |   10 +++++++++-
 3 files changed, 24 insertions(+), 4 deletions(-)
drivers/net/xen-netback/netback.c +8 -3
index 74c13b9..65f04e7 100644
@@ -1096,15 +1096,20 @@ static int xenvif_set_skb_gso(struct xenvif *vif,
 		return -EINVAL;
 	}
 
-	/* Currently only TCPv4 S.O. is supported. */
-	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+	switch (gso->u.gso.type) {
+	case XEN_NETIF_GSO_TYPE_TCPV4:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+		break;
+	case XEN_NETIF_GSO_TYPE_TCPV6:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+		break;
+	default:
 		netdev_err(vif->dev, "Bad GSO type %d.\n", gso->u.gso.type);
 		xenvif_fatal_tx_err(vif);
 		return -EINVAL;
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
 
 	/* Header must be checked, and gso_segs computed. */
 	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
drivers/net/xen-netback/xenbus.c +7 -0
index 9c9b37d..7e4dcc9 100644
@@ -105,6 +105,13 @@ static int netback_probe(struct xenbus_device *dev,
 			goto abort_transaction;
 		}
 
+		err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6",
+				    "%d", sg);
+		if (err) {
+			message = "writing feature-gso-tcpv6";
+			goto abort_transaction;
+		}
+
 		/* We support partial checksum setup for IPv6 packets */
 		err = xenbus_printf(xbt, dev->nodename,
 				    "feature-ipv6-csum-offload",
include/xen/interface/io/netif.h +9 -1
index d9fb44739..d7dd8d7 100644
@@ -61,6 +61,13 @@
  */
 
 /*
+ * "feature-gso-tcpv4" and "feature-gso-tcpv6" advertise the capability to
+ * handle large TCP packets (in IPv4 or IPv6 form respectively). Neither
+ * frontends nor backends are assumed to be capable unless the flags are
+ * present.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has XEN_NETTXF_extra_info)
@@ -105,8 +112,9 @@ struct xen_netif_tx_request {
 #define _XEN_NETIF_EXTRA_FLAG_MORE	(0)
 #define  XEN_NETIF_EXTRA_FLAG_MORE	(1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
 
-/* GSO types - only TCPv4 currently supported. */
+/* GSO types */
 #define XEN_NETIF_GSO_TYPE_TCPV4	(1)
+#define XEN_NETIF_GSO_TYPE_TCPV6	(2)
 
 /*
  * This structure needs to fit within both netif_tx_request and
#36 lore raw

Re: [PATCH net-next v4 4/5] xen-netback: handle IPv6 TCP GSO packets from the guest

In reply to Paul Durrant
Quoted 6 lines · Paul Durrant

This patch adds a xenstore feature flag, festure-gso-tcpv6, to advertise that netback can handle IPv6 TCP GSO packets. It creates SKB_GSO_TCPV6 skbs if the frontend passes an extra segment with the new type XEN_NETIF_GSO_TYPE_TCPV6 added to netif.h.

This patch looks fine but should it not be after the following patch which actually causes the necessary pull ups to happen?

Quoted 84 lines
Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/netback.c |   11 ++++++++---
 drivers/net/xen-netback/xenbus.c  |    7 +++++++
 include/xen/interface/io/netif.h  |   10 +++++++++-
 3 files changed, 24 insertions(+), 4 deletions(-)
drivers/net/xen-netback/netback.c +8 -3
index 74c13b9..65f04e7 100644
@@ -1096,15 +1096,20 @@ static int xenvif_set_skb_gso(struct xenvif *vif,
 		return -EINVAL;
 	}
 
-	/* Currently only TCPv4 S.O. is supported. */
-	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+	switch (gso->u.gso.type) {
+	case XEN_NETIF_GSO_TYPE_TCPV4:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+		break;
+	case XEN_NETIF_GSO_TYPE_TCPV6:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+		break;
+	default:
 		netdev_err(vif->dev, "Bad GSO type %d.\n", gso->u.gso.type);
 		xenvif_fatal_tx_err(vif);
 		return -EINVAL;
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
 
 	/* Header must be checked, and gso_segs computed. */
 	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
drivers/net/xen-netback/xenbus.c +7 -0
index 9c9b37d..7e4dcc9 100644
@@ -105,6 +105,13 @@ static int netback_probe(struct xenbus_device *dev,
 			goto abort_transaction;
 		}
 
+		err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6",
+				    "%d", sg);
+		if (err) {
+			message = "writing feature-gso-tcpv6";
+			goto abort_transaction;
+		}
+
 		/* We support partial checksum setup for IPv6 packets */
 		err = xenbus_printf(xbt, dev->nodename,
 				    "feature-ipv6-csum-offload",
include/xen/interface/io/netif.h +9 -1
index d9fb44739..d7dd8d7 100644
@@ -61,6 +61,13 @@
  */
 
 /*
+ * "feature-gso-tcpv4" and "feature-gso-tcpv6" advertise the capability to
+ * handle large TCP packets (in IPv4 or IPv6 form respectively). Neither
+ * frontends nor backends are assumed to be capable unless the flags are
+ * present.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has XEN_NETTXF_extra_info)
@@ -105,8 +112,9 @@ struct xen_netif_tx_request {
 #define _XEN_NETIF_EXTRA_FLAG_MORE	(0)
 #define  XEN_NETIF_EXTRA_FLAG_MORE	(1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
 
-/* GSO types - only TCPv4 currently supported. */
+/* GSO types */
 #define XEN_NETIF_GSO_TYPE_TCPV4	(1)
+#define XEN_NETIF_GSO_TYPE_TCPV6	(2)
 
 /*
  * This structure needs to fit within both netif_tx_request and
Acked-by
#37 lore raw

Re: [PATCH net-next v4 4/5] xen-netback: handle IPv6 TCP GSO packets from the guest

Quoted 10 lines · Ian Campbell
Quoted 6 lines · Paul Durrant

This patch adds a xenstore feature flag, festure-gso-tcpv6, to advertise that netback can handle IPv6 TCP GSO packets. It creates SKB_GSO_TCPV6 skbs if the frontend passes an extra segment with the new type XEN_NETIF_GSO_TYPE_TCPV6 added to netif.h.

This patch looks fine but should it not be after the following patch which actually causes the necessary pull ups to happen?

Sorry, it is, I shouldn't review series in two halves, forget what I've already seen!

Quoted 2 lines
Quoted 2 lines
Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Quoted 82 lines
Quoted 81 lines
---
 drivers/net/xen-netback/netback.c |   11 ++++++++---
 drivers/net/xen-netback/xenbus.c  |    7 +++++++
 include/xen/interface/io/netif.h  |   10 +++++++++-
 3 files changed, 24 insertions(+), 4 deletions(-)
drivers/net/xen-netback/netback.c +8 -3
index 74c13b9..65f04e7 100644
@@ -1096,15 +1096,20 @@ static int xenvif_set_skb_gso(struct xenvif *vif,
 		return -EINVAL;
 	}
 
-	/* Currently only TCPv4 S.O. is supported. */
-	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+	switch (gso->u.gso.type) {
+	case XEN_NETIF_GSO_TYPE_TCPV4:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+		break;
+	case XEN_NETIF_GSO_TYPE_TCPV6:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+		break;
+	default:
 		netdev_err(vif->dev, "Bad GSO type %d.\n", gso->u.gso.type);
 		xenvif_fatal_tx_err(vif);
 		return -EINVAL;
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
 
 	/* Header must be checked, and gso_segs computed. */
 	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
drivers/net/xen-netback/xenbus.c +7 -0
index 9c9b37d..7e4dcc9 100644
@@ -105,6 +105,13 @@ static int netback_probe(struct xenbus_device *dev,
 			goto abort_transaction;
 		}
 
+		err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6",
+				    "%d", sg);
+		if (err) {
+			message = "writing feature-gso-tcpv6";
+			goto abort_transaction;
+		}
+
 		/* We support partial checksum setup for IPv6 packets */
 		err = xenbus_printf(xbt, dev->nodename,
 				    "feature-ipv6-csum-offload",
include/xen/interface/io/netif.h +9 -1
index d9fb44739..d7dd8d7 100644
@@ -61,6 +61,13 @@
  */
 
 /*
+ * "feature-gso-tcpv4" and "feature-gso-tcpv6" advertise the capability to
+ * handle large TCP packets (in IPv4 or IPv6 form respectively). Neither
+ * frontends nor backends are assumed to be capable unless the flags are
+ * present.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has XEN_NETTXF_extra_info)
@@ -105,8 +112,9 @@ struct xen_netif_tx_request {
 #define _XEN_NETIF_EXTRA_FLAG_MORE	(0)
 #define  XEN_NETIF_EXTRA_FLAG_MORE	(1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
 
-/* GSO types - only TCPv4 currently supported. */
+/* GSO types */
 #define XEN_NETIF_GSO_TYPE_TCPV4	(1)
+#define XEN_NETIF_GSO_TYPE_TCPV6	(2)
 
 /*
  * This structure needs to fit within both netif_tx_request and
Acked-by
#38 lore raw

Re: [PATCH net-next v4 4/5] xen-netback: handle IPv6 TCP GSO packets from the guest

In reply to Ian Campbell
Quoted 10 lines · Ian Campbell
Quoted 6 lines · Paul Durrant

This patch adds a xenstore feature flag, festure-gso-tcpv6, to advertise that netback can handle IPv6 TCP GSO packets. It creates SKB_GSO_TCPV6 skbs if the frontend passes an extra segment with the new type XEN_NETIF_GSO_TYPE_TCPV6 added to netif.h.

This patch looks fine but should it not be after the following patch which actually causes the necessary pull ups to happen?

Sorry, it is, I shouldn't review series in two halves, forget what I've already seen!

Quoted 2 lines
Quoted 2 lines
Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Quoted 82 lines
Quoted 81 lines
---
 drivers/net/xen-netback/netback.c |   11 ++++++++---
 drivers/net/xen-netback/xenbus.c  |    7 +++++++
 include/xen/interface/io/netif.h  |   10 +++++++++-
 3 files changed, 24 insertions(+), 4 deletions(-)
drivers/net/xen-netback/netback.c +8 -3
index 74c13b9..65f04e7 100644
@@ -1096,15 +1096,20 @@ static int xenvif_set_skb_gso(struct xenvif *vif,
 		return -EINVAL;
 	}
 
-	/* Currently only TCPv4 S.O. is supported. */
-	if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
+	switch (gso->u.gso.type) {
+	case XEN_NETIF_GSO_TYPE_TCPV4:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+		break;
+	case XEN_NETIF_GSO_TYPE_TCPV6:
+		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+		break;
+	default:
 		netdev_err(vif->dev, "Bad GSO type %d.\n", gso->u.gso.type);
 		xenvif_fatal_tx_err(vif);
 		return -EINVAL;
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-	skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
 
 	/* Header must be checked, and gso_segs computed. */
 	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
drivers/net/xen-netback/xenbus.c +7 -0
index 9c9b37d..7e4dcc9 100644
@@ -105,6 +105,13 @@ static int netback_probe(struct xenbus_device *dev,
 			goto abort_transaction;
 		}
 
+		err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6",
+				    "%d", sg);
+		if (err) {
+			message = "writing feature-gso-tcpv6";
+			goto abort_transaction;
+		}
+
 		/* We support partial checksum setup for IPv6 packets */
 		err = xenbus_printf(xbt, dev->nodename,
 				    "feature-ipv6-csum-offload",
include/xen/interface/io/netif.h +9 -1
index d9fb44739..d7dd8d7 100644
@@ -61,6 +61,13 @@
  */
 
 /*
+ * "feature-gso-tcpv4" and "feature-gso-tcpv6" advertise the capability to
+ * handle large TCP packets (in IPv4 or IPv6 form respectively). Neither
+ * frontends nor backends are assumed to be capable unless the flags are
+ * present.
+ */
+
+/*
  * This is the 'wire' format for packets:
  *  Request 1: xen_netif_tx_request  -- XEN_NETTXF_* (any flags)
  * [Request 2: xen_netif_extra_info]    (only if request 1 has XEN_NETTXF_extra_info)
@@ -105,8 +112,9 @@ struct xen_netif_tx_request {
 #define _XEN_NETIF_EXTRA_FLAG_MORE	(0)
 #define  XEN_NETIF_EXTRA_FLAG_MORE	(1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
 
-/* GSO types - only TCPv4 currently supported. */
+/* GSO types */
 #define XEN_NETIF_GSO_TYPE_TCPV4	(1)
+#define XEN_NETIF_GSO_TYPE_TCPV6	(2)
 
 /*
  * This structure needs to fit within both netif_tx_request and
#47 lore raw
In reply to Paul Durrant
Quoted 4 lines · Paul Durrant

This patch series adds support for checksum and large packet offloads into xen-netback.
Testing has mainly been done using the Microsoft network hardware certification suite running in Server 2008R2 VMs with Citrix PV frontends.

Are there any Linux netfront patches in existence/the pipeline to take advantage of this?

Quoted 21 lines

v2:
- Fixed Wei's email address in Cc lines

v3:
- Responded to Wei's comments:
- netif.h now updated with comments and a definition of XEN_NETIF_GSO_TYPE_NONE.
- limited number of pullups
- Responded to Annie's comments:
- New GSO_BIT macro

v4:
- Responded to more of Wei's comments
- Remove parsing of IPv6 fragment header and added warning

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#48 lore raw
In reply to Paul Durrant
Quoted 4 lines · Paul Durrant

This patch series adds support for checksum and large packet offloads into xen-netback.
Testing has mainly been done using the Microsoft network hardware certification suite running in Server 2008R2 VMs with Citrix PV frontends.

Are there any Linux netfront patches in existence/the pipeline to take advantage of this?

Quoted 21 lines

v2:
- Fixed Wei's email address in Cc lines

v3:
- Responded to Wei's comments:
- netif.h now updated with comments and a definition of XEN_NETIF_GSO_TYPE_NONE.
- limited number of pullups
- Responded to Annie's comments:
- New GSO_BIT macro

v4:
- Responded to more of Wei's comments
- Remove parsing of IPv6 fragment header and added warning

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#41 lore raw

Re: [PATCH net-next v4 5/5] xen-netback: enable IPv6 TCP GSO to the guest

In reply to Paul Durrant
Quoted 4 lines · Paul Durrant

This patch adds code to handle SKB_GSO_TCPV6 skbs and construct appropriate extra or prefix segments to pass the large packet to the frontend. New xenstore flags, feature-gso-tcpv6 and feature-gso-tcpv6-prefix, are sampled to determine if the frontend is capable of handling such packets.

IIRC the reason we have feature-gso-tcpv4 and feature-gso-tcpv4-prefix is that the former did things in a way which Windows couldn't cope with. I assuming that is true for v6 too. But could Linux cope with the prefix version too for v6 and reduce the number of options? Or is the non-prefix variant actually better, if the guest can manage, for some reason?

I suppose in the end its all piggybacking off the v4 code paths so supporting both isn't a hardship.

Quoted 32 lines
Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/common.h    |    9 +++++--
 drivers/net/xen-netback/interface.c |    6 +++--
 drivers/net/xen-netback/netback.c   |   48 +++++++++++++++++++++++++++--------
 drivers/net/xen-netback/xenbus.c    |   29 +++++++++++++++++++--
 include/xen/interface/io/netif.h    |    1 +
 5 files changed, 77 insertions(+), 16 deletions(-)
drivers/net/xen-netback/common.h +4 -0
index b4a9a3c..55b8dec 100644
@@ -87,9 +87,13 @@ struct pending_tx_info {
 struct xenvif_rx_meta {
 	int id;
 	int size;
+	int gso_type;
 	int gso_size;
 };
 
+#define GSO_BIT(type) \
+	(1 << XEN_NETIF_GSO_TYPE_ ## type)
+
 /* Discriminate from any valid pending_idx value. */
 #define INVALID_PENDING_IDX 0xFFFF
 

drivers/net/xen-netback/common.h struct xenvif { · line 158

Quoted 5 lines
drivers/net/xen-netback/common.h +2 -0
@@ -150,9 +154,10 @@ struct xenvif {
 	u8               fe_dev_addr[6];
 
 	/* Frontend feature information. */
+	int gso_mask;
+	int gso_prefix_mask;

Are these storing NETIF_F_FOO? In which case they should be netif_feature_t I think. At the least it needs to be unsigned.

Quoted 12 lines
drivers/net/xen-netback/common.h +1 -2
+
 	u8 can_sg:1;
-	u8 gso:1;
-	u8 gso_prefix:1;
 	u8 ip_csum:1;
 	u8 ipv6_csum:1;
 
drivers/net/xen-netback/interface.c +0 -0
index cb0d8ea..e4aa267 100644

drivers/net/xen-netback/interface.c static netdev_features_t xenvif_fix_features(struct net_device *dev, · line 217

Quoted 5 lines
drivers/net/xen-netback/interface.c +1 -1
@@ -214,8 +214,10 @@ static netdev_features_t xenvif_fix_features(struct net_device *dev,
 
 	if (!vif->can_sg)
 		features &= ~NETIF_F_SG;
-	if (!vif->gso && !vif->gso_prefix)
+	if (~(vif->gso_mask | vif->gso_prefix_mask) & GSO_BIT(TCPV4))

I must be blind -- where does this GSO_BIT macro come from?

I can't see it in current net-next...

drivers/net/xen-netback/interface.c static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, · line 399

Quoted 8 lines
drivers/net/xen-netback/interface.c +3 -1
@@ -392,7 +394,14 @@ static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
 		}
 
 		/* Leave a gap for the GSO descriptor. */
-		if (*head && skb_shinfo(skb)->gso_size && !vif->gso_prefix)
+		if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)
+			gso_type = XEN_NETIF_GSO_TYPE_TCPV4;
+		else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)

I think you can use skb_is_gso(skb) and skb_is_gso_v6(skb) for these ifs.

drivers/net/xen-netback/interface.c static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, · line 404

Quoted 5 lines
drivers/net/xen-netback/interface.c +5 -0
+			gso_type = XEN_NETIF_GSO_TYPE_TCPV6;
+		else
+			gso_type = XEN_NETIF_GSO_TYPE_NONE;
+
+		if (*head && ((1 << gso_type) & vif->gso_mask))

Perhaps test_bit(gso_type, &vif->gso_mask) rather than opencoding bitops?

I see there are a lot of these, a vif_can_gso_type(vif, gso_type) helper might be nice.

Quoted 16 lines
drivers/net/xen-netback/interface.c +6 -0
 			vif->rx.req_cons++;
 
 		*head = 0; /* There must be something in this buffer now. */
@@ -423,14 +432,28 @@ static int xenvif_gop_skb(struct sk_buff *skb,
 	unsigned char *data;
 	int head = 1;
 	int old_meta_prod;
+	int gso_type;
+	int gso_size;
 
 	old_meta_prod = npo->meta_prod;
 
+	if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) {
+		gso_type = XEN_NETIF_GSO_TYPE_TCPV4;
+		gso_size = skb_shinfo(skb)->gso_size;
+	} else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) {

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

Quoted 10 lines
drivers/net/xen-netback/interface.c +8 -1
+		gso_type = XEN_NETIF_GSO_TYPE_TCPV6;
+		gso_size = skb_shinfo(skb)->gso_size;
+	} else {
+		gso_type = XEN_NETIF_GSO_TYPE_NONE;
+		gso_size = 0;
+	}
+
 	/* Set up a GSO prefix descriptor, if necessary */
-	if (skb_shinfo(skb)->gso_size && vif->gso_prefix) {
+	if ((1 << skb_shinfo(skb)->gso_type) & vif->gso_prefix_mask) {

Isn't skb->gso_type a Linux GSO flag thing and vif->gso_prefix_mask a Xen netif.h GSO type? Are they really comparable in this way?

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

Quoted 13 lines
drivers/net/xen-netback/interface.c +6 -1
 		req = RING_GET_REQUEST(&vif->rx, vif->rx.req_cons++);
 		meta = npo->meta + npo->meta_prod++;
-		meta->gso_size = skb_shinfo(skb)->gso_size;
+		meta->gso_type = gso_type;
+		meta->gso_size = gso_size;
 		meta->size = 0;
 		meta->id = req->id;
 	}
 
+	if (vif->gso_mask & vif->gso_prefix_mask) {
+		xenbus_dev_fatal(dev, err,
+				 "%s: gso and gso prefix flags are not "
+				 "mutually exclusive",

Aren't they? I thought they were? Maybe I'm reading this error message backwards, in which case I would contend that it is written backwards ;-)

Ian.

#42 lore raw

Re: [PATCH net-next v4 5/5] xen-netback: enable IPv6 TCP GSO to the guest

In reply to Paul Durrant
Quoted 4 lines · Paul Durrant

This patch adds code to handle SKB_GSO_TCPV6 skbs and construct appropriate extra or prefix segments to pass the large packet to the frontend. New xenstore flags, feature-gso-tcpv6 and feature-gso-tcpv6-prefix, are sampled to determine if the frontend is capable of handling such packets.

IIRC the reason we have feature-gso-tcpv4 and feature-gso-tcpv4-prefix is that the former did things in a way which Windows couldn't cope with. I assuming that is true for v6 too. But could Linux cope with the prefix version too for v6 and reduce the number of options? Or is the non-prefix variant actually better, if the guest can manage, for some reason?

I suppose in the end its all piggybacking off the v4 code paths so supporting both isn't a hardship.

Quoted 32 lines
Cc Wei Liu <[email protected]>
Cc David Vrabel <[email protected]>
Cc Ian Campbell <[email protected]>
---
 drivers/net/xen-netback/common.h    |    9 +++++--
 drivers/net/xen-netback/interface.c |    6 +++--
 drivers/net/xen-netback/netback.c   |   48 +++++++++++++++++++++++++++--------
 drivers/net/xen-netback/xenbus.c    |   29 +++++++++++++++++++--
 include/xen/interface/io/netif.h    |    1 +
 5 files changed, 77 insertions(+), 16 deletions(-)
drivers/net/xen-netback/common.h +4 -0
index b4a9a3c..55b8dec 100644
@@ -87,9 +87,13 @@ struct pending_tx_info {
 struct xenvif_rx_meta {
 	int id;
 	int size;
+	int gso_type;
 	int gso_size;
 };
 
+#define GSO_BIT(type) \
+	(1 << XEN_NETIF_GSO_TYPE_ ## type)
+
 /* Discriminate from any valid pending_idx value. */
 #define INVALID_PENDING_IDX 0xFFFF
 

drivers/net/xen-netback/common.h struct xenvif { · line 158

Quoted 5 lines
drivers/net/xen-netback/common.h +2 -0
@@ -150,9 +154,10 @@ struct xenvif {
 	u8               fe_dev_addr[6];
 
 	/* Frontend feature information. */
+	int gso_mask;
+	int gso_prefix_mask;

Are these storing NETIF_F_FOO? In which case they should be netif_feature_t I think. At the least it needs to be unsigned.

Quoted 12 lines
drivers/net/xen-netback/common.h +1 -2
+
 	u8 can_sg:1;
-	u8 gso:1;
-	u8 gso_prefix:1;
 	u8 ip_csum:1;
 	u8 ipv6_csum:1;
 
drivers/net/xen-netback/interface.c +0 -0
index cb0d8ea..e4aa267 100644

drivers/net/xen-netback/interface.c static netdev_features_t xenvif_fix_features(struct net_device *dev, · line 217

Quoted 5 lines
drivers/net/xen-netback/interface.c +1 -1
@@ -214,8 +214,10 @@ static netdev_features_t xenvif_fix_features(struct net_device *dev,
 
 	if (!vif->can_sg)
 		features &= ~NETIF_F_SG;
-	if (!vif->gso && !vif->gso_prefix)
+	if (~(vif->gso_mask | vif->gso_prefix_mask) & GSO_BIT(TCPV4))

I must be blind -- where does this GSO_BIT macro come from?

I can't see it in current net-next...

drivers/net/xen-netback/interface.c static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, · line 399

Quoted 8 lines
drivers/net/xen-netback/interface.c +3 -1
@@ -392,7 +394,14 @@ static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
 		}
 
 		/* Leave a gap for the GSO descriptor. */
-		if (*head && skb_shinfo(skb)->gso_size && !vif->gso_prefix)
+		if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)
+			gso_type = XEN_NETIF_GSO_TYPE_TCPV4;
+		else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)

I think you can use skb_is_gso(skb) and skb_is_gso_v6(skb) for these ifs.

drivers/net/xen-netback/interface.c static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb, · line 404

Quoted 5 lines
drivers/net/xen-netback/interface.c +5 -0
+			gso_type = XEN_NETIF_GSO_TYPE_TCPV6;
+		else
+			gso_type = XEN_NETIF_GSO_TYPE_NONE;
+
+		if (*head && ((1 << gso_type) & vif->gso_mask))

Perhaps test_bit(gso_type, &vif->gso_mask) rather than opencoding bitops?

I see there are a lot of these, a vif_can_gso_type(vif, gso_type) helper might be nice.

Quoted 16 lines
drivers/net/xen-netback/interface.c +6 -0
 			vif->rx.req_cons++;
 
 		*head = 0; /* There must be something in this buffer now. */
@@ -423,14 +432,28 @@ static int xenvif_gop_skb(struct sk_buff *skb,
 	unsigned char *data;
 	int head = 1;
 	int old_meta_prod;
+	int gso_type;
+	int gso_size;
 
 	old_meta_prod = npo->meta_prod;
 
+	if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) {
+		gso_type = XEN_NETIF_GSO_TYPE_TCPV4;
+		gso_size = skb_shinfo(skb)->gso_size;
+	} else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) {

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

Quoted 10 lines
drivers/net/xen-netback/interface.c +8 -1
+		gso_type = XEN_NETIF_GSO_TYPE_TCPV6;
+		gso_size = skb_shinfo(skb)->gso_size;
+	} else {
+		gso_type = XEN_NETIF_GSO_TYPE_NONE;
+		gso_size = 0;
+	}
+
 	/* Set up a GSO prefix descriptor, if necessary */
-	if (skb_shinfo(skb)->gso_size && vif->gso_prefix) {
+	if ((1 << skb_shinfo(skb)->gso_type) & vif->gso_prefix_mask) {

Isn't skb->gso_type a Linux GSO flag thing and vif->gso_prefix_mask a Xen netif.h GSO type? Are they really comparable in this way?

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

Quoted 13 lines
drivers/net/xen-netback/interface.c +6 -1
 		req = RING_GET_REQUEST(&vif->rx, vif->rx.req_cons++);
 		meta = npo->meta + npo->meta_prod++;
-		meta->gso_size = skb_shinfo(skb)->gso_size;
+		meta->gso_type = gso_type;
+		meta->gso_size = gso_size;
 		meta->size = 0;
 		meta->id = req->id;
 	}
 
+	if (vif->gso_mask & vif->gso_prefix_mask) {
+		xenbus_dev_fatal(dev, err,
+				 "%s: gso and gso prefix flags are not "
+				 "mutually exclusive",

Aren't they? I thought they were? Maybe I'm reading this error message backwards, in which case I would contend that it is written backwards ;-)

Ian.

#43 lore raw

Re: [PATCH net-next v4 5/5] xen-netback: enable IPv6 TCP GSO to the guest

Quoted 14 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:49
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net-next v4 5/5] xen-netback: enable IPv6 TCP GSO to the guest

Quoted 1 line · Paul Durrant

This patch adds code to handle SKB_GSO_TCPV6 skbs and construct

appropriate

Quoted 2 lines

extra or prefix segments to pass the large packet to the frontend. New xenstore flags, feature-gso-tcpv6 and feature-gso-tcpv6-prefix, are

sampled

Quoted 9 lines
Quoted 1 line

to determine if the frontend is capable of handling such packets.

IIRC the reason we have feature-gso-tcpv4 and feature-gso-tcpv4-prefix is that the former did things in a way which Windows couldn't cope with. I assuming that is true for v6 too. But could Linux cope with the prefix version too for v6 and reduce the number of options? Or is the non-prefix variant actually better, if the guest can manage, for some reason?

The non-prefix variant actually conveys type information and so will be better for frontends that don't have to re-parse the headers anyway.

Paul

Quoted 3 lines

I suppose in the end its all piggybacking off the v4 code paths so supporting both isn't a hardship.

#44 lore raw

RE: [PATCH net-next v4 5/5] xen-netback: enable IPv6 TCP GSO to the guest

In reply to Ian Campbell
Quoted 14 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:49
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net-next v4 5/5] xen-netback: enable IPv6 TCP GSO to the guest

Quoted 1 line · Paul Durrant

This patch adds code to handle SKB_GSO_TCPV6 skbs and construct

appropriate

Quoted 2 lines

extra or prefix segments to pass the large packet to the frontend. New xenstore flags, feature-gso-tcpv6 and feature-gso-tcpv6-prefix, are

sampled

Quoted 9 lines
Quoted 1 line

to determine if the frontend is capable of handling such packets.

IIRC the reason we have feature-gso-tcpv4 and feature-gso-tcpv4-prefix is that the former did things in a way which Windows couldn't cope with. I assuming that is true for v6 too. But could Linux cope with the prefix version too for v6 and reduce the number of options? Or is the non-prefix variant actually better, if the guest can manage, for some reason?

The non-prefix variant actually conveys type information and so will be better for frontends that don't have to re-parse the headers anyway.

Paul

Quoted 3 lines

I suppose in the end its all piggybacking off the v4 code paths so supporting both isn't a hardship.

#49 lore raw
In reply to Ian Campbell
Quoted 8 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:20
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 0/5] xen-netback: IPv6 offload support

Quoted 9 lines
Quoted 4 lines · Paul Durrant

This patch series adds support for checksum and large packet offloads into xen-netback.
Testing has mainly been done using the Microsoft network hardware certification suite running in Server 2008R2 VMs with Citrix PV frontends.

Are there any Linux netfront patches in existence/the pipeline to take advantage of this?

I was waiting for the backend patches to be accepted first ;-)

Paul

Quoted 22 lines
Quoted 21 lines

v2:
- Fixed Wei's email address in Cc lines

v3:
- Responded to Wei's comments:
- netif.h now updated with comments and a definition of XEN_NETIF_GSO_TYPE_NONE.
- limited number of pullups
- Responded to Annie's comments:
- New GSO_BIT macro

v4:
- Responded to more of Wei's comments
- Remove parsing of IPv6 fragment header and added warning

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#50 lore raw
In reply to Ian Campbell
Quoted 8 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:20
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 0/5] xen-netback: IPv6 offload support

Quoted 9 lines
Quoted 4 lines · Paul Durrant

This patch series adds support for checksum and large packet offloads into xen-netback.
Testing has mainly been done using the Microsoft network hardware certification suite running in Server 2008R2 VMs with Citrix PV frontends.

Are there any Linux netfront patches in existence/the pipeline to take advantage of this?

I was waiting for the backend patches to be accepted first ;-)

Paul

Quoted 22 lines
Quoted 21 lines

v2:
- Fixed Wei's email address in Cc lines

v3:
- Responded to Wei's comments:
- netif.h now updated with comments and a definition of XEN_NETIF_GSO_TYPE_NONE.
- limited number of pullups
- Responded to Annie's comments:
- New GSO_BIT macro

v4:
- Responded to more of Wei's comments
- Remove parsing of IPv6 fragment header and added warning

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#25 lore raw

Re: [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Ian Campbell
Quoted 69 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:12
To: Paul Durrant
Cc: David Vrabel; Wei Liu; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

Quoted 5 lines · Paul Durrant
Quoted 5 lines

-----Original Message-----
From: David Vrabel
Sent: 14 October 2013 13:19
To: Wei Liu
Cc: Paul Durrant; [email protected]; Ian Campbell; David Vrabel;

xen-

Quoted 2 lines
Quoted 2 lines

[email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add

support

Quoted 4 lines
Quoted 4 lines

for IPv6 checksum offload from guest

Quoted 1 line · Wei Liu

On Mon, Oct 14, 2013 at 11:49:20AM +0100, Paul Durrant wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David

Vrabel;

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for

IPv6

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 2 lines

-/*
- * This is the amount of packet we copy rather than map, so that

the

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc). +/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets. */

You seem to forget to explain why 128 is chosen. :-)

Is that not sufficient explanation? What sort of thing are you looking

for?

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 6 lines

From the second version of this patch, we had a conversation.

Where does 128 come from?

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Quoted 7 lines
Quoted 3 lines

Is "most IPv6 headers" actually good enough? Don't we need to ensure netback copies all IP headers?

It will do if checksum offload is in use, but perhaps the pull as far as the transport header needs to be done anyway? I'm unsure of the expectations of other code.

Quoted 6 lines

I've always been under the impression that transport headers needed pulling up too, for the benefit of netfilter perhaps?

AIUI the frags should be pure "payload". I may be wrong about that though...

I don't believe there is actually any upper bound on IPv6 header size so coming up with a static value would be hard. Do all h/w drivers really have to parse headers (assuming they're driving dumb h/w that doesn't do header payload split)?

Paul

#26 lore raw

RE: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

In reply to Ian Campbell
Quoted 69 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:12
To: Paul Durrant
Cc: David Vrabel; Wei Liu; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add support for IPv6 checksum offload from guest

Quoted 5 lines · Paul Durrant
Quoted 5 lines

-----Original Message-----
From: David Vrabel
Sent: 14 October 2013 13:19
To: Wei Liu
Cc: Paul Durrant; [email protected]; Ian Campbell; David Vrabel;

xen-

Quoted 2 lines
Quoted 2 lines

[email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 2/5] xen-netback: add

support

Quoted 4 lines
Quoted 4 lines

for IPv6 checksum offload from guest

Quoted 1 line · Wei Liu

On Mon, Oct 14, 2013 at 11:49:20AM +0100, Paul Durrant wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 14 October 2013 11:43
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David

Vrabel;

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Ian Campbell
Subject: Re: [PATCH net-next v4 2/5] xen-netback: add support for

IPv6

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

checksum offload from guest

On Fri, Oct 11, 2013 at 04:06:19PM +0100, Paul Durrant wrote:
[...]

Quoted 2 lines

-/*
- * This is the amount of packet we copy rather than map, so that

the

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

- * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc). +/* This is a miniumum size for the linear area to avoid lots of
+ * calls to __pskb_pull_tail() as we set up checksum offsets. */

You seem to forget to explain why 128 is chosen. :-)

Is that not sufficient explanation? What sort of thing are you looking

for?

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 6 lines

From the second version of this patch, we had a conversation.

Where does 128 come from?

"It's just an arbitrary power of 2 that was chosen because it seems to cover most likely v6 headers and all v4 headers."

So something like: "We choose 128 which is likely to cover most V6 headers and all V4 headers" would be sufficeint.

Quoted 7 lines
Quoted 3 lines

Is "most IPv6 headers" actually good enough? Don't we need to ensure netback copies all IP headers?

It will do if checksum offload is in use, but perhaps the pull as far as the transport header needs to be done anyway? I'm unsure of the expectations of other code.

Quoted 6 lines

I've always been under the impression that transport headers needed pulling up too, for the benefit of netfilter perhaps?

AIUI the frags should be pure "payload". I may be wrong about that though...

I don't believe there is actually any upper bound on IPv6 header size so coming up with a static value would be hard. Do all h/w drivers really have to parse headers (assuming they're driving dumb h/w that doesn't do header payload split)?

Paul

#51 lore raw
In reply to Paul Durrant
Quoted 14 lines · Paul Durrant
Quoted 14 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:20
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 0/5] xen-netback: IPv6 offload support

Quoted 4 lines · Paul Durrant

This patch series adds support for checksum and large packet offloads into xen-netback.
Testing has mainly been done using the Microsoft network hardware certification suite running in Server 2008R2 VMs with Citrix PV frontends.

Quoted 5 lines
Quoted 3 lines

Are there any Linux netfront patches in existence/the pipeline to take advantage of this?

I was waiting for the backend patches to be accepted first ;-)

I think it would be useful to get et least an RFC so others can try it etc.

Ian.

#52 lore raw
In reply to Paul Durrant
Quoted 14 lines · Paul Durrant
Quoted 14 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:20
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 0/5] xen-netback: IPv6 offload support

Quoted 4 lines · Paul Durrant

This patch series adds support for checksum and large packet offloads into xen-netback.
Testing has mainly been done using the Microsoft network hardware certification suite running in Server 2008R2 VMs with Citrix PV frontends.

Quoted 5 lines
Quoted 3 lines

Are there any Linux netfront patches in existence/the pipeline to take advantage of this?

I was waiting for the backend patches to be accepted first ;-)

I think it would be useful to get et least an RFC so others can try it etc.

Ian.

#45 lore raw

Re: [PATCH net-next v4 5/5] xen-netback: enable IPv6 TCP GSO to the guest

In reply to Paul Durrant
Quoted 24 lines · Paul Durrant
Quoted 14 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:49
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net-next v4 5/5] xen-netback: enable IPv6 TCP GSO to the guest

Quoted 1 line · Paul Durrant

This patch adds code to handle SKB_GSO_TCPV6 skbs and construct

appropriate

Quoted 2 lines

extra or prefix segments to pass the large packet to the frontend. New xenstore flags, feature-gso-tcpv6 and feature-gso-tcpv6-prefix, are

sampled

Quoted 9 lines
Quoted 1 line

to determine if the frontend is capable of handling such packets.

IIRC the reason we have feature-gso-tcpv4 and feature-gso-tcpv4-prefix is that the former did things in a way which Windows couldn't cope with. I assuming that is true for v6 too. But could Linux cope with the prefix version too for v6 and reduce the number of options? Or is the non-prefix variant actually better, if the guest can manage, for some reason?

Quoted 3 lines

The non-prefix variant actually conveys type information and so will be better for frontends that don't have to re-parse the headers anyway.

Make sense, thanks.

Quoted 7 lines

Paul

Quoted 3 lines

I suppose in the end its all piggybacking off the v4 code paths so supporting both isn't a hardship.

#46 lore raw

Re: [PATCH net-next v4 5/5] xen-netback: enable IPv6 TCP GSO to the guest

In reply to Paul Durrant
Quoted 24 lines · Paul Durrant
Quoted 14 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:49
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; David Vrabel
Subject: Re: [PATCH net-next v4 5/5] xen-netback: enable IPv6 TCP GSO to the guest

Quoted 1 line · Paul Durrant

This patch adds code to handle SKB_GSO_TCPV6 skbs and construct

appropriate

Quoted 2 lines

extra or prefix segments to pass the large packet to the frontend. New xenstore flags, feature-gso-tcpv6 and feature-gso-tcpv6-prefix, are

sampled

Quoted 9 lines
Quoted 1 line

to determine if the frontend is capable of handling such packets.

IIRC the reason we have feature-gso-tcpv4 and feature-gso-tcpv4-prefix is that the former did things in a way which Windows couldn't cope with. I assuming that is true for v6 too. But could Linux cope with the prefix version too for v6 and reduce the number of options? Or is the non-prefix variant actually better, if the guest can manage, for some reason?

Quoted 3 lines

The non-prefix variant actually conveys type information and so will be better for frontends that don't have to re-parse the headers anyway.

Make sense, thanks.

Quoted 7 lines

Paul

Quoted 3 lines

I suppose in the end its all piggybacking off the v4 code paths so supporting both isn't a hardship.

#53 lore raw
In reply to Ian Campbell
Quoted 26 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 18:01
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 0/5] xen-netback: IPv6 offload support

Quoted 6 lines · Paul Durrant
Quoted 6 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:20
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 0/5] xen-netback: IPv6

offload

Quoted 4 lines
Quoted 4 lines

support

Quoted 1 line · Paul Durrant

This patch series adds support for checksum and large packet offloads

into

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

xen-netback.
Testing has mainly been done using the Microsoft network hardware certification suite running in Server 2008R2 VMs with Citrix PV

frontends.

Quoted 1 line
Quoted 1 line
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Are there any Linux netfront patches in existence/the pipeline to take advantage of this?

I was waiting for the backend patches to be accepted first ;-)

I think it would be useful to get et least an RFC so others can try it etc.

Well, everyone can build and use the Windows frontend :-) (https://github.com/xenserver/win-xenvif/tree/upstream)

I'll try to hack up something in xen-netfront soon.

Paul

#54 lore raw
In reply to Ian Campbell
Quoted 26 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 18:01
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 0/5] xen-netback: IPv6 offload support

Quoted 6 lines · Paul Durrant
Quoted 6 lines

-----Original Message-----
From: Ian Campbell
Sent: 16 October 2013 17:20
To: Paul Durrant
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH net-next v4 0/5] xen-netback: IPv6

offload

Quoted 4 lines
Quoted 4 lines

support

Quoted 1 line · Paul Durrant

This patch series adds support for checksum and large packet offloads

into

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

xen-netback.
Testing has mainly been done using the Microsoft network hardware certification suite running in Server 2008R2 VMs with Citrix PV

frontends.

Quoted 1 line
Quoted 1 line
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Are there any Linux netfront patches in existence/the pipeline to take advantage of this?

I was waiting for the backend patches to be accepted first ;-)

I think it would be useful to get et least an RFC so others can try it etc.

Well, everyone can build and use the Windows frontend :-) (https://github.com/xenserver/win-xenvif/tree/upstream)

I'll try to hack up something in xen-netfront soon.

Paul