diff options
author | Joachim Fenkes <fenkes@de.ibm.com> | 2007-07-09 09:29:03 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-07-09 23:12:27 -0400 |
commit | 9844b71baa60270110eabaa9589d3260443d1a71 (patch) | |
tree | 30e443f3329bf1c0b4e78d0787c8e33158dff59e /drivers/infiniband | |
parent | 15f001ec47b049051f679f8b8c965ac9aae95b3e (diff) |
IB/ehca: Lock renaming, static initializers
- Rename all spinlock flags to "flags", matching the vast majority of kernel
code.
- Move hcall_lock into the only file it's used in.
- Replaced spin_lock_init() and friends with static initializers for
global variables.
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_classes.h | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_cq.c | 12 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_main.c | 18 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_qp.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_reqs.c | 24 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/hcp_if.c | 2 |
6 files changed, 27 insertions, 36 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 9d689aeb928a..3550047c1375 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
@@ -295,7 +295,6 @@ void ehca_cleanup_mrmw_cache(void); | |||
295 | 295 | ||
296 | extern spinlock_t ehca_qp_idr_lock; | 296 | extern spinlock_t ehca_qp_idr_lock; |
297 | extern spinlock_t ehca_cq_idr_lock; | 297 | extern spinlock_t ehca_cq_idr_lock; |
298 | extern spinlock_t hcall_lock; | ||
299 | extern struct idr ehca_qp_idr; | 298 | extern struct idr ehca_qp_idr; |
300 | extern struct idr ehca_cq_idr; | 299 | extern struct idr ehca_cq_idr; |
301 | 300 | ||
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c index 67f0670fe3b1..94bad273b34c 100644 --- a/drivers/infiniband/hw/ehca/ehca_cq.c +++ b/drivers/infiniband/hw/ehca/ehca_cq.c | |||
@@ -56,11 +56,11 @@ int ehca_cq_assign_qp(struct ehca_cq *cq, struct ehca_qp *qp) | |||
56 | { | 56 | { |
57 | unsigned int qp_num = qp->real_qp_num; | 57 | unsigned int qp_num = qp->real_qp_num; |
58 | unsigned int key = qp_num & (QP_HASHTAB_LEN-1); | 58 | unsigned int key = qp_num & (QP_HASHTAB_LEN-1); |
59 | unsigned long spl_flags; | 59 | unsigned long flags; |
60 | 60 | ||
61 | spin_lock_irqsave(&cq->spinlock, spl_flags); | 61 | spin_lock_irqsave(&cq->spinlock, flags); |
62 | hlist_add_head(&qp->list_entries, &cq->qp_hashtab[key]); | 62 | hlist_add_head(&qp->list_entries, &cq->qp_hashtab[key]); |
63 | spin_unlock_irqrestore(&cq->spinlock, spl_flags); | 63 | spin_unlock_irqrestore(&cq->spinlock, flags); |
64 | 64 | ||
65 | ehca_dbg(cq->ib_cq.device, "cq_num=%x real_qp_num=%x", | 65 | ehca_dbg(cq->ib_cq.device, "cq_num=%x real_qp_num=%x", |
66 | cq->cq_number, qp_num); | 66 | cq->cq_number, qp_num); |
@@ -74,9 +74,9 @@ int ehca_cq_unassign_qp(struct ehca_cq *cq, unsigned int real_qp_num) | |||
74 | unsigned int key = real_qp_num & (QP_HASHTAB_LEN-1); | 74 | unsigned int key = real_qp_num & (QP_HASHTAB_LEN-1); |
75 | struct hlist_node *iter; | 75 | struct hlist_node *iter; |
76 | struct ehca_qp *qp; | 76 | struct ehca_qp *qp; |
77 | unsigned long spl_flags; | 77 | unsigned long flags; |
78 | 78 | ||
79 | spin_lock_irqsave(&cq->spinlock, spl_flags); | 79 | spin_lock_irqsave(&cq->spinlock, flags); |
80 | hlist_for_each(iter, &cq->qp_hashtab[key]) { | 80 | hlist_for_each(iter, &cq->qp_hashtab[key]) { |
81 | qp = hlist_entry(iter, struct ehca_qp, list_entries); | 81 | qp = hlist_entry(iter, struct ehca_qp, list_entries); |
82 | if (qp->real_qp_num == real_qp_num) { | 82 | if (qp->real_qp_num == real_qp_num) { |
@@ -88,7 +88,7 @@ int ehca_cq_unassign_qp(struct ehca_cq *cq, unsigned int real_qp_num) | |||
88 | break; | 88 | break; |
89 | } | 89 | } |
90 | } | 90 | } |
91 | spin_unlock_irqrestore(&cq->spinlock, spl_flags); | 91 | spin_unlock_irqrestore(&cq->spinlock, flags); |
92 | if (ret) | 92 | if (ret) |
93 | ehca_err(cq->ib_cq.device, | 93 | ehca_err(cq->ib_cq.device, |
94 | "qp not found cq_num=%x real_qp_num=%x", | 94 | "qp not found cq_num=%x real_qp_num=%x", |
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index ca215bac9742..32396b203f14 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
@@ -96,15 +96,13 @@ MODULE_PARM_DESC(static_rate, | |||
96 | MODULE_PARM_DESC(scaling_code, | 96 | MODULE_PARM_DESC(scaling_code, |
97 | "set scaling code (0: disabled/default, 1: enabled)"); | 97 | "set scaling code (0: disabled/default, 1: enabled)"); |
98 | 98 | ||
99 | spinlock_t ehca_qp_idr_lock; | 99 | DEFINE_SPINLOCK(ehca_qp_idr_lock); |
100 | spinlock_t ehca_cq_idr_lock; | 100 | DEFINE_SPINLOCK(ehca_cq_idr_lock); |
101 | spinlock_t hcall_lock; | ||
102 | DEFINE_IDR(ehca_qp_idr); | 101 | DEFINE_IDR(ehca_qp_idr); |
103 | DEFINE_IDR(ehca_cq_idr); | 102 | DEFINE_IDR(ehca_cq_idr); |
104 | 103 | ||
105 | 104 | static LIST_HEAD(shca_list); /* list of all registered ehcas */ | |
106 | static struct list_head shca_list; /* list of all registered ehcas */ | 105 | static DEFINE_SPINLOCK(shca_list_lock); |
107 | static spinlock_t shca_list_lock; | ||
108 | 106 | ||
109 | static struct timer_list poll_eqs_timer; | 107 | static struct timer_list poll_eqs_timer; |
110 | 108 | ||
@@ -864,14 +862,6 @@ int __init ehca_module_init(void) | |||
864 | 862 | ||
865 | printk(KERN_INFO "eHCA Infiniband Device Driver " | 863 | printk(KERN_INFO "eHCA Infiniband Device Driver " |
866 | "(Rel.: SVNEHCA_0023)\n"); | 864 | "(Rel.: SVNEHCA_0023)\n"); |
867 | idr_init(&ehca_qp_idr); | ||
868 | idr_init(&ehca_cq_idr); | ||
869 | spin_lock_init(&ehca_qp_idr_lock); | ||
870 | spin_lock_init(&ehca_cq_idr_lock); | ||
871 | spin_lock_init(&hcall_lock); | ||
872 | |||
873 | INIT_LIST_HEAD(&shca_list); | ||
874 | spin_lock_init(&shca_list_lock); | ||
875 | 865 | ||
876 | if ((ret = ehca_create_comp_pool())) { | 866 | if ((ret = ehca_create_comp_pool())) { |
877 | ehca_gen_err("Cannot create comp pool."); | 867 | ehca_gen_err("Cannot create comp pool."); |
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c index ec34ff432900..31d21526df5e 100644 --- a/drivers/infiniband/hw/ehca/ehca_qp.c +++ b/drivers/infiniband/hw/ehca/ehca_qp.c | |||
@@ -933,7 +933,7 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
933 | u64 h_ret; | 933 | u64 h_ret; |
934 | int bad_wqe_cnt = 0; | 934 | int bad_wqe_cnt = 0; |
935 | int squeue_locked = 0; | 935 | int squeue_locked = 0; |
936 | unsigned long spl_flags = 0; | 936 | unsigned long flags = 0; |
937 | 937 | ||
938 | /* do query_qp to obtain current attr values */ | 938 | /* do query_qp to obtain current attr values */ |
939 | mqpcb = ehca_alloc_fw_ctrlblock(GFP_KERNEL); | 939 | mqpcb = ehca_alloc_fw_ctrlblock(GFP_KERNEL); |
@@ -1074,7 +1074,7 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1074 | if (!ibqp->uobject) { | 1074 | if (!ibqp->uobject) { |
1075 | struct ehca_wqe *wqe; | 1075 | struct ehca_wqe *wqe; |
1076 | /* lock send queue */ | 1076 | /* lock send queue */ |
1077 | spin_lock_irqsave(&my_qp->spinlock_s, spl_flags); | 1077 | spin_lock_irqsave(&my_qp->spinlock_s, flags); |
1078 | squeue_locked = 1; | 1078 | squeue_locked = 1; |
1079 | /* mark next free wqe */ | 1079 | /* mark next free wqe */ |
1080 | wqe = (struct ehca_wqe*) | 1080 | wqe = (struct ehca_wqe*) |
@@ -1360,7 +1360,7 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1360 | 1360 | ||
1361 | modify_qp_exit2: | 1361 | modify_qp_exit2: |
1362 | if (squeue_locked) { /* this means: sqe -> rts */ | 1362 | if (squeue_locked) { /* this means: sqe -> rts */ |
1363 | spin_unlock_irqrestore(&my_qp->spinlock_s, spl_flags); | 1363 | spin_unlock_irqrestore(&my_qp->spinlock_s, flags); |
1364 | my_qp->sqerr_purgeflag = 1; | 1364 | my_qp->sqerr_purgeflag = 1; |
1365 | } | 1365 | } |
1366 | 1366 | ||
diff --git a/drivers/infiniband/hw/ehca/ehca_reqs.c b/drivers/infiniband/hw/ehca/ehca_reqs.c index b5664fa34de3..73f0c0652a00 100644 --- a/drivers/infiniband/hw/ehca/ehca_reqs.c +++ b/drivers/infiniband/hw/ehca/ehca_reqs.c | |||
@@ -363,10 +363,10 @@ int ehca_post_send(struct ib_qp *qp, | |||
363 | struct ehca_wqe *wqe_p; | 363 | struct ehca_wqe *wqe_p; |
364 | int wqe_cnt = 0; | 364 | int wqe_cnt = 0; |
365 | int ret = 0; | 365 | int ret = 0; |
366 | unsigned long spl_flags; | 366 | unsigned long flags; |
367 | 367 | ||
368 | /* LOCK the QUEUE */ | 368 | /* LOCK the QUEUE */ |
369 | spin_lock_irqsave(&my_qp->spinlock_s, spl_flags); | 369 | spin_lock_irqsave(&my_qp->spinlock_s, flags); |
370 | 370 | ||
371 | /* loop processes list of send reqs */ | 371 | /* loop processes list of send reqs */ |
372 | for (cur_send_wr = send_wr; cur_send_wr != NULL; | 372 | for (cur_send_wr = send_wr; cur_send_wr != NULL; |
@@ -408,7 +408,7 @@ int ehca_post_send(struct ib_qp *qp, | |||
408 | 408 | ||
409 | post_send_exit0: | 409 | post_send_exit0: |
410 | /* UNLOCK the QUEUE */ | 410 | /* UNLOCK the QUEUE */ |
411 | spin_unlock_irqrestore(&my_qp->spinlock_s, spl_flags); | 411 | spin_unlock_irqrestore(&my_qp->spinlock_s, flags); |
412 | iosync(); /* serialize GAL register access */ | 412 | iosync(); /* serialize GAL register access */ |
413 | hipz_update_sqa(my_qp, wqe_cnt); | 413 | hipz_update_sqa(my_qp, wqe_cnt); |
414 | return ret; | 414 | return ret; |
@@ -423,7 +423,7 @@ static int internal_post_recv(struct ehca_qp *my_qp, | |||
423 | struct ehca_wqe *wqe_p; | 423 | struct ehca_wqe *wqe_p; |
424 | int wqe_cnt = 0; | 424 | int wqe_cnt = 0; |
425 | int ret = 0; | 425 | int ret = 0; |
426 | unsigned long spl_flags; | 426 | unsigned long flags; |
427 | 427 | ||
428 | if (unlikely(!HAS_RQ(my_qp))) { | 428 | if (unlikely(!HAS_RQ(my_qp))) { |
429 | ehca_err(dev, "QP has no RQ ehca_qp=%p qp_num=%x ext_type=%d", | 429 | ehca_err(dev, "QP has no RQ ehca_qp=%p qp_num=%x ext_type=%d", |
@@ -432,7 +432,7 @@ static int internal_post_recv(struct ehca_qp *my_qp, | |||
432 | } | 432 | } |
433 | 433 | ||
434 | /* LOCK the QUEUE */ | 434 | /* LOCK the QUEUE */ |
435 | spin_lock_irqsave(&my_qp->spinlock_r, spl_flags); | 435 | spin_lock_irqsave(&my_qp->spinlock_r, flags); |
436 | 436 | ||
437 | /* loop processes list of send reqs */ | 437 | /* loop processes list of send reqs */ |
438 | for (cur_recv_wr = recv_wr; cur_recv_wr != NULL; | 438 | for (cur_recv_wr = recv_wr; cur_recv_wr != NULL; |
@@ -473,7 +473,7 @@ static int internal_post_recv(struct ehca_qp *my_qp, | |||
473 | } /* eof for cur_recv_wr */ | 473 | } /* eof for cur_recv_wr */ |
474 | 474 | ||
475 | post_recv_exit0: | 475 | post_recv_exit0: |
476 | spin_unlock_irqrestore(&my_qp->spinlock_r, spl_flags); | 476 | spin_unlock_irqrestore(&my_qp->spinlock_r, flags); |
477 | iosync(); /* serialize GAL register access */ | 477 | iosync(); /* serialize GAL register access */ |
478 | hipz_update_rqa(my_qp, wqe_cnt); | 478 | hipz_update_rqa(my_qp, wqe_cnt); |
479 | return ret; | 479 | return ret; |
@@ -536,7 +536,7 @@ poll_cq_one_read_cqe: | |||
536 | if (unlikely(cqe->status & WC_STATUS_PURGE_BIT)) { | 536 | if (unlikely(cqe->status & WC_STATUS_PURGE_BIT)) { |
537 | struct ehca_qp *qp=ehca_cq_get_qp(my_cq, cqe->local_qp_number); | 537 | struct ehca_qp *qp=ehca_cq_get_qp(my_cq, cqe->local_qp_number); |
538 | int purgeflag; | 538 | int purgeflag; |
539 | unsigned long spl_flags; | 539 | unsigned long flags; |
540 | if (!qp) { | 540 | if (!qp) { |
541 | ehca_err(cq->device, "cq_num=%x qp_num=%x " | 541 | ehca_err(cq->device, "cq_num=%x qp_num=%x " |
542 | "could not find qp -> ignore cqe", | 542 | "could not find qp -> ignore cqe", |
@@ -546,9 +546,9 @@ poll_cq_one_read_cqe: | |||
546 | /* ignore this purged cqe */ | 546 | /* ignore this purged cqe */ |
547 | goto poll_cq_one_read_cqe; | 547 | goto poll_cq_one_read_cqe; |
548 | } | 548 | } |
549 | spin_lock_irqsave(&qp->spinlock_s, spl_flags); | 549 | spin_lock_irqsave(&qp->spinlock_s, flags); |
550 | purgeflag = qp->sqerr_purgeflag; | 550 | purgeflag = qp->sqerr_purgeflag; |
551 | spin_unlock_irqrestore(&qp->spinlock_s, spl_flags); | 551 | spin_unlock_irqrestore(&qp->spinlock_s, flags); |
552 | 552 | ||
553 | if (purgeflag) { | 553 | if (purgeflag) { |
554 | ehca_dbg(cq->device, "Got CQE with purged bit qp_num=%x " | 554 | ehca_dbg(cq->device, "Got CQE with purged bit qp_num=%x " |
@@ -633,7 +633,7 @@ int ehca_poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc) | |||
633 | int nr; | 633 | int nr; |
634 | struct ib_wc *current_wc = wc; | 634 | struct ib_wc *current_wc = wc; |
635 | int ret = 0; | 635 | int ret = 0; |
636 | unsigned long spl_flags; | 636 | unsigned long flags; |
637 | 637 | ||
638 | if (num_entries < 1) { | 638 | if (num_entries < 1) { |
639 | ehca_err(cq->device, "Invalid num_entries=%d ehca_cq=%p " | 639 | ehca_err(cq->device, "Invalid num_entries=%d ehca_cq=%p " |
@@ -642,14 +642,14 @@ int ehca_poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc) | |||
642 | goto poll_cq_exit0; | 642 | goto poll_cq_exit0; |
643 | } | 643 | } |
644 | 644 | ||
645 | spin_lock_irqsave(&my_cq->spinlock, spl_flags); | 645 | spin_lock_irqsave(&my_cq->spinlock, flags); |
646 | for (nr = 0; nr < num_entries; nr++) { | 646 | for (nr = 0; nr < num_entries; nr++) { |
647 | ret = ehca_poll_cq_one(cq, current_wc); | 647 | ret = ehca_poll_cq_one(cq, current_wc); |
648 | if (ret) | 648 | if (ret) |
649 | break; | 649 | break; |
650 | current_wc++; | 650 | current_wc++; |
651 | } /* eof for nr */ | 651 | } /* eof for nr */ |
652 | spin_unlock_irqrestore(&my_cq->spinlock, spl_flags); | 652 | spin_unlock_irqrestore(&my_cq->spinlock, flags); |
653 | if (ret == -EAGAIN || !ret) | 653 | if (ret == -EAGAIN || !ret) |
654 | ret = nr; | 654 | ret = nr; |
655 | 655 | ||
diff --git a/drivers/infiniband/hw/ehca/hcp_if.c b/drivers/infiniband/hw/ehca/hcp_if.c index b0783773f1c8..4776a8b0feec 100644 --- a/drivers/infiniband/hw/ehca/hcp_if.c +++ b/drivers/infiniband/hw/ehca/hcp_if.c | |||
@@ -81,6 +81,8 @@ | |||
81 | #define H_MP_SHUTDOWN EHCA_BMASK_IBM(48, 48) | 81 | #define H_MP_SHUTDOWN EHCA_BMASK_IBM(48, 48) |
82 | #define H_MP_RESET_QKEY_CTR EHCA_BMASK_IBM(49, 49) | 82 | #define H_MP_RESET_QKEY_CTR EHCA_BMASK_IBM(49, 49) |
83 | 83 | ||
84 | static DEFINE_SPINLOCK(hcall_lock); | ||
85 | |||
84 | static u32 get_longbusy_msecs(int longbusy_rc) | 86 | static u32 get_longbusy_msecs(int longbusy_rc) |
85 | { | 87 | { |
86 | switch (longbusy_rc) { | 88 | switch (longbusy_rc) { |