git: 6591a7f69192 - main - iflib: Create led(4) devices

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Wed, 12 Aug 2026 02:11:48 UTC
The branch main has been updated by kbowling:

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

commit 6591a7f6919295f2ec2b463d1ae9554a8bbf6104
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-12 00:12:51 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-12 02:09:01 +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
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D32389
---
 sys/net/iflib.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index f490d7347341..ef2f96c268e5 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5436,6 +5436,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: