aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/xen-netback
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-09-23 06:46:57 -0400
committerDavid S. Miller <davem@davemloft.net>2016-09-23 06:46:57 -0400
commitd6989d4bbe6c4d1c2a76696833a07f044e85694d (patch)
tree2d9a70d0feee4d4a20568be1b39a961fa0d27d81 /drivers/net/xen-netback
parent0364a8824c020f12e2d5e9fad963685b58f7574e (diff)
parentb1f2beb87bb034bb209773807994279f90cace78 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'drivers/net/xen-netback')
-rw-r--r--drivers/net/xen-netback/xenbus.c46
1 files changed, 30 insertions, 16 deletions
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index bacf6e0c12b9..9911b4e61c0f 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -304,6 +304,11 @@ static int netback_probe(struct xenbus_device *dev,
304 be->dev = dev; 304 be->dev = dev;
305 dev_set_drvdata(&dev->dev, be); 305 dev_set_drvdata(&dev->dev, be);
306 306
307 be->state = XenbusStateInitialising;
308 err = xenbus_switch_state(dev, XenbusStateInitialising);
309 if (err)
310 goto fail;
311
307 sg = 1; 312 sg = 1;
308 313
309 do { 314 do {
@@ -416,11 +421,6 @@ static int netback_probe(struct xenbus_device *dev,
416 421
417 be->hotplug_script = script; 422 be->hotplug_script = script;
418 423
419 err = xenbus_switch_state(dev, XenbusStateInitWait);
420 if (err)
421 goto fail;
422
423 be->state = XenbusStateInitWait;
424 424
425 /* This kicks hotplug scripts, so do it immediately. */ 425 /* This kicks hotplug scripts, so do it immediately. */
426 err = backend_create_xenvif(be); 426 err = backend_create_xenvif(be);
@@ -525,20 +525,20 @@ static inline void backend_switch_state(struct backend_info *be,
525 525
526/* Handle backend state transitions: 526/* Handle backend state transitions:
527 * 527 *
528 * The backend state starts in InitWait and the following transitions are 528 * The backend state starts in Initialising and the following transitions are
529 * allowed. 529 * allowed.
530 * 530 *
531 * InitWait -> Connected 531 * Initialising -> InitWait -> Connected
532 * 532 * \
533 * ^ \ | 533 * \ ^ \ |
534 * | \ | 534 * \ | \ |
535 * | \ | 535 * \ | \ |
536 * | \ | 536 * \ | \ |
537 * | \ | 537 * \ | \ |
538 * | \ | 538 * \ | \ |
539 * | V V 539 * V | V V
540 * 540 *
541 * Closed <-> Closing 541 * Closed <-> Closing
542 * 542 *
543 * The state argument specifies the eventual state of the backend and the 543 * The state argument specifies the eventual state of the backend and the
544 * function transitions to that state via the shortest path. 544 * function transitions to that state via the shortest path.
@@ -548,6 +548,20 @@ static void set_backend_state(struct backend_info *be,
548{ 548{
549 while (be->state != state) { 549 while (be->state != state) {
550 switch (be->state) { 550 switch (be->state) {
551 case XenbusStateInitialising:
552 switch (state) {
553 case XenbusStateInitWait:
554 case XenbusStateConnected:
555 case XenbusStateClosing:
556 backend_switch_state(be, XenbusStateInitWait);
557 break;
558 case XenbusStateClosed:
559 backend_switch_state(be, XenbusStateClosed);
560 break;
561 default:
562 BUG();
563 }
564 break;
551 case XenbusStateClosed: 565 case XenbusStateClosed:
552 switch (state) { 566 switch (state) {
553 case XenbusStateInitWait: 567 case XenbusStateInitWait: