WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-3.0.4-testing] [NET] front: Fix interface teardown.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.0.4-testing] [NET] front: Fix interface teardown.
From: "Xen patchbot-3.0.4-testing" <patchbot-3.0.4-testing@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 03 Jan 2007 14:15:32 -0800
Delivery-date: Wed, 03 Jan 2007 14:15:49 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1166614762 0
# Node ID bcaf2f568ebdd00812dd4c9e50f890b958d86ff7
# Parent  4531b892915a51918769786b1863fb98589a082a
[NET] front: Fix interface teardown.

Original bug discovered and fixed by Glauber de Oliveira Costa
<gcosta@xxxxxxxxxx>.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

Based on xen-unstable changeset 13100:e99ba0c6c0461159a40f27c9891e13098e791dca
---
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c |  105 +++++--------------
 1 files changed, 32 insertions(+), 73 deletions(-)

diff -r 4531b892915a -r bcaf2f568ebd 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Wed Dec 20 
11:21:04 2006 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Wed Dec 20 
11:39:22 2006 +0000
@@ -244,12 +244,8 @@ static int setup_device(struct xenbus_de
 static int setup_device(struct xenbus_device *, struct netfront_info *);
 static struct net_device *create_netdev(struct xenbus_device *);
 
-static void netfront_closing(struct xenbus_device *);
-
 static void end_access(int, void *);
 static void netif_disconnect_backend(struct netfront_info *);
-static int open_netdev(struct netfront_info *);
-static void close_netdev(struct netfront_info *);
 
 static int network_connect(struct net_device *);
 static void network_tx_buf_gc(struct net_device *);
@@ -293,9 +289,20 @@ static int __devinit netfront_probe(stru
        info = netdev_priv(netdev);
        dev->dev.driver_data = info;
 
-       err = open_netdev(info);
-       if (err)
+       err = register_netdev(info->netdev);
+       if (err) {
+               printk(KERN_WARNING "%s: register_netdev err=%d\n",
+                      __FUNCTION__, err);
                goto fail;
+       }
+
+       err = xennet_sysfs_addif(info->netdev);
+       if (err) {
+               unregister_netdev(info->netdev);
+               printk(KERN_WARNING "%s: add sysfs failed err=%d\n",
+                      __FUNCTION__, err);
+               goto fail;
+       }
 
        return 0;
 
@@ -305,6 +312,24 @@ static int __devinit netfront_probe(stru
        return err;
 }
 
+static int __devexit netfront_remove(struct xenbus_device *dev)
+{
+       struct netfront_info *info = dev->dev.driver_data;
+
+       DPRINTK("%s\n", dev->nodename);
+
+       netif_disconnect_backend(info);
+
+       del_timer_sync(&info->rx_refill_timer);
+
+       xennet_sysfs_delif(info->netdev);
+
+       unregister_netdev(info->netdev);
+
+       free_netdev(info->netdev);
+
+       return 0;
+}
 
 /**
  * We are reconnecting to the backend, due to a suspend/resume, or a backend
@@ -534,9 +559,7 @@ static void backend_changed(struct xenbu
                break;
 
        case XenbusStateClosing:
-               if (dev->state == XenbusStateClosed)
-                       break;
-               netfront_closing(dev);
+               xenbus_frontend_closed(dev);
                break;
        }
 }
@@ -1995,70 +2018,6 @@ inetdev_notify(struct notifier_block *th
 }
 
 
-/* ** Close down ** */
-
-
-/**
- * Handle the change of state of the backend to Closing.  We must delete our
- * device-layer structures now, to ensure that writes are flushed through to
- * the backend.  Once is this done, we can switch to Closed in
- * acknowledgement.
- */
-static void netfront_closing(struct xenbus_device *dev)
-{
-       struct netfront_info *info = dev->dev.driver_data;
-
-       DPRINTK("%s\n", dev->nodename);
-
-       close_netdev(info);
-       xenbus_frontend_closed(dev);
-}
-
-
-static int __devexit netfront_remove(struct xenbus_device *dev)
-{
-       struct netfront_info *info = dev->dev.driver_data;
-
-       DPRINTK("%s\n", dev->nodename);
-
-       netif_disconnect_backend(info);
-       free_netdev(info->netdev);
-
-       return 0;
-}
-
-
-static int open_netdev(struct netfront_info *info)
-{
-       int err;
-       
-       err = register_netdev(info->netdev);
-       if (err) {
-               printk(KERN_WARNING "%s: register_netdev err=%d\n",
-                      __FUNCTION__, err);
-               return err;
-       }
-
-       err = xennet_sysfs_addif(info->netdev);
-       if (err) {
-               unregister_netdev(info->netdev);
-               printk(KERN_WARNING "%s: add sysfs failed err=%d\n",
-                      __FUNCTION__, err);
-               return err;
-       }
-
-       return 0;
-}
-
-static void close_netdev(struct netfront_info *info)
-{
-       del_timer_sync(&info->rx_refill_timer);
-
-       xennet_sysfs_delif(info->netdev);
-       unregister_netdev(info->netdev);
-}
-
-
 static void netif_disconnect_backend(struct netfront_info *info)
 {
        /* Stop old i/f to prevent errors whilst we rebuild the state. */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.0.4-testing] [NET] front: Fix interface teardown., Xen patchbot-3.0.4-testing <=