git: 24f8c4e852d6 - main - enic: Report device enable failures to iflib
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Sep 2026 05:17:12 UTC
The branch main has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=24f8c4e852d69189a1de1ff51c351ae8ee603dfa
commit 24f8c4e852d69189a1de1ff51c351ae8ee603dfa
Author: Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-07 11:13:26 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-17 05:16:42 +0000
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 | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 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);
+ /* Queue setup above needs normal stop cleanup even if enable fails. */
+ softc->stopped = 0;
ENIC_LOCK(softc);
- vnic_dev_enable_wait(enic->vdev);
+ error = vnic_dev_enable_wait(enic->vdev);
ENIC_UNLOCK(softc);
-
- softc->stopped = 0;
+ 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);
}