diff options
author | Paul Durrant <Paul.Durrant@citrix.com> | 2013-10-16 12:50:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-17 15:35:14 -0400 |
commit | 146c8a77d27bcbd7722120f70f51e3b287205d0a (patch) | |
tree | b7ce7bf02f0967015366284281e31468a45508cf /drivers | |
parent | c0f4ace79e7e5bec0ff065c4afa3eb3329c9384c (diff) |
xen-netback: add support for IPv6 checksum offload to guest
Check xenstore flag feature-ipv6-csum-offload to determine if a
guest is happy to accept IPv6 packets with only partial checksum.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/xen-netback/common.h | 3 | ||||
-rw-r--r-- | drivers/net/xen-netback/interface.c | 10 | ||||
-rw-r--r-- | drivers/net/xen-netback/xenbus.c | 7 |
3 files changed, 15 insertions, 5 deletions
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index 5715318d6bab..b4a9a3c844b2 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h | |||
@@ -153,7 +153,8 @@ struct xenvif { | |||
153 | u8 can_sg:1; | 153 | u8 can_sg:1; |
154 | u8 gso:1; | 154 | u8 gso:1; |
155 | u8 gso_prefix:1; | 155 | u8 gso_prefix:1; |
156 | u8 csum:1; | 156 | u8 ip_csum:1; |
157 | u8 ipv6_csum:1; | ||
157 | 158 | ||
158 | /* Internal feature information. */ | 159 | /* Internal feature information. */ |
159 | u8 can_queue:1; /* can queue packets for receiver? */ | 160 | u8 can_queue:1; /* can queue packets for receiver? */ |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 01bb854c7f62..8e927838652c 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
@@ -216,8 +216,10 @@ static netdev_features_t xenvif_fix_features(struct net_device *dev, | |||
216 | features &= ~NETIF_F_SG; | 216 | features &= ~NETIF_F_SG; |
217 | if (!vif->gso && !vif->gso_prefix) | 217 | if (!vif->gso && !vif->gso_prefix) |
218 | features &= ~NETIF_F_TSO; | 218 | features &= ~NETIF_F_TSO; |
219 | if (!vif->csum) | 219 | if (!vif->ip_csum) |
220 | features &= ~NETIF_F_IP_CSUM; | 220 | features &= ~NETIF_F_IP_CSUM; |
221 | if (!vif->ipv6_csum) | ||
222 | features &= ~NETIF_F_IPV6_CSUM; | ||
221 | 223 | ||
222 | return features; | 224 | return features; |
223 | } | 225 | } |
@@ -306,7 +308,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
306 | vif->domid = domid; | 308 | vif->domid = domid; |
307 | vif->handle = handle; | 309 | vif->handle = handle; |
308 | vif->can_sg = 1; | 310 | vif->can_sg = 1; |
309 | vif->csum = 1; | 311 | vif->ip_csum = 1; |
310 | vif->dev = dev; | 312 | vif->dev = dev; |
311 | 313 | ||
312 | vif->credit_bytes = vif->remaining_credit = ~0UL; | 314 | vif->credit_bytes = vif->remaining_credit = ~0UL; |
@@ -316,7 +318,9 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
316 | vif->credit_timeout.expires = jiffies; | 318 | vif->credit_timeout.expires = jiffies; |
317 | 319 | ||
318 | dev->netdev_ops = &xenvif_netdev_ops; | 320 | dev->netdev_ops = &xenvif_netdev_ops; |
319 | dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO; | 321 | dev->hw_features = NETIF_F_SG | |
322 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | ||
323 | NETIF_F_TSO; | ||
320 | dev->features = dev->hw_features; | 324 | dev->features = dev->hw_features; |
321 | SET_ETHTOOL_OPS(dev, &xenvif_ethtool_ops); | 325 | SET_ETHTOOL_OPS(dev, &xenvif_ethtool_ops); |
322 | 326 | ||
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 1b08d8798372..ad27b15242cd 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -574,7 +574,12 @@ static int connect_rings(struct backend_info *be) | |||
574 | if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-no-csum-offload", | 574 | if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-no-csum-offload", |
575 | "%d", &val) < 0) | 575 | "%d", &val) < 0) |
576 | val = 0; | 576 | val = 0; |
577 | vif->csum = !val; | 577 | vif->ip_csum = !val; |
578 | |||
579 | if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-ipv6-csum-offload", | ||
580 | "%d", &val) < 0) | ||
581 | val = 0; | ||
582 | vif->ipv6_csum = !!val; | ||
578 | 583 | ||
579 | /* Map the shared frame, irq etc. */ | 584 | /* Map the shared frame, irq etc. */ |
580 | err = xenvif_connect(vif, tx_ring_ref, rx_ring_ref, | 585 | err = xenvif_connect(vif, tx_ring_ref, rx_ring_ref, |