aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/mcdi.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2011-02-24 18:57:47 -0500
committerBen Hutchings <bhutchings@solarflare.com>2011-02-28 18:57:23 -0500
commite5f0fd278084d79d6be0920043519749374b0507 (patch)
treeafd06055d8d1058ceabc349396b087698183d237 /drivers/net/sfc/mcdi.c
parenta526f140b22131376b0e49577210e6af73e2b89f (diff)
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>
Diffstat (limited to 'drivers/net/sfc/mcdi.c')
-rw-r--r--drivers/net/sfc/mcdi.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c
index b716e827b291..88e786b11ed1 100644
--- a/drivers/net/sfc/mcdi.c
+++ b/drivers/net/sfc/mcdi.c
@@ -602,7 +602,7 @@ void efx_mcdi_process_event(struct efx_channel *channel,
602 ************************************************************************** 602 **************************************************************************
603 */ 603 */
604 604
605int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build) 605void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len)
606{ 606{
607 u8 outbuf[ALIGN(MC_CMD_GET_VERSION_V1_OUT_LEN, 4)]; 607 u8 outbuf[ALIGN(MC_CMD_GET_VERSION_V1_OUT_LEN, 4)];
608 size_t outlength; 608 size_t outlength;
@@ -616,29 +616,20 @@ int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build)
616 if (rc) 616 if (rc)
617 goto fail; 617 goto fail;
618 618
619 if (outlength == MC_CMD_GET_VERSION_V0_OUT_LEN) {
620 *version = 0;
621 *build = MCDI_DWORD(outbuf, GET_VERSION_OUT_FIRMWARE);
622 return 0;
623 }
624
625 if (outlength < MC_CMD_GET_VERSION_V1_OUT_LEN) { 619 if (outlength < MC_CMD_GET_VERSION_V1_OUT_LEN) {
626 rc = -EIO; 620 rc = -EIO;
627 goto fail; 621 goto fail;
628 } 622 }
629 623
630 ver_words = (__le16 *)MCDI_PTR(outbuf, GET_VERSION_OUT_VERSION); 624 ver_words = (__le16 *)MCDI_PTR(outbuf, GET_VERSION_OUT_VERSION);
631 *version = (((u64)le16_to_cpu(ver_words[0]) << 48) | 625 snprintf(buf, len, "%u.%u.%u.%u",
632 ((u64)le16_to_cpu(ver_words[1]) << 32) | 626 le16_to_cpu(ver_words[0]), le16_to_cpu(ver_words[1]),
633 ((u64)le16_to_cpu(ver_words[2]) << 16) | 627 le16_to_cpu(ver_words[2]), le16_to_cpu(ver_words[3]));
634 le16_to_cpu(ver_words[3])); 628 return;
635 *build = MCDI_DWORD(outbuf, GET_VERSION_OUT_FIRMWARE);
636
637 return 0;
638 629
639fail: 630fail:
640 netif_err(efx, probe, efx->net_dev, "%s: failed rc=%d\n", __func__, rc); 631 netif_err(efx, probe, efx->net_dev, "%s: failed rc=%d\n", __func__, rc);
641 return rc; 632 buf[0] = 0;
642} 633}
643 634
644int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, 635int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,