From nobody Wed Oct 28 20:35:47 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 4jFJz76lVdz6x6Df for ; Wed, 28 Oct 2026 20:35:47 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jFJz72vj0z4R7X for ; Wed, 28 Oct 2026 20:35:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793219747; 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=j1Sl9yckhOkKbVbXCB4k1o280p+Ver+69LSxcN5RaO8=; b=Y7S98RSz6q9m74P1Oq4OtdTXGSq7qm80ZjyvkcyiipNJJXUnJXj4ip0/8YFYLPpbMReStI PBdtG965TGEYcZn3eoLu+Vcz7hu+nN8nzG67HDeX6LStrwq/wG4duRAtrYK5yc/GJYLRGn OSeLpH/Fcr8QoYIXzGlFdxC+R3kS/vDDplcMf2F5VGSPOh32HnqmhfUJ4qkBOedmIKCVvy u3nKhn3UecOrelgkSkpVkJdWmp25g2q3x43FYrAKeWP6aUUgXVo4mcOcyeaupTeg5ohmg8 0syt6WRQR225GzV/t3kA+0Fa9RaiwKehBDf7KvgD+a9srQLWPd6pWVzs0yamdQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793219747; b=UDaNIVc7EWMEZrRnItLjxOr2x577q0Fyk6r1S7DbydTE8TbgsXPJ/DnHUIn4EhvN1n1Vbx tD5/iWfGBxO9F2+bqIhgWZxcav4zNQHthIkjjCMZfJBXEXlnwRy9ObXy3HYSV4D9tu6wAk 7PTMjUJiazzJOa1a3FQlBjzHCnZHePfEv7oVAcOGTQHJ7fxofotRqXutXCB2loow0npa4E BwFpvy5qGvJEQVeAlV8i5AE6NrBMtpprbF4SlI0jQCh5CTMBRZ/gu1tgdiU+qHk8eQUzHw ROq5ZIzd2W/poGbWB91pbDIU4fx1+mo3svByi4Yd/bUaVmp6BZsI3IfawtOwtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793219747; 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=j1Sl9yckhOkKbVbXCB4k1o280p+Ver+69LSxcN5RaO8=; b=a6xufWfTwaVp5N1sdIr66NEpdqVOmiwss1vZNycsTl1X3k6CDoO/VOycA8Lg3z1VR/Jyvq t4oN2mVZZx/RiCiW4iQz2QFFYkqTtXOIR8iah9u3ofTpFlLhSEP+b2/9GY4k2mZPoSkuFm A4Nd193mwDK5Fingf6VYpQPRYWvOTeLZzxPAxg/VaCxqKIsSHtMY9eV9neFaQGaS5y4q0s 2QljfJQKWz9gDxpGwD2eU/isYabtuOayPLaHcgahfYG1PYcxYvYL7wGTksWz/+H9vR6XjU LUWN21/TojAxAtrhevX6dCY4ASt6DQW2eNWyNRTGGo73UNv75O1p/fTep4Pg6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jFJz72WGbz1Mty for ; Wed, 28 Oct 2026 20:35:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1d8e0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 28 Oct 2026 20:35:47 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: R. Christian McDonald Subject: git: 12efd0da33c1 - stable/15 - igc: Fix the flow control sysctl List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: Commits to the stable branches of the FreeBSD src repository 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: rcm X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 12efd0da33c1fc280af6bab280d5f68f15307404 Auto-Submitted: auto-generated Date: Wed, 28 Oct 2026 20:35:47 +0000 Message-Id: <6ae25ca3.1d8e0.71a5cd12@gitrepo.freebsd.org> The branch stable/15 has been updated by rcm: URL: https://cgit.FreeBSD.org/src/commit/?id=12efd0da33c1fc280af6bab280d5f68f15307404 commit 12efd0da33c1fc280af6bab280d5f68f15307404 Author: R. Christian McDonald AuthorDate: 2026-10-05 14:01:54 +0000 Commit: R. Christian McDonald CommitDate: 2026-10-28 20:34:08 +0000 igc: Fix the flow control sysctl dev.igc.N.fc read and wrote a function-static variable shared by every igc device, so a read returned the last value written to any of them (3 until the first write), not the state of the device. The softc value started as 0, which is also the value of "no flow control", while the hardware was set up for full flow control. As a result: - Writing 0 was taken for no change and did nothing, unless another value had been written to that device before. - igc_reset() took a softc value of 0 for "not set", so a device set to 0 went back to full flow control on the next init. - With more than one receive queue the driver enabled per-queue drop (SRRCTL.DROP_EN), which is meant for a MAC that does not send pause frames, although the MAC was told to send them. - Values out of range were accepted and ignored. A write only forced the MAC's flow control bits. The pause bits advertised to the link partner, the pause thresholds and DROP_EN stayed as the last init had set them, and the next link event resolved flow control from the stale advertisement again: a port set to 0 came back honoring pause frames, for example. Start the softc value as full, report it, use it as it is in igc_reset(), reject invalid values, and apply a change by reinitializing the interface, as the dmac and eee_control sysctls do. Two things behave differently now. Changing the mode of a running interface takes the link down to renegotiate. And with the default mode and more than one receive queue DROP_EN is no longer set: a full receive ring makes the MAC send pause frames, and holds up the other queues, where it used to drop that queue's packets. Setting fc to 0 or 1 selects per-queue drop. Tested on I226-V ports with four receive queues: for each mode, the flow control bits in CTRL, the pause thresholds and DROP_EN were read back, and the mode the link partner resolved, also after a down/up. Reviewed by: gallatin Fixes: 517904de5cca ("igc(4): Introduce new driver for the Intel I225 Ethernet controller.") MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D60363 (cherry picked from commit 68386f6b551e64c956c9623b9973be9e462ce1de) --- sys/dev/igc/if_igc.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index 554c219cbc6d..1cf866dba374 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -183,6 +183,7 @@ static int igc_if_msix_intr_assign(if_ctx_t, int); static int igc_msix_link(void *); static void igc_handle_link(void *context); +static void igc_sysctl_request_reinit(struct igc_softc *); static int igc_set_flowcntl(SYSCTL_HANDLER_ARGS); static int igc_sysctl_dmac(SYSCTL_HANDLER_ARGS); static int igc_sysctl_eee(SYSCTL_HANDLER_ARGS); @@ -536,6 +537,7 @@ igc_if_attach_pre(if_ctx_t ctx) OID_AUTO, "debug", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, igc_sysctl_debug_info, "I", "Debug Information"); + sc->fc = igc_fc_full; SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "fc", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, @@ -2205,10 +2207,7 @@ igc_reset(if_ctx_t ctx) /* 16-byte granularity */ hw->fc.low_water = hw->fc.high_water - 16; - if (sc->fc) /* locally set flow control value? */ - hw->fc.requested_mode = sc->fc; - else - hw->fc.requested_mode = igc_fc_full; + hw->fc.requested_mode = sc->fc; hw->fc.pause_time = IGC_FC_PAUSE_TIME; @@ -3746,34 +3745,35 @@ igc_sysctl_tso_tcp_flags_mask(SYSCTL_HANDLER_ARGS) static int igc_set_flowcntl(SYSCTL_HANDLER_ARGS) { - int error; - static int input = 3; /* default is full */ + int error, input; struct igc_softc *sc = (struct igc_softc *) arg1; + input = sc->fc; error = sysctl_handle_int(oidp, &input, 0, req); if ((error) || (req->newptr == NULL)) return (error); - if (input == sc->fc) /* no change? */ - return (error); - switch (input) { case igc_fc_rx_pause: case igc_fc_tx_pause: case igc_fc_full: case igc_fc_none: - sc->hw.fc.requested_mode = input; - sc->fc = input; break; default: - /* Do nothing */ - return (error); + return (EINVAL); } - sc->hw.fc.current_mode = sc->hw.fc.requested_mode; - igc_force_mac_fc(&sc->hw); - return (error); + if (input == sc->fc) /* no change? */ + return (0); + + /* + * The mode is advertised to the link partner and also decides the + * pause thresholds and per-queue drop, so it takes a reinit to apply. + */ + sc->fc = input; + igc_sysctl_request_reinit(sc); + return (0); } static void