Skip to content

Commit 81297a0

Browse files
committed
Merge: ice: fix issues with loading certain older DDP packages
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1508 JIRA: https://issues.redhat.com/browse/RHEL-106471 ice: don't leave device non-functional if Tx scheduler config fails Signed-off-by: Petr Oros <poros@redhat.com> Closes RHEL-106471 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: Scott Weaver <scweaver@redhat.com>
2 parents 7dae70e + 5caf0f8 commit 81297a0

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
@@ -2374,7 +2374,13 @@ ice_get_set_tx_topo(struct ice_hw *hw, u8 *buf, u16 buf_size,
23742374
* The function will apply the new Tx topology from the package buffer
23752375
* if available.
23762376
*
2377-
* Return: zero when update was successful, negative values otherwise.
2377+
* Return:
2378+
* * 0 - Successfully applied topology configuration.
2379+
* * -EBUSY - Failed to acquire global configuration lock.
2380+
* * -EEXIST - Topology configuration has already been applied.
2381+
* * -EIO - Unable to apply topology configuration.
2382+
* * -ENODEV - Failed to re-initialize device after applying configuration.
2383+
* * Other negative error codes indicate unexpected failures.
23782384
*/
23792385
int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len)
23802386
{
@@ -2407,7 +2413,7 @@ int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len)
24072413

24082414
if (status) {
24092415
ice_debug(hw, ICE_DBG_INIT, "Get current topology is failed\n");
2410-
return status;
2416+
return -EIO;
24112417
}
24122418

24132419
/* Is default topology already applied ? */
@@ -2494,31 +2500,45 @@ int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len)
24942500
ICE_GLOBAL_CFG_LOCK_TIMEOUT);
24952501
if (status) {
24962502
ice_debug(hw, ICE_DBG_INIT, "Failed to acquire global lock\n");
2497-
return status;
2503+
return -EBUSY;
24982504
}
24992505

25002506
/* Check if reset was triggered already. */
25012507
reg = rd32(hw, GLGEN_RSTAT);
25022508
if (reg & GLGEN_RSTAT_DEVSTATE_M) {
2503-
/* Reset is in progress, re-init the HW again */
25042509
ice_debug(hw, ICE_DBG_INIT, "Reset is in progress. Layer topology might be applied already\n");
25052510
ice_check_reset(hw);
2506-
return 0;
2511+
/* Reset is in progress, re-init the HW again */
2512+
goto reinit_hw;
25072513
}
25082514

25092515
/* Set new topology */
25102516
status = ice_get_set_tx_topo(hw, new_topo, size, NULL, NULL, true);
25112517
if (status) {
2512-
ice_debug(hw, ICE_DBG_INIT, "Failed setting Tx topology\n");
2513-
return status;
2518+
ice_debug(hw, ICE_DBG_INIT, "Failed to set Tx topology, status %pe\n",
2519+
ERR_PTR(status));
2520+
/* only report -EIO here as the caller checks the error value
2521+
* and reports an informational error message informing that
2522+
* the driver failed to program Tx topology.
2523+
*/
2524+
status = -EIO;
25142525
}
25152526

2516-
/* New topology is updated, delay 1 second before issuing the CORER */
2527+
/* Even if Tx topology config failed, we need to CORE reset here to
2528+
* clear the global configuration lock. Delay 1 second to allow
2529+
* hardware to settle then issue a CORER
2530+
*/
25172531
msleep(1000);
25182532
ice_reset(hw, ICE_RESET_CORER);
2519-
/* CORER will clear the global lock, so no explicit call
2520-
* required for release.
2521-
*/
2533+
ice_check_reset(hw);
2534+
2535+
reinit_hw:
2536+
/* Since we triggered a CORER, re-initialize hardware */
2537+
ice_deinit_hw(hw);
2538+
if (ice_init_hw(hw)) {
2539+
ice_debug(hw, ICE_DBG_INIT, "Failed to re-init hardware after setting Tx topology\n");
2540+
return -ENODEV;
2541+
}
25222542

2523-
return 0;
2543+
return status;
25242544
}

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4573,17 +4573,23 @@ ice_init_tx_topology(struct ice_hw *hw, const struct firmware *firmware)
45734573
dev_info(dev, "Tx scheduling layers switching feature disabled\n");
45744574
else
45754575
dev_info(dev, "Tx scheduling layers switching feature enabled\n");
4576-
/* if there was a change in topology ice_cfg_tx_topo triggered
4577-
* a CORER and we need to re-init hw
4576+
return 0;
4577+
} else if (err == -ENODEV) {
4578+
/* If we failed to re-initialize the device, we can no longer
4579+
* continue loading.
45784580
*/
4579-
ice_deinit_hw(hw);
4580-
err = ice_init_hw(hw);
4581-
4581+
dev_warn(dev, "Failed to initialize hardware after applying Tx scheduling configuration.\n");
45824582
return err;
45834583
} else if (err == -EIO) {
45844584
dev_info(dev, "DDP package does not support Tx scheduling layers switching feature - please update to the latest DDP package and try again\n");
4585+
return 0;
4586+
} else if (err == -EEXIST) {
4587+
return 0;
45854588
}
45864589

4590+
/* Do not treat this as a fatal error. */
4591+
dev_info(dev, "Failed to apply Tx scheduling configuration, err %pe\n",
4592+
ERR_PTR(err));
45874593
return 0;
45884594
}
45894595

0 commit comments

Comments
 (0)