mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-18 06:33:43 -04:00
ice: add support for flash update overwrite mask
Support the recently added DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK parameter in the ice flash update handler. Convert the overwrite mask bitfield into the appropriate preservation level used by the firmware when updating. Because there is no equivalent preservation level for overwriting only identifiers, this combination is rejected by the driver as not supported with an appropriate extended ACK message. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
cbb58368fb
commit
50db1bca55
@@ -250,8 +250,24 @@ ice_devlink_flash_update(struct devlink *devlink,
|
||||
struct device *dev = &pf->pdev->dev;
|
||||
struct ice_hw *hw = &pf->hw;
|
||||
const struct firmware *fw;
|
||||
u8 preservation;
|
||||
int err;
|
||||
|
||||
if (!params->overwrite_mask) {
|
||||
/* preserve all settings and identifiers */
|
||||
preservation = ICE_AQC_NVM_PRESERVE_ALL;
|
||||
} else if (params->overwrite_mask == DEVLINK_FLASH_OVERWRITE_SETTINGS) {
|
||||
/* overwrite settings, but preserve the vital device identifiers */
|
||||
preservation = ICE_AQC_NVM_PRESERVE_SELECTED;
|
||||
} else if (params->overwrite_mask == (DEVLINK_FLASH_OVERWRITE_SETTINGS |
|
||||
DEVLINK_FLASH_OVERWRITE_IDENTIFIERS)) {
|
||||
/* overwrite both settings and identifiers, preserve nothing */
|
||||
preservation = ICE_AQC_NVM_NO_PRESERVATION;
|
||||
} else {
|
||||
NL_SET_ERR_MSG_MOD(extack, "Requested overwrite mask is not supported");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (!hw->dev_caps.common_cap.nvm_unified_update) {
|
||||
NL_SET_ERR_MSG_MOD(extack, "Current firmware does not support unified update");
|
||||
return -EOPNOTSUPP;
|
||||
@@ -269,7 +285,7 @@ ice_devlink_flash_update(struct devlink *devlink,
|
||||
|
||||
devlink_flash_update_begin_notify(devlink);
|
||||
devlink_flash_update_status_notify(devlink, "Preparing to flash", NULL, 0, 0);
|
||||
err = ice_flash_pldm_image(pf, fw, extack);
|
||||
err = ice_flash_pldm_image(pf, fw, preservation, extack);
|
||||
devlink_flash_update_end_notify(devlink);
|
||||
|
||||
release_firmware(fw);
|
||||
@@ -278,6 +294,7 @@ ice_devlink_flash_update(struct devlink *devlink,
|
||||
}
|
||||
|
||||
static const struct devlink_ops ice_devlink_ops = {
|
||||
.supported_flash_update_params = DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK,
|
||||
.info_get = ice_devlink_info_get,
|
||||
.flash_update = ice_devlink_flash_update,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user