From nobody Sun Jul 26 01:01:16 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 4h73MK18fNz6mQTm for ; Sun, 26 Jul 2026 01:01:17 +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 4h73MJ3MLYz3LX2 for ; Sun, 26 Jul 2026 01:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785027676; 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=hU37wfDFUGY57AkXB+jr5K+avYEXgw61vNFxCrULjaU=; b=jvuqcHGzgYFsnlu1UkP04jw7GDlMnEYR+9IhQw5li6pHIjN+dkAAxKxHzoRPHLD+UCgOvr nsk6KfI3Et4s0gYEnTLcTU7xwT52Y4Y7y3259aM1Mwo+a6NCSDAFS0usbg0khIKJZv1Apw TnqPv0jkcS/ZsrlJkcchwxmxf1aJBsGz8nXP8jt/ZP/3lUlM20VYdNd2EEr60X3nkNI7Op 0P6YDyQQhNmBnQV8vAn1IRB5nbze6RE4uwhldUtUdw1zQ6i1QtN6WRf1GcVHycPCPdKX64 cnyMKhFWSUzS4HpUBeC0bDhDa//0Fiy/J+2suCQTDhZDskR7bfFH2WL7iDCO+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785027676; a=rsa-sha256; cv=none; b=Q2PQ2gyt/ujPNJneINgYbWWNzvyH2iEF9qrZcrOITe0cep5O2r/J+CoDU6olBShzOnwaN9 g5hNHsay4G0aIePelrqHP1Hb9LVpAR4X573gFjdDgKRniRPmtFYK82IWj4PonGtdBgLLTI ZVdhq1siwRul9H9iPE19wnJey6KJmvZzvu3/QXTlJ+wFgeVKYwMS+ea3bMrFL6YOfvJ9D7 n427USMwAzGd6Tkr23651rSGzNzVP5/5fj4J0un1/X0Vs2XyihKbY/3scER77gUrt45tY9 soSzk7AiNJhZ5Fktp01SzpTSFfiuUotigIENut45koZLC2wb5US3i+Em75U1Yg== 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=1785027676; 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=hU37wfDFUGY57AkXB+jr5K+avYEXgw61vNFxCrULjaU=; b=AY9uzi2LSYjCH+Zso0GRQXztLOs9N0GVxgf9/vMuqLF9E+jhpbi+OiuScKXtmRTfULYKY/ ZOfqYWpn+75X6+711t9AtV50Xkn3eYxeTwzTvDp39/hmydG/Qzo0Sv0hND7Y8QBIK/gc1d zFk/vJGSuig5iDHdz5IkhAl0kZ9sZsgHjq42vYUDu4tnLyuSkY6UORlAWATj4scsXQg8yt hp5tnl3R4DBtzqe7WuD+sjtQ0l03BVMHhcKM628RtO6IcfLZMS8XVMT/IWoRn2/DEt7xBG WN8x1GtnSk10Hfy/vr8IHKC+ekyd8AY0nnkk5ZAdBI60CRjvjSGaAiPIyFM5fg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h73MJ24hHz10bB for ; Sun, 26 Jul 2026 01:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 328a2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 26 Jul 2026 01:01:16 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: e35533457530 - main - igc: synchronize interrupt moderation state 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: e35533457530bb9db655e6137c2eea790e18b97b Auto-Submitted: auto-generated Date: Sun, 26 Jul 2026 01:01:16 +0000 Message-Id: <6a655c5c.328a2.39d16193@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=e35533457530bb9db655e6137c2eea790e18b97b commit e35533457530bb9db655e6137c2eea790e18b97b Author: Kevin Bowling AuthorDate: 2026-07-25 23:58:58 +0000 Commit: Kevin Bowling CommitDate: 2026-07-26 01:00:02 +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. MFC after: 1 week --- 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 d0e9ad3b7a8d..3e4c0228619a 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -165,6 +165,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 *); /********************************************************************* @@ -469,6 +470,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); @@ -880,6 +888,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); @@ -990,7 +999,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; } @@ -1640,7 +1648,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, @@ -1683,18 +1691,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 @@ -2693,7 +2708,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; @@ -2702,7 +2717,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