cxgbe: Make the TOE ISCSI RX stats per-queue instead of per adapter.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D29903
This commit is contained in:
John Baldwin 2021-05-14 12:16:33 -07:00
parent 76cfc6fa0d
commit 4b6ed0758d
6 changed files with 52 additions and 91 deletions

View File

@ -656,11 +656,16 @@ iq_to_rxq(struct sge_iq *iq)
return (__containerof(iq, struct sge_rxq, iq)); return (__containerof(iq, struct sge_rxq, iq));
} }
/* ofld_rxq: SGE ingress queue + SGE free list + miscellaneous items */ /* ofld_rxq: SGE ingress queue + SGE free list + miscellaneous items */
struct sge_ofld_rxq { struct sge_ofld_rxq {
struct sge_iq iq; /* MUST be first */ struct sge_iq iq; /* MUST be first */
struct sge_fl fl; /* MUST follow iq */ struct sge_fl fl; /* MUST follow iq */
counter_u64_t rx_iscsi_ddp_setup_ok;
counter_u64_t rx_iscsi_ddp_setup_error;
uint64_t rx_iscsi_ddp_pdus;
uint64_t rx_iscsi_ddp_octets;
uint64_t rx_iscsi_fl_pdus;
uint64_t rx_iscsi_fl_octets;
u_long rx_toe_tls_records; u_long rx_toe_tls_records;
u_long rx_toe_tls_octets; u_long rx_toe_tls_octets;
} __aligned(CACHE_LINE_SIZE); } __aligned(CACHE_LINE_SIZE);

View File

@ -96,50 +96,6 @@ static int worker_thread_count;
static struct cxgbei_worker_thread_softc *cwt_softc; static struct cxgbei_worker_thread_softc *cwt_softc;
static struct proc *cxgbei_proc; static struct proc *cxgbei_proc;
static void
free_ci_counters(struct cxgbei_data *ci)
{
#define FREE_CI_COUNTER(x) do { \
if (ci->x != NULL) { \
counter_u64_free(ci->x); \
ci->x = NULL; \
} \
} while (0)
FREE_CI_COUNTER(ddp_setup_ok);
FREE_CI_COUNTER(ddp_setup_error);
FREE_CI_COUNTER(ddp_bytes);
FREE_CI_COUNTER(ddp_pdus);
FREE_CI_COUNTER(fl_bytes);
FREE_CI_COUNTER(fl_pdus);
#undef FREE_CI_COUNTER
}
static int
alloc_ci_counters(struct cxgbei_data *ci)
{
#define ALLOC_CI_COUNTER(x) do { \
ci->x = counter_u64_alloc(M_WAITOK); \
if (ci->x == NULL) \
goto fail; \
} while (0)
ALLOC_CI_COUNTER(ddp_setup_ok);
ALLOC_CI_COUNTER(ddp_setup_error);
ALLOC_CI_COUNTER(ddp_bytes);
ALLOC_CI_COUNTER(ddp_pdus);
ALLOC_CI_COUNTER(fl_bytes);
ALLOC_CI_COUNTER(fl_pdus);
#undef ALLOC_CI_COUNTER
return (0);
fail:
free_ci_counters(ci);
return (ENOMEM);
}
static void static void
read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len, read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len,
uint32_t *max_rx_pdu_len) uint32_t *max_rx_pdu_len)
@ -182,10 +138,6 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci)
MPASS(sc->vres.iscsi.size > 0); MPASS(sc->vres.iscsi.size > 0);
MPASS(ci != NULL); MPASS(ci != NULL);
rc = alloc_ci_counters(ci);
if (rc != 0)
return (rc);
read_pdu_limits(sc, &ci->max_tx_pdu_len, &ci->max_rx_pdu_len); read_pdu_limits(sc, &ci->max_tx_pdu_len, &ci->max_rx_pdu_len);
pr = &ci->pr; pr = &ci->pr;
@ -195,7 +147,6 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci)
device_printf(sc->dev, device_printf(sc->dev,
"%s: failed to initialize the iSCSI page pod region: %u.\n", "%s: failed to initialize the iSCSI page pod region: %u.\n",
__func__, rc); __func__, rc);
free_ci_counters(ci);
return (rc); return (rc);
} }
@ -219,30 +170,9 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci)
children = SYSCTL_CHILDREN(oid); children = SYSCTL_CHILDREN(oid);
oid = SYSCTL_ADD_NODE(&ci->ctx, children, OID_AUTO, "iscsi", oid = SYSCTL_ADD_NODE(&ci->ctx, children, OID_AUTO, "iscsi",
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "iSCSI ULP statistics"); CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "iSCSI ULP settings");
children = SYSCTL_CHILDREN(oid); children = SYSCTL_CHILDREN(oid);
SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_setup_ok",
CTLFLAG_RD, &ci->ddp_setup_ok,
"# of times DDP buffer was setup successfully.");
SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_setup_error",
CTLFLAG_RD, &ci->ddp_setup_error,
"# of times DDP buffer setup failed.");
SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_bytes",
CTLFLAG_RD, &ci->ddp_bytes, "# of bytes placed directly");
SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "ddp_pdus",
CTLFLAG_RD, &ci->ddp_pdus, "# of PDUs with data placed directly.");
SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "fl_bytes",
CTLFLAG_RD, &ci->fl_bytes, "# of data bytes delivered in freelist");
SYSCTL_ADD_COUNTER_U64(&ci->ctx, children, OID_AUTO, "fl_pdus",
CTLFLAG_RD, &ci->fl_pdus,
"# of PDUs with data delivered in freelist");
ci->ddp_threshold = 2048; ci->ddp_threshold = 2048;
SYSCTL_ADD_UINT(&ci->ctx, children, OID_AUTO, "ddp_threshold", SYSCTL_ADD_UINT(&ci->ctx, children, OID_AUTO, "ddp_threshold",
CTLFLAG_RW, &ci->ddp_threshold, 0, "Rx zero copy threshold"); CTLFLAG_RW, &ci->ddp_threshold, 0, "Rx zero copy threshold");
@ -291,7 +221,6 @@ static int
do_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) do_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
{ {
struct adapter *sc = iq->adapter; struct adapter *sc = iq->adapter;
struct cxgbei_data *ci = sc->iscsi_ulp_softc;
struct cpl_iscsi_data *cpl = mtod(m, struct cpl_iscsi_data *); struct cpl_iscsi_data *cpl = mtod(m, struct cpl_iscsi_data *);
u_int tid = GET_TID(cpl); u_int tid = GET_TID(cpl);
struct toepcb *toep = lookup_tid(sc, tid); struct toepcb *toep = lookup_tid(sc, tid);
@ -311,8 +240,8 @@ do_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m
icp->icp_flags |= ICPF_RX_FLBUF; icp->icp_flags |= ICPF_RX_FLBUF;
icp->ip.ip_data_mbuf = m; icp->ip.ip_data_mbuf = m;
counter_u64_add(ci->fl_pdus, 1); toep->ofld_rxq->rx_iscsi_fl_pdus++;
counter_u64_add(ci->fl_bytes, m->m_pkthdr.len); toep->ofld_rxq->rx_iscsi_fl_octets += m->m_pkthdr.len;
#if 0 #if 0
CTR3(KTR_CXGBE, "%s: tid %u, cpl->len %u", __func__, tid, CTR3(KTR_CXGBE, "%s: tid %u, cpl->len %u", __func__, tid,
@ -326,7 +255,6 @@ static int
do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
{ {
struct adapter *sc = iq->adapter; struct adapter *sc = iq->adapter;
struct cxgbei_data *ci = sc->iscsi_ulp_softc;
const struct cpl_rx_data_ddp *cpl = (const void *)(rss + 1); const struct cpl_rx_data_ddp *cpl = (const void *)(rss + 1);
u_int tid = GET_TID(cpl); u_int tid = GET_TID(cpl);
struct toepcb *toep = lookup_tid(sc, tid); struct toepcb *toep = lookup_tid(sc, tid);
@ -369,8 +297,8 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
MPASS((icp->icp_flags & ICPF_RX_FLBUF) == 0); MPASS((icp->icp_flags & ICPF_RX_FLBUF) == 0);
MPASS(ip->ip_data_len > 0); MPASS(ip->ip_data_len > 0);
icp->icp_flags |= ICPF_RX_DDP; icp->icp_flags |= ICPF_RX_DDP;
counter_u64_add(ci->ddp_pdus, 1); toep->ofld_rxq->rx_iscsi_ddp_pdus++;
counter_u64_add(ci->ddp_bytes, ip->ip_data_len); toep->ofld_rxq->rx_iscsi_ddp_octets += ip->ip_data_len;
} }
INP_WLOCK(inp); INP_WLOCK(inp);
@ -527,7 +455,6 @@ cxgbei_deactivate(struct adapter *sc)
if (ci != NULL) { if (ci != NULL) {
sysctl_ctx_free(&ci->ctx); sysctl_ctx_free(&ci->ctx);
t4_free_ppod_region(&ci->pr); t4_free_ppod_region(&ci->pr);
free_ci_counters(ci);
free(ci, M_CXGBE); free(ci, M_CXGBE);
sc->iscsi_ulp_softc = NULL; sc->iscsi_ulp_softc = NULL;
} }

View File

@ -113,12 +113,6 @@ struct cxgbei_data {
struct ppod_region pr; struct ppod_region pr;
struct sysctl_ctx_list ctx; /* from uld_activate to deactivate */ struct sysctl_ctx_list ctx; /* from uld_activate to deactivate */
counter_u64_t ddp_setup_ok;
counter_u64_t ddp_setup_error;
counter_u64_t ddp_bytes;
counter_u64_t ddp_pdus;
counter_u64_t fl_bytes;
counter_u64_t fl_pdus;
}; };
/* cxgbei.c */ /* cxgbei.c */

View File

@ -819,7 +819,8 @@ icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip,
*ittp = htobe32(itt); *ittp = htobe32(itt);
MPASS(*arg == NULL); /* State is maintained for DDP only. */ MPASS(*arg == NULL); /* State is maintained for DDP only. */
if (rc != 0) if (rc != 0)
counter_u64_add(ci->ddp_setup_error, 1); counter_u64_add(
toep->ofld_rxq->rx_iscsi_ddp_setup_error, 1);
return (0); return (0);
} }
@ -853,7 +854,7 @@ icl_cxgbei_conn_task_setup(struct icl_conn *ic, struct icl_pdu *ip,
*ittp = htobe32(prsv->prsv_tag); *ittp = htobe32(prsv->prsv_tag);
*arg = prsv; *arg = prsv;
counter_u64_add(ci->ddp_setup_ok, 1); counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1);
return (0); return (0);
} }
@ -922,7 +923,8 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io,
*tttp = htobe32(ttt); *tttp = htobe32(ttt);
MPASS(io_to_ppod_reservation(io) == NULL); MPASS(io_to_ppod_reservation(io) == NULL);
if (rc != 0) if (rc != 0)
counter_u64_add(ci->ddp_setup_error, 1); counter_u64_add(
toep->ofld_rxq->rx_iscsi_ddp_setup_error, 1);
return (0); return (0);
} }
@ -968,7 +970,7 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io,
*tttp = htobe32(prsv->prsv_tag); *tttp = htobe32(prsv->prsv_tag);
io_to_ppod_reservation(io) = prsv; io_to_ppod_reservation(io) = prsv;
*arg = ctsio; *arg = ctsio;
counter_u64_add(ci->ddp_setup_ok, 1); counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1);
return (0); return (0);
} }

View File

@ -11886,6 +11886,14 @@ clear_stats(struct adapter *sc, u_int port_id)
ofld_rxq->fl.cl_allocated = 0; ofld_rxq->fl.cl_allocated = 0;
ofld_rxq->fl.cl_recycled = 0; ofld_rxq->fl.cl_recycled = 0;
ofld_rxq->fl.cl_fast_recycled = 0; ofld_rxq->fl.cl_fast_recycled = 0;
counter_u64_zero(
ofld_rxq->rx_iscsi_ddp_setup_ok);
counter_u64_zero(
ofld_rxq->rx_iscsi_ddp_setup_error);
ofld_rxq->rx_iscsi_ddp_pdus = 0;
ofld_rxq->rx_iscsi_ddp_octets = 0;
ofld_rxq->rx_iscsi_fl_pdus = 0;
ofld_rxq->rx_iscsi_fl_octets = 0;
ofld_rxq->rx_toe_tls_records = 0; ofld_rxq->rx_toe_tls_records = 0;
ofld_rxq->rx_toe_tls_octets = 0; ofld_rxq->rx_toe_tls_octets = 0;
} }

View File

@ -4116,12 +4116,37 @@ add_ofld_rxq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid,
return; return;
children = SYSCTL_CHILDREN(oid); children = SYSCTL_CHILDREN(oid);
SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, SYSCTL_ADD_ULONG(ctx, children, OID_AUTO,
"rx_toe_tls_records", CTLFLAG_RD, &ofld_rxq->rx_toe_tls_records, "rx_toe_tls_records", CTLFLAG_RD, &ofld_rxq->rx_toe_tls_records,
"# of TOE TLS records received"); "# of TOE TLS records received");
SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, SYSCTL_ADD_ULONG(ctx, children, OID_AUTO,
"rx_toe_tls_octets", CTLFLAG_RD, &ofld_rxq->rx_toe_tls_octets, "rx_toe_tls_octets", CTLFLAG_RD, &ofld_rxq->rx_toe_tls_octets,
"# of payload octets in received TOE TLS records"); "# of payload octets in received TOE TLS records");
oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "iscsi",
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "TOE iSCSI statistics");
children = SYSCTL_CHILDREN(oid);
ofld_rxq->rx_iscsi_ddp_setup_ok = counter_u64_alloc(M_WAITOK);
ofld_rxq->rx_iscsi_ddp_setup_error = counter_u64_alloc(M_WAITOK);
SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "ddp_setup_ok",
CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_setup_ok,
"# of times DDP buffer was setup successfully.");
SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "ddp_setup_error",
CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_setup_error,
"# of times DDP buffer setup failed.");
SYSCTL_ADD_U64(ctx, children, OID_AUTO, "ddp_octets",
CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_octets, 0,
"# of octets placed directly");
SYSCTL_ADD_U64(ctx, children, OID_AUTO, "ddp_pdus",
CTLFLAG_RD, &ofld_rxq->rx_iscsi_ddp_pdus, 0,
"# of PDUs with data placed directly.");
SYSCTL_ADD_U64(ctx, children, OID_AUTO, "fl_octets",
CTLFLAG_RD, &ofld_rxq->rx_iscsi_fl_octets, 0,
"# of data octets delivered in freelist");
SYSCTL_ADD_U64(ctx, children, OID_AUTO, "fl_pdus",
CTLFLAG_RD, &ofld_rxq->rx_iscsi_fl_pdus, 0,
"# of PDUs with data delivered in freelist");
} }
#endif #endif