Commit 71994354 authored by Kaike Wan's avatar Kaike Wan Committed by Jason Gunthorpe

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.comReviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarKaike Wan <kaike.wan@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 c05fc156
...@@ -4101,6 +4101,7 @@ def_access_ibp_counter(rc_dupreq); ...@@ -4101,6 +4101,7 @@ def_access_ibp_counter(rc_dupreq);
def_access_ibp_counter(rdma_seq); def_access_ibp_counter(rdma_seq);
def_access_ibp_counter(unaligned); def_access_ibp_counter(unaligned);
def_access_ibp_counter(seq_naks); def_access_ibp_counter(seq_naks);
def_access_ibp_counter(rc_crwaits);
static struct cntr_entry dev_cntrs[DEV_CNTR_LAST] = { static struct cntr_entry dev_cntrs[DEV_CNTR_LAST] = {
[C_RCV_OVF] = RXE32_DEV_CNTR_ELEM(RcvOverflow, RCV_BUF_OVFL_CNT, CNTR_SYNTH), [C_RCV_OVF] = RXE32_DEV_CNTR_ELEM(RcvOverflow, RCV_BUF_OVFL_CNT, CNTR_SYNTH),
...@@ -5119,6 +5120,7 @@ static struct cntr_entry port_cntrs[PORT_CNTR_LAST] = { ...@@ -5119,6 +5120,7 @@ static struct cntr_entry port_cntrs[PORT_CNTR_LAST] = {
[C_SW_IBP_RDMA_SEQ] = SW_IBP_CNTR(RdmaSeq, rdma_seq), [C_SW_IBP_RDMA_SEQ] = SW_IBP_CNTR(RdmaSeq, rdma_seq),
[C_SW_IBP_UNALIGNED] = SW_IBP_CNTR(Unaligned, unaligned), [C_SW_IBP_UNALIGNED] = SW_IBP_CNTR(Unaligned, unaligned),
[C_SW_IBP_SEQ_NAK] = SW_IBP_CNTR(SeqNak, seq_naks), [C_SW_IBP_SEQ_NAK] = SW_IBP_CNTR(SeqNak, seq_naks),
[C_SW_IBP_RC_CRWAITS] = SW_IBP_CNTR(RcCrWait, rc_crwaits),
[C_SW_CPU_RC_ACKS] = CNTR_ELEM("RcAcks", 0, 0, CNTR_NORMAL, [C_SW_CPU_RC_ACKS] = CNTR_ELEM("RcAcks", 0, 0, CNTR_NORMAL,
access_sw_cpu_rc_acks), access_sw_cpu_rc_acks),
[C_SW_CPU_RC_QACKS] = CNTR_ELEM("RcQacks", 0, 0, CNTR_NORMAL, [C_SW_CPU_RC_QACKS] = CNTR_ELEM("RcQacks", 0, 0, CNTR_NORMAL,
......
...@@ -1245,6 +1245,7 @@ enum { ...@@ -1245,6 +1245,7 @@ enum {
C_SW_IBP_RDMA_SEQ, C_SW_IBP_RDMA_SEQ,
C_SW_IBP_UNALIGNED, C_SW_IBP_UNALIGNED,
C_SW_IBP_SEQ_NAK, C_SW_IBP_SEQ_NAK,
C_SW_IBP_RC_CRWAITS,
C_SW_CPU_RC_ACKS, C_SW_CPU_RC_ACKS,
C_SW_CPU_RC_QACKS, C_SW_CPU_RC_QACKS,
C_SW_CPU_RC_DELAYED_COMP, C_SW_CPU_RC_DELAYED_COMP,
......
...@@ -595,11 +595,8 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -595,11 +595,8 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
case IB_WR_SEND_WITH_IMM: case IB_WR_SEND_WITH_IMM:
case IB_WR_SEND_WITH_INV: case IB_WR_SEND_WITH_INV:
/* If no credit, return. */ /* If no credit, return. */
if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT) && if (!rvt_rc_credit_avail(qp, wqe))
rvt_cmp_msn(wqe->ssn, qp->s_lsn + 1) > 0) {
qp->s_flags |= RVT_S_WAIT_SSN_CREDIT;
goto bail; goto bail;
}
if (len > pmtu) { if (len > pmtu) {
qp->s_state = OP(SEND_FIRST); qp->s_state = OP(SEND_FIRST);
len = pmtu; len = pmtu;
...@@ -632,11 +629,8 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -632,11 +629,8 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
goto no_flow_control; goto no_flow_control;
case IB_WR_RDMA_WRITE_WITH_IMM: case IB_WR_RDMA_WRITE_WITH_IMM:
/* If no credit, return. */ /* If no credit, return. */
if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT) && if (!rvt_rc_credit_avail(qp, wqe))
rvt_cmp_msn(wqe->ssn, qp->s_lsn + 1) > 0) {
qp->s_flags |= RVT_S_WAIT_SSN_CREDIT;
goto bail; goto bail;
}
no_flow_control: no_flow_control:
put_ib_reth_vaddr( put_ib_reth_vaddr(
wqe->rdma_wr.remote_addr, wqe->rdma_wr.remote_addr,
......
...@@ -313,11 +313,8 @@ int qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags) ...@@ -313,11 +313,8 @@ int qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags)
case IB_WR_SEND: case IB_WR_SEND:
case IB_WR_SEND_WITH_IMM: case IB_WR_SEND_WITH_IMM:
/* If no credit, return. */ /* If no credit, return. */
if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT) && if (!rvt_rc_credit_avail(qp, wqe))
rvt_cmp_msn(wqe->ssn, qp->s_lsn + 1) > 0) {
qp->s_flags |= RVT_S_WAIT_SSN_CREDIT;
goto bail; goto bail;
}
if (len > pmtu) { if (len > pmtu) {
qp->s_state = OP(SEND_FIRST); qp->s_state = OP(SEND_FIRST);
len = pmtu; len = pmtu;
...@@ -344,11 +341,8 @@ int qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags) ...@@ -344,11 +341,8 @@ int qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags)
goto no_flow_control; goto no_flow_control;
case IB_WR_RDMA_WRITE_WITH_IMM: case IB_WR_RDMA_WRITE_WITH_IMM:
/* If no credit, return. */ /* If no credit, return. */
if (!(qp->s_flags & RVT_S_UNLIMITED_CREDIT) && if (!rvt_rc_credit_avail(qp, wqe))
rvt_cmp_msn(wqe->ssn, qp->s_lsn + 1) > 0) {
qp->s_flags |= RVT_S_WAIT_SSN_CREDIT;
goto bail; goto bail;
}
no_flow_control: no_flow_control:
ohdr->u.rc.reth.vaddr = ohdr->u.rc.reth.vaddr =
cpu_to_be64(wqe->rdma_wr.remote_addr); cpu_to_be64(wqe->rdma_wr.remote_addr);
......
...@@ -436,6 +436,7 @@ QIB_DIAGC_ATTR(dmawait); ...@@ -436,6 +436,7 @@ QIB_DIAGC_ATTR(dmawait);
QIB_DIAGC_ATTR(unaligned); QIB_DIAGC_ATTR(unaligned);
QIB_DIAGC_ATTR(rc_dupreq); QIB_DIAGC_ATTR(rc_dupreq);
QIB_DIAGC_ATTR(rc_seqnak); QIB_DIAGC_ATTR(rc_seqnak);
QIB_DIAGC_ATTR(rc_crwaits);
static struct attribute *diagc_default_attributes[] = { static struct attribute *diagc_default_attributes[] = {
&qib_diagc_attr_rc_resends.attr, &qib_diagc_attr_rc_resends.attr,
...@@ -453,6 +454,7 @@ static struct attribute *diagc_default_attributes[] = { ...@@ -453,6 +454,7 @@ static struct attribute *diagc_default_attributes[] = {
&qib_diagc_attr_unaligned.attr, &qib_diagc_attr_unaligned.attr,
&qib_diagc_attr_rc_dupreq.attr, &qib_diagc_attr_rc_dupreq.attr,
&qib_diagc_attr_rc_seqnak.attr, &qib_diagc_attr_rc_seqnak.attr,
&qib_diagc_attr_rc_crwaits.attr,
NULL NULL
}; };
......
...@@ -116,6 +116,7 @@ struct rvt_ibport { ...@@ -116,6 +116,7 @@ struct rvt_ibport {
u64 n_unaligned; u64 n_unaligned;
u64 n_rc_dupreq; u64 n_rc_dupreq;
u64 n_rc_seqnak; u64 n_rc_seqnak;
u64 n_rc_crwaits;
u16 pkey_violations; u16 pkey_violations;
u16 qkey_violations; u16 qkey_violations;
u16 mkey_violations; u16 mkey_violations;
......
...@@ -973,6 +973,41 @@ static inline void rvt_free_rq(struct rvt_rq *rq) ...@@ -973,6 +973,41 @@ static inline void rvt_free_rq(struct rvt_rq *rq)
rq->wq = NULL; 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, struct rvt_qp_iter *rvt_qp_iter_init(struct rvt_dev_info *rdi,
u64 v, u64 v,
void (*cb)(struct rvt_qp *qp, u64 v)); void (*cb)(struct rvt_qp *qp, u64 v));
......
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