git: 568e69e4eb0a - main - cxgbe: Add counters for iSCSI PDUs transmitted via TOE.

John Baldwin jhb at FreeBSD.org
Mon Apr 12 20:58:46 UTC 2021


The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=568e69e4eb0ad1a5c69d8ea4592a4314bd6b6679

commit 568e69e4eb0ad1a5c69d8ea4592a4314bd6b6679
Author:     John Baldwin <jhb at FreeBSD.org>
AuthorDate: 2021-04-12 20:56:04 +0000
Commit:     John Baldwin <jhb at FreeBSD.org>
CommitDate: 2021-04-12 20:57:45 +0000

    cxgbe: Add counters for iSCSI PDUs transmitted via TOE.
    
    Reviewed by:    np
    MFC after:      1 week
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D29297
---
 sys/dev/cxgbe/adapter.h       |  2 ++
 sys/dev/cxgbe/t4_main.c       |  2 ++
 sys/dev/cxgbe/t4_sge.c        | 10 ++++++++++
 sys/dev/cxgbe/tom/t4_cpl_io.c |  3 +++
 4 files changed, 17 insertions(+)

diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h
index 7dd4cb72c63c..c46f9626b95b 100644
--- a/sys/dev/cxgbe/adapter.h
+++ b/sys/dev/cxgbe/adapter.h
@@ -712,6 +712,8 @@ struct sge_wrq {
 /* ofld_txq: SGE egress queue + miscellaneous items */
 struct sge_ofld_txq {
 	struct sge_wrq wrq;
+	counter_u64_t tx_iscsi_pdus;
+	counter_u64_t tx_iscsi_octets;
 	counter_u64_t tx_toe_tls_records;
 	counter_u64_t tx_toe_tls_octets;
 } __aligned(CACHE_LINE_SIZE);
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index b8500984fb8a..ce439b94aa6c 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -10756,6 +10756,8 @@ clear_stats(struct adapter *sc, u_int port_id)
 			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_iscsi_pdus);
+				counter_u64_zero(ofld_txq->tx_iscsi_octets);
 				counter_u64_zero(ofld_txq->tx_toe_tls_records);
 				counter_u64_zero(ofld_txq->tx_toe_tls_octets);
 			}
diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c
index 002b4892e110..2c7e8f348331 100644
--- a/sys/dev/cxgbe/t4_sge.c
+++ b/sys/dev/cxgbe/t4_sge.c
@@ -4507,8 +4507,16 @@ alloc_ofld_txq(struct vi_info *vi, struct sge_ofld_txq *ofld_txq, int idx,
 	if (rc != 0)
 		return (rc);
 
+	ofld_txq->tx_iscsi_pdus = counter_u64_alloc(M_WAITOK);
+	ofld_txq->tx_iscsi_octets = counter_u64_alloc(M_WAITOK);
 	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_iscsi_pdus", CTLFLAG_RD, &ofld_txq->tx_iscsi_pdus,
+	    "# of iSCSI PDUs transmitted");
+	SYSCTL_ADD_COUNTER_U64(&vi->ctx, children, OID_AUTO,
+	    "tx_iscsi_octets", CTLFLAG_RD, &ofld_txq->tx_iscsi_octets,
+	    "# of payload octets in transmitted iSCSI PDUs");
 	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");
@@ -4529,6 +4537,8 @@ free_ofld_txq(struct vi_info *vi, struct sge_ofld_txq *ofld_txq)
 	if (rc != 0)
 		return (rc);
 
+	counter_u64_free(ofld_txq->tx_iscsi_pdus);
+	counter_u64_free(ofld_txq->tx_iscsi_octets);
 	counter_u64_free(ofld_txq->tx_toe_tls_records);
 	counter_u64_free(ofld_txq->tx_toe_tls_octets);
 
diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c
index 07340709934a..ee40d0646b71 100644
--- a/sys/dev/cxgbe/tom/t4_cpl_io.c
+++ b/sys/dev/cxgbe/tom/t4_cpl_io.c
@@ -1092,6 +1092,9 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, int drop)
 		}
 		toep->txsd_avail--;
 
+		counter_u64_add(toep->ofld_txq->tx_iscsi_pdus, 1);
+		counter_u64_add(toep->ofld_txq->tx_iscsi_octets, plen);
+
 		t4_l2t_send(sc, wr, toep->l2te);
 	}
 


More information about the dev-commits-src-all mailing list