git: dcdc00a41d3e - main - ice: Report initialization failures to iflib

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Mon, 10 Aug 2026 00:33:19 UTC
The branch main has been updated by kbowling:

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

commit dcdc00a41d3e4be0e75eb625cd3a23d5a927ed15
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-09 09:38:21 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-10 00:33:10 +0000

    ice: Report initialization failures to iflib
    
    The primary and mirror-VSI ifdi_init callbacks can return early when
    reset state or hardware queue and filter setup prevents initialization.
    Iflib then marks the interface running and enables interrupts although
    the driver did not finish bringing it up.
    
    Report each non-detach failure through iflib_init_failed().  Keep the
    existing ice reset and subinterface-reinitialization machinery
    responsible for scheduling recovery.
    
    MFC after:      2 weeks
---
 sys/dev/ice/if_ice_iflib.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c
index 6ea539d52e02..2722b8892d61 100644
--- a/sys/dev/ice/if_ice_iflib.c
+++ b/sys/dev/ice/if_ice_iflib.c
@@ -2084,16 +2084,16 @@ ice_if_init(if_ctx_t ctx)
 		return;
 
 	if (ice_test_state(&sc->state, ICE_STATE_RECOVERY_MODE))
-		return;
+		goto err_init_failed;
 
 	if (ice_test_state(&sc->state, ICE_STATE_RESET_FAILED)) {
 		device_printf(sc->dev, "request to start interface cannot be completed as the device failed to reset\n");
-		return;
+		goto err_init_failed;
 	}
 
 	if (ice_test_state(&sc->state, ICE_STATE_PREPARED_FOR_RESET)) {
 		device_printf(sc->dev, "request to start interface while device is prepared for impending reset\n");
-		return;
+		goto err_init_failed;
 	}
 
 	ice_update_rx_mbuf_sz(sc);
@@ -2104,7 +2104,7 @@ ice_if_init(if_ctx_t ctx)
 		device_printf(dev,
 			      "LAA address change failed, err %s\n",
 			      ice_err_str(err));
-		return;
+		goto err_init_failed;
 	}
 
 	/* Initialize software Tx tracking values */
@@ -2115,7 +2115,7 @@ ice_if_init(if_ctx_t ctx)
 		device_printf(dev,
 			      "Unable to configure the main VSI for Tx: %s\n",
 			      ice_err_str(err));
-		return;
+		goto err_init_failed;
 	}
 
 	err = ice_cfg_vsi_for_rx(&sc->pf_vsi);
@@ -2172,6 +2172,8 @@ err_stop_rx:
 	ice_control_all_rx_queues(&sc->pf_vsi, false);
 err_cleanup_tx:
 	ice_vsi_disable_tx(&sc->pf_vsi);
+err_init_failed:
+	iflib_init_failed(ctx);
 }
 
 /**
@@ -4406,20 +4408,20 @@ ice_subif_if_init(if_ctx_t ctx)
 		return;
 
 	if (ice_test_state(&sc->state, ICE_STATE_RECOVERY_MODE))
-		return;
+		goto err_init_failed;
 
 	if (ice_test_state(&sc->state, ICE_STATE_RESET_FAILED)) {
 		device_printf(dev,
 		    "request to start interface cannot be completed as the parent device %s failed to reset\n",
 		    device_get_nameunit(sc->dev));
-		return;
+		goto err_init_failed;
 	}
 
 	if (ice_test_state(&sc->state, ICE_STATE_PREPARED_FOR_RESET)) {
 		device_printf(dev,
 		    "request to start interface cannot be completed while parent device %s is prepared for impending reset\n",
 		    device_get_nameunit(sc->dev));
-		return;
+		goto err_init_failed;
 	}
 
 	/* XXX: Equiv to ice_update_rx_mbuf_sz */
@@ -4433,7 +4435,7 @@ ice_subif_if_init(if_ctx_t ctx)
 		device_printf(dev,
 			      "Unable to configure subif VSI for Tx: %s\n",
 			      ice_err_str(err));
-		return;
+		goto err_init_failed;
 	}
 
 	err = ice_cfg_vsi_for_rx(vsi);
@@ -4460,6 +4462,8 @@ ice_subif_if_init(if_ctx_t ctx)
 
 err_cleanup_tx:
 	ice_vsi_disable_tx(vsi);
+err_init_failed:
+	iflib_init_failed(ctx);
 }
 
 /**