Fri, Jul 17, 2020 at 08:35:41PM CEST, jacob.e.kel...@intel.com wrote: >A flash image may contain settings or device identifying information. >When performing a flash update, these settings and information may >conflict with contents already in the flash. Devices may handle this >conflict in multiple ways. > >Add a new attribute to the devlink command, >DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MODE, which specifies how the device >should handle these settings and fields. > >DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING, the default, requests that all >settings and device identifiers within the current flash are kept. That >is, no settings or fields will be overwritten. This is the expected >behavior for most updates, and appears to be how all of the drivers are >implemented today. > >DEVLINK_FLASH_UPDATE_OVERWRITE_SETTINGS, requests that the device >overwrite any device settings in the flash section with the settings >from the flash image, but to preserve identifiers such as the MAC >address and serial identifier. This may be useful as a way to restore >a device to known-good settings from a new flash image. > >DEVLINK_FLASH_UPDATE_OVERWRITE_EVERYTHING, requests that all content in >the flash image be preserved over content of flash on the device. This >mode requests the device to completely overwrite the flash section, >possibly changing settings and device identifiers. The primary >motivation is to support writing initial device identifiers during >manufacturing. It is not expected to be necessary in normal end-user >flash updates. > >For the ice driver, implement support for the overwrite mode by >selecting the associated preservation level to request from firmware. > >For all other drivers that support flash update, require that the mode >be DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING, which is the expected >default. > >Update the documentation to explain the overwrite mode attribute.
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components: 1) "program" 2) "config" Then it is up to the user what he decides to flash.