diff options
Diffstat (limited to 'drivers/infiniband/ulp/ipoib/ipoib_ib.c')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_ib.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 23885801b6d2..86bcdd72a107 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -52,7 +52,7 @@ MODULE_PARM_DESC(data_debug_level, | |||
52 | 52 | ||
53 | #define IPOIB_OP_RECV (1ul << 31) | 53 | #define IPOIB_OP_RECV (1ul << 31) |
54 | 54 | ||
55 | static DECLARE_MUTEX(pkey_sem); | 55 | static DEFINE_MUTEX(pkey_mutex); |
56 | 56 | ||
57 | struct ipoib_ah *ipoib_create_ah(struct net_device *dev, | 57 | struct ipoib_ah *ipoib_create_ah(struct net_device *dev, |
58 | struct ib_pd *pd, struct ib_ah_attr *attr) | 58 | struct ib_pd *pd, struct ib_ah_attr *attr) |
@@ -445,25 +445,16 @@ int ipoib_ib_dev_down(struct net_device *dev) | |||
445 | 445 | ||
446 | /* Shutdown the P_Key thread if still active */ | 446 | /* Shutdown the P_Key thread if still active */ |
447 | if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) { | 447 | if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) { |
448 | down(&pkey_sem); | 448 | mutex_lock(&pkey_mutex); |
449 | set_bit(IPOIB_PKEY_STOP, &priv->flags); | 449 | set_bit(IPOIB_PKEY_STOP, &priv->flags); |
450 | cancel_delayed_work(&priv->pkey_task); | 450 | cancel_delayed_work(&priv->pkey_task); |
451 | up(&pkey_sem); | 451 | mutex_unlock(&pkey_mutex); |
452 | flush_workqueue(ipoib_workqueue); | 452 | flush_workqueue(ipoib_workqueue); |
453 | } | 453 | } |
454 | 454 | ||
455 | ipoib_mcast_stop_thread(dev, 1); | 455 | ipoib_mcast_stop_thread(dev, 1); |
456 | |||
457 | /* | ||
458 | * Flush the multicast groups first so we stop any multicast joins. The | ||
459 | * completion thread may have already died and we may deadlock waiting | ||
460 | * for the completion thread to finish some multicast joins. | ||
461 | */ | ||
462 | ipoib_mcast_dev_flush(dev); | 456 | ipoib_mcast_dev_flush(dev); |
463 | 457 | ||
464 | /* Delete broadcast and local addresses since they will be recreated */ | ||
465 | ipoib_mcast_dev_down(dev); | ||
466 | |||
467 | ipoib_flush_paths(dev); | 458 | ipoib_flush_paths(dev); |
468 | 459 | ||
469 | return 0; | 460 | return 0; |
@@ -608,13 +599,13 @@ void ipoib_ib_dev_flush(void *_dev) | |||
608 | if (test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) | 599 | if (test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) |
609 | ipoib_ib_dev_up(dev); | 600 | ipoib_ib_dev_up(dev); |
610 | 601 | ||
611 | down(&priv->vlan_mutex); | 602 | mutex_lock(&priv->vlan_mutex); |
612 | 603 | ||
613 | /* Flush any child interfaces too */ | 604 | /* Flush any child interfaces too */ |
614 | list_for_each_entry(cpriv, &priv->child_intfs, list) | 605 | list_for_each_entry(cpriv, &priv->child_intfs, list) |
615 | ipoib_ib_dev_flush(&cpriv->dev); | 606 | ipoib_ib_dev_flush(&cpriv->dev); |
616 | 607 | ||
617 | up(&priv->vlan_mutex); | 608 | mutex_unlock(&priv->vlan_mutex); |
618 | } | 609 | } |
619 | 610 | ||
620 | void ipoib_ib_dev_cleanup(struct net_device *dev) | 611 | void ipoib_ib_dev_cleanup(struct net_device *dev) |
@@ -624,9 +615,7 @@ void ipoib_ib_dev_cleanup(struct net_device *dev) | |||
624 | ipoib_dbg(priv, "cleaning up ib_dev\n"); | 615 | ipoib_dbg(priv, "cleaning up ib_dev\n"); |
625 | 616 | ||
626 | ipoib_mcast_stop_thread(dev, 1); | 617 | ipoib_mcast_stop_thread(dev, 1); |
627 | 618 | ipoib_mcast_dev_flush(dev); | |
628 | /* Delete the broadcast address and the local address */ | ||
629 | ipoib_mcast_dev_down(dev); | ||
630 | 619 | ||
631 | ipoib_transport_dev_cleanup(dev); | 620 | ipoib_transport_dev_cleanup(dev); |
632 | } | 621 | } |
@@ -662,12 +651,12 @@ void ipoib_pkey_poll(void *dev_ptr) | |||
662 | if (test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) | 651 | if (test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) |
663 | ipoib_open(dev); | 652 | ipoib_open(dev); |
664 | else { | 653 | else { |
665 | down(&pkey_sem); | 654 | mutex_lock(&pkey_mutex); |
666 | if (!test_bit(IPOIB_PKEY_STOP, &priv->flags)) | 655 | if (!test_bit(IPOIB_PKEY_STOP, &priv->flags)) |
667 | queue_delayed_work(ipoib_workqueue, | 656 | queue_delayed_work(ipoib_workqueue, |
668 | &priv->pkey_task, | 657 | &priv->pkey_task, |
669 | HZ); | 658 | HZ); |
670 | up(&pkey_sem); | 659 | mutex_unlock(&pkey_mutex); |
671 | } | 660 | } |
672 | } | 661 | } |
673 | 662 | ||
@@ -681,12 +670,12 @@ int ipoib_pkey_dev_delay_open(struct net_device *dev) | |||
681 | 670 | ||
682 | /* P_Key value not assigned yet - start polling */ | 671 | /* P_Key value not assigned yet - start polling */ |
683 | if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) { | 672 | if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) { |
684 | down(&pkey_sem); | 673 | mutex_lock(&pkey_mutex); |
685 | clear_bit(IPOIB_PKEY_STOP, &priv->flags); | 674 | clear_bit(IPOIB_PKEY_STOP, &priv->flags); |
686 | queue_delayed_work(ipoib_workqueue, | 675 | queue_delayed_work(ipoib_workqueue, |
687 | &priv->pkey_task, | 676 | &priv->pkey_task, |
688 | HZ); | 677 | HZ); |
689 | up(&pkey_sem); | 678 | mutex_unlock(&pkey_mutex); |
690 | return 1; | 679 | return 1; |
691 | } | 680 | } |
692 | 681 | ||