qlcnic: check IDC version
authorSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Thu, 13 May 2010 03:07:47 +0000 (03:07 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 14 May 2010 10:08:00 +0000 (03:08 -0700)
Warn user if IDC version mismatch with different class of drivers.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/qlcnic/qlcnic.h
drivers/net/qlcnic/qlcnic_main.c

index ed9df150c20f125f3b97fcd48de24d5539b6a14d..8a9412fd2ff531e4a7f9f897d6dba10bd9d558a1 100644 (file)
@@ -53,6 +53,7 @@
 #define _QLCNIC_LINUX_MINOR 0
 #define _QLCNIC_LINUX_SUBVERSION 2
 #define QLCNIC_LINUX_VERSIONID  "5.0.2"
+#define QLCNIC_DRV_IDC_VER  0x01
 
 #define QLCNIC_VERSION_CODE(a, b, c)   (((a) << 24) + ((b) << 16) + (c))
 #define _major(v)      (((v) >> 24) & 0xff)
index 50be833c3767d642b6d6746a2dc79071bd075a56..54a6bb20ec073f61f791e740d071fe0b8650ebc5 100644 (file)
@@ -1975,12 +1975,25 @@ qlcnic_check_drv_state(struct qlcnic_adapter *adapter)
                return 1;
 }
 
+static int qlcnic_check_idc_ver(struct qlcnic_adapter *adapter)
+{
+       u32 val = QLCRD32(adapter, QLCNIC_CRB_DRV_IDC_VER);
+
+       if (val != QLCNIC_DRV_IDC_VER) {
+               dev_warn(&adapter->pdev->dev, "IDC Version mismatch, driver's"
+                       " idc ver = %x; reqd = %x\n", QLCNIC_DRV_IDC_VER, val);
+       }
+
+       return 0;
+}
+
 static int
 qlcnic_can_start_firmware(struct qlcnic_adapter *adapter)
 {
        u32 val, prev_state;
        u8 dev_init_timeo = adapter->dev_init_timeo;
        u8 portnum = adapter->portnum;
+       u8 ret;
 
        if (test_and_clear_bit(__QLCNIC_START_FW, &adapter->state))
                return 1;
@@ -2000,12 +2013,14 @@ qlcnic_can_start_firmware(struct qlcnic_adapter *adapter)
        switch (prev_state) {
        case QLCNIC_DEV_COLD:
                QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_INITIALIZING);
+               QLCWR32(adapter, QLCNIC_CRB_DRV_IDC_VER, QLCNIC_DRV_IDC_VER);
                qlcnic_api_unlock(adapter);
                return 1;
 
        case QLCNIC_DEV_READY:
+               ret = qlcnic_check_idc_ver(adapter);
                qlcnic_api_unlock(adapter);
-               return 0;
+               return ret;
 
        case QLCNIC_DEV_NEED_RESET:
                val = QLCRD32(adapter, QLCNIC_CRB_DRV_STATE);
@@ -2048,9 +2063,10 @@ qlcnic_can_start_firmware(struct qlcnic_adapter *adapter)
        QLC_DEV_CLR_RST_QSCNT(val, portnum);
        QLCWR32(adapter, QLCNIC_CRB_DRV_STATE, val);
 
+       ret = qlcnic_check_idc_ver(adapter);
        qlcnic_api_unlock(adapter);
 
-       return 0;
+       return ret;
 }
 
 static void