From: Andy Moreton Date: Thu, 16 Nov 2017 08:03:58 +0000 (+0000) Subject: net/sfc/base: report correct partition write chunk size X-Git-Tag: spdx-start~675 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e74e5d32b200937283ecbbf08b1aa72e2228d3ba;p=dpdk.git 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 Signed-off-by: Andrew Rybchenko --- diff --git a/drivers/net/sfc/base/ef10_nvram.c b/drivers/net/sfc/base/ef10_nvram.c index fdd76465c4..a70838b773 100644 --- a/drivers/net/sfc/base/ef10_nvram.c +++ b/drivers/net/sfc/base/ef10_nvram.c @@ -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);