From nobody Thu Jul 30 05:15:13 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 4h9cpT5nMnz6mh74 for ; Thu, 30 Jul 2026 05:15:13 +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 4h9cpT59nQz3ZMG for ; Thu, 30 Jul 2026 05:15:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785388513; 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=aD/Vf8yyrmJoIYULQeFgTYzjdlGzwISsVYPOCU8HZF+0k/MPaAIPtgckpXI1oX/KMK603W ory2owOH0/87+naOjPv7jwH1zQhuFg7HaSXLO2on9/Z1xQp01178bNTfIiK2T5pJgu95td eMz1izKwirbj593//q9Muq6Yd1k5YJHbKVRUjmmeFYqurjaYYR6z9eciHXEX4lapVtg1Ls M4/6EJ4RrHLF7qczyhih9NV6kkPXKKWMTkxe9EDua+Z+SxLUSvX/9KECBUWOHX8qh9gD1o J25qxETLZMNBdFDcLoLR2o1gpXu8U0A6+kvemvQoiPrQnvRdvQvAvmUAeOylRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785388513; a=rsa-sha256; cv=none; b=ArK6FJAeQseY2RK2RKyz06lFrsdQquu7esIFr/ywHG9bO4MNS+YgPp0dSONDhugl1/ojDk yqXTi+1Tlm+Isl6+gOT7SIGbF34f6RDIZFAguLeW7SNG2eWAJ69u+VVV22yoeoPiepce21 +S86pXOWZ4lPdOLitmTrXk/MzHy4UhQBKZtDKoy2foTUrIJNeuZIEbzHikwyAjy8HG4Ta/ e01S41Jt8x3zAKTXBtroMmOG8EDgZCzKoNhPKzHhTn1XZmowgAk3z/xy4egrl+uSvBJOdp 9wCMhLv97CP4f4Rid+OptIcnNSauys9ZKLMpm+C0LtdAvKTYOAcRWlrnJL8lZA== 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=1785388513; 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=xBEV36oom8YybWhdMvBjz+bjqvqECnvUYm6l9oGAYC3bcl08mi7/EWmAdps3QKlB8yv2VJ D+hq1YEyC6Gn8tSxvqmcE2McBRuh8s8a08E1fI9nZTPRdhhmnWhXZv2Esy15Nd7K7FBN/y 2TZNILdwGwQaij9luBYykAjxJATJLg8fYjf2l1fLTPk0jze7GToGeB1Ge/jXkLJ5U2zUta ZloasIq6Ps45bvU8jwuEtwPc0QeLe3fpbEl7xM+ZuG3YY5LFVGI5gKRuv/3pnRT0485wf7 7Ww7VMpe7/1hLiuzkXYpZGHRJcAyf5W4+AWY1TpR7iy+tr8HYonpvEQC+f9nWg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h9cpT42TXz10DM for ; Thu, 30 Jul 2026 05:15:13 +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 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: 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); }