ia64/xen-unstable
changeset 10642:4b9876fe2f1f
[NET] back: Add GSO features field and check gso_size
This patch adds the as-yet unused GSO features which will contain
protocol-independent bits such as the ECN marker.
It also makes the backend check gso_size to ensure that it is non-zero.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This patch adds the as-yet unused GSO features which will contain
protocol-independent bits such as the ECN marker.
It also makes the backend check gso_size to ensure that it is non-zero.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Mon Jul 03 09:05:18 2006 +0100 (2006-07-03) |
parents | 18abc9eb9a31 |
children | addde2d2d97a |
files | linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c xen/include/public/io/netif.h |
line diff
1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Mon Jul 03 08:57:15 2006 +0100 1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Mon Jul 03 09:05:18 2006 +0100 1.3 @@ -691,6 +691,29 @@ int netbk_get_extras(netif_t *netif, str 1.4 return work_to_do; 1.5 } 1.6 1.7 +static int netbk_set_skb_gso(struct sk_buff *skb, struct netif_extra_info *gso) 1.8 +{ 1.9 + if (!gso->u.gso.size) { 1.10 + DPRINTK("GSO size must not be zero.\n"); 1.11 + return -EINVAL; 1.12 + } 1.13 + 1.14 + /* Currently only TCPv4 S.O. is supported. */ 1.15 + if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) { 1.16 + DPRINTK("Bad GSO type %d.\n", gso->u.gso.type); 1.17 + return -EINVAL; 1.18 + } 1.19 + 1.20 + skb_shinfo(skb)->gso_size = gso->u.gso.size; 1.21 + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; 1.22 + 1.23 + /* Header must be checked, and gso_segs computed. */ 1.24 + skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; 1.25 + skb_shinfo(skb)->gso_segs = 0; 1.26 + 1.27 + return 0; 1.28 +} 1.29 + 1.30 /* Called after netfront has transmitted */ 1.31 static void net_tx_action(unsigned long unused) 1.32 { 1.33 @@ -819,20 +842,11 @@ static void net_tx_action(unsigned long 1.34 struct netif_extra_info *gso; 1.35 gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1]; 1.36 1.37 - /* Currently on TCPv4 S.O. is supported. */ 1.38 - if (gso->u.gso.type != XEN_NETIF_GSO_TCPV4) { 1.39 - DPRINTK("Bad GSO type %d.\n", gso->u.gso.type); 1.40 + if (netbk_set_skb_gso(skb, gso)) { 1.41 kfree_skb(skb); 1.42 netbk_tx_err(netif, &txreq, i); 1.43 - break; 1.44 + continue; 1.45 } 1.46 - 1.47 - skb_shinfo(skb)->gso_size = gso->u.gso.size; 1.48 - skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; 1.49 - 1.50 - /* Header must be checked, and gso_segs computed. */ 1.51 - skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; 1.52 - skb_shinfo(skb)->gso_segs = 0; 1.53 } 1.54 1.55 gnttab_set_map_op(mop, MMAP_VADDR(pending_idx),
2.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Mon Jul 03 08:57:15 2006 +0100 2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Mon Jul 03 09:05:18 2006 +0100 2.3 @@ -787,7 +787,7 @@ static int network_start_xmit(struct sk_ 2.4 tx->flags |= NETTXF_extra_info; 2.5 2.6 gso->u.gso.size = skb_shinfo(skb)->gso_size; 2.7 - gso->u.gso.type = XEN_NETIF_GSO_TCPV4; 2.8 + gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4; 2.9 2.10 gso->type = XEN_NETIF_EXTRA_TYPE_GSO; 2.11 gso->flags = 0;
3.1 --- a/xen/include/public/io/netif.h Mon Jul 03 08:57:15 2006 +0100 3.2 +++ b/xen/include/public/io/netif.h Mon Jul 03 09:05:18 2006 +0100 3.3 @@ -65,7 +65,7 @@ typedef struct netif_tx_request netif_tx 3.4 #define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE) 3.5 3.6 /* GSO types - only TCPv4 currently supported. */ 3.7 -#define XEN_NETIF_GSO_TCPV4 (1) 3.8 +#define XEN_NETIF_GSO_TYPE_TCPV4 (1) 3.9 3.10 /* 3.11 * This structure needs to fit within both netif_tx_request and 3.12 @@ -87,7 +87,16 @@ struct netif_extra_info { 3.13 * GSO type. This determines the protocol of the packet and any 3.14 * extra features required to segment the packet properly. 3.15 */ 3.16 - uint16_t type; /* XEN_NETIF_GSO_* */ 3.17 + uint8_t type; /* XEN_NETIF_GSO_TYPE_* */ 3.18 + 3.19 + /* Future expansion. */ 3.20 + uint8_t pad; 3.21 + 3.22 + /* 3.23 + * GSO features. This specifies any extra GSO features required 3.24 + * to process this packet, such as ECN support for TCPv4. 3.25 + */ 3.26 + uint16_t features; /* XEN_NETIF_GSO_FEAT_* */ 3.27 } gso; 3.28 3.29 uint16_t pad[3];