From nobody Thu Jul 30 05:15:13 2026 X-Original-To: dev-commits-src-all@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 4h9cpZ6qmnz6mh1p for ; Thu, 30 Jul 2026 05:15:18 +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 4h9cpZ60tjz3ZNB for ; Thu, 30 Jul 2026 05:15:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785388518; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XiftgzN1+9SU41sJ8OVzewgvI/0TvswSkbZ2TYyj+Hc=; b=xWQurbYM2fFO55xcWJqL+AlI8jCsK9zy9eftnKU5o19Zols7V0ewIyLvTVCsZOguZ3jJx8 wUqPLfQt/kApJkypfuVHc9jyrfFTsKxAbJR/da2SBZSzWPGCpsR14YP20pinMdnNFkVG4a JPrZCIHFSTvDx8bwXwvNTCfDtzFXD5Uuk3DS0UpyFXEhJam+JB/XcJljIrJb9Ayc7StYDz NzYizp+3C6WkfJVfc6ElQ/LSOSAVjWWXwd4koXGuxGtnDKALX9583Z1iCnNPo3Eln2pDBd XgHkJVyey1/tfhoGGjYeiT1oKtwCO78TQlImDlOCjyKk+h63zo4fY53/73crCg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785388518; a=rsa-sha256; cv=none; b=q/tSxOqjwOBLVKMnA0dL1t75oxwX6IoZ4O4OstkaStrOLogRbLaP1jhqqx5EWvuhpMcQl8 ook9VqAyJdB6szz56LbB9n1uuA/De3QtNmv8Xj9bdZNHPSOthDowiryId6hwWKyxNN8nmF Razly/ffuW8BEndNv/G4hR6C3FlmNjnHkfYUSKB66cQU8Km0yc6oLaDb9vD70RyPZANVsW NXUD94RQkGrD+tWp5Q3xzxJjEDBJ/Y+Nw0FSqiWz8/sKtbNYDCepCAtTSLbtwRUHAfwvnM 8uPKGXorwHg4BsX6mKx5cPQ4Kkvz1HTFbzWB1+lcv6qlIQzSHl96/mGN1OX1Rw== 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=1785388518; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XiftgzN1+9SU41sJ8OVzewgvI/0TvswSkbZ2TYyj+Hc=; b=R0odrkB8WRBnDW2w8zkiVfGQEDj2eSgAfcIKWEioNDyUPYFalaruopqpSKcts7D50NU9s7 SMRnkbyxHVDMedfKKIjXwxG9xnU3+Lt7HpIePH+dg6pXjewAHwdvVS84wMWhDGcuyXByh6 1rE019Rtsq9SyG4fSwiwGOLbSEVbHTXKMso/xBwT8bOWcrtKOkrKHD1w155/sApR9ZApPt dtXayY/Bxg791IPcCn/X8gAABHVDUxz+Z50zBaywjKoMb1v6WcX2a+Pv41ODLpdg+m28hK GhjmQPL+bTww5rRzUliqE7LP4RV7aGdLmQmScgW1HXGfg1c5oKKxJKVP+qicjQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h9cpZ5283zyMv for ; Thu, 30 Jul 2026 05:15:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33b98 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 30 Jul 2026 05:15:13 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: d2cd0b57532b - main - e1000: Sample statistics at timer cadence List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2cd0b57532ba35fe39744a60d53b90e6f13b5e4 Auto-Submitted: auto-generated Date: Thu, 30 Jul 2026 05:15:13 +0000 Message-Id: <6a6adde1.33b98.771273ba@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=d2cd0b57532ba35fe39744a60d53b90e6f13b5e4 commit d2cd0b57532ba35fe39744a60d53b90e6f13b5e4 Author: Kevin Bowling AuthorDate: 2026-07-29 09:11:19 +0000 Commit: Kevin Bowling CommitDate: 2026-07-30 05:11:31 +0000 e1000: Sample statistics at timer cadence Mailbox and link interrupts share iflib admin service with the periodic timer. Mark timer-driven passes explicitly and run the hardware statistics sweep only for those samples instead of repeating 66 PF MMIO reads for every VF mailbox message. DTrace on the I350 DUT measured the PF sweep at about 79 us on average. The normal hz/2 timer continues to extend clear-on-read counters safely; exported counters may trail hardware by up to 500 ms. Sponsored by: BBOX.io --- sys/dev/e1000/if_em.c | 15 ++++++++++++++- sys/dev/e1000/if_em.h | 1 + sys/dev/e1000/if_igbv.c | 3 ++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 4612653cf1bc..d8bde14c6c20 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1626,6 +1626,7 @@ em_if_attach_post(if_ctx_t ctx) sc->ustats.stats = (struct e1000_hw_stats){}; em_update_stats_counters(sc); + atomic_readandclear_32(&sc->stats_pending); hw->mac.get_link_status = 1; if (sc->vf_ifp) igbv_if_update_admin_status(ctx); @@ -2595,9 +2596,13 @@ em_if_multi_set(if_ctx_t ctx) static void em_if_timer(if_ctx_t ctx, uint16_t qid) { + struct e1000_softc *sc; + if (qid != 0) return; + sc = iflib_get_softc(ctx); + atomic_set_32(&sc->stats_pending, 1); iflib_admin_intr_deferred(ctx); } @@ -2733,7 +2738,15 @@ em_if_update_admin_status(if_ctx_t ctx) iflib_link_state_change(ctx, LINK_STATE_DOWN, 0); igb_iov_ping_all_vfs(sc); } - em_update_stats_counters(sc); + /* + * Mailbox, link, and timer events share this admin task. The PF + * statistics sweep performs 66 MMIO reads, so run it only when the + * ordinary iflib timer requests a sample rather than once per mailbox + * message. Exported counters can consequently trail hardware by the + * timer interval (normally 500 ms). + */ + if (atomic_readandclear_32(&sc->stats_pending) != 0) + em_update_stats_counters(sc); /* Reset LAA into RAR[0] on 82571 */ if (hw->mac.type == e1000_82571 && e1000_get_laa_state_82571(hw)) diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 1692fdf41295..9cdf013c994a 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -596,6 +596,7 @@ struct e1000_softc { int link_mask; int tso_automasked; u32 promisc_pending; + u32 stats_pending; #ifdef PCI_IOV struct igb_vf *vfs; diff --git a/sys/dev/e1000/if_igbv.c b/sys/dev/e1000/if_igbv.c index 4f869388ce81..378a0065242b 100644 --- a/sys/dev/e1000/if_igbv.c +++ b/sys/dev/e1000/if_igbv.c @@ -151,7 +151,8 @@ igbv_if_update_admin_status(if_ctx_t ctx) iflib_admin_intr_deferred(ctx); } /* em_if_init() establishes a new counter baseline after the reset. */ - if (!sc->vf_reset_pending) + if (!sc->vf_reset_pending && + atomic_readandclear_32(&sc->stats_pending) != 0) em_update_stats_counters(sc); }