aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/ipath')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c30
-rw-r--r--drivers/infiniband/hw/ipath/ipath_rc.c15
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ruc.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c6
4 files changed, 25 insertions, 28 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index b26146c16588..0924a21fec13 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -375,10 +375,10 @@ static void ipath_error_qp(struct ipath_qp *qp)
375 375
376 spin_lock(&dev->pending_lock); 376 spin_lock(&dev->pending_lock);
377 /* XXX What if its already removed by the timeout code? */ 377 /* XXX What if its already removed by the timeout code? */
378 if (qp->timerwait.next != LIST_POISON1) 378 if (!list_empty(&qp->timerwait))
379 list_del(&qp->timerwait); 379 list_del_init(&qp->timerwait);
380 if (qp->piowait.next != LIST_POISON1) 380 if (!list_empty(&qp->piowait))
381 list_del(&qp->piowait); 381 list_del_init(&qp->piowait);
382 spin_unlock(&dev->pending_lock); 382 spin_unlock(&dev->pending_lock);
383 383
384 wc.status = IB_WC_WR_FLUSH_ERR; 384 wc.status = IB_WC_WR_FLUSH_ERR;
@@ -712,10 +712,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
712 init_attr->qp_type == IB_QPT_RC ? 712 init_attr->qp_type == IB_QPT_RC ?
713 ipath_do_rc_send : ipath_do_uc_send, 713 ipath_do_rc_send : ipath_do_uc_send,
714 (unsigned long)qp); 714 (unsigned long)qp);
715 qp->piowait.next = LIST_POISON1; 715 INIT_LIST_HEAD(&qp->piowait);
716 qp->piowait.prev = LIST_POISON2; 716 INIT_LIST_HEAD(&qp->timerwait);
717 qp->timerwait.next = LIST_POISON1;
718 qp->timerwait.prev = LIST_POISON2;
719 qp->state = IB_QPS_RESET; 717 qp->state = IB_QPS_RESET;
720 qp->s_wq = swq; 718 qp->s_wq = swq;
721 qp->s_size = init_attr->cap.max_send_wr + 1; 719 qp->s_size = init_attr->cap.max_send_wr + 1;
@@ -785,10 +783,10 @@ int ipath_destroy_qp(struct ib_qp *ibqp)
785 783
786 /* Make sure the QP isn't on the timeout list. */ 784 /* Make sure the QP isn't on the timeout list. */
787 spin_lock_irqsave(&dev->pending_lock, flags); 785 spin_lock_irqsave(&dev->pending_lock, flags);
788 if (qp->timerwait.next != LIST_POISON1) 786 if (!list_empty(&qp->timerwait))
789 list_del(&qp->timerwait); 787 list_del_init(&qp->timerwait);
790 if (qp->piowait.next != LIST_POISON1) 788 if (!list_empty(&qp->piowait))
791 list_del(&qp->piowait); 789 list_del_init(&qp->piowait);
792 spin_unlock_irqrestore(&dev->pending_lock, flags); 790 spin_unlock_irqrestore(&dev->pending_lock, flags);
793 791
794 /* 792 /*
@@ -857,10 +855,10 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc)
857 855
858 spin_lock(&dev->pending_lock); 856 spin_lock(&dev->pending_lock);
859 /* XXX What if its already removed by the timeout code? */ 857 /* XXX What if its already removed by the timeout code? */
860 if (qp->timerwait.next != LIST_POISON1) 858 if (!list_empty(&qp->timerwait))
861 list_del(&qp->timerwait); 859 list_del_init(&qp->timerwait);
862 if (qp->piowait.next != LIST_POISON1) 860 if (!list_empty(&qp->piowait))
863 list_del(&qp->piowait); 861 list_del_init(&qp->piowait);
864 spin_unlock(&dev->pending_lock); 862 spin_unlock(&dev->pending_lock);
865 863
866 ipath_cq_enter(to_icq(qp->ibqp.send_cq), wc, 1); 864 ipath_cq_enter(to_icq(qp->ibqp.send_cq), wc, 1);
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c
index a4055ca00614..493b1821a934 100644
--- a/drivers/infiniband/hw/ipath/ipath_rc.c
+++ b/drivers/infiniband/hw/ipath/ipath_rc.c
@@ -57,7 +57,7 @@ static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe)
57 qp->s_len = wqe->length - len; 57 qp->s_len = wqe->length - len;
58 dev = to_idev(qp->ibqp.device); 58 dev = to_idev(qp->ibqp.device);
59 spin_lock(&dev->pending_lock); 59 spin_lock(&dev->pending_lock);
60 if (qp->timerwait.next == LIST_POISON1) 60 if (list_empty(&qp->timerwait))
61 list_add_tail(&qp->timerwait, 61 list_add_tail(&qp->timerwait,
62 &dev->pending[dev->pending_index]); 62 &dev->pending[dev->pending_index]);
63 spin_unlock(&dev->pending_lock); 63 spin_unlock(&dev->pending_lock);
@@ -356,7 +356,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
356 if ((int)(qp->s_psn - qp->s_next_psn) > 0) 356 if ((int)(qp->s_psn - qp->s_next_psn) > 0)
357 qp->s_next_psn = qp->s_psn; 357 qp->s_next_psn = qp->s_psn;
358 spin_lock(&dev->pending_lock); 358 spin_lock(&dev->pending_lock);
359 if (qp->timerwait.next == LIST_POISON1) 359 if (list_empty(&qp->timerwait))
360 list_add_tail(&qp->timerwait, 360 list_add_tail(&qp->timerwait,
361 &dev->pending[dev->pending_index]); 361 &dev->pending[dev->pending_index]);
362 spin_unlock(&dev->pending_lock); 362 spin_unlock(&dev->pending_lock);
@@ -726,8 +726,8 @@ void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc)
726 */ 726 */
727 dev = to_idev(qp->ibqp.device); 727 dev = to_idev(qp->ibqp.device);
728 spin_lock(&dev->pending_lock); 728 spin_lock(&dev->pending_lock);
729 if (qp->timerwait.next != LIST_POISON1) 729 if (!list_empty(&qp->timerwait))
730 list_del(&qp->timerwait); 730 list_del_init(&qp->timerwait);
731 spin_unlock(&dev->pending_lock); 731 spin_unlock(&dev->pending_lock);
732 732
733 if (wqe->wr.opcode == IB_WR_RDMA_READ) 733 if (wqe->wr.opcode == IB_WR_RDMA_READ)
@@ -886,8 +886,8 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode)
886 * just won't find anything to restart if we ACK everything. 886 * just won't find anything to restart if we ACK everything.
887 */ 887 */
888 spin_lock(&dev->pending_lock); 888 spin_lock(&dev->pending_lock);
889 if (qp->timerwait.next != LIST_POISON1) 889 if (!list_empty(&qp->timerwait))
890 list_del(&qp->timerwait); 890 list_del_init(&qp->timerwait);
891 spin_unlock(&dev->pending_lock); 891 spin_unlock(&dev->pending_lock);
892 892
893 /* 893 /*
@@ -1194,8 +1194,7 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1194 IB_WR_RDMA_READ)) 1194 IB_WR_RDMA_READ))
1195 goto ack_done; 1195 goto ack_done;
1196 spin_lock(&dev->pending_lock); 1196 spin_lock(&dev->pending_lock);
1197 if (qp->s_rnr_timeout == 0 && 1197 if (qp->s_rnr_timeout == 0 && !list_empty(&qp->timerwait))
1198 qp->timerwait.next != LIST_POISON1)
1199 list_move_tail(&qp->timerwait, 1198 list_move_tail(&qp->timerwait,
1200 &dev->pending[dev->pending_index]); 1199 &dev->pending[dev->pending_index]);
1201 spin_unlock(&dev->pending_lock); 1200 spin_unlock(&dev->pending_lock);
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c
index eb81424b3c5b..d38f4f3cfd1d 100644
--- a/drivers/infiniband/hw/ipath/ipath_ruc.c
+++ b/drivers/infiniband/hw/ipath/ipath_ruc.c
@@ -435,7 +435,7 @@ void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev)
435 unsigned long flags; 435 unsigned long flags;
436 436
437 spin_lock_irqsave(&dev->pending_lock, flags); 437 spin_lock_irqsave(&dev->pending_lock, flags);
438 if (qp->piowait.next == LIST_POISON1) 438 if (list_empty(&qp->piowait))
439 list_add_tail(&qp->piowait, &dev->piowait); 439 list_add_tail(&qp->piowait, &dev->piowait);
440 spin_unlock_irqrestore(&dev->pending_lock, flags); 440 spin_unlock_irqrestore(&dev->pending_lock, flags);
441 /* 441 /*
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index cb9e387c301f..3adb86fc8be7 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -464,7 +464,7 @@ static void ipath_ib_timer(void *arg)
464 last = &dev->pending[dev->pending_index]; 464 last = &dev->pending[dev->pending_index];
465 while (!list_empty(last)) { 465 while (!list_empty(last)) {
466 qp = list_entry(last->next, struct ipath_qp, timerwait); 466 qp = list_entry(last->next, struct ipath_qp, timerwait);
467 list_del(&qp->timerwait); 467 list_del_init(&qp->timerwait);
468 qp->timer_next = resend; 468 qp->timer_next = resend;
469 resend = qp; 469 resend = qp;
470 atomic_inc(&qp->refcount); 470 atomic_inc(&qp->refcount);
@@ -474,7 +474,7 @@ static void ipath_ib_timer(void *arg)
474 qp = list_entry(last->next, struct ipath_qp, timerwait); 474 qp = list_entry(last->next, struct ipath_qp, timerwait);
475 if (--qp->s_rnr_timeout == 0) { 475 if (--qp->s_rnr_timeout == 0) {
476 do { 476 do {
477 list_del(&qp->timerwait); 477 list_del_init(&qp->timerwait);
478 tasklet_hi_schedule(&qp->s_task); 478 tasklet_hi_schedule(&qp->s_task);
479 if (list_empty(last)) 479 if (list_empty(last))
480 break; 480 break;
@@ -554,7 +554,7 @@ static int ipath_ib_piobufavail(void *arg)
554 while (!list_empty(&dev->piowait)) { 554 while (!list_empty(&dev->piowait)) {
555 qp = list_entry(dev->piowait.next, struct ipath_qp, 555 qp = list_entry(dev->piowait.next, struct ipath_qp,
556 piowait); 556 piowait);
557 list_del(&qp->piowait); 557 list_del_init(&qp->piowait);
558 tasklet_hi_schedule(&qp->s_task); 558 tasklet_hi_schedule(&qp->s_task);
559 } 559 }
560 spin_unlock_irqrestore(&dev->pending_lock, flags); 560 spin_unlock_irqrestore(&dev->pending_lock, flags);