From nobody Sun Aug 2 04:22:58 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 4hCRVq1Y6Zz6n68s for ; Sun, 02 Aug 2026 04:22:59 +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 4hCRVp5v5nz49Fv for ; Sun, 02 Aug 2026 04:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785644578; 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=6Hq5FUWdGQ+3UCxkSA4E1t0ttKlIrjTAZvFjDQU+fF0=; b=Q2NgBd2cHCy/zFW1bqiTcPhKyjfFX3YBdefMyqQm4aFYkUgnKixhNRMvK+S/8x3x3jt/aK UKiyJK7HdJFG/RP8qbSngxSn30mBOD8She7dwydNXcQrB0EJ2ChhWtarRo5xoKpjTOSxM+ NoVkOZ/VhmJnm3fgxlco7rY8l1uxpf0G8tsywpeGoqhACe0HGWxEkSZnlgEo3hm8AEbau1 EMHccSNo+AeNLKYuOpfYtIfBFCqeMy3LiFQJJaRCen1uAHWWyebQHJpBjp6UagT49riLIG S37puwbdVrlBk9h5KioUp0DdVA9Y3PSRZe4LOixCnY00OektrIcFmn1rw6o1hg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785644578; a=rsa-sha256; cv=none; b=OSWVIsxu1w1EiZlqXPsJJO1hh34tU7nl2tNgZecMVftEbN/1Jb1BOY5/XBr6uc2XeMAKJ9 HcDyIZ3AL+GMOUo1vJQcGdgp75icp0FTn48Rads5+re8gsyIQ7NNs18lsMMyNj++d5Kijr rq0/7wrvHSNd5oz1lCt+xcSgt7Dz580dzqrlXLNuP7BDIlugMIDgaRd+DE4eBdNAN53u3Y fBi1rTfzu7wlru3vPOcWNTWQi/zCeX6OEKzoMuxL6h+5re1u5d2+pAy7XWg9JvDQRVSGwb FLEhbVKbbB7s4nEcCwQucZtmn60W64WWTp9FqLGMzR/r/BfxQHf/i6fguZbozA== 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=1785644578; 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=6Hq5FUWdGQ+3UCxkSA4E1t0ttKlIrjTAZvFjDQU+fF0=; b=LzaYPtoFa0iGgP6r97HzhZu/5Ks/AI6+1JifH+bee2CRWGhORQOPXQTy2kceCpulbhPASy 3dKUP8RQ8vVJQhmxC2M2bZ61PUSBQ+9HpSIKaCo7eEl/ZydoRJM/q9HrMh6mQeuPXneD7v fOpez1L5BeEDUJdS2+nkXgPRGRIWLN1fCaOCm9Hm3c14NyMbcfZa5+761DJzsqBE3hC9s/ nohtFc0OC6//RpkismVCsgvXTWtsAMrxGgxuiw4YnEpKyMdW4fUqwFie3wcuW7E7MHKd1K s0rI7r0CGHwIQn5xaPrnNVsu5WPy0tdGbOvGJhlWVrwexaRTzPgwzGwcZ1UXiA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hCRVp4cGPz1DYw for ; Sun, 02 Aug 2026 04:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c9ca by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 02 Aug 2026 04:22:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 1c8d599a4ed8 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: 1c8d599a4ed88ecd88aaeaab17662b91f3f28ad7 Auto-Submitted: auto-generated Date: Sun, 02 Aug 2026 04:22:58 +0000 Message-Id: <6a6ec622.3c9ca.26718d4a@gitrepo.freebsd.org> The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=1c8d599a4ed88ecd88aaeaab17662b91f3f28ad7 commit 1c8d599a4ed88ecd88aaeaab17662b91f3f28ad7 Author: Kevin Bowling AuthorDate: 2026-07-25 23:49:03 +0000 Commit: Kevin Bowling CommitDate: 2026-08-02 04:20:00 +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 fbf02c92e7a2..28a9ebc39a78 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -496,6 +496,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 *); @@ -968,6 +969,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); @@ -1622,6 +1630,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); @@ -1732,14 +1742,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; } @@ -2627,7 +2636,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) @@ -2751,22 +2760,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 @@ -3300,9 +3315,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: @@ -5020,7 +5036,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)); @@ -5047,7 +5063,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 1ed797b2c0c2..47e71c35d078 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