ia64/xen-unstable

changeset 10087:64fbdbc31dba

[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@gondor.apana.org.au>
author kaf24@firebug.cl.cam.ac.uk
date Thu May 18 09:41:29 2006 +0100 (2006-05-18)
parents 21bd82ade5cc
children 4bd332f2bb1e
files linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu May 18 09:38:37 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu May 18 09:41:29 2006 +0100
     1.3 @@ -97,11 +97,6 @@ struct netfront_info
     1.4  #define BEST_CONNECTED    2
     1.5  	unsigned int backend_state;
     1.6  
     1.7 -	/* Is this interface open or closed (down or up)? */
     1.8 -#define UST_CLOSED        0
     1.9 -#define UST_OPEN          1
    1.10 -	unsigned int user_state;
    1.11 -
    1.12  	/* Receive-ring batched refills. */
    1.13  #define RX_MIN_TARGET 8
    1.14  #define RX_DFL_MIN_TARGET 64
    1.15 @@ -446,8 +441,6 @@ static int network_open(struct net_devic
    1.16  
    1.17  	memset(&np->stats, 0, sizeof(np->stats));
    1.18  
    1.19 -	np->user_state = UST_OPEN;
    1.20 -
    1.21  	network_alloc_rx_buffers(dev);
    1.22  	np->rx.sring->rsp_event = np->rx.rsp_cons + 1;
    1.23  
    1.24 @@ -508,7 +501,7 @@ static void network_tx_buf_gc(struct net
    1.25  	if (unlikely(netif_queue_stopped(dev)) &&
    1.26  	    ((np->tx.sring->req_prod - prod) < NET_TX_RING_SIZE) &&
    1.27  	    !gnttab_empty_grant_references(&np->gref_tx_head)) {
    1.28 -		if (np->user_state == UST_OPEN)
    1.29 +		if (likely(netif_running(dev)))
    1.30  			netif_wake_queue(dev);
    1.31  	}
    1.32  }
    1.33 @@ -730,7 +723,7 @@ static irqreturn_t netif_int(int irq, vo
    1.34  	spin_unlock_irqrestore(&np->tx_lock, flags);
    1.35  
    1.36  	if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx) &&
    1.37 -	    (np->user_state == UST_OPEN))
    1.38 +	    likely(netif_running(dev)))
    1.39  		netif_rx_schedule(dev);
    1.40  
    1.41  	return IRQ_HANDLED;
    1.42 @@ -952,7 +945,6 @@ static int netif_poll(struct net_device 
    1.43  static int network_close(struct net_device *dev)
    1.44  {
    1.45  	struct netfront_info *np = netdev_priv(dev);
    1.46 -	np->user_state = UST_CLOSED;
    1.47  	netif_stop_queue(np->netdev);
    1.48  	return 0;
    1.49  }
    1.50 @@ -1051,7 +1043,7 @@ static void network_connect(struct net_d
    1.51  	notify_remote_via_irq(np->irq);
    1.52  	network_tx_buf_gc(dev);
    1.53  
    1.54 -	if (np->user_state == UST_OPEN)
    1.55 +	if (netif_running(dev))
    1.56  		netif_start_queue(dev);
    1.57  
    1.58  	spin_unlock(&np->rx_lock);
    1.59 @@ -1065,7 +1057,7 @@ static void show_device(struct netfront_
    1.60  		IPRINTK("<vif handle=%u %s(%s) evtchn=%u tx=%p rx=%p>\n",
    1.61  			np->handle,
    1.62  			be_state_name[np->backend_state],
    1.63 -			np->user_state ? "open" : "closed",
    1.64 +			netif_running(np->netdev) ? "open" : "closed",
    1.65  			np->evtchn,
    1.66  			np->tx,
    1.67  			np->rx);
    1.68 @@ -1116,7 +1108,6 @@ static int create_netdev(int handle, str
    1.69  
    1.70  	np                = netdev_priv(netdev);
    1.71  	np->backend_state = BEST_CLOSED;
    1.72 -	np->user_state    = UST_CLOSED;
    1.73  	np->handle        = handle;
    1.74  	np->xbdev         = dev;
    1.75