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

[Xen-changelog] [NET] front: clean up transmit queue waking



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 4bd332f2bb1e8e42431f64ce5b586298ab99e7f5
# Parent  64fbdbc31dba2cb91c41ec766cf470ccc35eca1e
[NET] front: clean up transmit queue waking

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c |   37 ++++++++++---------
 1 files changed, 20 insertions(+), 17 deletions(-)

diff -r 64fbdbc31dba -r 4bd332f2bb1e 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu May 18 
09:41:29 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu May 18 
10:02:32 2006 +0100
@@ -449,9 +449,20 @@ static int network_open(struct net_devic
        return 0;
 }
 
+static inline void network_maybe_wake_tx(struct net_device *dev)
+{
+       struct netfront_info *np = netdev_priv(dev);
+
+       if (unlikely(netif_queue_stopped(dev)) &&
+           !RING_FULL(&np->tx) &&
+           !gnttab_empty_grant_references(&np->gref_tx_head) &&
+           likely(netif_running(dev)))
+               netif_wake_queue(dev);
+}
+
 static void network_tx_buf_gc(struct net_device *dev)
 {
-       RING_IDX i, prod;
+       RING_IDX cons, prod;
        unsigned short id;
        struct netfront_info *np = netdev_priv(dev);
        struct sk_buff *skb;
@@ -463,15 +474,15 @@ static void network_tx_buf_gc(struct net
                prod = np->tx.sring->rsp_prod;
                rmb(); /* Ensure we see responses up to 'rp'. */
 
-               for (i = np->tx.rsp_cons; i != prod; i++) {
-                       id  = RING_GET_RESPONSE(&np->tx, i)->id;
+               for (cons = np->tx.rsp_cons; cons != prod; cons++) {
+                       id  = RING_GET_RESPONSE(&np->tx, cons)->id;
                        skb = np->tx_skbs[id];
                        if (unlikely(gnttab_query_foreign_access(
                                np->grant_tx_ref[id]) != 0)) {
                                printk(KERN_ALERT "network_tx_buf_gc: warning "
                                       "-- grant still in use by backend "
                                       "domain.\n");
-                               goto out;
+                               break; /* bail immediately */
                        }
                        gnttab_end_foreign_access_ref(
                                np->grant_tx_ref[id], GNTMAP_readonly);
@@ -495,15 +506,9 @@ static void network_tx_buf_gc(struct net
                np->tx.sring->rsp_event =
                        prod + ((np->tx.sring->req_prod - prod) >> 1) + 1;
                mb();
-       } while (prod != np->tx.sring->rsp_prod);
-
- out:
-       if (unlikely(netif_queue_stopped(dev)) &&
-           ((np->tx.sring->req_prod - prod) < NET_TX_RING_SIZE) &&
-           !gnttab_empty_grant_references(&np->gref_tx_head)) {
-               if (likely(netif_running(dev)))
-                       netif_wake_queue(dev);
-       }
+       } while ((cons == prod) && (prod != np->tx.sring->rsp_prod));
+
+       network_maybe_wake_tx(dev);
 }
 
 
@@ -695,9 +700,8 @@ static int network_start_xmit(struct sk_
        network_tx_buf_gc(dev);
 
        if (RING_FULL(&np->tx) ||
-           gnttab_empty_grant_references(&np->gref_tx_head)) {
+           gnttab_empty_grant_references(&np->gref_tx_head))
                netif_stop_queue(dev);
-       }
 
        spin_unlock_irq(&np->tx_lock);
 
@@ -1043,8 +1047,7 @@ static void network_connect(struct net_d
        notify_remote_via_irq(np->irq);
        network_tx_buf_gc(dev);
 
-       if (netif_running(dev))
-               netif_start_queue(dev);
+       network_maybe_wake_tx(dev);
 
        spin_unlock(&np->rx_lock);
        spin_unlock_irq(&np->tx_lock);

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