aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/amso1100
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/amso1100')
-rw-r--r--drivers/infiniband/hw/amso1100/c2.h2
-rw-r--r--drivers/infiniband/hw/amso1100/c2_qp.c36
-rw-r--r--drivers/infiniband/hw/amso1100/c2_rnic.c4
3 files changed, 31 insertions, 11 deletions
diff --git a/drivers/infiniband/hw/amso1100/c2.h b/drivers/infiniband/hw/amso1100/c2.h
index 1b17dcdd0505..04a9db5de881 100644
--- a/drivers/infiniband/hw/amso1100/c2.h
+++ b/drivers/infiniband/hw/amso1100/c2.h
@@ -302,7 +302,7 @@ struct c2_dev {
302 unsigned long pa; /* PA device memory */ 302 unsigned long pa; /* PA device memory */
303 void **qptr_array; 303 void **qptr_array;
304 304
305 kmem_cache_t *host_msg_cache; 305 struct kmem_cache *host_msg_cache;
306 306
307 struct list_head cca_link; /* adapter list */ 307 struct list_head cca_link; /* adapter list */
308 struct list_head eh_wakeup_list; /* event wakeup list */ 308 struct list_head eh_wakeup_list; /* event wakeup list */
diff --git a/drivers/infiniband/hw/amso1100/c2_qp.c b/drivers/infiniband/hw/amso1100/c2_qp.c
index 5bcf697aa335..179d005ed4a5 100644
--- a/drivers/infiniband/hw/amso1100/c2_qp.c
+++ b/drivers/infiniband/hw/amso1100/c2_qp.c
@@ -564,6 +564,32 @@ int c2_alloc_qp(struct c2_dev *c2dev,
564 return err; 564 return err;
565} 565}
566 566
567static inline void c2_lock_cqs(struct c2_cq *send_cq, struct c2_cq *recv_cq)
568{
569 if (send_cq == recv_cq)
570 spin_lock_irq(&send_cq->lock);
571 else if (send_cq > recv_cq) {
572 spin_lock_irq(&send_cq->lock);
573 spin_lock_nested(&recv_cq->lock, SINGLE_DEPTH_NESTING);
574 } else {
575 spin_lock_irq(&recv_cq->lock);
576 spin_lock_nested(&send_cq->lock, SINGLE_DEPTH_NESTING);
577 }
578}
579
580static inline void c2_unlock_cqs(struct c2_cq *send_cq, struct c2_cq *recv_cq)
581{
582 if (send_cq == recv_cq)
583 spin_unlock_irq(&send_cq->lock);
584 else if (send_cq > recv_cq) {
585 spin_unlock(&recv_cq->lock);
586 spin_unlock_irq(&send_cq->lock);
587 } else {
588 spin_unlock(&send_cq->lock);
589 spin_unlock_irq(&recv_cq->lock);
590 }
591}
592
567void c2_free_qp(struct c2_dev *c2dev, struct c2_qp *qp) 593void c2_free_qp(struct c2_dev *c2dev, struct c2_qp *qp)
568{ 594{
569 struct c2_cq *send_cq; 595 struct c2_cq *send_cq;
@@ -576,15 +602,9 @@ void c2_free_qp(struct c2_dev *c2dev, struct c2_qp *qp)
576 * Lock CQs here, so that CQ polling code can do QP lookup 602 * Lock CQs here, so that CQ polling code can do QP lookup
577 * without taking a lock. 603 * without taking a lock.
578 */ 604 */
579 spin_lock_irq(&send_cq->lock); 605 c2_lock_cqs(send_cq, recv_cq);
580 if (send_cq != recv_cq)
581 spin_lock(&recv_cq->lock);
582
583 c2_free_qpn(c2dev, qp->qpn); 606 c2_free_qpn(c2dev, qp->qpn);
584 607 c2_unlock_cqs(send_cq, recv_cq);
585 if (send_cq != recv_cq)
586 spin_unlock(&recv_cq->lock);
587 spin_unlock_irq(&send_cq->lock);
588 608
589 /* 609 /*
590 * Destory qp in the rnic... 610 * Destory qp in the rnic...
diff --git a/drivers/infiniband/hw/amso1100/c2_rnic.c b/drivers/infiniband/hw/amso1100/c2_rnic.c
index 623dc95f91df..1687c511cb2f 100644
--- a/drivers/infiniband/hw/amso1100/c2_rnic.c
+++ b/drivers/infiniband/hw/amso1100/c2_rnic.c
@@ -441,7 +441,7 @@ static int c2_rnic_close(struct c2_dev *c2dev)
441 * involves initalizing the various limits and resouce pools that 441 * involves initalizing the various limits and resouce pools that
442 * comprise the RNIC instance. 442 * comprise the RNIC instance.
443 */ 443 */
444int c2_rnic_init(struct c2_dev *c2dev) 444int __devinit c2_rnic_init(struct c2_dev *c2dev)
445{ 445{
446 int err; 446 int err;
447 u32 qsize, msgsize; 447 u32 qsize, msgsize;
@@ -611,7 +611,7 @@ int c2_rnic_init(struct c2_dev *c2dev)
611/* 611/*
612 * Called by c2_remove to cleanup the RNIC resources. 612 * Called by c2_remove to cleanup the RNIC resources.
613 */ 613 */
614void c2_rnic_term(struct c2_dev *c2dev) 614void __devexit c2_rnic_term(struct c2_dev *c2dev)
615{ 615{
616 616
617 /* Close the open adapter instance */ 617 /* Close the open adapter instance */