git: dbf07219675e - stable/15 - iflib: Create led(4) devices

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Wed, 26 Aug 2026 00:25:42 UTC
The branch stable/15 has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=dbf07219675e9673964160c5e2d25a867ec93e29

commit dbf07219675e9673964160c5e2d25a867ec93e29
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-12 00:12:51 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-26 00:25:08 +0000

    iflib: Create led(4) devices
    
    When a driver implements ifdi_led_func, have the framework create its
    led(4) device after attach completes and the ifnet and context locks are
    released.
    
    PR:             246885
    Reported by:    jlduran
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D32389
    
    (cherry picked from commit 6591a7f6919295f2ec2b463d1ae9554a8bbf6104)
---
 sys/net/iflib.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 297b64061a99..38544ac51400 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5288,6 +5288,13 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct
 	CTX_UNLOCK(ctx);
 	IFNET_WUNLOCK();
 
+	/* Create led(4) devices if the driver defined the method */
+	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)
+		iflib_led_create(ctx);
+
 	return (0);
 
 fail_detach: