[QLGC VNIC] sending different instance IDs
authoraestrin <aestrin@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 24 Mar 2009 15:41:15 +0000 (15:41 +0000)
committeraestrin <aestrin@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 24 Mar 2009 15:41:15 +0000 (15:41 +0000)
for each viport communicating with the same EVIC IOC.
submitted by Deepak Gupta (deepak.gupta@qlogic.com)

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2043 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/qlgcvnic/kernel/netvnic.inx
ulp/qlgcvnic/kernel/vnic_adapter.c
ulp/qlgcvnic/kernel/vnic_adapter.h
ulp/qlgcvnic/kernel/vnic_config.h
ulp/qlgcvnic/kernel/vnic_driver.c

index 92c1e9a..c20210a 100644 (file)
@@ -36,22 +36,13 @@ qlgcvnic.sys=1
 ; empty since we don't support W9x/Me\r
 \r
 [vnic.DeviceSection.ntx86]\r
-%vnic.DeviceDesc% = VNIC.DDInstall,IBA\V00066aP00000030S00066as00000030v0001, \\r
-                                                               IBA\V00066aP00000030S00066as00000030, \\r
-                                                               IBA\V00066aP00000030v0001, \\r
-                                                               IBA\V00066aP00000030\r
+%vnic.DeviceDesc% = VNIC.DDInstall,IBA\qlgcvnic\r
 \r
 [vnic.DeviceSection.ntamd64]\r
-%vnic.DeviceDesc% = vnic.DDInstall,IBA\V00066aP00000030S00066as00000030v0001, \\r
-                                                               IBA\V00066aP00000030S00066as00000030, \\r
-                                                               IBA\V00066aP00000030v0001, \\r
-                                                               IBA\V00066aP00000030\r
+%vnic.DeviceDesc% = VNIC.DDInstall,IBA\qlgcvnic\r
 \r
 [vnic.DeviceSection.ntia64]\r
-%vnic.DeviceDesc% = vnic.DDInstall,IBA\V00066aP00000030S00066as00000030v0001, \\r
-                                                               IBA\V00066aP00000030S00066as00000030, \\r
-                                                               IBA\V00066aP00000030v0001, \\r
-                                                               IBA\V00066aP00000030\r
+%vnic.DeviceDesc% = VNIC.DDInstall,IBA\qlgcvnic\r
 \r
 [vnic.DDInstall.ntx86]\r
 Characteristics = %CHARACTERISTICS%\r
index fa6bd7c..dfec042 100644 (file)
@@ -150,6 +150,34 @@ __adapter_find_on_failover_list(
 \r
 #endif // LBFO_ENABLED\r
 \r
+\r
+uint32_t _get_instance(ioc_ifc_data_t  *ifc_data)\r
+{\r
+       cl_qlist_t      *qlist;\r
+       cl_list_item_t  *item;\r
+       vnic_adapter_t  *p_adapter;\r
+       uint32_t        instance = 1;\r
+\r
+       qlist = &g_vnic.adapter_list;\r
+\r
+       if (cl_qlist_count(qlist)) {\r
+\r
+               item = cl_qlist_head(qlist);\r
+\r
+               while(item != cl_qlist_end(qlist)) {\r
+                       p_adapter = PARENT_STRUCT(item, vnic_adapter_t, list_adapter);\r
+                       if (p_adapter->ifc_data.guid == ifc_data->guid) {\r
+                               instance += 2; // Right now we are considering one interface will consume two instance IDs\r
+                       }\r
+                       item = cl_qlist_next(item);\r
+               }\r
+\r
+       }\r
+\r
+       return instance;\r
+\r
+}\r
+\r
 ib_api_status_t\r
 vnic_create_adapter(\r
        IN              NDIS_HANDLE                     h_handle,\r
@@ -216,9 +244,8 @@ vnic_create_adapter(
        /* we will use these indexes later as an viport instance ID for connect request\r
        *  since target requires unique instance per connection per IOC.\r
        */\r
-       p_adapter->primaryPath.instance = NETPATH_PRIMARY;\r
-       p_adapter->secondaryPath.instance = NETPATH_SECONDARY;\r
-       \r
+       p_adapter->primaryPath.instance = _get_instance(&p_adapter->ifc_data);\r
+       p_adapter->secondaryPath.instance = (p_adapter->primaryPath.instance) + 1;\r
        /* set adapter level params here */\r
        p_adapter->vlan_info = p_adapter->params.VlanInfo;\r
 \r
@@ -232,6 +259,8 @@ vnic_create_adapter(
        p_adapter->h_handle = h_handle;\r
        *pp_adapter = p_adapter;\r
 \r
+       // Insert in global list of adapters\r
+       cl_qlist_insert_tail (&g_vnic.adapter_list, &p_adapter->list_adapter);\r
        VNIC_EXIT( VNIC_DBG_ADAPTER );\r
        return IB_SUCCESS;\r
 }\r
@@ -278,6 +307,7 @@ vnic_destroy_adapter(
                ASSERT( ib_status == IB_SUCCESS );\r
        }\r
 \r
+       cl_qlist_remove_item(&g_vnic.adapter_list, &p_adapter->list_adapter);\r
        NdisFreeSpinLock( &p_adapter->lock );\r
        NdisFreeSpinLock( &p_adapter->path_records_lock );\r
        NdisFreeMemory( p_adapter, sizeof(vnic_adapter_t), 0 );\r
@@ -1232,7 +1262,6 @@ __vnic_pnp_cb(
        return ib_status;\r
 }\r
 \r
-\r
 NDIS_STATUS\r
 vnic_get_adapter_interface(\r
        IN      NDIS_HANDLE                     h_handle,\r
index cd143b5..cbed223 100644 (file)
@@ -180,7 +180,7 @@ typedef struct _vnic_adapter {
                uint32_t                        carrierOffNum;\r
        }   statistics;\r
 #endif /* VNIC_STATISTIC */\r
-\r
+       cl_list_item_t                  list_adapter;\r
 } vnic_adapter_t;\r
 \r
 ib_api_status_t\r
index 9568b08..7d49064 100644 (file)
@@ -198,6 +198,7 @@ typedef struct _vnic_globals {
        uint32_t                        shutdown;\r
        uint8_t                         host_name[IB_NODE_DESCRIPTION_SIZE];\r
        g_registry_params_t     *p_params;\r
+       cl_qlist_t                      adapter_list;\r
 } vnic_globals_t;\r
 \r
 typedef struct IbConfig {\r
index daa8274..08947e9 100644 (file)
@@ -185,6 +185,7 @@ DriverEntry(
                cl_qlist_init( &g_vnic.primary_list );\r
                cl_qlist_init( &g_vnic.secondary_list );\r
 #endif\r
+               cl_qlist_init( &g_vnic.adapter_list);\r
        }\r
 \r
        VNIC_EXIT( VNIC_DBG_INIT );\r