Support for restoring settings and identifiers from factory settings
instead of using those found in the image.

Restoring data from factory settings requires restoring both settings
and identifiers simultaneously. Other combinations are not supported.

Reviewed-by: Marcin Szycik <[email protected]>
Signed-off-by: Konrad Knitter <[email protected]>
---
 Documentation/networking/devlink/ice.rst       | 6 ++++++
 drivers/net/ethernet/intel/ice/ice_fw_update.c | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/networking/devlink/ice.rst 
b/Documentation/networking/devlink/ice.rst
index 792e9f8c846a..c11c7bc1362c 100644
--- a/Documentation/networking/devlink/ice.rst
+++ b/Documentation/networking/devlink/ice.rst
@@ -222,6 +222,12 @@ combined flash image that contains the ``fw.mgmt``, 
``fw.undi``, and
        identifying fields such as the MAC address, VPD area, and device
        serial number. It is expected that this combination be used with an
        image customized for the specific device.
+   * - ``DEVLINK_FLASH_OVERWRITE_SETTINGS``, 
``DEVLINK_FLASH_OVERWRITE_IDENTIFIERS``
+       and ``DEVLINK_FLASH_OVERWRITE_FROM_FACTORY_SETTINGS``
+     - Do not preserve either settings or identifiers. Overwrite everything
+       in the flash with contents of the factory settings section instead of
+       provided image.
+
 
 The ice hardware does not support overwriting only identifiers while
 preserving settings, and thus ``DEVLINK_FLASH_OVERWRITE_IDENTIFIERS`` on its
diff --git a/drivers/net/ethernet/intel/ice/ice_fw_update.c 
b/drivers/net/ethernet/intel/ice/ice_fw_update.c
index d86db081579f..f869648939bf 100644
--- a/drivers/net/ethernet/intel/ice/ice_fw_update.c
+++ b/drivers/net/ethernet/intel/ice/ice_fw_update.c
@@ -1008,6 +1008,10 @@ int ice_devlink_flash_update(struct devlink *devlink,
                                              
DEVLINK_FLASH_OVERWRITE_IDENTIFIERS)) {
                /* overwrite both settings and identifiers, preserve nothing */
                preservation = ICE_AQC_NVM_NO_PRESERVATION;
+       } else if (params->overwrite_mask == (DEVLINK_FLASH_OVERWRITE_SETTINGS |
+                                             
DEVLINK_FLASH_OVERWRITE_IDENTIFIERS |
+                                             
DEVLINK_FLASH_OVERWRITE_FROM_FACTORY_SETTINGS)) {
+               preservation = ICE_AQC_NVM_FACTORY_DEFAULT;
        } else {
                NL_SET_ERR_MSG_MOD(extack, "Requested overwrite mask is not 
supported");
                return -EOPNOTSUPP;
-- 
2.38.1

Reply via email to