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

[Xen-changelog] [xen-unstable] [NET] back: Add GSO features field and check gso_size



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 4b9876fe2f1fbb1996e475e83dc85d843387e353
# Parent  18abc9eb9a311863529a1b7ee536bf2b3c8b2eb8
[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>
---
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c   |   36 +++++++++++++------
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c |    2 -
 xen/include/public/io/netif.h                        |   13 +++++-
 3 files changed, 37 insertions(+), 14 deletions(-)

diff -r 18abc9eb9a31 -r 4b9876fe2f1f 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Mon Jul 03 
08:57:15 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Mon Jul 03 
09:05:18 2006 +0100
@@ -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 only TCPv4 S.O. is supported. */
+       if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_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 18abc9eb9a31 -r 4b9876fe2f1f 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Mon Jul 03 
08:57:15 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Mon Jul 03 
09:05:18 2006 +0100
@@ -787,7 +787,7 @@ static int network_start_xmit(struct sk_
                        tx->flags |= NETTXF_extra_info;
 
                gso->u.gso.size = skb_shinfo(skb)->gso_size;
-               gso->u.gso.type = XEN_NETIF_GSO_TCPV4;
+               gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
 
                gso->type = XEN_NETIF_EXTRA_TYPE_GSO;
                gso->flags = 0;
diff -r 18abc9eb9a31 -r 4b9876fe2f1f xen/include/public/io/netif.h
--- a/xen/include/public/io/netif.h     Mon Jul 03 08:57:15 2006 +0100
+++ b/xen/include/public/io/netif.h     Mon Jul 03 09:05:18 2006 +0100
@@ -65,7 +65,7 @@ typedef struct netif_tx_request netif_tx
 #define XEN_NETIF_EXTRA_FLAG_MORE  (1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
 
 /* GSO types - only TCPv4 currently supported. */
-#define XEN_NETIF_GSO_TCPV4        (1)
+#define XEN_NETIF_GSO_TYPE_TCPV4        (1)
 
 /*
  * This structure needs to fit within both netif_tx_request and
@@ -87,7 +87,16 @@ struct netif_extra_info {
              * GSO type. This determines the protocol of the packet and any
              * extra features required to segment the packet properly.
              */
-            uint16_t type; /* XEN_NETIF_GSO_* */
+            uint8_t type; /* XEN_NETIF_GSO_TYPE_* */
+
+            /* Future expansion. */
+            uint8_t pad;
+
+            /*
+             * GSO features. This specifies any extra GSO features required
+             * to process this packet, such as ECN support for TCPv4.
+             */
+            uint16_t features; /* XEN_NETIF_GSO_FEAT_* */
         } gso;
 
         uint16_t pad[3];

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


 


Rackspace

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