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

[Xen-changelog] [xen-unstable] [NET] Enable TCPv4 segmentation offload in front/back drivers.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 5379548bfc79e8768e3ffb7cd6a8aa0edf8af0c1
# Parent  947e09f90b3bbb900a80b7e15d9987f2d1e04566
[NET] Enable TCPv4 segmentation offload in front/back drivers.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/netback/netback.c   |   19 +++++++++++++------
 linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c    |    4 ----
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c |    4 ----
 3 files changed, 13 insertions(+), 14 deletions(-)

diff -r 947e09f90b3b -r 5379548bfc79 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Mon Jul 31 
18:12:53 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Tue Aug 01 
11:54:45 2006 +0100
@@ -221,13 +221,20 @@ static struct sk_buff *netbk_copy_skb(st
        return NULL;
 }
 
+static inline int netbk_max_required_rx_slots(netif_t *netif)
+{
+       if (netif->features & (NETIF_F_SG|NETIF_F_TSO))
+               return MAX_SKB_FRAGS + 2; /* header + extra_info + frags */
+       return 1; /* all in one */
+}
+
 static inline int netbk_queue_full(netif_t *netif)
 {
-       RING_IDX peek = netif->rx_req_cons_peek;
-
-       return ((netif->rx.sring->req_prod - peek) <= (MAX_SKB_FRAGS + 1)) ||
-              ((netif->rx.rsp_prod_pvt + NET_RX_RING_SIZE - peek) <=
-               (MAX_SKB_FRAGS + 1));
+       RING_IDX peek   = netif->rx_req_cons_peek;
+       RING_IDX needed = netbk_max_required_rx_slots(netif);
+
+       return ((netif->rx.sring->req_prod - peek) < needed) ||
+              ((netif->rx.rsp_prod_pvt + NET_RX_RING_SIZE - peek) < needed);
 }
 
 int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -271,7 +278,7 @@ int netif_be_start_xmit(struct sk_buff *
 
        if (netbk_can_queue(dev) && netbk_queue_full(netif)) {
                netif->rx.sring->req_event = netif->rx_req_cons_peek +
-                       MAX_SKB_FRAGS + 2;
+                       netbk_max_required_rx_slots(netif);
                mb(); /* request notification /then/ check & stop the queue */
                if (netbk_queue_full(netif))
                        netif_stop_queue(dev);
diff -r 947e09f90b3b -r 5379548bfc79 
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Mon Jul 31 18:12:53 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Tue Aug 01 11:54:45 
2006 +0100
@@ -101,14 +101,12 @@ static int netback_probe(struct xenbus_d
                        goto abort_transaction;
                }
 
-#if 0 /* KAF: After the protocol is finalised. */
                err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4",
                                    "%d", 1);
                if (err) {
                        message = "writing feature-gso-tcpv4";
                        goto abort_transaction;
                }
-#endif
 
                err = xenbus_transaction_end(xbt, 0);
        } while (err == -EAGAIN);
@@ -384,7 +382,6 @@ static int connect_rings(struct backend_
                be->netif->dev->features |= NETIF_F_SG;
        }
 
-#if 0 /* KAF: After the protocol is finalised. */
        if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4", "%d",
                         &val) < 0)
                val = 0;
@@ -392,7 +389,6 @@ static int connect_rings(struct backend_
                be->netif->features |= NETIF_F_TSO;
                be->netif->dev->features |= NETIF_F_TSO;
        }
-#endif
 
        /* Map the shared frame, irq etc. */
        err = netif_map(be->netif, tx_ring_ref, rx_ring_ref, evtchn);
diff -r 947e09f90b3b -r 5379548bfc79 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Mon Jul 31 
18:12:53 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Tue Aug 01 
11:54:45 2006 +0100
@@ -338,13 +338,11 @@ again:
                goto abort_transaction;
        }
 
-#if 0 /* KAF: After the protocol is finalised. */
        err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4", "%d", 1);
        if (err) {
                message = "writing feature-gso-tcpv4";
                goto abort_transaction;
        }
-#endif
 
        err = xenbus_transaction_end(xbt, 0);
        if (err) {
@@ -1327,9 +1325,7 @@ static int xennet_set_tso(struct net_dev
                if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
                                 "feature-gso-tcpv4", "%d", &val) < 0)
                        val = 0;
-#if 0 /* KAF: After the protocol is finalised. */
                if (!val)
-#endif
                        return -ENOSYS;
        }
 

_______________________________________________
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®.