direct-io.hg

changeset 8494:572abc9efcf5

Fix split of duties between close_netdev() and
netif_disconnect_backend() in netif driver.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Jan 04 14:45:52 2006 +0100 (2006-01-04)
parents f26ae65f3f95
children c2e93601eae5
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	Wed Jan 04 12:37:27 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed Jan 04 14:45:52 2006 +0100
     1.3 @@ -1218,22 +1218,14 @@ static int netfront_remove(struct xenbus
     1.4  
     1.5  static void close_netdev(struct netfront_info *info)
     1.6  {
     1.7 -	/* Stop old i/f to prevent errors whilst we rebuild the state. */
     1.8 -	spin_lock_irq(&info->tx_lock);
     1.9 -	spin_lock(&info->rx_lock);
    1.10 +	spin_lock_irq(&info->netdev->xmit_lock);
    1.11  	netif_stop_queue(info->netdev);
    1.12 -	/* info->backend_state = BEST_DISCONNECTED; */
    1.13 -	spin_unlock(&info->rx_lock);
    1.14 -	spin_unlock_irq(&info->tx_lock);
    1.15 +	spin_unlock_irq(&info->netdev->xmit_lock);
    1.16  
    1.17  #ifdef CONFIG_PROC_FS
    1.18  	xennet_proc_delif(info->netdev);
    1.19  #endif
    1.20  
    1.21 -	if (info->irq)
    1.22 -		unbind_from_irqhandler(info->irq, info->netdev);
    1.23 -	info->evtchn = info->irq = 0;
    1.24 -
    1.25  	del_timer_sync(&info->rx_refill_timer);
    1.26  
    1.27  	unregister_netdev(info->netdev);
    1.28 @@ -1242,6 +1234,17 @@ static void close_netdev(struct netfront
    1.29  
    1.30  static void netif_disconnect_backend(struct netfront_info *info)
    1.31  {
    1.32 +	/* Stop old i/f to prevent errors whilst we rebuild the state. */
    1.33 +	spin_lock_irq(&info->tx_lock);
    1.34 +	spin_lock(&info->rx_lock);
    1.35 +	info->backend_state = BEST_DISCONNECTED;
    1.36 +	spin_unlock(&info->rx_lock);
    1.37 +	spin_unlock_irq(&info->tx_lock);
    1.38 +
    1.39 +	if (info->irq)
    1.40 +		unbind_from_irqhandler(info->irq, info->netdev);
    1.41 +	info->evtchn = info->irq = 0;
    1.42 +
    1.43  	end_access(info->tx_ring_ref, info->tx.sring);
    1.44  	end_access(info->rx_ring_ref, info->rx.sring);
    1.45  	info->tx_ring_ref = GRANT_INVALID_REF;