git: 58f985559ee6 - main - enic: Route resets through iflib lifecycle

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Thu, 03 Sep 2026 03:28:16 UTC
The branch main has been updated by kbowling:

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

commit 58f985559ee689e50233b9113df4f37375b48c2d
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-26 09:21:55 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-03 03:28:09 +0000

    enic: Route resets through iflib lifecycle
    
    Mark the driver stopped after attach so its first IFDI_STOP() call
    does not repeat hardware shutdown.
    
    Defer error interrupt recovery through iflib instead of calling
    driver stop and init methods from interrupt context.  Let iflib own
    the stop and restart around MTU changes as well, avoiding duplicate
    lifecycle operations.
    
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
---
 sys/dev/enic/if_enic.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/dev/enic/if_enic.c b/sys/dev/enic/if_enic.c
index 74e3ff6f8721..8d8f75d4611d 100644
--- a/sys/dev/enic/if_enic.c
+++ b/sys/dev/enic/if_enic.c
@@ -449,6 +449,8 @@ enic_attach_pre(if_ctx_t ctx)
 		dev_err(enic, "Device initialization failed, aborting\n");
 		goto err_out_dev_close;
 	}
+	/* Queue DMA has not been enabled; the first iflib stop may be skipped. */
+	softc->stopped = 1;
 	ENIC_UNLOCK(softc);
 
 	enic->port_mtu = vnic_dev_mtu(enic->vdev);
@@ -912,8 +914,8 @@ enic_err_intr(void *vsc)
 
 	softc = vsc;
 
-	enic_stop(softc->ctx);
-	enic_init(softc->ctx);
+	iflib_request_reset_if_up(softc->ctx);
+	iflib_admin_intr_deferred(softc->ctx);
 
 	return (FILTER_HANDLED);
 }
@@ -1091,14 +1093,12 @@ enic_mtu_set(if_ctx_t ctx, uint32_t mtu)
 	softc = iflib_get_softc(ctx);
 	enic = &softc->enic;
 
-	enic_stop(softc->ctx);
 	if (mtu > enic->port_mtu){
 		return (EINVAL);
 	}
 
 	enic->config.mtu = mtu;
 	scctx->isc_max_frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
-	enic_init(softc->ctx);
 
 	return (0);
 }