ice: use same function to snapshot both NVM and Shadow RAM
authorJacob Keller <jacob.e.keller@intel.com>
Mon, 28 Nov 2022 20:36:45 +0000 (12:36 -0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 1 Dec 2022 04:54:30 +0000 (20:54 -0800)
commited23debec5d197956fbda4ad8fad66d910c6a6b6
tree4191ba421396c6e26a38c92f03773219162e578a
parentaf6397c9ee2b42988c912dcad2fca1f43d5c1c99
ice: use same function to snapshot both NVM and Shadow RAM

The ice driver supports a region for both the flat NVM contents as well as
the Shadow RAM which is a layer built on top of the flash during device
initialization.

These regions use an almost identical read function, except that the NVM
needs to set the direct flag when reading, while Shadow RAM needs to read
without the direct flag set. They each call ice_read_flat_nvm with the only
difference being whether to set the direct flash flag.

The NVM region read function also was fixed to read the NVM in blocks to
avoid a situation where the firmware reclaims the lock due to taking too
long.

Note that the region snapshot function takes the ops pointer so the
function can easily determine which region to read. Make use of this and
re-use the NVM snapshot function for both the NVM and Shadow RAM regions.
This makes Shadow RAM benefit from the same block approach as the NVM
region. It also reduces code in the ice driver.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ice/ice_devlink.c