net/qede: fix driver version string
authorHarish Patil <harish.patil@qlogic.com>
Wed, 19 Oct 2016 04:11:41 +0000 (21:11 -0700)
committerBruce Richardson <bruce.richardson@intel.com>
Wed, 26 Oct 2016 17:42:22 +0000 (19:42 +0200)
This patch fixes the base driver version display.
The driver version notation is:
<Base-Version_PMD-Version>

Fixes: 2ea6f76aff40 ("qede: add core driver")

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
drivers/net/qede/qede_ethdev.c
drivers/net/qede/qede_ethdev.h
drivers/net/qede/qede_if.h
drivers/net/qede/qede_main.c

index 2763d63..394f89a 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "qede_ethdev.h"
 #include <rte_alarm.h>
+#include <rte_version.h>
 
 /* Globals */
 static const struct qed_eth_ops *qed_ops;
@@ -188,31 +189,28 @@ static void qede_print_adapter_info(struct qede_dev *qdev)
 {
        struct ecore_dev *edev = &qdev->edev;
        struct qed_dev_info *info = &qdev->dev_info.common;
-       static char ver_str[QED_DRV_VER_STR_SIZE];
+       static char drv_ver[QEDE_PMD_DRV_VER_STR_SIZE];
+       static char ver_str[QEDE_PMD_DRV_VER_STR_SIZE];
 
        DP_INFO(edev, "*********************************\n");
+       DP_INFO(edev, " DPDK version:%s\n", rte_version());
        DP_INFO(edev, " Chip details : %s%d\n",
-               ECORE_IS_BB(edev) ? "BB" : "AH",
-               CHIP_REV_IS_A0(edev) ? 0 : 1);
-
-       sprintf(ver_str, "%s %s_%d.%d.%d.%d", QEDE_PMD_VER_PREFIX,
-               edev->ver_str, QEDE_PMD_VERSION_MAJOR, QEDE_PMD_VERSION_MINOR,
-               QEDE_PMD_VERSION_REVISION, QEDE_PMD_VERSION_PATCH);
-       strcpy(qdev->drv_ver, ver_str);
-       DP_INFO(edev, " Driver version : %s\n", ver_str);
-
-       sprintf(ver_str, "%d.%d.%d.%d", info->fw_major, info->fw_minor,
-               info->fw_rev, info->fw_eng);
+                 ECORE_IS_BB(edev) ? "BB" : "AH",
+                 CHIP_REV_IS_A0(edev) ? 0 : 1);
+       snprintf(ver_str, QEDE_PMD_DRV_VER_STR_SIZE, "%d.%d.%d.%d",
+                info->fw_major, info->fw_minor, info->fw_rev, info->fw_eng);
+       snprintf(drv_ver, QEDE_PMD_DRV_VER_STR_SIZE, "%s_%s",
+                ver_str, QEDE_PMD_VERSION);
+       DP_INFO(edev, " Driver version : %s\n", drv_ver);
        DP_INFO(edev, " Firmware version : %s\n", ver_str);
 
-       sprintf(ver_str, "%d.%d.%d.%d",
+       snprintf(ver_str, MCP_DRV_VER_STR_SIZE,
+                "%d.%d.%d.%d",
                (info->mfw_rev >> 24) & 0xff,
                (info->mfw_rev >> 16) & 0xff,
                (info->mfw_rev >> 8) & 0xff, (info->mfw_rev) & 0xff);
-       DP_INFO(edev, " Management firmware version : %s\n", ver_str);
-
+       DP_INFO(edev, " Management Firmware version : %s\n", ver_str);
        DP_INFO(edev, " Firmware file : %s\n", fw_file);
-
        DP_INFO(edev, "*********************************\n");
 }
 
@@ -1362,11 +1360,12 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
        /* Start the Slowpath-process */
        memset(&params, 0, sizeof(struct qed_slowpath_params));
        params.int_mode = ECORE_INT_MODE_MSIX;
-       params.drv_major = QEDE_MAJOR_VERSION;
-       params.drv_minor = QEDE_MINOR_VERSION;
-       params.drv_rev = QEDE_REVISION_VERSION;
-       params.drv_eng = QEDE_ENGINEERING_VERSION;
-       strncpy((char *)params.name, "qede LAN", QED_DRV_VER_STR_SIZE);
+       params.drv_major = QEDE_PMD_VERSION_MAJOR;
+       params.drv_minor = QEDE_PMD_VERSION_MINOR;
+       params.drv_rev = QEDE_PMD_VERSION_REVISION;
+       params.drv_eng = QEDE_PMD_VERSION_PATCH;
+       strncpy((char *)params.name, QEDE_PMD_VER_PREFIX,
+               QEDE_PMD_DRV_VER_STR_SIZE);
 
        /* For CMT mode device do periodic polling for slowpath events.
         * This is required since uio device uses only one MSI-x
@@ -1403,7 +1402,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
 
        qede_alloc_etherdev(adapter, &dev_info);
 
-       adapter->ops->common->set_id(edev, edev->name, QEDE_DRV_MODULE_VERSION);
+       adapter->ops->common->set_id(edev, edev->name, QEDE_PMD_VERSION);
 
        if (!is_vf)
                adapter->dev_info.num_mac_addrs =
index 5838f33..c3b87e8 100644 (file)
 #define QEDE_PMD_VERSION_REVISION       0
 #define QEDE_PMD_VERSION_PATCH         1
 
-#define QEDE_MAJOR_VERSION             8
-#define QEDE_MINOR_VERSION             7
-#define QEDE_REVISION_VERSION          9
-#define QEDE_ENGINEERING_VERSION       0
+#define QEDE_PMD_VERSION qede_stringify(QEDE_PMD_VERSION_MAJOR) "."     \
+                        qede_stringify(QEDE_PMD_VERSION_MINOR) "."     \
+                        qede_stringify(QEDE_PMD_VERSION_REVISION) "."  \
+                        qede_stringify(QEDE_PMD_VERSION_PATCH)
+
+#define QEDE_PMD_DRV_VER_STR_SIZE NAME_SIZE
+#define QEDE_PMD_VER_PREFIX "QEDE PMD"
 
-#define QEDE_DRV_MODULE_VERSION qede_stringify(QEDE_MAJOR_VERSION) "." \
-               qede_stringify(QEDE_MINOR_VERSION) "."                  \
-               qede_stringify(QEDE_REVISION_VERSION) "."               \
-               qede_stringify(QEDE_ENGINEERING_VERSION)
 
 #define QEDE_RSS_INDIR_INITED     (1 << 0)
 #define QEDE_RSS_KEY_INITED       (1 << 1)
@@ -144,7 +143,7 @@ struct qede_dev {
        bool accept_any_vlan;
        struct ether_addr primary_mac;
        bool handle_hw_err;
-       char drv_ver[QED_DRV_VER_STR_SIZE];
+       char drv_ver[QEDE_PMD_DRV_VER_STR_SIZE];
 };
 
 /* Static functions */
index 935eed8..2d38b1b 100644 (file)
@@ -76,14 +76,13 @@ struct qed_link_output {
        uint32_t pause_config;
 };
 
-#define QED_DRV_VER_STR_SIZE 80
 struct qed_slowpath_params {
        uint32_t int_mode;
        uint8_t drv_major;
        uint8_t drv_minor;
        uint8_t drv_rev;
        uint8_t drv_eng;
-       uint8_t name[QED_DRV_VER_STR_SIZE];
+       uint8_t name[NAME_SIZE];
 };
 
 #define ILT_PAGE_SIZE_TCFC 0x8000      /* 32KB */
index c83893d..0483116 100644 (file)
@@ -426,7 +426,7 @@ qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info)
 
 static void
 qed_set_id(struct ecore_dev *edev, char name[NAME_SIZE],
-          const char ver_str[VER_SIZE])
+          const char ver_str[NAME_SIZE])
 {
        int i;
 
@@ -434,7 +434,7 @@ qed_set_id(struct ecore_dev *edev, char name[NAME_SIZE],
        for_each_hwfn(edev, i) {
                snprintf(edev->hwfns[i].name, NAME_SIZE, "%s-%d", name, i);
        }
-       rte_memcpy(edev->ver_str, ver_str, VER_SIZE);
+       memcpy(edev->ver_str, ver_str, NAME_SIZE);
        edev->drv_type = DRV_ID_DRV_TYPE_LINUX;
 }