git: 013f1779f634 - main - ice(4): Do not leave device non-functional if Tx scheduler config fails
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 02 Nov 2026 07:35:14 UTC
The branch main has been updated by kgalazka:
URL: https://cgit.FreeBSD.org/src/commit/?id=013f1779f63413173535ab770abb70715e92bee6
commit 013f1779f63413173535ab770abb70715e92bee6
Author: Sobczyk, Pawel <pawel.sobczyk@intel.com>
AuthorDate: 2026-11-02 07:31:05 +0000
Commit: Krzysztof Galazka <kgalazka@FreeBSD.org>
CommitDate: 2026-11-02 07:32:16 +0000
ice(4): Do not leave device non-functional if Tx scheduler config fails
The ice_cfg_tx_topo function attempts to apply Tx scheduler topology
configuration based on NVM parameters, selecting either a 5 or 9 layer
topology. As part of this flow, the driver acquires the "Global Configuration Lock",
which is a hardware resource associated with programming the DDP package
to the device. This "lock" is implemented by firmware as a way to
guarantee that only one PF can program the DDP for a device. Unlike a
traditional lock, once a PF has acquired this lock, no other PF will be
able to acquire it again (including that PF) until a CORER of the device.
However, if configuration of the Tx topology fails, (i.e.
ice_get_set_tx_topo returns an error code), the driver exits
ice_cfg_tx_topo() immediately, and fails to trigger CORER.
While the global configuration lock is held, the firmware rejects most
AdminQ commands, as it is waiting for the DDP package download (or Tx
scheduler topology programming) to occur.
Refactor ice_cfg_tx_topo() to always trigger a CORER after acquiring the
global lock, regardless of success or failure of the topology
configuration.
We need to re-initialize the HW structure when we trigger the CORER.
Previously, this was the responsibility of the core driver to cleanup after
the CORER. Instead, make it the responsibility of this function. This
avoids needless re-initialization for the cases where no reset occurred.
Authored-by: Jacob Keller <jacob.e.keller@intel.com>
Co-Authored-by: Pawel Sobczyk <pawel.sobczyk@intel.com>
Signed-off-by: Sobczyk, Pawel <pawel.sobczyk@intel.com>
Reviewed by: kbowling
Tested by: Mateusz Moga <mateusz.moga@intel.com>
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D60168
---
sys/dev/ice/ice_ddp_common.c | 32 +++++++++++++++++++++-----------
sys/dev/ice/if_ice_iflib.c | 17 +++++++----------
2 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/sys/dev/ice/ice_ddp_common.c b/sys/dev/ice/ice_ddp_common.c
index dfc50cc1f966..da5af86c9bfd 100644
--- a/sys/dev/ice/ice_ddp_common.c
+++ b/sys/dev/ice/ice_ddp_common.c
@@ -2527,25 +2527,35 @@ update_topo:
/* check reset was triggered already or not */
reg = rd32(hw, GLGEN_RSTAT);
if (reg & GLGEN_RSTAT_DEVSTATE_M) {
- /* Reset is in progress, re-init the hw again */
ice_debug(hw, ICE_DBG_INIT, "Reset is in progress. layer topology might be applied already\n");
ice_check_reset(hw);
- return 0;
+ /* Reset is in progress, re-init the hw again */
+ goto reinit_hw;
}
/* set new topology */
status = ice_get_set_tx_topo(hw, new_topo, size, NULL, NULL, true);
if (status) {
- ice_debug(hw, ICE_DBG_INIT, "Set tx topology is failed\n");
- return status;
+ ice_debug(hw, ICE_DBG_INIT, "Failed setting Tx topology, status %d\n",
+ status);
+ status = ICE_ERR_CFG;
}
- /* new topology is updated, delay 1 second before issuing the CORRER */
- for (i = 0; i < 10; i++)
- ice_msec_delay(100, true);
- ice_reset(hw, ICE_RESET_CORER);
- /* CORER will clear the global lock, so no explicit call
- * required for release
+ /* Even if Tx topology config failed, we need to CORE reset here to
+ * clear the global configuration lock. Delay 1 second to allow
+ * hardware to settle then issue a CORER
*/
- return 0;
+ ice_msec_delay(1000, true);
+ ice_reset(hw, ICE_RESET_CORER);
+ ice_check_reset(hw);
+
+reinit_hw:
+ /* Since we triggered a CORER, re-initialize hardware */
+ ice_deinit_hw(hw);
+ if (ice_init_hw(hw)) {
+ ice_debug(hw, ICE_DBG_INIT, "Failed to re-init hardware after setting Tx topology\n");
+ return ICE_ERR_RESET_FAILED;
+ }
+
+ return status;
}
diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c
index 5576d7883a55..d5dca978601c 100644
--- a/sys/dev/ice/if_ice_iflib.c
+++ b/sys/dev/ice/if_ice_iflib.c
@@ -528,11 +528,11 @@ ice_if_attach_pre(if_ctx_t ctx)
/* Setup ControlQ lengths */
ice_set_ctrlq_len(hw);
-reinit_hw:
-
fw_mode = ice_get_fw_mode(hw);
if (fw_mode == ICE_FW_MODE_REC) {
- device_printf(dev, "Firmware recovery mode detected. Limiting functionality. Refer to Intel(R) Ethernet Adapters and Devices User Guide for details on firmware recovery mode.\n");
+ device_printf(dev, "Firmware recovery mode detected. \
+ Limiting functionality. Refer to Intel(R) Ethernet Adapters and \
+ Devices User Guide for details on firmware recovery mode.\n");
err = ice_attach_pre_recovery_mode(sc);
if (err)
@@ -574,14 +574,11 @@ reinit_hw:
if (err)
goto deinit_hw;
- /*
- * Success indicates a change was made that requires a reinitialization
- * of the hardware
- */
err = ice_load_pkg_file(sc);
- if (!err) {
- ice_deinit_hw(hw);
- goto reinit_hw;
+ if (err == ICE_ERR_RESET_FAILED) {
+ device_printf(dev,
+ "Failed to re-init hardware after setting Tx topology\n");
+ goto deinit_hw;
}
err = ice_init_link_events(sc);