IB/{rdmavt, hfi1, qib}: Add a counter for credit waits

This patch adds a counter for credit waits to assist field debugging.

Link: https://lore.kernel.org/r/20190911113047.126040.10857.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
Kaike Wan
2019-09-11 07:30:47 -04:00
committad av Jason Gunthorpe
förälder c05fc15634
incheckning 7199435414
7 ändrade filer med 45 tillägg och 16 borttagningar

Visa fil

@@ -973,6 +973,41 @@ static inline void rvt_free_rq(struct rvt_rq *rq)
rq->wq = NULL;
}
/**
* rvt_to_iport - Get the ibport pointer
* @qp: the qp pointer
*
* This function returns the ibport pointer from the qp pointer.
*/
static inline struct rvt_ibport *rvt_to_iport(struct rvt_qp *qp)
{
struct rvt_dev_info *rdi = ib_to_rvt(qp->ibqp.device);
return rdi->ports[qp->port_num - 1];
}
/**
* rvt_rc_credit_avail - Check if there are enough RC credits for the request
* @qp: the qp
* @wqe: the request
*
* This function returns false when there are not enough credits for the given
* request and true otherwise.
*/
static inline bool rvt_rc_credit_avail(struct rvt_qp *qp, struct rvt_swqe *wqe)
{
lockdep_assert_held(&qp->s_lock);
if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT) &&
rvt_cmp_msn(wqe->ssn, qp->s_lsn + 1) > 0) {
struct rvt_ibport *rvp = rvt_to_iport(qp);
qp->s_flags |= RVT_S_WAIT_SSN_CREDIT;
rvp->n_rc_crwaits++;
return false;
}
return true;
}
struct rvt_qp_iter *rvt_qp_iter_init(struct rvt_dev_info *rdi,
u64 v,
void (*cb)(struct rvt_qp *qp, u64 v));