ia64/xen-unstable

changeset 10086:21bd82ade5cc

[NET] front: Remove tx_full and unnecessary queue operations

The tx_full variable merely mirrors information already present in
the XOFF bit on the net device. The net device architecture itself
is quite mature and can be trusted by Xen to maintain its state
correctly.

Also, it's pointless to stop the queue in close_netdev since it can
be waken up anyway since there could be a softirq running on another
CPU. All of this is handled by unregister_netdev anyway.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
author kaf24@firebug.cl.cam.ac.uk
date Thu May 18 09:38:37 2006 +0100 (2006-05-18)
parents 56444cd2805c
children 64fbdbc31dba
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 08:55:20 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu May 18 09:38:37 2006 +0100
     1.3 @@ -81,7 +81,6 @@ struct netfront_info
     1.4  	struct net_device *netdev;
     1.5  
     1.6  	struct net_device_stats stats;
     1.7 -	unsigned int tx_full;
     1.8  
     1.9  	netif_tx_front_ring_t tx;
    1.10  	netif_rx_front_ring_t rx;
    1.11 @@ -506,10 +505,9 @@ static void network_tx_buf_gc(struct net
    1.12  	} while (prod != np->tx.sring->rsp_prod);
    1.13  
    1.14   out:
    1.15 -	if ((np->tx_full) &&
    1.16 +	if (unlikely(netif_queue_stopped(dev)) &&
    1.17  	    ((np->tx.sring->req_prod - prod) < NET_TX_RING_SIZE) &&
    1.18  	    !gnttab_empty_grant_references(&np->gref_tx_head)) {
    1.19 -		np->tx_full = 0;
    1.20  		if (np->user_state == UST_OPEN)
    1.21  			netif_wake_queue(dev);
    1.22  	}
    1.23 @@ -650,13 +648,6 @@ static int network_start_xmit(struct sk_
    1.24  	unsigned long mfn;
    1.25  	int notify;
    1.26  
    1.27 -	if (unlikely(np->tx_full)) {
    1.28 -		printk(KERN_ALERT "%s: full queue wasn't stopped!\n",
    1.29 -		       dev->name);
    1.30 -		netif_stop_queue(dev);
    1.31 -		goto drop;
    1.32 -	}
    1.33 -
    1.34  	if (unlikely((((unsigned long)skb->data & ~PAGE_MASK) + skb->len) >=
    1.35  		     PAGE_SIZE)) {
    1.36  		struct sk_buff *nskb;
    1.37 @@ -712,7 +703,6 @@ static int network_start_xmit(struct sk_
    1.38  
    1.39  	if (RING_FULL(&np->tx) ||
    1.40  	    gnttab_empty_grant_references(&np->gref_tx_head)) {
    1.41 -		np->tx_full = 1;
    1.42  		netif_stop_queue(dev);
    1.43  	}
    1.44  
    1.45 @@ -987,11 +977,8 @@ static void network_connect(struct net_d
    1.46  
    1.47  	/* Recovery procedure: */
    1.48  
    1.49 -	/* Step 1: Reinitialise variables. */
    1.50 -	np->tx_full = 0;
    1.51 -
    1.52  	/*
    1.53 -	 * Step 2: Rebuild the RX and TX ring contents.
    1.54 +	 * Step 1: Rebuild the RX and TX ring contents.
    1.55  	 * NB. We could just free the queued TX packets now but we hope
    1.56  	 * that sending them out might do some good.  We have to rebuild
    1.57  	 * the RX ring because some of our pages are currently flipped out
    1.58 @@ -1055,7 +1042,7 @@ static void network_connect(struct net_d
    1.59  	RING_PUSH_REQUESTS(&np->rx);
    1.60  
    1.61  	/*
    1.62 -	 * Step 3: All public and private state should now be sane.  Get
    1.63 +	 * Step 2: All public and private state should now be sane.  Get
    1.64  	 * ready to start sending and receiving packets and give the driver
    1.65  	 * domain a kick because we've probably just requeued some
    1.66  	 * packets.
    1.67 @@ -1266,10 +1253,6 @@ static int netfront_remove(struct xenbus
    1.68  
    1.69  static void close_netdev(struct netfront_info *info)
    1.70  {
    1.71 -	spin_lock_irq(&info->netdev->xmit_lock);
    1.72 -	netif_stop_queue(info->netdev);
    1.73 -	spin_unlock_irq(&info->netdev->xmit_lock);
    1.74 -
    1.75  #ifdef CONFIG_PROC_FS
    1.76  	xennet_proc_delif(info->netdev);
    1.77  #endif