[dpdk-dev] [PATCH 13/29] net/sfc/base: transition to the extensible NVRAM info API
Andrew Rybchenko
arybchenko at solarflare.com
Mon Jun 10 09:38:28 CEST 2019
From: Richard Houldsworth <rhouldsworth at solarflare.com>
Old NVRAM info API required function prototype too often.
Signed-off-by: Richard Houldsworth <rhouldsworth at solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
drivers/net/sfc/base/ef10_nvram.c | 20 +++++++++++++-------
drivers/net/sfc/base/ef10_vpd.c | 7 +++++--
drivers/net/sfc/base/efx_impl.h | 9 ---------
drivers/net/sfc/base/efx_nvram.c | 38 +-------------------------------------
drivers/net/sfc/base/siena_nvram.c | 9 +++++----
5 files changed, 24 insertions(+), 59 deletions(-)
diff --git a/drivers/net/sfc/base/ef10_nvram.c b/drivers/net/sfc/base/ef10_nvram.c
index a618c75..1fb7185 100644
--- a/drivers/net/sfc/base/ef10_nvram.c
+++ b/drivers/net/sfc/base/ef10_nvram.c
@@ -1946,11 +1946,13 @@ static uint32_t checksum_tlv_partition(
__out size_t *sizep)
{
efx_rc_t rc;
+ efx_nvram_info_t eni = { 0 };
- if ((rc = efx_mcdi_nvram_info(enp, partn, sizep,
- NULL, NULL, NULL)) != 0)
+ if ((rc = efx_mcdi_nvram_info(enp, partn, &eni)) != 0)
goto fail1;
+ *sizep = eni.eni_partn_size;
+
return (0);
fail1:
@@ -1967,7 +1969,7 @@ static uint32_t checksum_tlv_partition(
{
efx_rc_t rc;
- if ((rc = efx_mcdi_nvram_info_ex(enp, partn, enip)) != 0)
+ if ((rc = efx_mcdi_nvram_info(enp, partn, enip)) != 0)
goto fail1;
if (enip->eni_write_size == 0)
@@ -2080,12 +2082,14 @@ static uint32_t checksum_tlv_partition(
__in size_t size)
{
efx_rc_t rc;
+ efx_nvram_info_t eni = { 0 };
uint32_t erase_size;
- if ((rc = efx_mcdi_nvram_info(enp, partn, NULL, NULL,
- &erase_size, NULL)) != 0)
+ if ((rc = efx_mcdi_nvram_info(enp, partn, &eni)) != 0)
goto fail1;
+ erase_size = eni.eni_erase_size;
+
if (erase_size == 0) {
if ((rc = efx_mcdi_nvram_erase(enp, partn, offset, size)) != 0)
goto fail2;
@@ -2126,13 +2130,15 @@ static uint32_t checksum_tlv_partition(
__in size_t size)
{
size_t chunk;
+ efx_nvram_info_t eni = { 0 };
uint32_t write_size;
efx_rc_t rc;
- if ((rc = efx_mcdi_nvram_info(enp, partn, NULL, NULL,
- NULL, &write_size)) != 0)
+ if ((rc = efx_mcdi_nvram_info(enp, partn, &eni)) != 0)
goto fail1;
+ write_size = eni.eni_write_size;
+
if (write_size != 0) {
/*
* Check that the size is a multiple of the write chunk size if
diff --git a/drivers/net/sfc/base/ef10_vpd.c b/drivers/net/sfc/base/ef10_vpd.c
index d56747b..c641936 100644
--- a/drivers/net/sfc/base/ef10_vpd.c
+++ b/drivers/net/sfc/base/ef10_vpd.c
@@ -79,6 +79,7 @@
__out size_t *sizep)
{
efx_rc_t rc;
+ efx_nvram_info_t eni = { 0 };
EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp));
@@ -88,10 +89,12 @@
* so we just need to return an upper bound on the dynamic vpd,
* which is the size of the DYNAMIC_CONFIG partition.
*/
- if ((rc = efx_mcdi_nvram_info(enp, NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG,
- sizep, NULL, NULL, NULL)) != 0)
+ if ((rc = efx_mcdi_nvram_info(enp,
+ NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG, &eni)) != 0)
goto fail1;
+ *sizep = eni.eni_partn_size;
+
return (0);
fail1:
diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h
index 577d5aa..d8cadda 100644
--- a/drivers/net/sfc/base/efx_impl.h
+++ b/drivers/net/sfc/base/efx_impl.h
@@ -563,15 +563,6 @@
efx_mcdi_nvram_info(
__in efx_nic_t *enp,
__in uint32_t partn,
- __out_opt size_t *sizep,
- __out_opt uint32_t *addressp,
- __out_opt uint32_t *erase_sizep,
- __out_opt uint32_t *write_sizep);
-
- __checkReturn efx_rc_t
-efx_mcdi_nvram_info_ex(
- __in efx_nic_t *enp,
- __in uint32_t partn,
__out efx_nvram_info_t *eni);
__checkReturn efx_rc_t
diff --git a/drivers/net/sfc/base/efx_nvram.c b/drivers/net/sfc/base/efx_nvram.c
index b817cb6..74dac41 100644
--- a/drivers/net/sfc/base/efx_nvram.c
+++ b/drivers/net/sfc/base/efx_nvram.c
@@ -691,7 +691,7 @@
}
__checkReturn efx_rc_t
-efx_mcdi_nvram_info_ex(
+efx_mcdi_nvram_info(
__in efx_nic_t *enp,
__in uint32_t partn,
__out efx_nvram_info_t *enip)
@@ -752,42 +752,6 @@
return (rc);
}
- __checkReturn efx_rc_t
-efx_mcdi_nvram_info(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __out_opt size_t *sizep,
- __out_opt uint32_t *addressp,
- __out_opt uint32_t *erase_sizep,
- __out_opt uint32_t *write_sizep)
-{
- efx_nvram_info_t eni;
- efx_rc_t rc;
-
- if ((rc = efx_mcdi_nvram_info_ex(enp, partn, &eni)) != 0)
- goto fail1;
-
- if (sizep)
- *sizep = eni.eni_partn_size;
-
- if (addressp)
- *addressp = eni.eni_address;
-
- if (erase_sizep)
- *erase_sizep = eni.eni_erase_size;
-
- if (write_sizep)
- *write_sizep = eni.eni_write_size;
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-
/*
* MC_CMD_NVRAM_UPDATE_START_V2 must be used to support firmware-verified
* NVRAM updates. Older firmware will ignore the flags field in the request.
diff --git a/drivers/net/sfc/base/siena_nvram.c b/drivers/net/sfc/base/siena_nvram.c
index 7d423d2..47a8ca2 100644
--- a/drivers/net/sfc/base/siena_nvram.c
+++ b/drivers/net/sfc/base/siena_nvram.c
@@ -18,16 +18,17 @@
__out size_t *sizep)
{
efx_rc_t rc;
+ efx_nvram_info_t eni = { 0 };
if ((1 << partn) & ~enp->en_u.siena.enu_partn_mask) {
rc = ENOTSUP;
goto fail1;
}
- if ((rc = efx_mcdi_nvram_info(enp, partn, sizep,
- NULL, NULL, NULL)) != 0) {
+ if ((rc = efx_mcdi_nvram_info(enp, partn, &eni)) != 0)
goto fail2;
- }
+
+ *sizep = eni.eni_partn_size;
return (0);
@@ -47,7 +48,7 @@
{
efx_rc_t rc;
- if ((rc = efx_mcdi_nvram_info_ex(enp, partn, enip)) != 0)
+ if ((rc = efx_mcdi_nvram_info(enp, partn, enip)) != 0)
goto fail1;
if (enip->eni_write_size == 0)
--
1.8.3.1
More information about the dev
mailing list