diff options
| author | Jack Morgenstein <jackm@mellanox.co.il> | 2006-03-20 13:08:24 -0500 | 
|---|---|---|
| committer | Roland Dreier <rolandd@cisco.com> | 2006-03-20 13:08:24 -0500 | 
| commit | 0b3ea0829cbcdaee6e018a83a2949ef458213f3b (patch) | |
| tree | 3e86dc70e4b71b1de1e9ab2df319b014dd242f7c | |
| parent | 8b9ab02b690e988f19c9d740ef642d7d833d23d5 (diff) | |
IPoIB: Move ipoib_ib_dev_flush() to ipoib workqueue
Move ipoib_ib_dev_flush() to ipoib's workqueue.  This keeps it ordered
with respect to other work scheduled by the ipoib driver.  This fixes
problems with races, for example:
 - ipoib_ib_dev_flush() has started running because of an IB event
 - user does ifconfig ib0 down
 - ipoib_mcast_stop_thread() gets called twice and waits for the same
   completion twice
Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
| -rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib.h | 2 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_ib.c | 9 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 2 | 
4 files changed, 14 insertions, 7 deletions
| diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 638eff745b2f..1251f86ec856 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
| @@ -259,7 +259,7 @@ void ipoib_ib_dev_cleanup(struct net_device *dev); | |||
| 259 | 259 | ||
| 260 | int ipoib_ib_dev_open(struct net_device *dev); | 260 | int ipoib_ib_dev_open(struct net_device *dev); | 
| 261 | int ipoib_ib_dev_up(struct net_device *dev); | 261 | int ipoib_ib_dev_up(struct net_device *dev); | 
| 262 | int ipoib_ib_dev_down(struct net_device *dev); | 262 | int ipoib_ib_dev_down(struct net_device *dev, int flush); | 
| 263 | int ipoib_ib_dev_stop(struct net_device *dev); | 263 | int ipoib_ib_dev_stop(struct net_device *dev); | 
| 264 | 264 | ||
| 265 | int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port); | 265 | int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port); | 
| diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 5a5367d10875..a1f5a05f2f36 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
| @@ -435,7 +435,7 @@ int ipoib_ib_dev_up(struct net_device *dev) | |||
| 435 | return ipoib_mcast_start_thread(dev); | 435 | return ipoib_mcast_start_thread(dev); | 
| 436 | } | 436 | } | 
| 437 | 437 | ||
| 438 | int ipoib_ib_dev_down(struct net_device *dev) | 438 | int ipoib_ib_dev_down(struct net_device *dev, int flush) | 
| 439 | { | 439 | { | 
| 440 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 440 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 
| 441 | 441 | ||
| @@ -450,10 +450,11 @@ int ipoib_ib_dev_down(struct net_device *dev) | |||
| 450 | set_bit(IPOIB_PKEY_STOP, &priv->flags); | 450 | set_bit(IPOIB_PKEY_STOP, &priv->flags); | 
| 451 | cancel_delayed_work(&priv->pkey_task); | 451 | cancel_delayed_work(&priv->pkey_task); | 
| 452 | mutex_unlock(&pkey_mutex); | 452 | mutex_unlock(&pkey_mutex); | 
| 453 | flush_workqueue(ipoib_workqueue); | 453 | if (flush) | 
| 454 | flush_workqueue(ipoib_workqueue); | ||
| 454 | } | 455 | } | 
| 455 | 456 | ||
| 456 | ipoib_mcast_stop_thread(dev, 1); | 457 | ipoib_mcast_stop_thread(dev, flush); | 
| 457 | ipoib_mcast_dev_flush(dev); | 458 | ipoib_mcast_dev_flush(dev); | 
| 458 | 459 | ||
| 459 | ipoib_flush_paths(dev); | 460 | ipoib_flush_paths(dev); | 
| @@ -591,7 +592,7 @@ void ipoib_ib_dev_flush(void *_dev) | |||
| 591 | 592 | ||
| 592 | ipoib_dbg(priv, "flushing\n"); | 593 | ipoib_dbg(priv, "flushing\n"); | 
| 593 | 594 | ||
| 594 | ipoib_ib_dev_down(dev); | 595 | ipoib_ib_dev_down(dev, 0); | 
| 595 | 596 | ||
| 596 | /* | 597 | /* | 
| 597 | * The device could have been brought down between the start and when | 598 | * The device could have been brought down between the start and when | 
| diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index c3b5f79d1168..1633aadae421 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
| @@ -133,7 +133,13 @@ static int ipoib_stop(struct net_device *dev) | |||
| 133 | 133 | ||
| 134 | netif_stop_queue(dev); | 134 | netif_stop_queue(dev); | 
| 135 | 135 | ||
| 136 | ipoib_ib_dev_down(dev); | 136 | /* | 
| 137 | * Now flush workqueue to make sure a scheduled task doesn't | ||
| 138 | * bring our internal state back up. | ||
| 139 | */ | ||
| 140 | flush_workqueue(ipoib_workqueue); | ||
| 141 | |||
| 142 | ipoib_ib_dev_down(dev, 1); | ||
| 137 | ipoib_ib_dev_stop(dev); | 143 | ipoib_ib_dev_stop(dev); | 
| 138 | 144 | ||
| 139 | if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { | 145 | if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { | 
| diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c index faaf10e5fc7b..18d2f53ec34c 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c | |||
| @@ -255,6 +255,6 @@ void ipoib_event(struct ib_event_handler *handler, | |||
| 255 | record->event == IB_EVENT_LID_CHANGE || | 255 | record->event == IB_EVENT_LID_CHANGE || | 
| 256 | record->event == IB_EVENT_SM_CHANGE) { | 256 | record->event == IB_EVENT_SM_CHANGE) { | 
| 257 | ipoib_dbg(priv, "Port active event\n"); | 257 | ipoib_dbg(priv, "Port active event\n"); | 
| 258 | schedule_work(&priv->flush_task); | 258 | queue_work(ipoib_workqueue, &priv->flush_task); | 
| 259 | } | 259 | } | 
| 260 | } | 260 | } | 
