From nobody Sun Aug 2 04:27:39 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 4hCRcD3KSXz6n6Bf for ; Sun, 02 Aug 2026 04:27:40 +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 4hCRcD1Lx8z4FR4 for ; Sun, 02 Aug 2026 04:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785644860; 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=d6cL7/2lq/oeOL8ceRgHHnrWWSwxiOT6bt0kCJgRZ7Y=; b=R736HvlrAOAQyDkOJl7wgh9aNgblse6c8rYYqJiP+DDIRr53YNEjbXsy1pRl8G4YiHGVZ1 B308nv2CkMj/AVWluwCiLOlh208bFf9x3fEDVTp0hq7ueQMgsH/W7WnVtxkB+e9aUEvJXf RomCvRxkDodkzwiXdV+8Ajakv3H4h6w/PYnj2QO14V/c7s7O1qfCkNCC+ujHYw4Fw3d9Gh Wip0abbVhPyN7Tc1JxpMf8kIErFydkXa8WhuAoiwResJU5VtQc7MiMDRbmJVQvKR8wgGOn qf8vb0kmWbLT1fFjhyYJHJJw5kamddZ0v54oeHkNhpeC3b62AHrbrjFka6DxHA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785644860; a=rsa-sha256; cv=none; b=ZDOc0HwCosGCp1kWjIwbhvxORChCZiJ+/MkM4twV+d+drc1IyVpH6sLLTvU7dYgd2gtYK0 7wHz+LvNTwT8l6ps80sTLyLXKDh1/Amzb0uyedCO7tZMPiyaDXfocXvie2lllckG3dNH51 9ahu00QjnsIEeRsyLqhi9jWMsRskrGayNIAStWAMhUjsSIz/6eavY42SpIx6HQ+M79zPrs YmRCILrInkUUHPt/cWH8YlMPbmygDfRekp5/yS36ZkxZ469bRyfGFO2ENNi/XS/4QrGyA/ 9RZUKyvO30rLv/FaOjjpVjSO5xzNMs+uNPZZhF7TcEbzTEKo60uxYYFKr4MMIw== 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=1785644860; 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=d6cL7/2lq/oeOL8ceRgHHnrWWSwxiOT6bt0kCJgRZ7Y=; b=kDH0uLqMwEtlTx3DFS79MCPGLe4CC8OE7aeSY7mcckTC3g+9MArD+KDRP0f1B2e20IcDyG GAJ5ZpbZ+0ZnCsLJteKDOA5HNpv24+hbi9AZuyM4RNibgbuciVjj98bKJH+ZQPT2XeOhmp q4eO4v+P2EazNE1IQbCzqyhJu517yGAlOeL2aFuNHgBRVbJwYLyJ8d9YUkP2h+fdJjPR3O MK5smCnCUHj2lCy3cx8hOAXsERiqV75Pacz9B5wI/YNny6pHi6jxH9Rf15ItqTKUzssnPp 3PztnWVESRzmbzCr0smlf7/E1X1mbYrWoTXi2zOUBZ7fpOq4PDNbrwkoIHbvHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hCRcC72l5z1DZ5 for ; Sun, 02 Aug 2026 04:27:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c89f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 02 Aug 2026 04:27:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: a99fd9daa651 - stable/14 - igc: 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: a99fd9daa6519d951e3e68d858dd2201e55d6e09 Auto-Submitted: auto-generated Date: Sun, 02 Aug 2026 04:27:39 +0000 Message-Id: <6a6ec73b.3c89f.318855db@gitrepo.freebsd.org> The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=a99fd9daa6519d951e3e68d858dd2201e55d6e09 commit a99fd9daa6519d951e3e68d858dd2201e55d6e09 Author: Kevin Bowling AuthorDate: 2026-07-25 23:58:58 +0000 Commit: Kevin Bowling CommitDate: 2026-08-02 04:26:47 +0000 igc: synchronize interrupt moderation state Keep the saved EITR value synchronized with hardware across reinitialization. Correct EITR encoding, decoding, and MSI-X register selection, and reject nonpositive fallback rates. Apply the packet-buffer fallback without permanently disabling AIM. (cherry picked from commit e35533457530bb9db655e6137c2eea790e18b97b) --- sys/dev/igc/if_igc.c | 35 +++++++++++++++++++++++++---------- sys/dev/igc/if_igc.h | 6 ++++-- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index 78a97660649c..a5d3965a739a 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -166,6 +166,7 @@ static int igc_sysctl_eee(SYSCTL_HANDLER_ARGS); static int igc_get_regs(SYSCTL_HANDLER_ARGS); static void igc_configure_queues(struct igc_softc *); +static void igc_initialize_interrupt_rate(struct igc_softc *); /********************************************************************* @@ -470,6 +471,13 @@ igc_if_attach_pre(if_ctx_t ctx) dev = iflib_get_dev(ctx); sc = iflib_get_softc(ctx); + if (igc_max_interrupt_rate <= 0) { + device_printf(dev, + "Invalid max_interrupt_rate %d; using default %d\n", + igc_max_interrupt_rate, IGC_INTS_DEFAULT); + igc_max_interrupt_rate = IGC_INTS_DEFAULT; + } + sc->ctx = sc->osdep.ctx = ctx; sc->dev = sc->osdep.dev = dev; scctx = sc->shared = iflib_get_softc_ctx(ctx); @@ -881,6 +889,7 @@ igc_if_init(if_ctx_t ctx) if (sc->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */ igc_configure_queues(sc); + igc_initialize_interrupt_rate(sc); /* this clears any pending interrupts */ IGC_READ_REG(&sc->hw, IGC_ICR); @@ -991,7 +1000,6 @@ igc_neweitr(struct igc_softc *sc, struct igc_rx_queue *que, /* Want at least enough packet buffer for two frames to AIM */ if (sc->shared->isc_max_frame_size * 2 > (sc->pba << 10)) { neweitr = igc_max_interrupt_rate; - sc->enable_aim = 0; goto igc_set_next_eitr; } @@ -1641,7 +1649,7 @@ igc_configure_queues(struct igc_softc *sc) struct igc_hw *hw = &sc->hw; struct igc_rx_queue *rx_que; struct igc_tx_queue *tx_que; - u32 ivar = 0, newitr = 0; + u32 ivar = 0; /* First turn on RSS capability */ IGC_WRITE_REG(hw, IGC_GPIE, @@ -1684,18 +1692,25 @@ igc_configure_queues(struct igc_softc *sc) sc->link_mask = 1 << sc->linkvec; IGC_WRITE_REG(hw, IGC_IVAR_MISC, ivar); - /* Set the starting interrupt rate */ - if (igc_max_interrupt_rate > 0) - newitr = IGC_INTS_TO_EITR(igc_max_interrupt_rate); + return; +} + +static void +igc_initialize_interrupt_rate(struct igc_softc *sc) +{ + struct igc_hw *hw = &sc->hw; + struct igc_rx_queue *rx_que; + u32 newitr; + newitr = IGC_INTS_TO_EITR(igc_max_interrupt_rate); newitr |= IGC_EITR_CNT_IGNR; for (int i = 0; i < sc->rx_num_queues; i++) { rx_que = &sc->rx_queues[i]; - IGC_WRITE_REG(hw, IGC_EITR(rx_que->msix), newitr); + rx_que->eitr_setting = newitr; + IGC_WRITE_REG(hw, IGC_EITR(rx_que->msix), + rx_que->eitr_setting); } - - return; } static void @@ -2698,7 +2713,7 @@ igc_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS) if (tx) { tque = oidp->oid_arg1; hw = &tque->sc->hw; - reg = IGC_READ_REG(hw, IGC_EITR(tque->me)); + reg = IGC_READ_REG(hw, IGC_EITR(tque->msix)); } else { rque = oidp->oid_arg1; hw = &rque->sc->hw; @@ -2707,7 +2722,7 @@ igc_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS) usec = (reg & IGC_QVECTOR_MASK); if (usec > 0) - rate = IGC_INTS_TO_EITR(usec); + rate = IGC_EITR_TO_INTS(usec); else rate = 0; diff --git a/sys/dev/igc/if_igc.h b/sys/dev/igc/if_igc.h index d8d5d5b251fa..4af08e03fedb 100644 --- a/sys/dev/igc/if_igc.h +++ b/sys/dev/igc/if_igc.h @@ -171,8 +171,10 @@ #define IGC_EITR_DIVIDEND 1000000 #define IGC_EITR_SHIFT 2 #define IGC_QVECTOR_MASK 0x7FFC -#define IGC_INTS_TO_EITR(i) (((IGC_EITR_DIVIDEND/i) & IGC_QVECTOR_MASK) << \ - IGC_EITR_SHIFT) +#define IGC_INTS_TO_EITR(i) \ + (((IGC_EITR_DIVIDEND / (i)) << IGC_EITR_SHIFT) & IGC_QVECTOR_MASK) +#define IGC_EITR_TO_INTS(i) ((IGC_EITR_DIVIDEND << IGC_EITR_SHIFT) / \ + ((i) & IGC_QVECTOR_MASK)) /* * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be