diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -316,10 +316,6 @@ u_int tx_parse_error; int fcs_reg; uint64_t fcs_base; - u_long tx_toe_tls_records; - u_long tx_toe_tls_octets; - u_long rx_toe_tls_records; - u_long rx_toe_tls_octets; struct callout tick; }; @@ -654,6 +650,8 @@ struct sge_ofld_rxq { struct sge_iq iq; /* MUST be first */ struct sge_fl fl; /* MUST follow iq */ + u_long rx_toe_tls_records; + u_long rx_toe_tls_octets; } __aligned(CACHE_LINE_SIZE); static inline struct sge_ofld_rxq * @@ -715,6 +713,8 @@ /* ofld_txq: SGE egress queue + miscellaneous items */ struct sge_ofld_txq { struct sge_wrq wrq; + counter_u64_t tx_toe_tls_records; + counter_u64_t tx_toe_tls_octets; } __aligned(CACHE_LINE_SIZE); #define INVALID_NM_RXQ_CNTXT_ID ((uint16_t)(-1)) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -7218,19 +7218,6 @@ #undef T4_REGSTAT #undef T4_PORTSTAT - - SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "tx_toe_tls_records", - CTLFLAG_RD, &pi->tx_toe_tls_records, - "# of TOE TLS records transmitted"); - SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "tx_toe_tls_octets", - CTLFLAG_RD, &pi->tx_toe_tls_octets, - "# of payload octets in transmitted TOE TLS records"); - SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "rx_toe_tls_records", - CTLFLAG_RD, &pi->rx_toe_tls_records, - "# of TOE TLS records received"); - SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "rx_toe_tls_octets", - CTLFLAG_RD, &pi->rx_toe_tls_octets, - "# of payload octets in received TOE TLS records"); } static int @@ -10765,6 +10752,8 @@ for_each_ofld_txq(vi, i, ofld_txq) { ofld_txq->wrq.tx_wrs_direct = 0; ofld_txq->wrq.tx_wrs_copied = 0; + counter_u64_zero(ofld_txq->tx_toe_tls_records); + counter_u64_zero(ofld_txq->tx_toe_tls_octets); } #endif #ifdef TCP_OFFLOAD @@ -10772,6 +10761,8 @@ ofld_rxq->fl.cl_allocated = 0; ofld_rxq->fl.cl_recycled = 0; ofld_rxq->fl.cl_fast_recycled = 0; + ofld_rxq->rx_toe_tls_records = 0; + ofld_rxq->rx_toe_tls_octets = 0; } #endif diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -3958,6 +3958,13 @@ add_iq_sysctls(&vi->ctx, oid, &ofld_rxq->iq); add_fl_sysctls(pi->adapter, &vi->ctx, oid, &ofld_rxq->fl); + SYSCTL_ADD_ULONG(&vi->ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + "rx_toe_tls_records", CTLFLAG_RD, &ofld_rxq->rx_toe_tls_records, + "# of TOE TLS records received"); + SYSCTL_ADD_ULONG(&vi->ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + "rx_toe_tls_octets", CTLFLAG_RD, &ofld_rxq->rx_toe_tls_octets, + "# of payload octets in received TOE TLS records"); + return (rc); } @@ -4494,11 +4501,21 @@ snprintf(name, sizeof(name), "%d", idx); oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "offload tx queue"); + children = SYSCTL_CHILDREN(oid); rc = alloc_wrq(sc, vi, &ofld_txq->wrq, oid); if (rc != 0) return (rc); + ofld_txq->tx_toe_tls_records = counter_u64_alloc(M_WAITOK); + ofld_txq->tx_toe_tls_octets = counter_u64_alloc(M_WAITOK); + SYSCTL_ADD_COUNTER_U64(&vi->ctx, children, OID_AUTO, + "tx_toe_tls_records", CTLFLAG_RD, &ofld_txq->tx_toe_tls_records, + "# of TOE TLS records transmitted"); + SYSCTL_ADD_COUNTER_U64(&vi->ctx, children, OID_AUTO, + "tx_toe_tls_octets", CTLFLAG_RD, &ofld_txq->tx_toe_tls_octets, + "# of payload octets in transmitted TOE TLS records"); + return (rc); } @@ -4512,6 +4529,9 @@ if (rc != 0) return (rc); + counter_u64_free(ofld_txq->tx_toe_tls_records); + counter_u64_free(ofld_txq->tx_toe_tls_octets); + bzero(ofld_txq, sizeof(*ofld_txq)); return (0); } diff --git a/sys/dev/cxgbe/tom/t4_tls.c b/sys/dev/cxgbe/tom/t4_tls.c --- a/sys/dev/cxgbe/tom/t4_tls.c +++ b/sys/dev/cxgbe/tom/t4_tls.c @@ -1664,8 +1664,8 @@ } toep->txsd_avail--; - atomic_add_long(&toep->vi->pi->tx_toe_tls_records, 1); - atomic_add_long(&toep->vi->pi->tx_toe_tls_octets, plen); + counter_u64_add(toep->ofld_txq->tx_toe_tls_records, 1); + counter_u64_add(toep->ofld_txq->tx_toe_tls_octets, plen); t4_l2t_send(sc, wr, toep->l2te); } @@ -1966,8 +1966,8 @@ } toep->txsd_avail--; - atomic_add_long(&toep->vi->pi->tx_toe_tls_records, 1); - atomic_add_long(&toep->vi->pi->tx_toe_tls_octets, m->m_len); + counter_u64_add(toep->ofld_txq->tx_toe_tls_records, 1); + counter_u64_add(toep->ofld_txq->tx_toe_tls_octets, m->m_len); t4_l2t_send(sc, wr, toep->l2te); } @@ -2003,7 +2003,7 @@ m_adj(m, sizeof(*cpl)); len = m->m_pkthdr.len; - atomic_add_long(&toep->vi->pi->rx_toe_tls_octets, len); + toep->ofld_rxq->rx_toe_tls_octets += len; KASSERT(len == G_CPL_TLS_DATA_LENGTH(be32toh(cpl->length_pkd)), ("%s: payload length mismatch", __func__)); @@ -2070,7 +2070,7 @@ m_adj(m, sizeof(*cpl)); len = m->m_pkthdr.len; - atomic_add_long(&toep->vi->pi->rx_toe_tls_records, 1); + toep->ofld_rxq->rx_toe_tls_records++; KASSERT(len == G_CPL_RX_TLS_CMP_LENGTH(be32toh(cpl->pdulength_length)), ("%s: payload length mismatch", __func__));