From ff6e4be615cb8a299908c6c65d2d257a2104edb1 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 4 Jan 2006 14:45:52 +0100 Subject: Fix split of duties between close_netdev() and netif_disconnect_backend() in netif driver. Signed-off-by: Keir Fraser --- .../drivers/xen/netfront/netfront.c | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c index eca6b4c888..2acba6b21d 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c @@ -1218,22 +1218,14 @@ static int netfront_remove(struct xenbus_device *dev) static void close_netdev(struct netfront_info *info) { - /* Stop old i/f to prevent errors whilst we rebuild the state. */ - spin_lock_irq(&info->tx_lock); - spin_lock(&info->rx_lock); + spin_lock_irq(&info->netdev->xmit_lock); netif_stop_queue(info->netdev); - /* info->backend_state = BEST_DISCONNECTED; */ - spin_unlock(&info->rx_lock); - spin_unlock_irq(&info->tx_lock); + spin_unlock_irq(&info->netdev->xmit_lock); #ifdef CONFIG_PROC_FS xennet_proc_delif(info->netdev); #endif - if (info->irq) - unbind_from_irqhandler(info->irq, info->netdev); - info->evtchn = info->irq = 0; - del_timer_sync(&info->rx_refill_timer); unregister_netdev(info->netdev); @@ -1242,6 +1234,17 @@ static void close_netdev(struct netfront_info *info) static void netif_disconnect_backend(struct netfront_info *info) { + /* Stop old i/f to prevent errors whilst we rebuild the state. */ + spin_lock_irq(&info->tx_lock); + spin_lock(&info->rx_lock); + info->backend_state = BEST_DISCONNECTED; + spin_unlock(&info->rx_lock); + spin_unlock_irq(&info->tx_lock); + + if (info->irq) + unbind_from_irqhandler(info->irq, info->netdev); + info->evtchn = info->irq = 0; + end_access(info->tx_ring_ref, info->tx.sring); end_access(info->rx_ring_ref, info->rx.sring); info->tx_ring_ref = GRANT_INVALID_REF; -- cgit v1.2.3