Commit a94685876859be30446357db6d6c4a9c951305b4

Authored by Paul Durrant
Committed by David S. Miller
1 parent 7365bcfa32

xen-netback: handle IPv6 TCP GSO packets from the guest

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.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 24 additions and 4 deletions Side-by-side Diff

drivers/net/xen-netback/netback.c
... ... @@ -1098,15 +1098,20 @@
1098 1098 return -EINVAL;
1099 1099 }
1100 1100  
1101   - /* Currently only TCPv4 S.O. is supported. */
1102   - if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {
  1101 + switch (gso->u.gso.type) {
  1102 + case XEN_NETIF_GSO_TYPE_TCPV4:
  1103 + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
  1104 + break;
  1105 + case XEN_NETIF_GSO_TYPE_TCPV6:
  1106 + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
  1107 + break;
  1108 + default:
1103 1109 netdev_err(vif->dev, "Bad GSO type %d.\n", gso->u.gso.type);
1104 1110 xenvif_fatal_tx_err(vif);
1105 1111 return -EINVAL;
1106 1112 }
1107 1113  
1108 1114 skb_shinfo(skb)->gso_size = gso->u.gso.size;
1109   - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
1110 1115  
1111 1116 /* Header must be checked, and gso_segs computed. */
1112 1117 skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
drivers/net/xen-netback/xenbus.c
... ... @@ -105,6 +105,13 @@
105 105 goto abort_transaction;
106 106 }
107 107  
  108 + err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv6",
  109 + "%d", sg);
  110 + if (err) {
  111 + message = "writing feature-gso-tcpv6";
  112 + goto abort_transaction;
  113 + }
  114 +
108 115 /* We support partial checksum setup for IPv6 packets */
109 116 err = xenbus_printf(xbt, dev->nodename,
110 117 "feature-ipv6-csum-offload",
include/xen/interface/io/netif.h
... ... @@ -58,6 +58,13 @@
58 58 */
59 59  
60 60 /*
  61 + * "feature-gso-tcpv4" and "feature-gso-tcpv6" advertise the capability to
  62 + * handle large TCP packets (in IPv4 or IPv6 form respectively). Neither
  63 + * frontends nor backends are assumed to be capable unless the flags are
  64 + * present.
  65 + */
  66 +
  67 +/*
61 68 * This is the 'wire' format for packets:
62 69 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags)
63 70 * [Request 2: xen_netif_extra_info] (only if request 1 has XEN_NETTXF_extra_info)
64 71  
... ... @@ -102,8 +109,9 @@
102 109 #define _XEN_NETIF_EXTRA_FLAG_MORE (0)
103 110 #define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
104 111  
105   -/* GSO types - only TCPv4 currently supported. */
  112 +/* GSO types */
106 113 #define XEN_NETIF_GSO_TYPE_TCPV4 (1)
  114 +#define XEN_NETIF_GSO_TYPE_TCPV6 (2)
107 115  
108 116 /*
109 117 * This structure needs to fit within both netif_tx_request and