提交 94b8d9f9 编写于 作者: B Bryan O'Sullivan 提交者: Roland Dreier

IB/ipath: replace uses of LIST_POISON

Per Andrew's request.
Signed-off-by: NBryan O'Sullivan <bos@pathscale.com>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 eaf6733b
...@@ -375,10 +375,10 @@ static void ipath_error_qp(struct ipath_qp *qp) ...@@ -375,10 +375,10 @@ static void ipath_error_qp(struct ipath_qp *qp)
spin_lock(&dev->pending_lock); spin_lock(&dev->pending_lock);
/* XXX What if its already removed by the timeout code? */ /* XXX What if its already removed by the timeout code? */
if (qp->timerwait.next != LIST_POISON1) if (!list_empty(&qp->timerwait))
list_del(&qp->timerwait); list_del_init(&qp->timerwait);
if (qp->piowait.next != LIST_POISON1) if (!list_empty(&qp->piowait))
list_del(&qp->piowait); list_del_init(&qp->piowait);
spin_unlock(&dev->pending_lock); spin_unlock(&dev->pending_lock);
wc.status = IB_WC_WR_FLUSH_ERR; wc.status = IB_WC_WR_FLUSH_ERR;
...@@ -712,10 +712,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, ...@@ -712,10 +712,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
init_attr->qp_type == IB_QPT_RC ? init_attr->qp_type == IB_QPT_RC ?
ipath_do_rc_send : ipath_do_uc_send, ipath_do_rc_send : ipath_do_uc_send,
(unsigned long)qp); (unsigned long)qp);
qp->piowait.next = LIST_POISON1; INIT_LIST_HEAD(&qp->piowait);
qp->piowait.prev = LIST_POISON2; INIT_LIST_HEAD(&qp->timerwait);
qp->timerwait.next = LIST_POISON1;
qp->timerwait.prev = LIST_POISON2;
qp->state = IB_QPS_RESET; qp->state = IB_QPS_RESET;
qp->s_wq = swq; qp->s_wq = swq;
qp->s_size = init_attr->cap.max_send_wr + 1; qp->s_size = init_attr->cap.max_send_wr + 1;
...@@ -785,10 +783,10 @@ int ipath_destroy_qp(struct ib_qp *ibqp) ...@@ -785,10 +783,10 @@ int ipath_destroy_qp(struct ib_qp *ibqp)
/* Make sure the QP isn't on the timeout list. */ /* Make sure the QP isn't on the timeout list. */
spin_lock_irqsave(&dev->pending_lock, flags); spin_lock_irqsave(&dev->pending_lock, flags);
if (qp->timerwait.next != LIST_POISON1) if (!list_empty(&qp->timerwait))
list_del(&qp->timerwait); list_del_init(&qp->timerwait);
if (qp->piowait.next != LIST_POISON1) if (!list_empty(&qp->piowait))
list_del(&qp->piowait); list_del_init(&qp->piowait);
spin_unlock_irqrestore(&dev->pending_lock, flags); spin_unlock_irqrestore(&dev->pending_lock, flags);
/* /*
...@@ -857,10 +855,10 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc) ...@@ -857,10 +855,10 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc)
spin_lock(&dev->pending_lock); spin_lock(&dev->pending_lock);
/* XXX What if its already removed by the timeout code? */ /* XXX What if its already removed by the timeout code? */
if (qp->timerwait.next != LIST_POISON1) if (!list_empty(&qp->timerwait))
list_del(&qp->timerwait); list_del_init(&qp->timerwait);
if (qp->piowait.next != LIST_POISON1) if (!list_empty(&qp->piowait))
list_del(&qp->piowait); list_del_init(&qp->piowait);
spin_unlock(&dev->pending_lock); spin_unlock(&dev->pending_lock);
ipath_cq_enter(to_icq(qp->ibqp.send_cq), wc, 1); ipath_cq_enter(to_icq(qp->ibqp.send_cq), wc, 1);
......
...@@ -57,7 +57,7 @@ static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe) ...@@ -57,7 +57,7 @@ static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe)
qp->s_len = wqe->length - len; qp->s_len = wqe->length - len;
dev = to_idev(qp->ibqp.device); dev = to_idev(qp->ibqp.device);
spin_lock(&dev->pending_lock); spin_lock(&dev->pending_lock);
if (qp->timerwait.next == LIST_POISON1) if (list_empty(&qp->timerwait))
list_add_tail(&qp->timerwait, list_add_tail(&qp->timerwait,
&dev->pending[dev->pending_index]); &dev->pending[dev->pending_index]);
spin_unlock(&dev->pending_lock); spin_unlock(&dev->pending_lock);
...@@ -356,7 +356,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, ...@@ -356,7 +356,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
if ((int)(qp->s_psn - qp->s_next_psn) > 0) if ((int)(qp->s_psn - qp->s_next_psn) > 0)
qp->s_next_psn = qp->s_psn; qp->s_next_psn = qp->s_psn;
spin_lock(&dev->pending_lock); spin_lock(&dev->pending_lock);
if (qp->timerwait.next == LIST_POISON1) if (list_empty(&qp->timerwait))
list_add_tail(&qp->timerwait, list_add_tail(&qp->timerwait,
&dev->pending[dev->pending_index]); &dev->pending[dev->pending_index]);
spin_unlock(&dev->pending_lock); spin_unlock(&dev->pending_lock);
...@@ -726,8 +726,8 @@ void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc) ...@@ -726,8 +726,8 @@ void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc)
*/ */
dev = to_idev(qp->ibqp.device); dev = to_idev(qp->ibqp.device);
spin_lock(&dev->pending_lock); spin_lock(&dev->pending_lock);
if (qp->timerwait.next != LIST_POISON1) if (!list_empty(&qp->timerwait))
list_del(&qp->timerwait); list_del_init(&qp->timerwait);
spin_unlock(&dev->pending_lock); spin_unlock(&dev->pending_lock);
if (wqe->wr.opcode == IB_WR_RDMA_READ) 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,8 +886,8 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode)
* just won't find anything to restart if we ACK everything. * just won't find anything to restart if we ACK everything.
*/ */
spin_lock(&dev->pending_lock); spin_lock(&dev->pending_lock);
if (qp->timerwait.next != LIST_POISON1) if (!list_empty(&qp->timerwait))
list_del(&qp->timerwait); list_del_init(&qp->timerwait);
spin_unlock(&dev->pending_lock); spin_unlock(&dev->pending_lock);
/* /*
...@@ -1194,8 +1194,7 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev, ...@@ -1194,8 +1194,7 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
IB_WR_RDMA_READ)) IB_WR_RDMA_READ))
goto ack_done; goto ack_done;
spin_lock(&dev->pending_lock); spin_lock(&dev->pending_lock);
if (qp->s_rnr_timeout == 0 && if (qp->s_rnr_timeout == 0 && !list_empty(&qp->timerwait))
qp->timerwait.next != LIST_POISON1)
list_move_tail(&qp->timerwait, list_move_tail(&qp->timerwait,
&dev->pending[dev->pending_index]); &dev->pending[dev->pending_index]);
spin_unlock(&dev->pending_lock); spin_unlock(&dev->pending_lock);
......
...@@ -435,7 +435,7 @@ void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev) ...@@ -435,7 +435,7 @@ void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&dev->pending_lock, flags); spin_lock_irqsave(&dev->pending_lock, flags);
if (qp->piowait.next == LIST_POISON1) if (list_empty(&qp->piowait))
list_add_tail(&qp->piowait, &dev->piowait); list_add_tail(&qp->piowait, &dev->piowait);
spin_unlock_irqrestore(&dev->pending_lock, flags); spin_unlock_irqrestore(&dev->pending_lock, flags);
/* /*
......
...@@ -464,7 +464,7 @@ static void ipath_ib_timer(void *arg) ...@@ -464,7 +464,7 @@ static void ipath_ib_timer(void *arg)
last = &dev->pending[dev->pending_index]; last = &dev->pending[dev->pending_index];
while (!list_empty(last)) { while (!list_empty(last)) {
qp = list_entry(last->next, struct ipath_qp, timerwait); qp = list_entry(last->next, struct ipath_qp, timerwait);
list_del(&qp->timerwait); list_del_init(&qp->timerwait);
qp->timer_next = resend; qp->timer_next = resend;
resend = qp; resend = qp;
atomic_inc(&qp->refcount); atomic_inc(&qp->refcount);
...@@ -474,7 +474,7 @@ static void ipath_ib_timer(void *arg) ...@@ -474,7 +474,7 @@ static void ipath_ib_timer(void *arg)
qp = list_entry(last->next, struct ipath_qp, timerwait); qp = list_entry(last->next, struct ipath_qp, timerwait);
if (--qp->s_rnr_timeout == 0) { if (--qp->s_rnr_timeout == 0) {
do { do {
list_del(&qp->timerwait); list_del_init(&qp->timerwait);
tasklet_hi_schedule(&qp->s_task); tasklet_hi_schedule(&qp->s_task);
if (list_empty(last)) if (list_empty(last))
break; break;
...@@ -554,7 +554,7 @@ static int ipath_ib_piobufavail(void *arg) ...@@ -554,7 +554,7 @@ static int ipath_ib_piobufavail(void *arg)
while (!list_empty(&dev->piowait)) { while (!list_empty(&dev->piowait)) {
qp = list_entry(dev->piowait.next, struct ipath_qp, qp = list_entry(dev->piowait.next, struct ipath_qp,
piowait); piowait);
list_del(&qp->piowait); list_del_init(&qp->piowait);
tasklet_hi_schedule(&qp->s_task); tasklet_hi_schedule(&qp->s_task);
} }
spin_unlock_irqrestore(&dev->pending_lock, flags); spin_unlock_irqrestore(&dev->pending_lock, flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册