git: e54458ceaad9 - stable/15 - iflib: Allow conditional LED device support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 26 Aug 2026 00:57:12 UTC
The branch stable/15 has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=e54458ceaad9413122c4c914dbf446c630e6b86c
commit e54458ceaad9413122c4c914dbf446c630e6b86c
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-12 01:29:31 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-26 00:56:52 +0000
iflib: Allow conditional LED device support
A driver class may implement LED control even though the capability is
not available on every device or firmware version it supports. Add an
optional capability method and consult it before creating the led(4)
device. Default to supported so existing providers are unchanged.
This will be used by bnxt which blends PF and VF in the same driver.
(cherry picked from commit 2519e19f05e0c3e5925bf81b729b4c28f2ad1af6)
---
sys/net/ifdi_if.m | 10 ++++++++++
sys/net/iflib.c | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/sys/net/ifdi_if.m b/sys/net/ifdi_if.m
index f4a3db5092ab..7f49de5457cd 100644
--- a/sys/net/ifdi_if.m
+++ b/sys/net/ifdi_if.m
@@ -71,6 +71,12 @@ CODE {
{
}
+ static bool
+ null_led_supported(if_ctx_t _ctx __unused)
+ {
+ return (true);
+ }
+
static void
null_vlan_register_op(if_ctx_t _ctx __unused, uint16_t vtag __unused)
{
@@ -341,6 +347,10 @@ METHOD void led_func {
int _onoff;
} DEFAULT null_led_func;
+METHOD bool led_supported {
+ if_ctx_t _ctx;
+} DEFAULT null_led_supported;
+
METHOD void vlan_register {
if_ctx_t _ctx;
uint16_t _vtag;
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 38544ac51400..5b114460f611 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5292,7 +5292,7 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct
kobj_desc = &ifdi_led_func_desc;
kobj_method = kobj_lookup_method(((kobj_t)ctx)->ops->cls, NULL,
kobj_desc);
- if (kobj_method != &kobj_desc->deflt)
+ if (kobj_method != &kobj_desc->deflt && IFDI_LED_SUPPORTED(ctx))
iflib_led_create(ctx);
return (0);