net/sfc/base: report correct partition write chunk size

If the firmware reports a non-zero write chunk size then nvram writes
may fail if a different granularity is used (e.g. for MUM firmware on
Sorrento).

Signed-off-by: Andy Moreton <amoreton@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
This commit is contained in:
Andy Moreton 2017-11-16 08:03:58 +00:00 committed by Ferruh Yigit
parent f4332a5f48
commit e74e5d32b2

View File

@ -2310,16 +2310,27 @@ ef10_nvram_partn_rw_start(
__in uint32_t partn,
__out size_t *chunk_sizep)
{
uint32_t write_size = 0;
efx_rc_t rc;
if ((rc = ef10_nvram_partn_lock(enp, partn)) != 0)
if ((rc = efx_mcdi_nvram_info(enp, partn, NULL, NULL,
NULL, &write_size)) != 0)
goto fail1;
if (chunk_sizep != NULL)
*chunk_sizep = EF10_NVRAM_CHUNK;
if ((rc = ef10_nvram_partn_lock(enp, partn)) != 0)
goto fail2;
if (chunk_sizep != NULL) {
if (write_size == 0)
*chunk_sizep = EF10_NVRAM_CHUNK;
else
*chunk_sizep = write_size;
}
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);