From nobody Thu Jul 16 18:24:12 2026 X-Original-To: dev-commits-src-main@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 4h1LzJ5lGLz6lkbp for ; Thu, 16 Jul 2026 18:24:12 +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 4h1LzJ527Hz3XTR for ; Thu, 16 Jul 2026 18:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784226252; 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=KDEAg3JS/DuWQ0nwpslHjJAmn8TwYbXqIBi8L967xTQ=; b=APpZRWOMJo/jOZlLFfm44Bgc9g6nMhmIi4gousgKh2/khWluur6BJ8ljKAGktJv+FNVRaa RvBCRnXLY+foOIH/uPe9gTjQGnqquvGB8fk2IIhLtq8tE+94y8rR2PczX167UHpz62JNRb ihowzcjOPfhwnMT4OOGvCbjRT8gn6l477Se6GW12el4Q26yCGqnq8wDJhtfyRJ9Qh2RYP6 o70/m5hVwAcDn51qyzWd1BXxY7UGX5K5FDTLQBFGCoc9JrrHtkDSr5Z6uqICzEb6rhZYG5 8MWgzSHL6tVEgsgh0FPXS3eP/vR6r6M9aU+G3N+x595s0NIbm66Br/WNdmwwBg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1784226252; a=rsa-sha256; cv=none; b=VnLTHAhk5ucHW4jzCke24TZ+Ucy3XK18iexHtkG2QiaQ9KlkrKSgwgkcgdL+t7irTzzS+6 51KwY3vEI7LN5Rg/pgorvis0DKX3DHeQG6zdNbK/bYjdedk/BVr4CBup2Ccl2jV6ni97rB AS0moZGE1jewOVkQtnUtRiC5PW2WEBQscs43+G1slf3wk6m1xm46q1WFjZ5TUluO7jb71t 6OzvXFjdXRsI7Um6y+x+XzVL96LlGfhQMtiStJZB8t48DEEUm/JoUW5b61XV3danaDvcPn 7ohS6e29Zk8Tp2nut6XYjD70cSLPypYYcAr/+c0fYhndne+ZSaWq84FtD4za+g== 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=1784226252; 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=KDEAg3JS/DuWQ0nwpslHjJAmn8TwYbXqIBi8L967xTQ=; b=NWNIaeOCT6HAP0VJnbafQqGJ1RTfi5SAKBHrnApIiV+SuQI4S4Y2NT9CqdG6K5Bcc+b5X9 0AZfKlws12Eq4RxKA2I92Y7H9IISFxJxosh4oplbi43QdD38wwRHEqlkAU2fau09al+jiW Y5LDMgjKfOXnzantc17M51cM5ahZlc0XxClD5Z0Gu48dOmMOGMsD1qb73T29HEuLnX6azC 4kaOPtUD6toOM0CwcWzuzrp4L9XXgql0vQqpcW1qYgvwdD2UJrP2kMHJLuQBbgsn8n1OK1 c3gU1whO5JMOuod0TZx/VxV6RGmBut+BMaQvhgdvznLkOKZQpB2W8e+lD6YGDw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h1LzJ3M9Xz1RqB for ; Thu, 16 Jul 2026 18:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36f0a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 16 Jul 2026 18:24:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: David Arinzon From: Arthur Kiyanovski Subject: git: 3ba01cb4c61c - main - ena: Batch RX statistics updates List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 3ba01cb4c61cc1e29c4d1d7ea4b73cdffb5ce3c2 Auto-Submitted: auto-generated Date: Thu, 16 Jul 2026 18:24:12 +0000 Message-Id: <6a5921cc.36f0a.7e136f97@gitrepo.freebsd.org> The branch main has been updated by akiyano: URL: https://cgit.FreeBSD.org/src/commit/?id=3ba01cb4c61cc1e29c4d1d7ea4b73cdffb5ce3c2 commit 3ba01cb4c61cc1e29c4d1d7ea4b73cdffb5ce3c2 Author: David Arinzon AuthorDate: 2026-04-16 11:22:04 +0000 Commit: Arthur Kiyanovski CommitDate: 2026-07-16 18:20:41 +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 --- 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 1e5298c2d984..c11006cbc10f 100644 --- a/sys/dev/ena/ena_datapath.c +++ b/sys/dev/ena/ena_datapath.c @@ -572,6 +572,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 */ @@ -614,7 +616,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)) @@ -646,12 +648,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. @@ -676,10 +673,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 @@ -702,6 +696,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); }