sfc: Read MC firmware version when requested through ethtool
We currently make no use of siena_nic_data::fw_{version,build} except to format the firmware version for ethtool_get_drvinfo(). Since we only read the version at start of day, this information is incorrect after an MC firmware update. Remove the cached version information and read it via MCDI whenever it is requested. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
This commit is contained in:
parent
a526f140b2
commit
e5f0fd2780
5 changed files with 9 additions and 41 deletions
|
@ -602,7 +602,7 @@ void efx_mcdi_process_event(struct efx_channel *channel,
|
|||
**************************************************************************
|
||||
*/
|
||||
|
||||
int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build)
|
||||
void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len)
|
||||
{
|
||||
u8 outbuf[ALIGN(MC_CMD_GET_VERSION_V1_OUT_LEN, 4)];
|
||||
size_t outlength;
|
||||
|
@ -616,29 +616,20 @@ int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build)
|
|||
if (rc)
|
||||
goto fail;
|
||||
|
||||
if (outlength == MC_CMD_GET_VERSION_V0_OUT_LEN) {
|
||||
*version = 0;
|
||||
*build = MCDI_DWORD(outbuf, GET_VERSION_OUT_FIRMWARE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (outlength < MC_CMD_GET_VERSION_V1_OUT_LEN) {
|
||||
rc = -EIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ver_words = (__le16 *)MCDI_PTR(outbuf, GET_VERSION_OUT_VERSION);
|
||||
*version = (((u64)le16_to_cpu(ver_words[0]) << 48) |
|
||||
((u64)le16_to_cpu(ver_words[1]) << 32) |
|
||||
((u64)le16_to_cpu(ver_words[2]) << 16) |
|
||||
le16_to_cpu(ver_words[3]));
|
||||
*build = MCDI_DWORD(outbuf, GET_VERSION_OUT_FIRMWARE);
|
||||
|
||||
return 0;
|
||||
snprintf(buf, len, "%u.%u.%u.%u",
|
||||
le16_to_cpu(ver_words[0]), le16_to_cpu(ver_words[1]),
|
||||
le16_to_cpu(ver_words[2]), le16_to_cpu(ver_words[3]));
|
||||
return;
|
||||
|
||||
fail:
|
||||
netif_err(efx, probe, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
buf[0] = 0;
|
||||
}
|
||||
|
||||
int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue