i40e/i40evf: print FW build number in version string
authorShannon Nelson <shannon.nelson@intel.com>
Tue, 24 Feb 2015 06:58:41 +0000 (06:58 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 3 Mar 2015 09:07:24 +0000 (01:07 -0800)
Include the FW build number in the formatted FW version string.  In order
to fit within ethtool's 32 character limit, the etrack's unused high order
bits are trimmed as is the leading 0 for the NVM version.  This leaves
us with 2 character left for if/when the etrack id goes to 5 hex chars
and the NVM major number goes to 2 chars.

Change-ID: Icb004c4b9b14a2f54dd200b467fcc1d7b9297308
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_adminq.c
drivers/net/ethernet/intel/i40e/i40e_adminq.h
drivers/net/ethernet/intel/i40e/i40e_common.c
drivers/net/ethernet/intel/i40e/i40e_prototype.h
drivers/net/ethernet/intel/i40evf/i40e_adminq.h

index 1e9576bb911eafa33426581b3e49b8b9c9e64e6d..5fa4eab779d278e422fd7a77d4f47ed073f3056e 100644 (file)
@@ -557,14 +557,14 @@ static inline char *i40e_fw_version_str(struct i40e_hw *hw)
        static char buf[32];
 
        snprintf(buf, sizeof(buf),
-                "f%d.%d a%d.%d n%02x.%02x e%08x",
-                hw->aq.fw_maj_ver, hw->aq.fw_min_ver,
+                "f%d.%d.%05d a%d.%d n%x.%02x e%x",
+                hw->aq.fw_maj_ver, hw->aq.fw_min_ver, hw->aq.fw_build,
                 hw->aq.api_maj_ver, hw->aq.api_min_ver,
                 (hw->nvm.version & I40E_NVM_VERSION_HI_MASK) >>
                        I40E_NVM_VERSION_HI_SHIFT,
                 (hw->nvm.version & I40E_NVM_VERSION_LO_MASK) >>
                        I40E_NVM_VERSION_LO_SHIFT,
-                hw->nvm.eetrack);
+                (hw->nvm.eetrack & 0xffffff));
 
        return buf;
 }
index 77f6254a89ac6078136e7cd92af1f910981c3f6f..dc2ed359e9458dfabce7d675513019542ed767d6 100644 (file)
@@ -592,6 +592,7 @@ i40e_status i40e_init_adminq(struct i40e_hw *hw)
                ret_code = i40e_aq_get_firmware_version(hw,
                                                        &hw->aq.fw_maj_ver,
                                                        &hw->aq.fw_min_ver,
+                                                       &hw->aq.fw_build,
                                                        &hw->aq.api_maj_ver,
                                                        &hw->aq.api_min_ver,
                                                        NULL);
index de17b6fbcc4e2a2f42054a875f961f9344a27d9a..28e519a50de4063edcae851c6e94fce88687203b 100644 (file)
@@ -93,6 +93,7 @@ struct i40e_adminq_info {
        u16 asq_buf_size;               /* send queue buffer size */
        u16 fw_maj_ver;                 /* firmware major version */
        u16 fw_min_ver;                 /* firmware minor version */
+       u32 fw_build;                   /* firmware build number */
        u16 api_maj_ver;                /* api major version */
        u16 api_min_ver;                /* api minor version */
        bool nvm_release_on_done;
index 88b2d45578dd5cc1413e511741cf331da411b982..cb19c377e0cc1b71bb99a035623c484c7137c40d 100644 (file)
@@ -1737,6 +1737,7 @@ i40e_status i40e_aq_get_switch_config(struct i40e_hw *hw,
  * @hw: pointer to the hw struct
  * @fw_major_version: firmware major version
  * @fw_minor_version: firmware minor version
+ * @fw_build: firmware build number
  * @api_major_version: major queue version
  * @api_minor_version: minor queue version
  * @cmd_details: pointer to command details structure or NULL
@@ -1745,6 +1746,7 @@ i40e_status i40e_aq_get_switch_config(struct i40e_hw *hw,
  **/
 i40e_status i40e_aq_get_firmware_version(struct i40e_hw *hw,
                                u16 *fw_major_version, u16 *fw_minor_version,
+                               u32 *fw_build,
                                u16 *api_major_version, u16 *api_minor_version,
                                struct i40e_asq_cmd_details *cmd_details)
 {
@@ -1758,13 +1760,15 @@ i40e_status i40e_aq_get_firmware_version(struct i40e_hw *hw,
        status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
 
        if (!status) {
-               if (fw_major_version != NULL)
+               if (fw_major_version)
                        *fw_major_version = le16_to_cpu(resp->fw_major);
-               if (fw_minor_version != NULL)
+               if (fw_minor_version)
                        *fw_minor_version = le16_to_cpu(resp->fw_minor);
-               if (api_major_version != NULL)
+               if (fw_build)
+                       *fw_build = le32_to_cpu(resp->fw_build);
+               if (api_major_version)
                        *api_major_version = le16_to_cpu(resp->api_major);
-               if (api_minor_version != NULL)
+               if (api_minor_version)
                        *api_minor_version = le16_to_cpu(resp->api_minor);
        }
 
index 8cab460865f5bb27cc5b7d78c405bf78d14d7a79..fea0d37ecc722af58d052476829c5f8ec53ef916 100644 (file)
@@ -66,6 +66,7 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink);
 
 i40e_status i40e_aq_get_firmware_version(struct i40e_hw *hw,
                                u16 *fw_major_version, u16 *fw_minor_version,
+                               u32 *fw_build,
                                u16 *api_major_version, u16 *api_minor_version,
                                struct i40e_asq_cmd_details *cmd_details);
 i40e_status i40e_aq_debug_write_register(struct i40e_hw *hw,
index 60f04e96a80e0a440faacf2c620777992259426b..ef43d68f67b30632b504962f1fd627799f16dd7f 100644 (file)
@@ -93,6 +93,7 @@ struct i40e_adminq_info {
        u16 asq_buf_size;               /* send queue buffer size */
        u16 fw_maj_ver;                 /* firmware major version */
        u16 fw_min_ver;                 /* firmware minor version */
+       u32 fw_build;                   /* firmware build number */
        u16 api_maj_ver;                /* api major version */
        u16 api_min_ver;                /* api minor version */
        bool nvm_release_on_done;