Skip to content

Commit c570ccc

Browse files
committed
Merge: ice: fix issues with loading certain older DDP packages
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7414 JIRA: https://issues.redhat.com/browse/RHEL-118146 ice: don't leave device non-functional if Tx scheduler config fails Signed-off-by: Petr Oros <poros@redhat.com> Closes RHEL-118146 Approved-by: Michal Schmidt <mschmidt@redhat.com> Approved-by: José Ignacio Tornos Martínez <jtornosm@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Patrick Talbert <ptalbert@redhat.com>
2 parents 3f9ee8e + c6ddd90 commit c570ccc

File tree

2 files changed

+43
-17
lines changed

2 files changed

+43
-17
lines changed

drivers/net/ethernet/intel/ice/ice_ddp.c

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,7 +2365,13 @@ ice_get_set_tx_topo(struct ice_hw *hw, u8 *buf, u16 buf_size,
23652365
* The function will apply the new Tx topology from the package buffer
23662366
* if available.
23672367
*
2368-
* Return: zero when update was successful, negative values otherwise.
2368+
* Return:
2369+
* * 0 - Successfully applied topology configuration.
2370+
* * -EBUSY - Failed to acquire global configuration lock.
2371+
* * -EEXIST - Topology configuration has already been applied.
2372+
* * -EIO - Unable to apply topology configuration.
2373+
* * -ENODEV - Failed to re-initialize device after applying configuration.
2374+
* * Other negative error codes indicate unexpected failures.
23692375
*/
23702376
int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len)
23712377
{
@@ -2398,7 +2404,7 @@ int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len)
23982404

23992405
if (status) {
24002406
ice_debug(hw, ICE_DBG_INIT, "Get current topology is failed\n");
2401-
return status;
2407+
return -EIO;
24022408
}
24032409

24042410
/* Is default topology already applied ? */
@@ -2485,31 +2491,45 @@ int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len)
24852491
ICE_GLOBAL_CFG_LOCK_TIMEOUT);
24862492
if (status) {
24872493
ice_debug(hw, ICE_DBG_INIT, "Failed to acquire global lock\n");
2488-
return status;
2494+
return -EBUSY;
24892495
}
24902496

24912497
/* Check if reset was triggered already. */
24922498
reg = rd32(hw, GLGEN_RSTAT);
24932499
if (reg & GLGEN_RSTAT_DEVSTATE_M) {
2494-
/* Reset is in progress, re-init the HW again */
24952500
ice_debug(hw, ICE_DBG_INIT, "Reset is in progress. Layer topology might be applied already\n");
24962501
ice_check_reset(hw);
2497-
return 0;
2502+
/* Reset is in progress, re-init the HW again */
2503+
goto reinit_hw;
24982504
}
24992505

25002506
/* Set new topology */
25012507
status = ice_get_set_tx_topo(hw, new_topo, size, NULL, NULL, true);
25022508
if (status) {
2503-
ice_debug(hw, ICE_DBG_INIT, "Failed setting Tx topology\n");
2504-
return status;
2509+
ice_debug(hw, ICE_DBG_INIT, "Failed to set Tx topology, status %pe\n",
2510+
ERR_PTR(status));
2511+
/* only report -EIO here as the caller checks the error value
2512+
* and reports an informational error message informing that
2513+
* the driver failed to program Tx topology.
2514+
*/
2515+
status = -EIO;
25052516
}
25062517

2507-
/* New topology is updated, delay 1 second before issuing the CORER */
2518+
/* Even if Tx topology config failed, we need to CORE reset here to
2519+
* clear the global configuration lock. Delay 1 second to allow
2520+
* hardware to settle then issue a CORER
2521+
*/
25082522
msleep(1000);
25092523
ice_reset(hw, ICE_RESET_CORER);
2510-
/* CORER will clear the global lock, so no explicit call
2511-
* required for release.
2512-
*/
2524+
ice_check_reset(hw);
2525+
2526+
reinit_hw:
2527+
/* Since we triggered a CORER, re-initialize hardware */
2528+
ice_deinit_hw(hw);
2529+
if (ice_init_hw(hw)) {
2530+
ice_debug(hw, ICE_DBG_INIT, "Failed to re-init hardware after setting Tx topology\n");
2531+
return -ENODEV;
2532+
}
25132533

2514-
return 0;
2534+
return status;
25152535
}

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4589,17 +4589,23 @@ ice_init_tx_topology(struct ice_hw *hw, const struct firmware *firmware)
45894589
dev_info(dev, "Tx scheduling layers switching feature disabled\n");
45904590
else
45914591
dev_info(dev, "Tx scheduling layers switching feature enabled\n");
4592-
/* if there was a change in topology ice_cfg_tx_topo triggered
4593-
* a CORER and we need to re-init hw
4592+
return 0;
4593+
} else if (err == -ENODEV) {
4594+
/* If we failed to re-initialize the device, we can no longer
4595+
* continue loading.
45944596
*/
4595-
ice_deinit_hw(hw);
4596-
err = ice_init_hw(hw);
4597-
4597+
dev_warn(dev, "Failed to initialize hardware after applying Tx scheduling configuration.\n");
45984598
return err;
45994599
} else if (err == -EIO) {
46004600
dev_info(dev, "DDP package does not support Tx scheduling layers switching feature - please update to the latest DDP package and try again\n");
4601+
return 0;
4602+
} else if (err == -EEXIST) {
4603+
return 0;
46014604
}
46024605

4606+
/* Do not treat this as a fatal error. */
4607+
dev_info(dev, "Failed to apply Tx scheduling configuration, err %pe\n",
4608+
ERR_PTR(err));
46034609
return 0;
46044610
}
46054611

0 commit comments

Comments
 (0)