From nobody Sat Aug 1 14:20:28 2026 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 4hC4pj2tMjz6n78t for ; Sat, 01 Aug 2026 14:20:29 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hC4pj0HnBz3RyX for ; Sat, 01 Aug 2026 14:20:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785594029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VREbcx7bsKESpeJoey3TQBkXPYCjL4EWINS/Bqj0Vjc=; b=BT0M4bjtIUxIFkAm57e35d0MRh9QlPe6/XA7SQuS8bB2rug8zTeVE6M4clfQNssb/RdOLI m0MXh1YWhq8bG5eAHgjz4vPR/a2Lx29NUYi8fuLXCgVMmeszrFC2JfDalOoqwJaljAF3Z1 lncebwqZI1Gz3M4p6UR2Mt6sFUkaPoYVIis3Xic05M3ImX5sLuTfMmj6cA2YkBNxXz1uAA dAmjl00Sqet+4WS0Uvk7vcJM5Cz58GCALOaGfC0MEGVYB/s98aB2BAePLBKucyU7IzhtEq nL+/khLBbEXE2nqht0J/QmAh7E6KHTLf3uO/Dx11nFOKHKXN7/vr9lvBoZZytw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785594029; a=rsa-sha256; cv=none; b=KIHzPCdALoRHwlOBShMGyIQJPxGZ++laTQHU4IjmwMJh+Muh2kYvv+DjoLXDBWLlrFy7cv rpLLZ3QfWd+4aZmpdmtDJ9SsekkKRo+i5gI5DzJ8qHwPBptBy+x2ppnjzjbh3vqcY2tW5C WypbnV0IyNYs38wxWeeAVdb0YekjOvaJO8Aqa838/vvITO3DzANnlvBQoVhtrRSgUK9Tui S+CHOyjHhOYfgOjRnfTIDsu3Y7aiDBK6Xn5ixfliNzUKm1Ab+ux9q9vDb8lpaWOj4V0DyS 0m0N0jXI8UipUI7qUFwOKgpCit+kAQzYhal77nYn3vLHc1XJhv1vDfpxdxlsKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785594029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VREbcx7bsKESpeJoey3TQBkXPYCjL4EWINS/Bqj0Vjc=; b=oUy30S4rahGIuFnTmn21Ds4UNHo5j1sQ2ejs0Nzz32dMCij6YOgFqSu8zj4J+PizsmLSti JFFOzToac2O3XvvOExgI++fTPMYqlDxy+RYlvLIVUaYqn9kcIQiVsBHWnxZajyeyLo14xB TpPf1nDrjBZBnwqRRLZt7+/cYFAvetssQMdOME+2I2wRMqDTb+UyMGOfQYy2S3ss2lA/Lq WJqhFqutJdiRi5zy0rNmMEyAAlkxb+ovX9CCIag8RvGOXbp7wIPRV45cUv4I+khNiQ3frz k/JFtFSGhzVqvKO0PPkvZN7mCGnY+8R5mTXjygIw1vXZCaYuPEoen43wPHKxDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hC4ph67CRznfs for ; Sat, 01 Aug 2026 14:20:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31e45 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 01 Aug 2026 14:20:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: David Arinzon From: Arthur Kiyanovski Subject: git: ae462f7fc72a - stable/15 - ena: Batch RX statistics updates 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: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: akiyano X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: ae462f7fc72a2211665ffa4d4fde11a53ab1c16b Auto-Submitted: auto-generated Date: Sat, 01 Aug 2026 14:20:28 +0000 Message-Id: <6a6e00ac.31e45.69fc5982@gitrepo.freebsd.org> The branch stable/15 has been updated by akiyano: URL: https://cgit.FreeBSD.org/src/commit/?id=ae462f7fc72a2211665ffa4d4fde11a53ab1c16b commit ae462f7fc72a2211665ffa4d4fde11a53ab1c16b Author: David Arinzon AuthorDate: 2026-04-16 11:22:04 +0000 Commit: Arthur Kiyanovski CommitDate: 2026-08-01 14:06:36 +0000 ena: Batch RX statistics updates Move per-packet counter_enter/counter_exit pairs out of the RX processing loop and batch them into a single update after the loop completes. Previously, each received packet triggered two separate counter_enter/counter_exit blocks -- one for bytes and one for packet count. This commit accumulates totals in local variables and updates all four counters (ring and hw stats for both packets and bytes) in a single counter_enter/counter_exit block after the loop. Also move the stats update to after the refill and LRO flush so that the error path (goto update_stats) and the normal path converge at the same label, avoiding code duplication. Submitted by: David Arinzon MFC after: 2 weeks Sponsored by: Amazon, Inc. Reviewed by: cperciva Differential Revision: https://reviews.freebsd.org/D58240 (cherry picked from commit 3ba01cb4c61cc1e29c4d1d7ea4b73cdffb5ce3c2) --- sys/dev/ena/ena_datapath.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c index 4fbdb8daaf58..1ce5c2ae3e65 100644 --- a/sys/dev/ena/ena_datapath.c +++ b/sys/dev/ena/ena_datapath.c @@ -576,6 +576,8 @@ ena_rx_cleanup(struct ena_ring *rx_ring) unsigned int qid; int rc, i; int budget = (ENA_RX_DESC_BUDGET == -1) ? INT_MAX : ENA_RX_DESC_BUDGET; + uint64_t total_pkts = 0; + uint64_t total_bytes = 0; #ifdef DEV_NETMAP int done; #endif /* DEV_NETMAP */ @@ -618,7 +620,7 @@ ena_rx_cleanup(struct ena_ring *rx_ring) reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID; } ena_trigger_reset(adapter, reset_reason); - return (0); + goto update_stats; } if (unlikely(ena_rx_ctx.descs == 0)) @@ -650,12 +652,7 @@ ena_rx_cleanup(struct ena_ring *rx_ring) ena_rx_checksum(rx_ring, &ena_rx_ctx, mbuf); } - counter_enter(); - counter_u64_add_protected(rx_ring->rx_stats.bytes, - mbuf->m_pkthdr.len); - counter_u64_add_protected(adapter->hw_stats.rx_bytes, - mbuf->m_pkthdr.len); - counter_exit(); + total_bytes += mbuf->m_pkthdr.len; /* * LRO is only for IP/TCP packets and TCP checksum of the packet * should be computed by hardware. @@ -680,10 +677,7 @@ ena_rx_cleanup(struct ena_ring *rx_ring) if_input(ifp, mbuf); } - counter_enter(); - counter_u64_add_protected(rx_ring->rx_stats.cnt, 1); - counter_u64_add_protected(adapter->hw_stats.rx_packets, 1); - counter_exit(); + total_pkts++; /* * Adjust our budget; note that we count descriptors, not @@ -706,6 +700,13 @@ ena_rx_cleanup(struct ena_ring *rx_ring) tcp_lro_flush_all(&rx_ring->lro); +update_stats: + counter_enter(); + counter_u64_add_protected(rx_ring->rx_stats.cnt, total_pkts); + counter_u64_add_protected(rx_ring->rx_stats.bytes, total_bytes); + counter_u64_add_protected(adapter->hw_stats.rx_packets, total_pkts); + counter_u64_add_protected(adapter->hw_stats.rx_bytes, total_bytes); + counter_exit(); return (budget <= 0); }