mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
IB/rdmavt: Add functions to get and release QP references
This centralizes the function and improves code readability. Reviewed-by: Dennis Dalessandro <[email protected]> Signed-off-by: Mike Marciniszyn <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
This commit is contained in:
parent
e4618d40eb
commit
4107b8a029
1 changed files with 19 additions and 0 deletions
|
|
@ -465,6 +465,25 @@ static inline struct rvt_rwqe *rvt_get_rwqe_ptr(struct rvt_rq *rq, unsigned n)
|
|||
rq->max_sge * sizeof(struct ib_sge)) * n);
|
||||
}
|
||||
|
||||
/**
|
||||
* rvt_get_qp - get a QP reference
|
||||
* @qp - the QP to hold
|
||||
*/
|
||||
static inline void rvt_get_qp(struct rvt_qp *qp)
|
||||
{
|
||||
atomic_inc(&qp->refcount);
|
||||
}
|
||||
|
||||
/**
|
||||
* rvt_put_qp - release a QP reference
|
||||
* @qp - the QP to release
|
||||
*/
|
||||
static inline void rvt_put_qp(struct rvt_qp *qp)
|
||||
{
|
||||
if (qp && atomic_dec_and_test(&qp->refcount))
|
||||
wake_up(&qp->wait);
|
||||
}
|
||||
|
||||
/**
|
||||
* rvt_qp_wqe_reserve - reserve operation
|
||||
* @qp - the rvt qp
|
||||
|
|
|
|||
Loading…
Reference in a new issue