From owner-dev-commits-src-main@freebsd.org Wed Sep 1 23:07:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C3E76734DE; Wed, 1 Sep 2021 23:07:43 +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 4H0KTV2CtRz4yFq; Wed, 1 Sep 2021 23:07:42 +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 AD0296106; Wed, 1 Sep 2021 23:07:41 +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 181N7fJb020977; Wed, 1 Sep 2021 23:07:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 181N7fsG020976; Wed, 1 Sep 2021 23:07:41 GMT (envelope-from git) Date: Wed, 1 Sep 2021 23:07:41 GMT Message-Id: <202109012307.181N7fsG020976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 223c8cb12e95 - main - ena: Add missing statistics MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 223c8cb12e951c63807300a0cbdc4a1569520b4b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2021 23:07:43 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=223c8cb12e951c63807300a0cbdc4a1569520b4b commit 223c8cb12e951c63807300a0cbdc4a1569520b4b Author: Artur Rojek AuthorDate: 2021-08-12 08:34:29 +0000 Commit: Marcin Wojtas 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 */