OSDN Git Service

qede: Populate mbi version in ethtool driver query data.
authorSudarsana Reddy Kalluru <skalluru@marvell.com>
Wed, 20 Mar 2019 07:26:25 +0000 (00:26 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Mar 2019 18:12:50 +0000 (11:12 -0700)
The patch adds support to display MBI image version in 'ethtool -i' output.

Signed-off-by: Sudarsana Reddy Kalluru <skalluru@marvell.com>
Signed-off-by: Ariel Elior <aelior@marvell.com>
Signed-off-by: Michal Kalderon <mkalderon@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qede/qede_ethtool.c

index b4c8949..f0a2ca2 100644 (file)
@@ -652,9 +652,9 @@ static void qede_get_drvinfo(struct net_device *ndev,
 {
        char mfw[ETHTOOL_FWVERS_LEN], storm[ETHTOOL_FWVERS_LEN];
        struct qede_dev *edev = netdev_priv(ndev);
+       char mbi[ETHTOOL_FWVERS_LEN];
 
        strlcpy(info->driver, "qede", sizeof(info->driver));
-       strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
 
        snprintf(storm, ETHTOOL_FWVERS_LEN, "%d.%d.%d.%d",
                 edev->dev_info.common.fw_major,
@@ -668,13 +668,27 @@ static void qede_get_drvinfo(struct net_device *ndev,
                 (edev->dev_info.common.mfw_rev >> 8) & 0xFF,
                 edev->dev_info.common.mfw_rev & 0xFF);
 
-       if ((strlen(storm) + strlen(mfw) + strlen("mfw storm  ")) <
-           sizeof(info->fw_version)) {
+       if ((strlen(storm) + strlen(DRV_MODULE_VERSION) + strlen("[storm]  ")) <
+           sizeof(info->version))
+               snprintf(info->version, sizeof(info->version),
+                        "%s [storm %s]", DRV_MODULE_VERSION, storm);
+       else
+               snprintf(info->version, sizeof(info->version),
+                        "%s %s", DRV_MODULE_VERSION, storm);
+
+       if (edev->dev_info.common.mbi_version) {
+               snprintf(mbi, ETHTOOL_FWVERS_LEN, "%d.%d.%d",
+                        (edev->dev_info.common.mbi_version &
+                         QED_MBI_VERSION_2_MASK) >> QED_MBI_VERSION_2_OFFSET,
+                        (edev->dev_info.common.mbi_version &
+                         QED_MBI_VERSION_1_MASK) >> QED_MBI_VERSION_1_OFFSET,
+                        (edev->dev_info.common.mbi_version &
+                         QED_MBI_VERSION_0_MASK) >> QED_MBI_VERSION_0_OFFSET);
                snprintf(info->fw_version, sizeof(info->fw_version),
-                        "mfw %s storm %s", mfw, storm);
+                        "mbi %s [mfw %s]", mbi, mfw);
        } else {
                snprintf(info->fw_version, sizeof(info->fw_version),
-                        "%s %s", mfw, storm);
+                        "mfw %s", mfw);
        }
 
        strlcpy(info->bus_info, pci_name(edev->pdev), sizeof(info->bus_info));