diff options
Diffstat (limited to 'drivers/net/xen-netback/interface.c')
-rw-r--r-- | drivers/net/xen-netback/interface.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 2329cccf1fa6..870f1fa58370 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
@@ -368,11 +368,11 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref, | |||
368 | unsigned long rx_ring_ref, unsigned int tx_evtchn, | 368 | unsigned long rx_ring_ref, unsigned int tx_evtchn, |
369 | unsigned int rx_evtchn) | 369 | unsigned int rx_evtchn) |
370 | { | 370 | { |
371 | struct task_struct *task; | ||
371 | int err = -ENOMEM; | 372 | int err = -ENOMEM; |
372 | 373 | ||
373 | /* Already connected through? */ | 374 | BUG_ON(vif->tx_irq); |
374 | if (vif->tx_irq) | 375 | BUG_ON(vif->task); |
375 | return 0; | ||
376 | 376 | ||
377 | err = xenvif_map_frontend_rings(vif, tx_ring_ref, rx_ring_ref); | 377 | err = xenvif_map_frontend_rings(vif, tx_ring_ref, rx_ring_ref); |
378 | if (err < 0) | 378 | if (err < 0) |
@@ -411,14 +411,16 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref, | |||
411 | } | 411 | } |
412 | 412 | ||
413 | init_waitqueue_head(&vif->wq); | 413 | init_waitqueue_head(&vif->wq); |
414 | vif->task = kthread_create(xenvif_kthread, | 414 | task = kthread_create(xenvif_kthread, |
415 | (void *)vif, "%s", vif->dev->name); | 415 | (void *)vif, "%s", vif->dev->name); |
416 | if (IS_ERR(vif->task)) { | 416 | if (IS_ERR(task)) { |
417 | pr_warn("Could not allocate kthread for %s\n", vif->dev->name); | 417 | pr_warn("Could not allocate kthread for %s\n", vif->dev->name); |
418 | err = PTR_ERR(vif->task); | 418 | err = PTR_ERR(task); |
419 | goto err_rx_unbind; | 419 | goto err_rx_unbind; |
420 | } | 420 | } |
421 | 421 | ||
422 | vif->task = task; | ||
423 | |||
422 | rtnl_lock(); | 424 | rtnl_lock(); |
423 | if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN) | 425 | if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN) |
424 | dev_set_mtu(vif->dev, ETH_DATA_LEN); | 426 | dev_set_mtu(vif->dev, ETH_DATA_LEN); |
@@ -461,8 +463,10 @@ void xenvif_disconnect(struct xenvif *vif) | |||
461 | if (netif_carrier_ok(vif->dev)) | 463 | if (netif_carrier_ok(vif->dev)) |
462 | xenvif_carrier_off(vif); | 464 | xenvif_carrier_off(vif); |
463 | 465 | ||
464 | if (vif->task) | 466 | if (vif->task) { |
465 | kthread_stop(vif->task); | 467 | kthread_stop(vif->task); |
468 | vif->task = NULL; | ||
469 | } | ||
466 | 470 | ||
467 | if (vif->tx_irq) { | 471 | if (vif->tx_irq) { |
468 | if (vif->tx_irq == vif->rx_irq) | 472 | if (vif->tx_irq == vif->rx_irq) |