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

[Xen-changelog] [NET] front: Replace user_state with netif_running



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 64fbdbc31dba2cb91c41ec766cf470ccc35eca1e
# Parent  21bd82ade5cca2e3917323ff40da4d77a8c58511
[NET] front: Replace user_state with netif_running

The user_state variable is simply replicating information that's already
present through netif_running.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diff -r 21bd82ade5cc -r 64fbdbc31dba 
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:38:37 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu May 18 
09:41:29 2006 +0100
@@ -97,11 +97,6 @@ struct netfront_info
 #define BEST_CONNECTED    2
        unsigned int backend_state;
 
-       /* Is this interface open or closed (down or up)? */
-#define UST_CLOSED        0
-#define UST_OPEN          1
-       unsigned int user_state;
-
        /* Receive-ring batched refills. */
 #define RX_MIN_TARGET 8
 #define RX_DFL_MIN_TARGET 64
@@ -445,8 +440,6 @@ static int network_open(struct net_devic
        struct netfront_info *np = netdev_priv(dev);
 
        memset(&np->stats, 0, sizeof(np->stats));
-
-       np->user_state = UST_OPEN;
 
        network_alloc_rx_buffers(dev);
        np->rx.sring->rsp_event = np->rx.rsp_cons + 1;
@@ -508,7 +501,7 @@ static void network_tx_buf_gc(struct net
        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 (np->user_state == UST_OPEN)
+               if (likely(netif_running(dev)))
                        netif_wake_queue(dev);
        }
 }
@@ -730,7 +723,7 @@ static irqreturn_t netif_int(int irq, vo
        spin_unlock_irqrestore(&np->tx_lock, flags);
 
        if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx) &&
-           (np->user_state == UST_OPEN))
+           likely(netif_running(dev)))
                netif_rx_schedule(dev);
 
        return IRQ_HANDLED;
@@ -952,7 +945,6 @@ static int network_close(struct net_devi
 static int network_close(struct net_device *dev)
 {
        struct netfront_info *np = netdev_priv(dev);
-       np->user_state = UST_CLOSED;
        netif_stop_queue(np->netdev);
        return 0;
 }
@@ -1051,7 +1043,7 @@ static void network_connect(struct net_d
        notify_remote_via_irq(np->irq);
        network_tx_buf_gc(dev);
 
-       if (np->user_state == UST_OPEN)
+       if (netif_running(dev))
                netif_start_queue(dev);
 
        spin_unlock(&np->rx_lock);
@@ -1065,7 +1057,7 @@ static void show_device(struct netfront_
                IPRINTK("<vif handle=%u %s(%s) evtchn=%u tx=%p rx=%p>\n",
                        np->handle,
                        be_state_name[np->backend_state],
-                       np->user_state ? "open" : "closed",
+                       netif_running(np->netdev) ? "open" : "closed",
                        np->evtchn,
                        np->tx,
                        np->rx);
@@ -1116,7 +1108,6 @@ static int create_netdev(int handle, str
 
        np                = netdev_priv(netdev);
        np->backend_state = BEST_CLOSED;
-       np->user_state    = UST_CLOSED;
        np->handle        = handle;
        np->xbdev         = dev;
 

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