Skip to content

Commit cc5776f

Browse files
mwilczyanguy11
authored andcommitted
ice: Enable switching default Tx scheduler topology
Introduce support for Tx scheduler topology change, based on user selection, from default 9-layer to 5-layer. Change requires NVM (version 3.20 or newer) and DDP package (OS Package 1.3.30 or newer - available for over a year in linux-firmware, since commit aed71f296637 in linux-firmware ("ice: Update package to 1.3.30.0")) https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/?id=aed71f296637 Enable 5-layer topology switch in init path of the driver. To accomplish that upload of the DDP package needs to be delayed, until change in Tx topology is finished. To trigger the Tx change user selection should be changed in NVM using devlink. Then the platform should be rebooted. Signed-off-by: Michal Wilczynski <[email protected]> Co-developed-by: Mateusz Polchlopek <[email protected]> Signed-off-by: Mateusz Polchlopek <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 927127c commit cc5776f

File tree

1 file changed

+89
-19
lines changed

1 file changed

+89
-19
lines changed

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

Lines changed: 89 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4453,11 +4453,13 @@ static char *ice_get_opt_fw_name(struct ice_pf *pf)
44534453
/**
44544454
* ice_request_fw - Device initialization routine
44554455
* @pf: pointer to the PF instance
4456+
* @firmware: double pointer to firmware struct
4457+
*
4458+
* Return: zero when successful, negative values otherwise.
44564459
*/
4457-
static void ice_request_fw(struct ice_pf *pf)
4460+
static int ice_request_fw(struct ice_pf *pf, const struct firmware **firmware)
44584461
{
44594462
char *opt_fw_filename = ice_get_opt_fw_name(pf);
4460-
const struct firmware *firmware = NULL;
44614463
struct device *dev = ice_pf_to_dev(pf);
44624464
int err = 0;
44634465

@@ -4466,29 +4468,95 @@ static void ice_request_fw(struct ice_pf *pf)
44664468
* and warning messages for other errors.
44674469
*/
44684470
if (opt_fw_filename) {
4469-
err = firmware_request_nowarn(&firmware, opt_fw_filename, dev);
4470-
if (err) {
4471-
kfree(opt_fw_filename);
4472-
goto dflt_pkg_load;
4473-
}
4474-
4475-
/* request for firmware was successful. Download to device */
4476-
ice_load_pkg(firmware, pf);
4471+
err = firmware_request_nowarn(firmware, opt_fw_filename, dev);
44774472
kfree(opt_fw_filename);
4478-
release_firmware(firmware);
4479-
return;
4473+
if (!err)
4474+
return err;
44804475
}
4476+
err = request_firmware(firmware, ICE_DDP_PKG_FILE, dev);
4477+
if (err)
4478+
dev_err(dev, "The DDP package file was not found or could not be read. Entering Safe Mode\n");
4479+
4480+
return err;
4481+
}
4482+
4483+
/**
4484+
* ice_init_tx_topology - performs Tx topology initialization
4485+
* @hw: pointer to the hardware structure
4486+
* @firmware: pointer to firmware structure
4487+
*
4488+
* Return: zero when init was successful, negative values otherwise.
4489+
*/
4490+
static int
4491+
ice_init_tx_topology(struct ice_hw *hw, const struct firmware *firmware)
4492+
{
4493+
u8 num_tx_sched_layers = hw->num_tx_sched_layers;
4494+
struct ice_pf *pf = hw->back;
4495+
struct device *dev;
4496+
u8 *buf_copy;
4497+
int err;
4498+
4499+
dev = ice_pf_to_dev(pf);
4500+
/* ice_cfg_tx_topo buf argument is not a constant,
4501+
* so we have to make a copy
4502+
*/
4503+
buf_copy = kmemdup(firmware->data, firmware->size, GFP_KERNEL);
4504+
4505+
err = ice_cfg_tx_topo(hw, buf_copy, firmware->size);
4506+
if (!err) {
4507+
if (hw->num_tx_sched_layers > num_tx_sched_layers)
4508+
dev_info(dev, "Tx scheduling layers switching feature disabled\n");
4509+
else
4510+
dev_info(dev, "Tx scheduling layers switching feature enabled\n");
4511+
/* if there was a change in topology ice_cfg_tx_topo triggered
4512+
* a CORER and we need to re-init hw
4513+
*/
4514+
ice_deinit_hw(hw);
4515+
err = ice_init_hw(hw);
44814516

4482-
dflt_pkg_load:
4483-
err = request_firmware(&firmware, ICE_DDP_PKG_FILE, dev);
4517+
return err;
4518+
} else if (err == -EIO) {
4519+
dev_info(dev, "DDP package does not support Tx scheduling layers switching feature - please update to the latest DDP package and try again\n");
4520+
}
4521+
4522+
return 0;
4523+
}
4524+
4525+
/**
4526+
* ice_init_ddp_config - DDP related configuration
4527+
* @hw: pointer to the hardware structure
4528+
* @pf: pointer to pf structure
4529+
*
4530+
* This function loads DDP file from the disk, then initializes Tx
4531+
* topology. At the end DDP package is loaded on the card.
4532+
*
4533+
* Return: zero when init was successful, negative values otherwise.
4534+
*/
4535+
static int ice_init_ddp_config(struct ice_hw *hw, struct ice_pf *pf)
4536+
{
4537+
struct device *dev = ice_pf_to_dev(pf);
4538+
const struct firmware *firmware = NULL;
4539+
int err;
4540+
4541+
err = ice_request_fw(pf, &firmware);
44844542
if (err) {
4485-
dev_err(dev, "The DDP package file was not found or could not be read. Entering Safe Mode\n");
4486-
return;
4543+
dev_err(dev, "Fail during requesting FW: %d\n", err);
4544+
return err;
4545+
}
4546+
4547+
err = ice_init_tx_topology(hw, firmware);
4548+
if (err) {
4549+
dev_err(dev, "Fail during initialization of Tx topology: %d\n",
4550+
err);
4551+
release_firmware(firmware);
4552+
return err;
44874553
}
44884554

4489-
/* request for firmware was successful. Download to device */
4555+
/* Download firmware to device */
44904556
ice_load_pkg(firmware, pf);
44914557
release_firmware(firmware);
4558+
4559+
return 0;
44924560
}
44934561

44944562
/**
@@ -4661,9 +4729,11 @@ int ice_init_dev(struct ice_pf *pf)
46614729

46624730
ice_init_feature_support(pf);
46634731

4664-
ice_request_fw(pf);
4732+
err = ice_init_ddp_config(hw, pf);
4733+
if (err)
4734+
return err;
46654735

4666-
/* if ice_request_fw fails, ICE_FLAG_ADV_FEATURES bit won't be
4736+
/* if ice_init_ddp_config fails, ICE_FLAG_ADV_FEATURES bit won't be
46674737
* set in pf->state, which will cause ice_is_safe_mode to return
46684738
* true
46694739
*/

0 commit comments

Comments
 (0)