IB/rdmavt, IB/qib, IB/hfi1: Use new QP put get routines
This improves readability and hides the reference count mechanism from the client drivers. Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
4107b8a029
commit
4d6f85c3fa
|
@ -202,8 +202,7 @@ static void flush_iowait(struct rvt_qp *qp)
|
||||||
write_seqlock_irqsave(&dev->iowait_lock, flags);
|
write_seqlock_irqsave(&dev->iowait_lock, flags);
|
||||||
if (!list_empty(&priv->s_iowait.list)) {
|
if (!list_empty(&priv->s_iowait.list)) {
|
||||||
list_del_init(&priv->s_iowait.list);
|
list_del_init(&priv->s_iowait.list);
|
||||||
if (atomic_dec_and_test(&qp->refcount))
|
rvt_put_qp(qp);
|
||||||
wake_up(&qp->wait);
|
|
||||||
}
|
}
|
||||||
write_sequnlock_irqrestore(&dev->iowait_lock, flags);
|
write_sequnlock_irqrestore(&dev->iowait_lock, flags);
|
||||||
}
|
}
|
||||||
|
@ -503,8 +502,7 @@ void hfi1_qp_wakeup(struct rvt_qp *qp, u32 flag)
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&qp->s_lock, flags);
|
spin_unlock_irqrestore(&qp->s_lock, flags);
|
||||||
/* Notify hfi1_destroy_qp() if it is waiting. */
|
/* Notify hfi1_destroy_qp() if it is waiting. */
|
||||||
if (atomic_dec_and_test(&qp->refcount))
|
rvt_put_qp(qp);
|
||||||
wake_up(&qp->wait);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int iowait_sleep(
|
static int iowait_sleep(
|
||||||
|
@ -544,7 +542,7 @@ static int iowait_sleep(
|
||||||
qp->s_flags |= RVT_S_WAIT_DMA_DESC;
|
qp->s_flags |= RVT_S_WAIT_DMA_DESC;
|
||||||
list_add_tail(&priv->s_iowait.list, &sde->dmawait);
|
list_add_tail(&priv->s_iowait.list, &sde->dmawait);
|
||||||
trace_hfi1_qpsleep(qp, RVT_S_WAIT_DMA_DESC);
|
trace_hfi1_qpsleep(qp, RVT_S_WAIT_DMA_DESC);
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
}
|
}
|
||||||
write_sequnlock(&dev->iowait_lock);
|
write_sequnlock(&dev->iowait_lock);
|
||||||
qp->s_flags &= ~RVT_S_BUSY;
|
qp->s_flags &= ~RVT_S_BUSY;
|
||||||
|
@ -963,8 +961,7 @@ void notify_error_qp(struct rvt_qp *qp)
|
||||||
if (!list_empty(&priv->s_iowait.list) && !(qp->s_flags & RVT_S_BUSY)) {
|
if (!list_empty(&priv->s_iowait.list) && !(qp->s_flags & RVT_S_BUSY)) {
|
||||||
qp->s_flags &= ~RVT_S_ANY_WAIT_IO;
|
qp->s_flags &= ~RVT_S_ANY_WAIT_IO;
|
||||||
list_del_init(&priv->s_iowait.list);
|
list_del_init(&priv->s_iowait.list);
|
||||||
if (atomic_dec_and_test(&qp->refcount))
|
rvt_put_qp(qp);
|
||||||
wake_up(&qp->wait);
|
|
||||||
}
|
}
|
||||||
write_sequnlock(&dev->iowait_lock);
|
write_sequnlock(&dev->iowait_lock);
|
||||||
|
|
||||||
|
|
|
@ -1389,7 +1389,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
|
||||||
restart_rc(qp, qp->s_last_psn + 1, 0);
|
restart_rc(qp, qp->s_last_psn + 1, 0);
|
||||||
if (list_empty(&qp->rspwait)) {
|
if (list_empty(&qp->rspwait)) {
|
||||||
qp->r_flags |= RVT_R_RSP_SEND;
|
qp->r_flags |= RVT_R_RSP_SEND;
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
list_add_tail(&qp->rspwait,
|
list_add_tail(&qp->rspwait,
|
||||||
&rcd->qp_wait_list);
|
&rcd->qp_wait_list);
|
||||||
}
|
}
|
||||||
|
@ -1573,7 +1573,7 @@ static void rdma_seq_err(struct rvt_qp *qp, struct hfi1_ibport *ibp, u32 psn,
|
||||||
restart_rc(qp, qp->s_last_psn + 1, 0);
|
restart_rc(qp, qp->s_last_psn + 1, 0);
|
||||||
if (list_empty(&qp->rspwait)) {
|
if (list_empty(&qp->rspwait)) {
|
||||||
qp->r_flags |= RVT_R_RSP_SEND;
|
qp->r_flags |= RVT_R_RSP_SEND;
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1782,7 +1782,7 @@ static inline void rc_defered_ack(struct hfi1_ctxtdata *rcd,
|
||||||
{
|
{
|
||||||
if (list_empty(&qp->rspwait)) {
|
if (list_empty(&qp->rspwait)) {
|
||||||
qp->r_flags |= RVT_R_RSP_NAK;
|
qp->r_flags |= RVT_R_RSP_NAK;
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1796,8 +1796,7 @@ static inline void rc_cancel_ack(struct rvt_qp *qp)
|
||||||
return;
|
return;
|
||||||
list_del_init(&qp->rspwait);
|
list_del_init(&qp->rspwait);
|
||||||
qp->r_flags &= ~RVT_R_RSP_NAK;
|
qp->r_flags &= ~RVT_R_RSP_NAK;
|
||||||
if (atomic_dec_and_test(&qp->refcount))
|
rvt_put_qp(qp);
|
||||||
wake_up(&qp->wait);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -748,7 +748,7 @@ static int wait_kmem(struct hfi1_ibdev *dev,
|
||||||
qp->s_flags |= RVT_S_WAIT_KMEM;
|
qp->s_flags |= RVT_S_WAIT_KMEM;
|
||||||
list_add_tail(&priv->s_iowait.list, &dev->memwait);
|
list_add_tail(&priv->s_iowait.list, &dev->memwait);
|
||||||
trace_hfi1_qpsleep(qp, RVT_S_WAIT_KMEM);
|
trace_hfi1_qpsleep(qp, RVT_S_WAIT_KMEM);
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
}
|
}
|
||||||
write_sequnlock(&dev->iowait_lock);
|
write_sequnlock(&dev->iowait_lock);
|
||||||
qp->s_flags &= ~RVT_S_BUSY;
|
qp->s_flags &= ~RVT_S_BUSY;
|
||||||
|
@ -959,7 +959,7 @@ static int pio_wait(struct rvt_qp *qp,
|
||||||
was_empty = list_empty(&sc->piowait);
|
was_empty = list_empty(&sc->piowait);
|
||||||
list_add_tail(&priv->s_iowait.list, &sc->piowait);
|
list_add_tail(&priv->s_iowait.list, &sc->piowait);
|
||||||
trace_hfi1_qpsleep(qp, RVT_S_WAIT_PIO);
|
trace_hfi1_qpsleep(qp, RVT_S_WAIT_PIO);
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
/* counting: only call wantpiobuf_intr if first user */
|
/* counting: only call wantpiobuf_intr if first user */
|
||||||
if (was_empty)
|
if (was_empty)
|
||||||
hfi1_sc_wantpiobuf_intr(sc, 1);
|
hfi1_sc_wantpiobuf_intr(sc, 1);
|
||||||
|
|
|
@ -109,7 +109,7 @@ struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev,
|
||||||
qp->s_flags |= RVT_S_WAIT_TX;
|
qp->s_flags |= RVT_S_WAIT_TX;
|
||||||
list_add_tail(&priv->s_iowait.list, &dev->txwait);
|
list_add_tail(&priv->s_iowait.list, &dev->txwait);
|
||||||
trace_hfi1_qpsleep(qp, RVT_S_WAIT_TX);
|
trace_hfi1_qpsleep(qp, RVT_S_WAIT_TX);
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
}
|
}
|
||||||
qp->s_flags &= ~RVT_S_BUSY;
|
qp->s_flags &= ~RVT_S_BUSY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -588,8 +588,7 @@ move_along:
|
||||||
qib_schedule_send(qp);
|
qib_schedule_send(qp);
|
||||||
spin_unlock_irqrestore(&qp->s_lock, flags);
|
spin_unlock_irqrestore(&qp->s_lock, flags);
|
||||||
}
|
}
|
||||||
if (atomic_dec_and_test(&qp->refcount))
|
rvt_put_qp(qp);
|
||||||
wake_up(&qp->wait);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
|
|
|
@ -1177,7 +1177,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
|
||||||
qib_restart_rc(qp, qp->s_last_psn + 1, 0);
|
qib_restart_rc(qp, qp->s_last_psn + 1, 0);
|
||||||
if (list_empty(&qp->rspwait)) {
|
if (list_empty(&qp->rspwait)) {
|
||||||
qp->r_flags |= RVT_R_RSP_SEND;
|
qp->r_flags |= RVT_R_RSP_SEND;
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
list_add_tail(&qp->rspwait,
|
list_add_tail(&qp->rspwait,
|
||||||
&rcd->qp_wait_list);
|
&rcd->qp_wait_list);
|
||||||
}
|
}
|
||||||
|
@ -1361,7 +1361,7 @@ static void rdma_seq_err(struct rvt_qp *qp, struct qib_ibport *ibp, u32 psn,
|
||||||
qib_restart_rc(qp, qp->s_last_psn + 1, 0);
|
qib_restart_rc(qp, qp->s_last_psn + 1, 0);
|
||||||
if (list_empty(&qp->rspwait)) {
|
if (list_empty(&qp->rspwait)) {
|
||||||
qp->r_flags |= RVT_R_RSP_SEND;
|
qp->r_flags |= RVT_R_RSP_SEND;
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1640,7 +1640,7 @@ static int qib_rc_rcv_error(struct qib_other_headers *ohdr,
|
||||||
*/
|
*/
|
||||||
if (list_empty(&qp->rspwait)) {
|
if (list_empty(&qp->rspwait)) {
|
||||||
qp->r_flags |= RVT_R_RSP_NAK;
|
qp->r_flags |= RVT_R_RSP_NAK;
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2233,7 +2233,7 @@ rnr_nak:
|
||||||
/* Queue RNR NAK for later */
|
/* Queue RNR NAK for later */
|
||||||
if (list_empty(&qp->rspwait)) {
|
if (list_empty(&qp->rspwait)) {
|
||||||
qp->r_flags |= RVT_R_RSP_NAK;
|
qp->r_flags |= RVT_R_RSP_NAK;
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -2245,7 +2245,7 @@ nack_op_err:
|
||||||
/* Queue NAK for later */
|
/* Queue NAK for later */
|
||||||
if (list_empty(&qp->rspwait)) {
|
if (list_empty(&qp->rspwait)) {
|
||||||
qp->r_flags |= RVT_R_RSP_NAK;
|
qp->r_flags |= RVT_R_RSP_NAK;
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -2259,7 +2259,7 @@ nack_inv:
|
||||||
/* Queue NAK for later */
|
/* Queue NAK for later */
|
||||||
if (list_empty(&qp->rspwait)) {
|
if (list_empty(&qp->rspwait)) {
|
||||||
qp->r_flags |= RVT_R_RSP_NAK;
|
qp->r_flags |= RVT_R_RSP_NAK;
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
list_add_tail(&qp->rspwait, &rcd->qp_wait_list);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -488,8 +488,7 @@ static void rvt_remove_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp)
|
||||||
spin_unlock_irqrestore(&rdi->qp_dev->qpt_lock, flags);
|
spin_unlock_irqrestore(&rdi->qp_dev->qpt_lock, flags);
|
||||||
if (removed) {
|
if (removed) {
|
||||||
synchronize_rcu();
|
synchronize_rcu();
|
||||||
if (atomic_dec_and_test(&qp->refcount))
|
rvt_put_qp(qp);
|
||||||
wake_up(&qp->wait);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -980,7 +979,7 @@ static void rvt_insert_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp)
|
||||||
struct rvt_ibport *rvp = rdi->ports[qp->port_num - 1];
|
struct rvt_ibport *rvp = rdi->ports[qp->port_num - 1];
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
atomic_inc(&qp->refcount);
|
rvt_get_qp(qp);
|
||||||
spin_lock_irqsave(&rdi->qp_dev->qpt_lock, flags);
|
spin_lock_irqsave(&rdi->qp_dev->qpt_lock, flags);
|
||||||
|
|
||||||
if (qp->ibqp.qp_num <= 1) {
|
if (qp->ibqp.qp_num <= 1) {
|
||||||
|
|
Loading…
Reference in New Issue