]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sfc: Read MC firmware version when requested through ethtool
authorBen Hutchings <bhutchings@solarflare.com>
Thu, 24 Feb 2011 23:57:47 +0000 (23:57 +0000)
committerBen Hutchings <bhutchings@solarflare.com>
Mon, 28 Feb 2011 23:57:23 +0000 (23:57 +0000)
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>
drivers/net/sfc/ethtool.c
drivers/net/sfc/mcdi.c
drivers/net/sfc/mcdi.h
drivers/net/sfc/nic.h
drivers/net/sfc/siena.c

index 272cfe724e1bcd5cbdf3fddb94bb5457fd8a30ed..3e974b11db0e89b1f13a8165398f82da5ac26791 100644 (file)
@@ -237,8 +237,8 @@ static void efx_ethtool_get_drvinfo(struct net_device *net_dev,
        strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
        strlcpy(info->version, EFX_DRIVER_VERSION, sizeof(info->version));
        if (efx_nic_rev(efx) >= EFX_REV_SIENA_A0)
-               siena_print_fwver(efx, info->fw_version,
-                                 sizeof(info->fw_version));
+               efx_mcdi_print_fwver(efx, info->fw_version,
+                                    sizeof(info->fw_version));
        strlcpy(info->bus_info, pci_name(efx->pci_dev), sizeof(info->bus_info));
 }
 
index b716e827b291bca53dab4464543553c1cdaa9673..88e786b11ed1c547f0f2aa8af9d3ca95bf58bffe 100644 (file)
@@ -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,
index c792f1d65e4880d84e85a136289e945e1ca863f1..9bac250143d9b20946b8016544bde13c9f46bf02 100644 (file)
@@ -93,7 +93,7 @@ extern void efx_mcdi_process_event(struct efx_channel *channel,
 #define MCDI_EVENT_FIELD(_ev, _field)                  \
        EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field)
 
-extern int efx_mcdi_fwver(struct efx_nic *efx, u64 *version, u32 *build);
+extern void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len);
 extern int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
                               bool *was_attached_out);
 extern int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
index eb0586925b51175bcc9cda3a39991c2a2e29521d..17407eac0030ae18f200d289b721f938187173ef 100644 (file)
@@ -142,20 +142,14 @@ static inline struct falcon_board *falcon_board(struct efx_nic *efx)
 
 /**
  * struct siena_nic_data - Siena NIC state
- * @fw_version: Management controller firmware version
- * @fw_build: Firmware build number
  * @mcdi: Management-Controller-to-Driver Interface
  * @wol_filter_id: Wake-on-LAN packet filter id
  */
 struct siena_nic_data {
-       u64 fw_version;
-       u32 fw_build;
        struct efx_mcdi_iface mcdi;
        int wol_filter_id;
 };
 
-extern void siena_print_fwver(struct efx_nic *efx, char *buf, size_t len);
-
 extern struct efx_nic_type falcon_a1_nic_type;
 extern struct efx_nic_type falcon_b0_nic_type;
 extern struct efx_nic_type siena_a0_nic_type;
index bf8456176443a5a12bc2fb4bdb31a6c704d37f7e..07b59a8c9a4cc5e2adb9b3ba8ac655e4e0458189 100644 (file)
@@ -227,13 +227,6 @@ static int siena_probe_nic(struct efx_nic *efx)
        if (rc)
                goto fail1;
 
-       rc = efx_mcdi_fwver(efx, &nic_data->fw_version, &nic_data->fw_build);
-       if (rc) {
-               netif_err(efx, probe, efx->net_dev,
-                         "Failed to read MCPU firmware version - rc %d\n", rc);
-               goto fail1; /* MCPU absent? */
-       }
-
        /* Let the BMC know that the driver is now in charge of link and
         * filter settings. We must do this before we reset the NIC */
        rc = efx_mcdi_drv_attach(efx, true, &already_attached);
@@ -514,16 +507,6 @@ static void siena_stop_nic_stats(struct efx_nic *efx)
        efx_mcdi_mac_stats(efx, efx->stats_buffer.dma_addr, 0, 0, 0);
 }
 
-void siena_print_fwver(struct efx_nic *efx, char *buf, size_t len)
-{
-       struct siena_nic_data *nic_data = efx->nic_data;
-       snprintf(buf, len, "%u.%u.%u.%u",
-                (unsigned int)(nic_data->fw_version >> 48),
-                (unsigned int)(nic_data->fw_version >> 32 & 0xffff),
-                (unsigned int)(nic_data->fw_version >> 16 & 0xffff),
-                (unsigned int)(nic_data->fw_version & 0xffff));
-}
-
 /**************************************************************************
  *
  * Wake on LAN