From nobody Wed Aug 12 02:50:14 2026 X-Original-To: dev-commits-src-main@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 4hKXzB3GN7z6m8NR for ; Wed, 12 Aug 2026 02:50:14 +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 4hKXzB2mSkz3fyf for ; Wed, 12 Aug 2026 02:50:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786503014; 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=0Xlja+1Qm2Mp8ISU6ksUA1nEy+62ISOMlmRonNed0uo=; b=Y4BrE7AOO/nIn/iIYgxxRdXhvXizNpPPPb+pKdGCgjgs345fb7vT8LhZVK1pUis7Dvv/2Z Uvi8CFuA5tSo3kwBOAYGt4zytnwULDu5oIg8dncbNKXS2PQWvOR3yHxqQmY5PbLKkc25+O Oli+pB7OS5rP7sxRDp5zzYZXqOzeNO2PUgUH73hX59SLbU1/slHNs+tvGp6LL+PtEjdlja n3h0eQl64tlJoPSI+ywPTnpkygcuqb86bHbOsEjI5FwEr8Tv2YqLsFq9g6VU1bKFNLqvk3 9EAz27kMj0eKkH9vhI7+7nlqqahSUsoSdCbTCWK0QYyVLYPZVNw8usnvr2JAlQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786503014; a=rsa-sha256; cv=none; b=t1wG9QJrr6xceemkVYE1J9IURYnTisrNSlEBD9nW1OoT9WSwKfMJrbWO7FPVo4/TViTRWu O+QptcHpYD1GMy8gagDbLYVL4AmXdPSmUSOFc140iJBCeOQSiX3Tg5WknuB/AL2RDYeLux IN5UeXySlbqO9dh9iRt7LSVUypXr7THVepVPFrjnEwxkJeNlZJquMQugUyJ8fqrXrp2cRr Z5TefVH2D0ddjXvCUfueicREGOWAsmjGsQAA1jgGQ5vnTyNM/DLiCD2cEugDvm1Y13f757 CHdQc/9rpg/kJzulVK+d53aMj3lmNaOUshg+iVd1W7vn6f3rrZyltzA7/UraqA== 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=1786503014; 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=0Xlja+1Qm2Mp8ISU6ksUA1nEy+62ISOMlmRonNed0uo=; b=lA5GuztPfzAhlKPctlEXgCv3lbqnUyZc2EXKBlkCdBfhOgy+PETg5yOgrSf0BsX/xfQWkC PCHu4IJi3tmUDEVyQPyfeDaLWZCsm5kBZ9Yixktj8/CcGr132NNM8V40G69/fv9uUWKmkt WKfgWHU+vtdtEYOPLrpZpw5A+TGa5ZE6/6NmNCaOVPs+zoZkJ3adPh0zrPbyU/bMSgAvxw 9oyRjRWklRhCWQ7k3w8dXC7ZY/5rDNe18j3x7FukivE+Qgor/XVq6MxDje+0P0kMrcift+ 9leZjrVUftl73GZayQu7ix1kjX6UkLtNBacCk7QfomufEP6Y++E0B+l3bniAtg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hKXzB1RWKz1KWX for ; Wed, 12 Aug 2026 02:50:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32dfd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 12 Aug 2026 02:50:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 19f75b38199b - main - igc: Add led(4) identification support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 19f75b38199b9d30e85fab83e61ff36b0b9ed015 Auto-Submitted: auto-generated Date: Wed, 12 Aug 2026 02:50:14 +0000 Message-Id: <6a7bdf66.32dfd.3440ab28@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=19f75b38199b9d30e85fab83e61ff36b0b9ed015 commit 19f75b38199b9d30e85fab83e61ff36b0b9ed015 Author: Kevin Bowling AuthorDate: 2026-08-12 00:22:35 +0000 Commit: Kevin Bowling CommitDate: 2026-08-12 02:48:40 +0000 igc: Add led(4) identification support I225 and I226 expose three programmable LED outputs. Use LED1 for adapter identification, following the convention in DPDK. Preserve the OEM configuration across identification requests. Restore the OEM configuration before a device reset so an active led(4) pattern cannot leave the output overridden across stop or detach. The LED mode values follow the Intel I225 Software User Manual. MFC after: 2 weeks --- share/man/man4/igc.4 | 10 +++++++++- sys/dev/igc/if_igc.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ sys/dev/igc/if_igc.h | 4 ++-- sys/dev/igc/igc_defines.h | 7 +++++-- 4 files changed, 61 insertions(+), 5 deletions(-) diff --git a/share/man/man4/igc.4 b/share/man/man4/igc.4 index 521a36531208..1fe87421738d 100644 --- a/share/man/man4/igc.4 +++ b/share/man/man4/igc.4 @@ -3,7 +3,7 @@ .\" Copyright 2021 Rubicon Communications, LLC (Netgate) .\" SPDX-License-Identifier: BSD-3-Clause .\" -.Dd August 3, 2026 +.Dd August 11, 2026 .Dt IGC 4 .Os .Sh NAME @@ -43,6 +43,13 @@ This driver version supports VLAN hardware insertion / extraction, VLAN checksum offload, and VLAN hardware filtering. For information on enabling VLANs, see .Xr ifconfig 8 . +.Pp +The identification LED of an adapter supported by the +.Nm +driver can be controlled via the +.Xr led 4 +interface at +.Pa /dev/led/igc* . The .Nm driver supports the following media types: @@ -154,6 +161,7 @@ address. .Xr altq 4 , .Xr arp 4 , .Xr iflib 4 , +.Xr led 4 , .Xr netintro 4 , .Xr ng_ether 4 , .Xr vlan 4 , diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index 8753209e8ea6..574cab87c305 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -139,6 +139,8 @@ static bool igc_if_vlan_filter_used(if_ctx_t); static void igc_if_vlan_filter_enable(struct igc_softc *); static void igc_if_vlan_filter_disable(struct igc_softc *); static void igc_setup_vlan_hw_support(if_ctx_t); +static void igc_if_led_func(if_ctx_t, int); +static void igc_led_restore(struct igc_softc *); static void igc_fw_version(struct igc_softc *); static void igc_sbuf_fw_version(struct igc_fw_version *, struct sbuf *); static void igc_print_fw_version(struct igc_softc *); @@ -231,6 +233,7 @@ static device_method_t igc_if_methods[] = { DEVMETHOD(ifdi_tx_queue_intr_enable, igc_if_tx_queue_intr_enable), DEVMETHOD(ifdi_debug, igc_if_debug), DEVMETHOD(ifdi_needs_restart, igc_if_needs_restart), + DEVMETHOD(ifdi_led_func, igc_if_led_func), DEVMETHOD_END }; @@ -1497,10 +1500,51 @@ igc_if_stop(if_ctx_t ctx) INIT_DEBUGOUT("igc_if_stop: begin"); + igc_led_restore(sc); igc_reset_hw(&sc->hw); IGC_WRITE_REG(&sc->hw, IGC_WUC, 0); } +/* + * I225/I226 have three configurable LED outputs. DPDK uses LED1 for + * adapter identification; retain that convention and preserve the OEM's + * configuration for normal link and activity indication. + */ +static void +igc_if_led_func(if_ctx_t ctx, int onoff) +{ + struct igc_softc *sc; + struct igc_hw *hw; + u32 ledctl; + + sc = iflib_get_softc(ctx); + hw = &sc->hw; + if (onoff) { + if (!sc->led_active) { + sc->ledctl_default = IGC_READ_REG(hw, IGC_LEDCTL); + sc->led_active = true; + } + ledctl = sc->ledctl_default; + ledctl &= ~(IGC_LEDCTL_LED1_MODE_MASK | + IGC_LEDCTL_LED1_BLINK); + ledctl |= IGC_LEDCTL_MODE_LED_ON << + IGC_LEDCTL_LED1_MODE_SHIFT; + IGC_WRITE_REG(hw, IGC_LEDCTL, ledctl); + } else { + igc_led_restore(sc); + } +} + +static void +igc_led_restore(struct igc_softc *sc) +{ + + if (!sc->led_active) + return; + IGC_WRITE_REG(&sc->hw, IGC_LEDCTL, sc->ledctl_default); + sc->led_active = false; +} + /********************************************************************* * * Determine hardware revision. @@ -1888,6 +1932,7 @@ igc_reset(if_ctx_t ctx) u32 pba; INIT_DEBUGOUT("igc_reset: begin"); + igc_led_restore(sc); /* Let the firmware know the OS is in control */ igc_get_hw_control(sc); diff --git a/sys/dev/igc/if_igc.h b/sys/dev/igc/if_igc.h index 57b3fdcb0f13..c98f17a97ca3 100644 --- a/sys/dev/igc/if_igc.h +++ b/sys/dev/igc/if_igc.h @@ -81,7 +81,6 @@ #include #include -#include #include #include @@ -350,7 +349,8 @@ struct igc_softc { /* FreeBSD operating-system-specific structures. */ struct igc_osdep osdep; device_t dev; - struct cdev *led_dev; + u32 ledctl_default; + bool led_active; struct igc_tx_queue *tx_queues; struct igc_rx_queue *rx_queues; diff --git a/sys/dev/igc/igc_defines.h b/sys/dev/igc/igc_defines.h index 9fc1c72022c3..885f0799f6a6 100644 --- a/sys/dev/igc/igc_defines.h +++ b/sys/dev/igc/igc_defines.h @@ -297,9 +297,12 @@ #define IGC_LEDCTL_LED0_MODE_SHIFT 0 #define IGC_LEDCTL_LED0_IVRT 0x00000040 #define IGC_LEDCTL_LED0_BLINK 0x00000080 +#define IGC_LEDCTL_LED1_MODE_MASK 0x00000F00 +#define IGC_LEDCTL_LED1_MODE_SHIFT 8 +#define IGC_LEDCTL_LED1_BLINK 0x00008000 -#define IGC_LEDCTL_MODE_LED_ON 0xE -#define IGC_LEDCTL_MODE_LED_OFF 0xF +#define IGC_LEDCTL_MODE_LED_ON 0x0 +#define IGC_LEDCTL_MODE_LED_OFF 0x1 /* Transmit Descriptor bit definitions */ #define IGC_TXD_DTYP_D 0x00100000 /* Data Descriptor */