From 24f8c4e852d69189a1de1ff51c351ae8ee603dfa Mon Sep 17 00:00:00 2001 From: Kevin Bowling Date: Mon, 7 Sep 2026 04:13:26 -0700 Subject: [PATCH] enic: Report device enable failures to iflib Do not publish a running interface after vnic_dev_enable_wait() fails. Run the existing stop cleanup for the queues configured before the enable request, then report initialization failure to iflib. Mark those queues as needing cleanup before submitting the enable request so the stopped-state shortcut cannot skip the unwind. MFC after: 2 weeks Sponsored by: BBOX.io --- sys/dev/enic/if_enic.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/dev/enic/if_enic.c b/sys/dev/enic/if_enic.c index aa80ee6bafde..afdc39685aee 100644 --- a/sys/dev/enic/if_enic.c +++ b/sys/dev/enic/if_enic.c @@ -984,6 +984,7 @@ enic_init(if_ctx_t ctx) struct enic *enic; if_softc_ctx_t scctx; unsigned int index; + int error; softc = iflib_get_softc(ctx); scctx = softc->scctx; @@ -1005,11 +1006,17 @@ enic_init(if_ctx_t ctx) bcopy(if_getlladdr(softc->ifp), softc->lladdr, ETHER_ADDR_LEN); enic_set_lladdr(softc); - ENIC_LOCK(softc); - vnic_dev_enable_wait(enic->vdev); - ENIC_UNLOCK(softc); - + /* Queue setup above needs normal stop cleanup even if enable fails. */ softc->stopped = 0; + ENIC_LOCK(softc); + error = vnic_dev_enable_wait(enic->vdev); + ENIC_UNLOCK(softc); + if (error != 0) { + device_printf(softc->dev, "Device enable failed: %d\n", error); + enic_stop(ctx); + iflib_init_failed(ctx); + return; + } enic_link_status(softc); }