[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [2/4] [NET] back: Add GSO features field and check gso_size



Hi:

[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@xxxxxxxxxxxxxxxxxxx>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff -r 3656a2985ae1 -r 8c37d0d4526e 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Mon Jul 03 
14:18:54 2006 +1000
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Mon Jul 03 
14:31:15 2006 +1000
@@ -691,6 +691,29 @@ int netbk_get_extras(netif_t *netif, str
        return work_to_do;
 }
 
+static int netbk_set_skb_gso(struct sk_buff *skb, struct netif_extra_info *gso)
+{
+       if (!gso->u.gso.size) {
+               DPRINTK("GSO size must not be zero.\n");
+               return -EINVAL;
+       }
+
+       /* Currently on TCPv4 S.O. is supported. */
+       if (gso->u.gso.type != XEN_NETIF_GSO_TCPV4) {
+               DPRINTK("Bad GSO type %d.\n", gso->u.gso.type);
+               return -EINVAL;
+       }
+
+       skb_shinfo(skb)->gso_size = gso->u.gso.size;
+       skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+
+       /* Header must be checked, and gso_segs computed. */
+       skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
+       skb_shinfo(skb)->gso_segs = 0;
+
+       return 0;
+}
+
 /* Called after netfront has transmitted */
 static void net_tx_action(unsigned long unused)
 {
@@ -819,20 +842,11 @@ static void net_tx_action(unsigned long 
                        struct netif_extra_info *gso;
                        gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1];
 
-                       /* Currently on TCPv4 S.O. is supported. */
-                       if (gso->u.gso.type != XEN_NETIF_GSO_TCPV4) {
-                               DPRINTK("Bad GSO type %d.\n", gso->u.gso.type);
+                       if (netbk_set_skb_gso(skb, gso)) {
                                kfree_skb(skb);
                                netbk_tx_err(netif, &txreq, i);
-                               break;
+                               continue;
                        }
-
-                       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;
-                       skb_shinfo(skb)->gso_segs = 0;
                }
 
                gnttab_set_map_op(mop, MMAP_VADDR(pending_idx),
diff -r 3656a2985ae1 -r 8c37d0d4526e xen/include/public/io/netif.h
--- a/xen/include/public/io/netif.h     Mon Jul 03 14:18:54 2006 +1000
+++ b/xen/include/public/io/netif.h     Mon Jul 03 14:31:15 2006 +1000
@@ -88,6 +88,12 @@ struct netif_extra_info {
              * extra features required to segment the packet properly.
              */
             uint16_t type; /* XEN_NETIF_GSO_* */
+
+            /*
+             * GSO features . This specifies any extra GSO features required
+             * to process this packet, such as ECN support for TCPv4.
+             */
+            uint16_t features; /* XEN_NETIF_FEAT_* */
         } gso;
 
         uint16_t pad[3];

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.