[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Netfront must switch state using xenbus_switch_state() or this



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID b32bc0c5648ddb111134b195a45ca12625c19fcf
# Parent  6df0bdcf8c9de75280cf40d8bf9583d343a6b41a
Netfront must switch state using xenbus_switch_state() or this
is not picked up by the waiting code in xenbus_probe.c.

Also clean up the waiting code a little.

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

diff -r 6df0bdcf8c9d -r b32bc0c5648d 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Mon Apr 10 
17:30:07 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Mon Apr 10 
17:56:34 2006
@@ -300,13 +300,6 @@
                goto abort_transaction;
        }
 
-       err = xenbus_printf(xbt, dev->nodename,
-                           "state", "%d", XenbusStateConnected);
-       if (err) {
-               message = "writing frontend XenbusStateConnected";
-               goto abort_transaction;
-       }
-
        err = xenbus_transaction_end(xbt, 0);
        if (err) {
                if (err == -EAGAIN)
@@ -314,6 +307,8 @@
                xenbus_dev_fatal(dev, err, "completing transaction");
                goto destroy_ring;
        }
+
+       xenbus_switch_state(dev, XenbusStateConnected);
 
        return 0;
 
diff -r 6df0bdcf8c9d -r b32bc0c5648d 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Mon Apr 10 
17:30:07 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Mon Apr 10 
17:56:34 2006
@@ -1065,19 +1065,16 @@
  */
 static int __init wait_for_devices(void)
 {
-       int i;
-
-       for (i = 0; i < 10 * HZ; i++) {
-               if (all_devices_ready()) {
-                       return;
-               }
-
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(1);
-       }
-
-       printk(KERN_WARNING
-              "XENBUS: Timeout connecting to devices!\n");
+       unsigned long timeout = jiffies + 10*HZ;
+
+       while (time_before(jiffies, timeout)) {
+               if (all_devices_ready())
+                       return 0;
+               schedule_timeout_interruptible(HZ/10);
+       }
+
+       printk(KERN_WARNING "XENBUS: Timeout connecting to devices!\n");
+       return 0;
 }
 
 late_initcall(wait_for_devices);

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.