From nobody Fri Oct 29 23:58:00 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3BBBA181CE01; Fri, 29 Oct 2021 23:58:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hgzrn0tPTz4VCV; Fri, 29 Oct 2021 23:58:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1ABE2023D; Fri, 29 Oct 2021 23:58:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TNw0lS003184; Fri, 29 Oct 2021 23:58:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TNw0Ra003183; Fri, 29 Oct 2021 23:58:00 GMT (envelope-from git) Date: Fri, 29 Oct 2021 23:58:00 GMT Message-Id: <202110292358.19TNw0Ra003183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 7e60a7e31843 - stable/13 - cxgbe: Make the TOE ISCSI RX stats per-queue instead of per adapter. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7e60a7e318439a49fbecff97701865f31e7f4c31 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7e60a7e318439a49fbecff97701865f31e7f4c31 commit 7e60a7e318439a49fbecff97701865f31e7f4c31 Author: John Baldwin AuthorDate: 2021-05-14 19:16:33 +0000 Commit: John Baldwin CommitDate: 2021-10-29 22:24:27 +0000 cxgbe: Make the TOE ISCSI RX stats per-queue instead of per adapter. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29903 (cherry picked from commit 4b6ed0758dc6fad17081d7bd791cb0edbddbddb8) (cherry picked from commit a9f0cf4838cb1991707fa32e1cf363ea18076249) --- sys/dev/cxgbe/adapter.h | 7 +++- sys/dev/cxgbe/cxgbei/cxgbei.c | 83 +++------------------------------------ sys/dev/cxgbe/cxgbei/cxgbei.h | 6 --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 10 +++-- sys/dev/cxgbe/t4_main.c | 8 ++++ sys/dev/cxgbe/t4_sge.c | 32 ++++++++++++++- 6 files changed, 55 insertions(+), 91 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index a394e8f11017..7909e0b108b2 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -664,11 +664,16 @@ iq_to_rxq(struct sge_iq *iq) 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); diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 4acdc726e75c..07f704752305 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -96,50 +96,6 @@ static int worker_thread_count; 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 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) 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 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) 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 @@ cxgbei_init(struct adapter *sc, struct cxgbei_data *ci) 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 @@ static int 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 @@ do_rx_iscsi_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m 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 @@ static int 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 @@ 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(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 @@ cxgbei_deactivate(struct adapter *sc) 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; } diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index b0369b974136..3b17a4f2b36a 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -113,12 +113,6 @@ struct cxgbei_data { 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 */ diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index 94963f13b601..961acfb31987 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -819,7 +819,8 @@ no_ddp: *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 @@ no_ddp: *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 @@ no_ddp: *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 @@ no_ddp: *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); } diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index eebba8afcb8c..bb8b9a4d78fb 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -11909,6 +11909,14 @@ clear_stats(struct adapter *sc, u_int port_id) 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; } diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 3134542b1b87..3679bbf84f2f 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4082,6 +4082,9 @@ alloc_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq, int idx, return (rc); } MPASS(ofld_rxq->iq.flags & IQ_SW_ALLOCATED); + ofld_rxq->rx_iscsi_ddp_setup_ok = counter_u64_alloc(M_WAITOK); + ofld_rxq->rx_iscsi_ddp_setup_error = + counter_u64_alloc(M_WAITOK); add_ofld_rxq_sysctls(&vi->ctx, oid, ofld_rxq); } @@ -4114,6 +4117,8 @@ free_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq *ofld_rxq) MPASS(!(ofld_rxq->iq.flags & IQ_HW_ALLOCATED)); free_iq_fl(vi->adapter, &ofld_rxq->iq, &ofld_rxq->fl); MPASS(!(ofld_rxq->iq.flags & IQ_SW_ALLOCATED)); + counter_u64_free(ofld_rxq->rx_iscsi_ddp_setup_ok); + counter_u64_free(ofld_rxq->rx_iscsi_ddp_setup_error); bzero(ofld_rxq, sizeof(*ofld_rxq)); } } @@ -4128,12 +4133,35 @@ add_ofld_rxq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid, 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); + + 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