aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-13 17:51:39 -0500
committerRoland Dreier <rolandd@cisco.com>2006-01-13 17:51:39 -0500
commit95ed644fd12f53c6fc778f3f246974e5fe3a9468 (patch)
treeedf9f57192ad95f9165b3be5dbf1e8e745249ed1 /drivers/infiniband/ulp
parent9eacee2ac624bfa9740d49355dbe6ee88d0cba0a (diff)
IB: convert from semaphores to mutexes
semaphore to mutex conversion by Ingo and Arjan's script. Signed-off-by: Ingo Molnar <mingo@elte.hu> [ Sanity-checked on real IB hardware ] Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h6
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c18
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c12
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c26
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_verbs.c8
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_vlan.c10
6 files changed, 40 insertions, 40 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index 9923a15a9996..e0a5412b7e68 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -45,11 +45,11 @@
45#include <linux/config.h> 45#include <linux/config.h>
46#include <linux/kref.h> 46#include <linux/kref.h>
47#include <linux/if_infiniband.h> 47#include <linux/if_infiniband.h>
48#include <linux/mutex.h>
48 49
49#include <net/neighbour.h> 50#include <net/neighbour.h>
50 51
51#include <asm/atomic.h> 52#include <asm/atomic.h>
52#include <asm/semaphore.h>
53 53
54#include <rdma/ib_verbs.h> 54#include <rdma/ib_verbs.h>
55#include <rdma/ib_pack.h> 55#include <rdma/ib_pack.h>
@@ -123,8 +123,8 @@ struct ipoib_dev_priv {
123 123
124 unsigned long flags; 124 unsigned long flags;
125 125
126 struct semaphore mcast_mutex; 126 struct mutex mcast_mutex;
127 struct semaphore vlan_mutex; 127 struct mutex vlan_mutex;
128 128
129 struct rb_root path_tree; 129 struct rb_root path_tree;
130 struct list_head path_list; 130 struct list_head path_list;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index f7e848970794..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
55static DECLARE_MUTEX(pkey_sem); 55static DEFINE_MUTEX(pkey_mutex);
56 56
57struct ipoib_ah *ipoib_create_ah(struct net_device *dev, 57struct 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,10 +445,10 @@ 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
@@ -599,13 +599,13 @@ void ipoib_ib_dev_flush(void *_dev)
599 if (test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) 599 if (test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
600 ipoib_ib_dev_up(dev); 600 ipoib_ib_dev_up(dev);
601 601
602 down(&priv->vlan_mutex); 602 mutex_lock(&priv->vlan_mutex);
603 603
604 /* Flush any child interfaces too */ 604 /* Flush any child interfaces too */
605 list_for_each_entry(cpriv, &priv->child_intfs, list) 605 list_for_each_entry(cpriv, &priv->child_intfs, list)
606 ipoib_ib_dev_flush(&cpriv->dev); 606 ipoib_ib_dev_flush(&cpriv->dev);
607 607
608 up(&priv->vlan_mutex); 608 mutex_unlock(&priv->vlan_mutex);
609} 609}
610 610
611void ipoib_ib_dev_cleanup(struct net_device *dev) 611void ipoib_ib_dev_cleanup(struct net_device *dev)
@@ -651,12 +651,12 @@ void ipoib_pkey_poll(void *dev_ptr)
651 if (test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) 651 if (test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags))
652 ipoib_open(dev); 652 ipoib_open(dev);
653 else { 653 else {
654 down(&pkey_sem); 654 mutex_lock(&pkey_mutex);
655 if (!test_bit(IPOIB_PKEY_STOP, &priv->flags)) 655 if (!test_bit(IPOIB_PKEY_STOP, &priv->flags))
656 queue_delayed_work(ipoib_workqueue, 656 queue_delayed_work(ipoib_workqueue,
657 &priv->pkey_task, 657 &priv->pkey_task,
658 HZ); 658 HZ);
659 up(&pkey_sem); 659 mutex_unlock(&pkey_mutex);
660 } 660 }
661} 661}
662 662
@@ -670,12 +670,12 @@ int ipoib_pkey_dev_delay_open(struct net_device *dev)
670 670
671 /* P_Key value not assigned yet - start polling */ 671 /* P_Key value not assigned yet - start polling */
672 if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) { 672 if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) {
673 down(&pkey_sem); 673 mutex_lock(&pkey_mutex);
674 clear_bit(IPOIB_PKEY_STOP, &priv->flags); 674 clear_bit(IPOIB_PKEY_STOP, &priv->flags);
675 queue_delayed_work(ipoib_workqueue, 675 queue_delayed_work(ipoib_workqueue,
676 &priv->pkey_task, 676 &priv->pkey_task,
677 HZ); 677 HZ);
678 up(&pkey_sem); 678 mutex_unlock(&pkey_mutex);
679 return 1; 679 return 1;
680 } 680 }
681 681
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 780009c7eaa6..fd3f5c862a5d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -105,7 +105,7 @@ int ipoib_open(struct net_device *dev)
105 struct ipoib_dev_priv *cpriv; 105 struct ipoib_dev_priv *cpriv;
106 106
107 /* Bring up any child interfaces too */ 107 /* Bring up any child interfaces too */
108 down(&priv->vlan_mutex); 108 mutex_lock(&priv->vlan_mutex);
109 list_for_each_entry(cpriv, &priv->child_intfs, list) { 109 list_for_each_entry(cpriv, &priv->child_intfs, list) {
110 int flags; 110 int flags;
111 111
@@ -115,7 +115,7 @@ int ipoib_open(struct net_device *dev)
115 115
116 dev_change_flags(cpriv->dev, flags | IFF_UP); 116 dev_change_flags(cpriv->dev, flags | IFF_UP);
117 } 117 }
118 up(&priv->vlan_mutex); 118 mutex_unlock(&priv->vlan_mutex);
119 } 119 }
120 120
121 netif_start_queue(dev); 121 netif_start_queue(dev);
@@ -140,7 +140,7 @@ static int ipoib_stop(struct net_device *dev)
140 struct ipoib_dev_priv *cpriv; 140 struct ipoib_dev_priv *cpriv;
141 141
142 /* Bring down any child interfaces too */ 142 /* Bring down any child interfaces too */
143 down(&priv->vlan_mutex); 143 mutex_lock(&priv->vlan_mutex);
144 list_for_each_entry(cpriv, &priv->child_intfs, list) { 144 list_for_each_entry(cpriv, &priv->child_intfs, list) {
145 int flags; 145 int flags;
146 146
@@ -150,7 +150,7 @@ static int ipoib_stop(struct net_device *dev)
150 150
151 dev_change_flags(cpriv->dev, flags & ~IFF_UP); 151 dev_change_flags(cpriv->dev, flags & ~IFF_UP);
152 } 152 }
153 up(&priv->vlan_mutex); 153 mutex_unlock(&priv->vlan_mutex);
154 } 154 }
155 155
156 return 0; 156 return 0;
@@ -892,8 +892,8 @@ static void ipoib_setup(struct net_device *dev)
892 spin_lock_init(&priv->lock); 892 spin_lock_init(&priv->lock);
893 spin_lock_init(&priv->tx_lock); 893 spin_lock_init(&priv->tx_lock);
894 894
895 init_MUTEX(&priv->mcast_mutex); 895 mutex_init(&priv->mcast_mutex);
896 init_MUTEX(&priv->vlan_mutex); 896 mutex_init(&priv->vlan_mutex);
897 897
898 INIT_LIST_HEAD(&priv->path_list); 898 INIT_LIST_HEAD(&priv->path_list);
899 INIT_LIST_HEAD(&priv->child_intfs); 899 INIT_LIST_HEAD(&priv->child_intfs);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 7403bac1977b..98039da0caf0 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -55,7 +55,7 @@ MODULE_PARM_DESC(mcast_debug_level,
55 "Enable multicast debug tracing if > 0"); 55 "Enable multicast debug tracing if > 0");
56#endif 56#endif
57 57
58static DECLARE_MUTEX(mcast_mutex); 58static DEFINE_MUTEX(mcast_mutex);
59 59
60/* Used for all multicast joins (broadcast, IPv4 mcast and IPv6 mcast) */ 60/* Used for all multicast joins (broadcast, IPv4 mcast and IPv6 mcast) */
61struct ipoib_mcast { 61struct ipoib_mcast {
@@ -385,10 +385,10 @@ static void ipoib_mcast_join_complete(int status,
385 385
386 if (!status && !ipoib_mcast_join_finish(mcast, mcmember)) { 386 if (!status && !ipoib_mcast_join_finish(mcast, mcmember)) {
387 mcast->backoff = 1; 387 mcast->backoff = 1;
388 down(&mcast_mutex); 388 mutex_lock(&mcast_mutex);
389 if (test_bit(IPOIB_MCAST_RUN, &priv->flags)) 389 if (test_bit(IPOIB_MCAST_RUN, &priv->flags))
390 queue_work(ipoib_workqueue, &priv->mcast_task); 390 queue_work(ipoib_workqueue, &priv->mcast_task);
391 up(&mcast_mutex); 391 mutex_unlock(&mcast_mutex);
392 complete(&mcast->done); 392 complete(&mcast->done);
393 return; 393 return;
394 } 394 }
@@ -418,7 +418,7 @@ static void ipoib_mcast_join_complete(int status,
418 418
419 mcast->query = NULL; 419 mcast->query = NULL;
420 420
421 down(&mcast_mutex); 421 mutex_lock(&mcast_mutex);
422 if (test_bit(IPOIB_MCAST_RUN, &priv->flags)) { 422 if (test_bit(IPOIB_MCAST_RUN, &priv->flags)) {
423 if (status == -ETIMEDOUT) 423 if (status == -ETIMEDOUT)
424 queue_work(ipoib_workqueue, &priv->mcast_task); 424 queue_work(ipoib_workqueue, &priv->mcast_task);
@@ -427,7 +427,7 @@ static void ipoib_mcast_join_complete(int status,
427 mcast->backoff * HZ); 427 mcast->backoff * HZ);
428 } else 428 } else
429 complete(&mcast->done); 429 complete(&mcast->done);
430 up(&mcast_mutex); 430 mutex_unlock(&mcast_mutex);
431 431
432 return; 432 return;
433} 433}
@@ -482,12 +482,12 @@ static void ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast,
482 if (mcast->backoff > IPOIB_MAX_BACKOFF_SECONDS) 482 if (mcast->backoff > IPOIB_MAX_BACKOFF_SECONDS)
483 mcast->backoff = IPOIB_MAX_BACKOFF_SECONDS; 483 mcast->backoff = IPOIB_MAX_BACKOFF_SECONDS;
484 484
485 down(&mcast_mutex); 485 mutex_lock(&mcast_mutex);
486 if (test_bit(IPOIB_MCAST_RUN, &priv->flags)) 486 if (test_bit(IPOIB_MCAST_RUN, &priv->flags))
487 queue_delayed_work(ipoib_workqueue, 487 queue_delayed_work(ipoib_workqueue,
488 &priv->mcast_task, 488 &priv->mcast_task,
489 mcast->backoff * HZ); 489 mcast->backoff * HZ);
490 up(&mcast_mutex); 490 mutex_unlock(&mcast_mutex);
491 } else 491 } else
492 mcast->query_id = ret; 492 mcast->query_id = ret;
493} 493}
@@ -520,11 +520,11 @@ void ipoib_mcast_join_task(void *dev_ptr)
520 priv->broadcast = ipoib_mcast_alloc(dev, 1); 520 priv->broadcast = ipoib_mcast_alloc(dev, 1);
521 if (!priv->broadcast) { 521 if (!priv->broadcast) {
522 ipoib_warn(priv, "failed to allocate broadcast group\n"); 522 ipoib_warn(priv, "failed to allocate broadcast group\n");
523 down(&mcast_mutex); 523 mutex_lock(&mcast_mutex);
524 if (test_bit(IPOIB_MCAST_RUN, &priv->flags)) 524 if (test_bit(IPOIB_MCAST_RUN, &priv->flags))
525 queue_delayed_work(ipoib_workqueue, 525 queue_delayed_work(ipoib_workqueue,
526 &priv->mcast_task, HZ); 526 &priv->mcast_task, HZ);
527 up(&mcast_mutex); 527 mutex_unlock(&mcast_mutex);
528 return; 528 return;
529 } 529 }
530 530
@@ -580,10 +580,10 @@ int ipoib_mcast_start_thread(struct net_device *dev)
580 580
581 ipoib_dbg_mcast(priv, "starting multicast thread\n"); 581 ipoib_dbg_mcast(priv, "starting multicast thread\n");
582 582
583 down(&mcast_mutex); 583 mutex_lock(&mcast_mutex);
584 if (!test_and_set_bit(IPOIB_MCAST_RUN, &priv->flags)) 584 if (!test_and_set_bit(IPOIB_MCAST_RUN, &priv->flags))
585 queue_work(ipoib_workqueue, &priv->mcast_task); 585 queue_work(ipoib_workqueue, &priv->mcast_task);
586 up(&mcast_mutex); 586 mutex_unlock(&mcast_mutex);
587 587
588 return 0; 588 return 0;
589} 589}
@@ -595,10 +595,10 @@ int ipoib_mcast_stop_thread(struct net_device *dev, int flush)
595 595
596 ipoib_dbg_mcast(priv, "stopping multicast thread\n"); 596 ipoib_dbg_mcast(priv, "stopping multicast thread\n");
597 597
598 down(&mcast_mutex); 598 mutex_lock(&mcast_mutex);
599 clear_bit(IPOIB_MCAST_RUN, &priv->flags); 599 clear_bit(IPOIB_MCAST_RUN, &priv->flags);
600 cancel_delayed_work(&priv->mcast_task); 600 cancel_delayed_work(&priv->mcast_task);
601 up(&mcast_mutex); 601 mutex_unlock(&mcast_mutex);
602 602
603 if (flush) 603 if (flush)
604 flush_workqueue(ipoib_workqueue); 604 flush_workqueue(ipoib_workqueue);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
index e829e10400e3..faaf10e5fc7b 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
@@ -65,9 +65,9 @@ int ipoib_mcast_attach(struct net_device *dev, u16 mlid, union ib_gid *mgid)
65 } 65 }
66 66
67 /* attach QP to multicast group */ 67 /* attach QP to multicast group */
68 down(&priv->mcast_mutex); 68 mutex_lock(&priv->mcast_mutex);
69 ret = ib_attach_mcast(priv->qp, mgid, mlid); 69 ret = ib_attach_mcast(priv->qp, mgid, mlid);
70 up(&priv->mcast_mutex); 70 mutex_unlock(&priv->mcast_mutex);
71 if (ret) 71 if (ret)
72 ipoib_warn(priv, "failed to attach to multicast group, ret = %d\n", ret); 72 ipoib_warn(priv, "failed to attach to multicast group, ret = %d\n", ret);
73 73
@@ -81,9 +81,9 @@ int ipoib_mcast_detach(struct net_device *dev, u16 mlid, union ib_gid *mgid)
81 struct ipoib_dev_priv *priv = netdev_priv(dev); 81 struct ipoib_dev_priv *priv = netdev_priv(dev);
82 int ret; 82 int ret;
83 83
84 down(&priv->mcast_mutex); 84 mutex_lock(&priv->mcast_mutex);
85 ret = ib_detach_mcast(priv->qp, mgid, mlid); 85 ret = ib_detach_mcast(priv->qp, mgid, mlid);
86 up(&priv->mcast_mutex); 86 mutex_unlock(&priv->mcast_mutex);
87 if (ret) 87 if (ret)
88 ipoib_warn(priv, "ib_detach_mcast failed (result = %d)\n", ret); 88 ipoib_warn(priv, "ib_detach_mcast failed (result = %d)\n", ret);
89 89
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
index d280b341a37f..4ca175553f9f 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
@@ -63,7 +63,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
63 63
64 ppriv = netdev_priv(pdev); 64 ppriv = netdev_priv(pdev);
65 65
66 down(&ppriv->vlan_mutex); 66 mutex_lock(&ppriv->vlan_mutex);
67 67
68 /* 68 /*
69 * First ensure this isn't a duplicate. We check the parent device and 69 * First ensure this isn't a duplicate. We check the parent device and
@@ -124,7 +124,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
124 124
125 list_add_tail(&priv->list, &ppriv->child_intfs); 125 list_add_tail(&priv->list, &ppriv->child_intfs);
126 126
127 up(&ppriv->vlan_mutex); 127 mutex_unlock(&ppriv->vlan_mutex);
128 128
129 return 0; 129 return 0;
130 130
@@ -139,7 +139,7 @@ device_init_failed:
139 free_netdev(priv->dev); 139 free_netdev(priv->dev);
140 140
141err: 141err:
142 up(&ppriv->vlan_mutex); 142 mutex_unlock(&ppriv->vlan_mutex);
143 return result; 143 return result;
144} 144}
145 145
@@ -153,7 +153,7 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
153 153
154 ppriv = netdev_priv(pdev); 154 ppriv = netdev_priv(pdev);
155 155
156 down(&ppriv->vlan_mutex); 156 mutex_lock(&ppriv->vlan_mutex);
157 list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) { 157 list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) {
158 if (priv->pkey == pkey) { 158 if (priv->pkey == pkey) {
159 unregister_netdev(priv->dev); 159 unregister_netdev(priv->dev);
@@ -167,7 +167,7 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
167 break; 167 break;
168 } 168 }
169 } 169 }
170 up(&ppriv->vlan_mutex); 170 mutex_unlock(&ppriv->vlan_mutex);
171 171
172 return ret; 172 return ret;
173} 173}