Commit d40f69c9 authored by Mike Marciniszyn's avatar Mike Marciniszyn Committed by Jason Gunthorpe

IB/{rdmavt, qib, hfi1}: Use new routine to release reference counts

The reference count adjustments on reference count completion
are open coded throughout.

Add a routine to do all reference count adjustments and use.
Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 52cdbcc2
...@@ -1834,7 +1834,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_opa_header *opah) ...@@ -1834,7 +1834,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_opa_header *opah)
qp->s_last = s_last; qp->s_last = s_last;
/* see post_send() */ /* see post_send() */
barrier(); barrier();
rvt_put_swqe(wqe); rvt_put_qp_swqe(qp, wqe);
rvt_qp_swqe_complete(qp, rvt_qp_swqe_complete(qp,
wqe, wqe,
ib_hfi1_wc_opcode[wqe->wr.opcode], ib_hfi1_wc_opcode[wqe->wr.opcode],
...@@ -1882,7 +1882,7 @@ struct rvt_swqe *do_rc_completion(struct rvt_qp *qp, ...@@ -1882,7 +1882,7 @@ struct rvt_swqe *do_rc_completion(struct rvt_qp *qp,
u32 s_last; u32 s_last;
trdma_clean_swqe(qp, wqe); trdma_clean_swqe(qp, wqe);
rvt_put_swqe(wqe); rvt_put_qp_swqe(qp, wqe);
rvt_qp_wqe_unreserve(qp, wqe); rvt_qp_wqe_unreserve(qp, wqe);
s_last = qp->s_last; s_last = qp->s_last;
trace_hfi1_qp_send_completion(qp, wqe, s_last); trace_hfi1_qp_send_completion(qp, wqe, s_last);
......
...@@ -933,7 +933,7 @@ void qib_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr) ...@@ -933,7 +933,7 @@ void qib_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr)
qp->s_last = s_last; qp->s_last = s_last;
/* see post_send() */ /* see post_send() */
barrier(); barrier();
rvt_put_swqe(wqe); rvt_put_qp_swqe(qp, wqe);
rvt_qp_swqe_complete(qp, rvt_qp_swqe_complete(qp,
wqe, wqe,
ib_qib_wc_opcode[wqe->wr.opcode], ib_qib_wc_opcode[wqe->wr.opcode],
...@@ -975,7 +975,7 @@ static struct rvt_swqe *do_rc_completion(struct rvt_qp *qp, ...@@ -975,7 +975,7 @@ static struct rvt_swqe *do_rc_completion(struct rvt_qp *qp,
qib_cmp24(qp->s_sending_psn, qp->s_sending_hpsn) > 0) { qib_cmp24(qp->s_sending_psn, qp->s_sending_hpsn) > 0) {
u32 s_last; u32 s_last;
rvt_put_swqe(wqe); rvt_put_qp_swqe(qp, wqe);
s_last = qp->s_last; s_last = qp->s_last;
if (++s_last >= qp->s_size) if (++s_last >= qp->s_size)
s_last = 0; s_last = 0;
......
...@@ -623,10 +623,7 @@ static void rvt_clear_mr_refs(struct rvt_qp *qp, int clr_sends) ...@@ -623,10 +623,7 @@ static void rvt_clear_mr_refs(struct rvt_qp *qp, int clr_sends)
while (qp->s_last != qp->s_head) { while (qp->s_last != qp->s_head) {
struct rvt_swqe *wqe = rvt_get_swqe_ptr(qp, qp->s_last); struct rvt_swqe *wqe = rvt_get_swqe_ptr(qp, qp->s_last);
rvt_put_swqe(wqe); rvt_put_qp_swqe(qp, wqe);
if (qp->allowed_ops == IB_OPCODE_UD)
atomic_dec(&ibah_to_rvtah(
wqe->ud_wr.ah)->refcount);
if (++qp->s_last >= qp->s_size) if (++qp->s_last >= qp->s_size)
qp->s_last = 0; qp->s_last = 0;
smp_wmb(); /* see qp_set_savail */ smp_wmb(); /* see qp_set_savail */
...@@ -2683,9 +2680,7 @@ void rvt_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe, ...@@ -2683,9 +2680,7 @@ void rvt_send_complete(struct rvt_qp *qp, struct rvt_swqe *wqe,
qp->s_last = last; qp->s_last = last;
/* See post_send() */ /* See post_send() */
barrier(); barrier();
rvt_put_swqe(wqe); rvt_put_qp_swqe(qp, wqe);
if (qp->allowed_ops == IB_OPCODE_UD)
atomic_dec(&ibah_to_rvtah(wqe->ud_wr.ah)->refcount);
rvt_qp_swqe_complete(qp, rvt_qp_swqe_complete(qp,
wqe, wqe,
......
...@@ -723,6 +723,20 @@ static inline void rvt_mod_retry_timer(struct rvt_qp *qp) ...@@ -723,6 +723,20 @@ static inline void rvt_mod_retry_timer(struct rvt_qp *qp)
return rvt_mod_retry_timer_ext(qp, 0); return rvt_mod_retry_timer_ext(qp, 0);
} }
/**
* rvt_put_qp_swqe - drop refs held by swqe
* @qp: the send qp
* @wqe: the send wqe
*
* This drops any references held by the swqe
*/
static inline void rvt_put_qp_swqe(struct rvt_qp *qp, struct rvt_swqe *wqe)
{
rvt_put_swqe(wqe);
if (qp->allowed_ops == IB_OPCODE_UD)
atomic_dec(&ibah_to_rvtah(wqe->ud_wr.ah)->refcount);
}
extern const int ib_rvt_state_ops[]; extern const int ib_rvt_state_ops[];
struct rvt_dev_info; struct rvt_dev_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment