From nobody Sun Aug 2 04:27:33 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 4hCRc55gHZz6n6MR for ; Sun, 02 Aug 2026 04:27:33 +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 4hCRc53CRtz4FWy for ; Sun, 02 Aug 2026 04:27:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785644853; 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=wk7wO9WRXraWn9DkimK06u2lklLbwf5KNN29YlY34pA=; b=V3S7GGeUNDl0myxLNJpUPPimJalPablTmcnl6//dcnPXpyBeTS5hmOkGZBX3SZCQP/u6jR aI30sk57A6gRjvtk5d0njWP/GQ42X0MwjpH5U7Ekn3i+p4UWQs4qyyKnRzDeJZi0QgShXJ eYhLg+BdIyFcfCzLNT8Vnl9Pry3QhFyKrBfrLmuj2j0ysQu5PQEad6fm5MdmsdNxEGBKbW y79yGbObX7eSGzmxYd9yejz2OW+19cp8DK7rqAJz8iHRxZaqBI++F1XR0rRz/38muqqNcZ 4lK45B74cBHeyOh5EPowbJbQdn5kv0Te2DJyX/pTB2mcl3RmhKLLalcQTVi+Ag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785644853; a=rsa-sha256; cv=none; b=beyr3ahtR6OI0b412wMP44BhInYKPGv6ns4e2LzJ3K/Q6IUqvKd47MNSjF1CID/epO63ng Ryh1BgtAhUIKzdjunqQBPzGJybW4bLQ1n1J6IAVZAmcpA/gOulfcW/FcQRcLDpLG04Xy19 u/Q3I+AzYtqtvwF9gQQhbVZDe5soJLl08VEVHe0qCXpEiswfUNTwT4kE3GZK+qS2zWWmYf DGWulXSbEO+6gssQ0SiD9lwNtRyiNhMzpxxqpOVlqUwJkOPP+HpxsPixP333gmfNeStlAK 1q4aNiHXVAL+let3WuGQ5S4Fbs7Nflx60pGL3mkOveaQY26aqPU59B2sRsQiGQ== 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=1785644853; 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=wk7wO9WRXraWn9DkimK06u2lklLbwf5KNN29YlY34pA=; b=XLygTC6GJUCyXAQyhAJMEYH7IW96X9+anmHYPD/FMcpRx22+RnRj3DDqFVsN+bein/FkW3 EWSVl+9Cth+UwT0QjO3FUYnD05mgzuNM1BOQQ0lNhEi0bXD3Sk4+LI4Mc6kMaOpci6f8al 7JVZJdcQaQxnwEQdiQCiNciGRcfy2GrJ64n+DBl27S48sCqHNk1kZH1FvMQCUQ9o/T9kjc 4P1ohA3UldM4MP5ehW2gmke19NZsTTOYGfynUiWgqwBLJpMH72QvNDbMTZIvTGp6Dg28bl NHyxRv+sm96nm+xW9no8qNsiDTytX7HNi+fe76Lo7lNR98/ZxJhsZGh5tP2+Tg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hCRc520Zbz1Dfh for ; Sun, 02 Aug 2026 04:27:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c9ce by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 02 Aug 2026 04:27:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: decb309534c7 - stable/14 - e1000: synchronize interrupt moderation state 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: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: decb309534c796b38a8a279873d0bc509b5f10a4 Auto-Submitted: auto-generated Date: Sun, 02 Aug 2026 04:27:33 +0000 Message-Id: <6a6ec735.3c9ce.fa75a0c@gitrepo.freebsd.org> The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=decb309534c796b38a8a279873d0bc509b5f10a4 commit decb309534c796b38a8a279873d0bc509b5f10a4 Author: Kevin Bowling AuthorDate: 2026-07-25 23:49:03 +0000 Commit: Kevin Bowling CommitDate: 2026-08-02 04:25:38 +0000 e1000: synchronize interrupt moderation state Keep the saved EITR and PBA values synchronized with hardware across reinitialization. Correct EITR encoding, decoding, and MSI-X register selection, and reject nonpositive fallback rates. Treat only sub-gigabit links as sub-gigabit and apply the packet-buffer fallback without permanently disabling AIM. (cherry picked from commit 6ef368a29b11ebc769e7929566809b75ae2c1e90) --- sys/dev/e1000/if_em.c | 56 +++++++++++++++++++++++++++++++++------------------ sys/dev/e1000/if_em.h | 6 ++++-- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index f29fe775fc59..9a79cb6115d9 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -494,6 +494,7 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS); static void lem_smartspeed(struct e1000_softc *); static void igb_configure_queues(struct e1000_softc *); +static void igb_initialize_interrupt_rate(struct e1000_softc *); static void em_flush_desc_rings(struct e1000_softc *); @@ -966,6 +967,13 @@ em_if_attach_pre(if_ctx_t ctx) dev = iflib_get_dev(ctx); sc = iflib_get_softc(ctx); + if (em_max_interrupt_rate <= 0) { + device_printf(dev, + "Invalid max_interrupt_rate %d; using default %d\n", + em_max_interrupt_rate, EM_INTS_DEFAULT); + em_max_interrupt_rate = EM_INTS_DEFAULT; + } + sc->ctx = sc->osdep.ctx = ctx; sc->dev = sc->osdep.dev = dev; scctx = sc->shared = iflib_get_softc_ctx(ctx); @@ -1615,6 +1623,8 @@ em_if_init(if_ctx_t ctx) /* Set up queue routing */ igb_configure_queues(sc); } + if (sc->hw.mac.type >= igb_mac_min) + igb_initialize_interrupt_rate(sc); /* this clears any pending interrupts */ E1000_READ_REG(&sc->hw, E1000_ICR); @@ -1725,14 +1735,13 @@ em_newitr(struct e1000_softc *sc, struct em_rx_queue *que, nextlatency = rxr->rx_nextlatency; /* Use half default (4K) ITR if sub-gig */ - if (sc->link_speed != 1000) { + if (sc->link_speed < SPEED_1000) { newitr = EM_INTS_4K; goto em_set_next_itr; } /* Want at least enough packet buffer for two frames to AIM */ if (sc->shared->isc_max_frame_size * 2 > (sc->pba << 10)) { newitr = em_max_interrupt_rate; - sc->enable_aim = 0; goto em_set_next_itr; } @@ -2620,7 +2629,7 @@ igb_configure_queues(struct e1000_softc *sc) struct e1000_hw *hw = &sc->hw; struct em_rx_queue *rx_que; struct em_tx_queue *tx_que; - u32 tmp, ivar = 0, newitr = 0; + u32 tmp, ivar = 0; /* First turn on RSS capability */ if (hw->mac.type != e1000_82575) @@ -2744,22 +2753,28 @@ igb_configure_queues(struct e1000_softc *sc) break; } - /* Set the igb starting interrupt rate */ - if (em_max_interrupt_rate > 0) { - newitr = IGB_INTS_TO_EITR(em_max_interrupt_rate); + return; +} - if (hw->mac.type == e1000_82575) - newitr |= newitr << 16; - else - newitr |= E1000_EITR_CNT_IGNR; +static void +igb_initialize_interrupt_rate(struct e1000_softc *sc) +{ + struct e1000_hw *hw = &sc->hw; + struct em_rx_queue *rx_que; + u32 newitr; - for (int i = 0; i < sc->rx_num_queues; i++) { - rx_que = &sc->rx_queues[i]; - E1000_WRITE_REG(hw, E1000_EITR(rx_que->msix), newitr); - } - } + newitr = IGB_INTS_TO_EITR(em_max_interrupt_rate); + if (hw->mac.type == e1000_82575) + newitr |= newitr << 16; + else + newitr |= E1000_EITR_CNT_IGNR; - return; + for (int i = 0; i < sc->rx_num_queues; i++) { + rx_que = &sc->rx_queues[i]; + rx_que->itr_setting = newitr; + E1000_WRITE_REG(hw, E1000_EITR(rx_que->msix), + rx_que->itr_setting); + } } static void @@ -3293,9 +3308,10 @@ em_reset(if_ctx_t ctx) hw->fc.refresh_time = 0xFFFF; /* Jumbos need adjusted PBA */ if (if_getmtu(ifp) > ETHERMTU) - E1000_WRITE_REG(hw, E1000_PBA, 12); + pba = E1000_PBA_12K; else - E1000_WRITE_REG(hw, E1000_PBA, 26); + pba = E1000_PBA_26K; + E1000_WRITE_REG(hw, E1000_PBA, pba); break; case e1000_82575: case e1000_82576: @@ -4960,7 +4976,7 @@ em_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS) tque = oidp->oid_arg1; hw = &tque->sc->hw; if (hw->mac.type >= igb_mac_min) - reg = E1000_READ_REG(hw, E1000_EITR(tque->me)); + reg = E1000_READ_REG(hw, E1000_EITR(tque->msix)); else if (hw->mac.type == e1000_82574 && tque->sc->intr_type == IFLIB_INTR_MSIX) reg = E1000_READ_REG(hw, E1000_EITR_82574(tque->msix)); @@ -4987,7 +5003,7 @@ em_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS) } else { usec = (reg & IGB_QVECTOR_MASK); if (usec > 0) - rate = IGB_INTS_TO_EITR(usec); + rate = IGB_EITR_TO_INTS(usec); else rate = 0; } diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index e4b94328b4dc..3f71a0ae6358 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -255,8 +255,10 @@ #define IGB_EITR_DIVIDEND 1000000 #define IGB_EITR_SHIFT 2 #define IGB_QVECTOR_MASK 0x7FFC -#define IGB_INTS_TO_EITR(i) (((IGB_EITR_DIVIDEND/i) & IGB_QVECTOR_MASK) << \ - IGB_EITR_SHIFT) +#define IGB_INTS_TO_EITR(i) \ + (((IGB_EITR_DIVIDEND / (i)) << IGB_EITR_SHIFT) & IGB_QVECTOR_MASK) +#define IGB_EITR_TO_INTS(i) ((IGB_EITR_DIVIDEND << IGB_EITR_SHIFT) / \ + ((i) & IGB_QVECTOR_MASK)) #define IGB_LINK_ITR 2000 #define I210_LINK_DELAY 1000