Index: sys/dev/cxgbe/adapter.h =================================================================== --- sys/dev/cxgbe/adapter.h +++ sys/dev/cxgbe/adapter.h @@ -656,11 +656,16 @@ return (__containerof(iq, struct sge_rxq, iq)); } - /* ofld_rxq: SGE ingress queue + SGE free list + miscellaneous items */ struct sge_ofld_rxq { struct sge_iq iq; /* MUST be first */ 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_octets; } __aligned(CACHE_LINE_SIZE); Index: sys/dev/cxgbe/cxgbei/cxgbei.h =================================================================== --- sys/dev/cxgbe/cxgbei/cxgbei.h +++ sys/dev/cxgbe/cxgbei/cxgbei.h @@ -113,12 +113,6 @@ struct ppod_region pr; 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 */ Index: sys/dev/cxgbe/cxgbei/cxgbei.c =================================================================== --- sys/dev/cxgbe/cxgbei/cxgbei.c +++ sys/dev/cxgbe/cxgbei/cxgbei.c @@ -96,50 +96,6 @@ static struct cxgbei_worker_thread_softc *cwt_softc; 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 read_pdu_limits(struct adapter *sc, uint32_t *max_tx_pdu_len, uint32_t *max_rx_pdu_len) @@ -182,10 +138,6 @@ MPASS(sc->vres.iscsi.size > 0); 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); pr = &ci->pr; @@ -195,7 +147,6 @@ device_printf(sc->dev, "%s: failed to initialize the iSCSI page pod region: %u.\n", __func__, rc); - free_ci_counters(ci); return (rc); } @@ -219,30 +170,9 @@ children = SYSCTL_CHILDREN(oid); 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); - 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; SYSCTL_ADD_UINT(&ci->ctx, children, OID_AUTO, "ddp_threshold", CTLFLAG_RW, &ci->ddp_threshold, 0, "Rx zero copy threshold"); @@ -291,7 +221,6 @@ do_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) { struct adapter *sc = iq->adapter; - struct cxgbei_data *ci = sc->iscsi_ulp_softc; struct cpl_iscsi_data *cpl = mtod(m, struct cpl_iscsi_data *); u_int tid = GET_TID(cpl); struct toepcb *toep = lookup_tid(sc, tid); @@ -311,8 +240,8 @@ icp->icp_flags |= ICPF_RX_FLBUF; icp->ip.ip_data_mbuf = m; - counter_u64_add(ci->fl_pdus, 1); - counter_u64_add(ci->fl_bytes, m->m_pkthdr.len); + toep->ofld_rxq->rx_iscsi_fl_pdus++; + toep->ofld_rxq->rx_iscsi_fl_octets += m->m_pkthdr.len; #if 0 CTR3(KTR_CXGBE, "%s: tid %u, cpl->len %u", __func__, tid, @@ -326,7 +255,6 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) { struct adapter *sc = iq->adapter; - struct cxgbei_data *ci = sc->iscsi_ulp_softc; const struct cpl_rx_data_ddp *cpl = (const void *)(rss + 1); u_int tid = GET_TID(cpl); struct toepcb *toep = lookup_tid(sc, tid); @@ -369,8 +297,8 @@ MPASS((icp->icp_flags & ICPF_RX_FLBUF) == 0); MPASS(ip->ip_data_len > 0); icp->icp_flags |= ICPF_RX_DDP; - counter_u64_add(ci->ddp_pdus, 1); - counter_u64_add(ci->ddp_bytes, ip->ip_data_len); + toep->ofld_rxq->rx_iscsi_ddp_pdus++; + toep->ofld_rxq->rx_iscsi_ddp_octets += ip->ip_data_len; } INP_WLOCK(inp); @@ -527,7 +455,6 @@ if (ci != NULL) { sysctl_ctx_free(&ci->ctx); t4_free_ppod_region(&ci->pr); - free_ci_counters(ci); free(ci, M_CXGBE); sc->iscsi_ulp_softc = NULL; } Index: sys/dev/cxgbe/cxgbei/icl_cxgbei.c =================================================================== --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -819,7 +819,8 @@ *ittp = htobe32(itt); MPASS(*arg == NULL); /* State is maintained for DDP only. */ 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); } @@ -853,7 +854,7 @@ *ittp = htobe32(prsv->prsv_tag); *arg = prsv; - counter_u64_add(ci->ddp_setup_ok, 1); + counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1); return (0); } @@ -922,7 +923,8 @@ *tttp = htobe32(ttt); MPASS(io_to_ppod_reservation(io) == NULL); 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); } @@ -968,7 +970,7 @@ *tttp = htobe32(prsv->prsv_tag); io_to_ppod_reservation(io) = prsv; *arg = ctsio; - counter_u64_add(ci->ddp_setup_ok, 1); + counter_u64_add(toep->ofld_rxq->rx_iscsi_ddp_setup_ok, 1); return (0); } Index: sys/dev/cxgbe/t4_main.c =================================================================== --- sys/dev/cxgbe/t4_main.c +++ sys/dev/cxgbe/t4_main.c @@ -11886,6 +11886,14 @@ ofld_rxq->fl.cl_allocated = 0; ofld_rxq->fl.cl_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_octets = 0; } Index: sys/dev/cxgbe/t4_sge.c =================================================================== --- sys/dev/cxgbe/t4_sge.c +++ sys/dev/cxgbe/t4_sge.c @@ -4116,12 +4116,37 @@ return; 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, "# 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, "# 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