Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Sep 2021 23:07:41 GMT
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 223c8cb12e95 - main - ena: Add missing statistics
Message-ID:  <202109012307.181N7fsG020976@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=223c8cb12e951c63807300a0cbdc4a1569520b4b

commit 223c8cb12e951c63807300a0cbdc4a1569520b4b
Author:     Artur Rojek <ar@semihalf.com>
AuthorDate: 2021-08-12 08:34:29 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2021-09-01 23:06:47 +0000

    ena: Add missing statistics
    
    Provide the following sysctl statistics in order to stay aligned with
    the Linux driver:
    * rx_ring.csum_good
    * tx_ring.unmask_interrupt_num
    
    Also rename the 'bad_csum' statistic name to 'csum_bad' for alignment.
    
    Obtained from: Semihalf
    MFC after: 2 weeks
    Sponsored by: Amazon, Inc.
---
 sys/dev/ena/ena.c          |  3 +++
 sys/dev/ena/ena.h          |  4 +++-
 sys/dev/ena/ena_datapath.c |  6 ++++--
 sys/dev/ena/ena_sysctl.c   | 11 +++++++++--
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c
index c1b770926b0f..91ddc7733b9f 100644
--- a/sys/dev/ena/ena.c
+++ b/sys/dev/ena/ena.c
@@ -1874,6 +1874,7 @@ ena_unmask_all_io_irqs(struct ena_adapter *adapter)
 {
 	struct ena_com_io_cq* io_cq;
 	struct ena_eth_io_intr_reg intr_reg;
+	struct ena_ring *tx_ring;
 	uint16_t ena_qid;
 	int i;
 
@@ -1882,6 +1883,8 @@ ena_unmask_all_io_irqs(struct ena_adapter *adapter)
 		ena_qid = ENA_IO_TXQ_IDX(i);
 		io_cq = &adapter->ena_dev->io_cq_queues[ena_qid];
 		ena_com_update_intr_reg(&intr_reg, 0, 0, true);
+		tx_ring = &adapter->tx_ring[i];
+		counter_u64_add(tx_ring->tx_stats.unmask_interrupt_num, 1);
 		ena_com_unmask_intr(io_cq, &intr_reg);
 	}
 }
diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h
index 0e85cb39b001..bc0f59a6f711 100644
--- a/sys/dev/ena/ena.h
+++ b/sys/dev/ena/ena.h
@@ -280,19 +280,21 @@ struct ena_stats_tx {
 	counter_u64_t queue_wakeup;
 	counter_u64_t queue_stop;
 	counter_u64_t llq_buffer_copy;
+	counter_u64_t unmask_interrupt_num;
 };
 
 struct ena_stats_rx {
 	counter_u64_t cnt;
 	counter_u64_t bytes;
 	counter_u64_t refil_partial;
-	counter_u64_t bad_csum;
+	counter_u64_t csum_bad;
 	counter_u64_t mjum_alloc_fail;
 	counter_u64_t mbuf_alloc_fail;
 	counter_u64_t dma_mapping_err;
 	counter_u64_t bad_desc_num;
 	counter_u64_t bad_req_id;
 	counter_u64_t empty_rx_ring;
+	counter_u64_t csum_good;
 };
 
 struct ena_ring {
diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c
index 6506c808e4cb..e1993a714fa0 100644
--- a/sys/dev/ena/ena_datapath.c
+++ b/sys/dev/ena/ena_datapath.c
@@ -103,6 +103,7 @@ ena_cleanup(void *arg, int pending)
 	    RX_IRQ_INTERVAL,
 	    TX_IRQ_INTERVAL,
 	    true);
+	counter_u64_add(tx_ring->tx_stats.unmask_interrupt_num, 1);
 	ena_com_unmask_intr(io_cq, &intr_reg);
 }
 
@@ -516,7 +517,7 @@ ena_rx_checksum(struct ena_ring *rx_ring, struct ena_com_rx_ctx *ena_rx_ctx,
 	    ena_rx_ctx->l3_csum_err)) {
 		/* ipv4 checksum error */
 		mbuf->m_pkthdr.csum_flags = 0;
-		counter_u64_add(rx_ring->rx_stats.bad_csum, 1);
+		counter_u64_add(rx_ring->rx_stats.csum_bad, 1);
 		ena_log_io(pdev, DBG, "RX IPv4 header checksum error\n");
 		return;
 	}
@@ -527,11 +528,12 @@ ena_rx_checksum(struct ena_ring *rx_ring, struct ena_com_rx_ctx *ena_rx_ctx,
 		if (ena_rx_ctx->l4_csum_err) {
 			/* TCP/UDP checksum error */
 			mbuf->m_pkthdr.csum_flags = 0;
-			counter_u64_add(rx_ring->rx_stats.bad_csum, 1);
+			counter_u64_add(rx_ring->rx_stats.csum_bad, 1);
 			ena_log_io(pdev, DBG, "RX L4 checksum error\n");
 		} else {
 			mbuf->m_pkthdr.csum_flags = CSUM_IP_CHECKED;
 			mbuf->m_pkthdr.csum_flags |= CSUM_IP_VALID;
+			counter_u64_add(rx_ring->rx_stats.csum_good, 1);
 		}
 	}
 }
diff --git a/sys/dev/ena/ena_sysctl.c b/sys/dev/ena/ena_sysctl.c
index cc8dff4af0c0..91bd0f74b341 100644
--- a/sys/dev/ena/ena_sysctl.c
+++ b/sys/dev/ena/ena_sysctl.c
@@ -238,6 +238,10 @@ ena_sysctl_add_stats(struct ena_adapter *adapter)
 		    "llq_buffer_copy", CTLFLAG_RD,
 		    &tx_stats->llq_buffer_copy,
 		    "Header copies for llq transaction");
+		SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO,
+		    "unmask_interrupt_num", CTLFLAG_RD,
+		    &tx_stats->unmask_interrupt_num,
+		    "Unmasked interrupt count");
 
 		/* RX specific stats */
 		rx_node = SYSCTL_ADD_NODE(ctx, queue_list, OID_AUTO,
@@ -256,8 +260,8 @@ ena_sysctl_add_stats(struct ena_adapter *adapter)
 		    "refil_partial", CTLFLAG_RD,
 		    &rx_stats->refil_partial, "Partial refilled mbufs");
 		SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
-		    "bad_csum", CTLFLAG_RD,
-		    &rx_stats->bad_csum, "Bad RX checksum");
+		    "csum_bad", CTLFLAG_RD,
+		    &rx_stats->csum_bad, "Bad RX checksum");
 		SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
 		    "mbuf_alloc_fail", CTLFLAG_RD,
 		    &rx_stats->mbuf_alloc_fail, "Failed mbuf allocs");
@@ -276,6 +280,9 @@ ena_sysctl_add_stats(struct ena_adapter *adapter)
 		SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
 		    "empty_rx_ring", CTLFLAG_RD,
 		    &rx_stats->empty_rx_ring, "RX descriptors depletion count");
+		SYSCTL_ADD_COUNTER_U64(ctx, rx_list, OID_AUTO,
+		    "csum_good", CTLFLAG_RD,
+		    &rx_stats->csum_good, "Valid RX checksum calculations");
 	}
 
 	/* Stats read from device */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109012307.181N7fsG020976>