[IPoIB NDIS 6.0 CM] Fixing a bug when ipoib_get_adapter_params fails reading paramete...
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 30 Nov 2009 15:46:11 +0000 (15:46 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 30 Nov 2009 15:46:11 +0000 (15:46 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2605 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib/kernel/ipoib_stat.h
ulp/ipoib_NDIS6_CM/kernel/ipoib_adapter.cpp
ulp/ipoib_NDIS6_CM/kernel/ipoib_driver.cpp
ulp/ipoib_NDIS6_CM/kernel/ipoib_stat.h
ulp/srp/kernel/srp_connection.c

index 7e601bb..6f1d187 100644 (file)
@@ -42,7 +42,7 @@ typedef struct _IPOIB_ST_DEVICE
        boolean_t                       valid;\r
        ipoib_adapter_t         *p_adapter;\r
        ipoib_port_t            *p_prev_port;\r
-       PRKTHREAD                       *p_halt_thread;\r
+       PRKTHREAD                       p_halt_thread;\r
        int                                     n_power_irps;   // NdisDevicePnPEventPowerProfileChanged \r
        int                                     n_pnp_irps;             // NdisDevicePnPEventSurpriseRemoved \r
        \r
index c1a8b74..c87ef53 100644 (file)
@@ -197,7 +197,7 @@ ipoib_create_adapter(
 \r
        ETH_COPY_NETWORK_ADDRESS( p_adapter->params.conf_mac.addr, p_adapter->mac.addr );\r
        /* If there is a NetworkAddress override in registry, use it */\r
-       if( (status == NDIS_STATUS_SUCCESS) && (len == HW_ADDR_LEN) )\r
+       if( (len == HW_ADDR_LEN) && (mac != NULL) )\r
        {\r
                if( ETH_IS_MULTICAST(mac) || ETH_IS_BROADCAST(mac) ||\r
                        !ETH_IS_LOCALLY_ADMINISTERED(mac) )\r
@@ -666,8 +666,8 @@ __ipoib_pnp_cb(
                }\r
 \r
                p_pnp_rec->context = p_port;\r
-\r
-               p_adapter->p_stat->p_prev_port = p_adapter->p_port;\r
+               if ( p_adapter->p_stat )\r
+                       p_adapter->p_stat->p_prev_port = p_adapter->p_port;\r
                p_adapter->p_port = p_port;\r
                cl_obj_unlock( &p_adapter->obj );\r
                break;\r
@@ -685,7 +685,8 @@ __ipoib_pnp_cb(
 \r
                cl_obj_lock( &p_adapter->obj );\r
                p_adapter->state = IB_PNP_PORT_REMOVE;\r
-               p_adapter->p_stat->p_prev_port = p_adapter->p_port;\r
+               if ( p_adapter->p_stat )\r
+                       p_adapter->p_stat->p_prev_port = p_adapter->p_port;\r
                p_port = p_adapter->p_port;\r
                p_adapter->p_port = NULL;\r
                cl_obj_unlock( &p_adapter->obj );\r
@@ -1022,7 +1023,8 @@ __ipoib_adapter_reset(
        state = p_adapter->state;\r
 \r
        /* Destroy the current port instance if it still exists. */\r
-       p_adapter->p_stat->p_prev_port = p_adapter->p_port;\r
+       if ( p_adapter->p_stat )\r
+               p_adapter->p_stat->p_prev_port = p_adapter->p_port;\r
        p_port = p_adapter->p_port;\r
        p_adapter->p_port = NULL;\r
        cl_obj_unlock( &p_adapter->obj );\r
index 477460b..2bb4ae2 100644 (file)
@@ -877,6 +877,11 @@ ipoib_get_adapter_params(
                        (sizeof(eth_hdr_t) + p_adapter->params.payload_mtu);\r
 \r
        NdisReadNetworkAddress( &status, (PVOID *) p_mac, p_len, h_config );\r
+       if (status != NDIS_STATUS_SUCCESS) {\r
+               // Don't rely on NDIS, zero the values\r
+               *p_mac = NULL;\r
+               *p_len = 0;\r
+       }\r
 \r
        NdisCloseConfiguration( h_config );\r
 \r
index 1c84791..1854be4 100644 (file)
@@ -41,7 +41,7 @@ typedef struct _IPOIB_ST_DEVICE
        boolean_t                       valid;\r
        ipoib_adapter_t         *p_adapter;\r
        ipoib_port_t            *p_prev_port;\r
-       PRKTHREAD                       *p_halt_thread;\r
+       PRKTHREAD                       p_halt_thread;\r
        int                                     n_power_irps;   // NdisDevicePnPEventPowerProfileChanged \r
        int                                     n_pnp_irps;             // NdisDevicePnPEventSurpriseRemoved \r
        \r
index 5b7780f..6270752 100644 (file)
@@ -727,7 +727,7 @@ srp_init_connection(
        switch( p_profile->io_class )\r
        {\r
        case SRP_IO_CLASS_R10:\r
-               p_connection->init_port_id.field1 = ca_guid;\r
+               p_connection->init_port_id.field1 = p_path_rec->sgid.unicast.interface_id;\r
                p_connection->init_port_id.field2 = ext_id;\r
                p_connection->targ_port_id.field1 = p_profile->ioc_guid;\r
                p_connection->targ_port_id.field2 = ext_id;\r
@@ -735,7 +735,7 @@ srp_init_connection(
 \r
        case SRP_IO_CLASS:\r
                p_connection->init_port_id.field1 = ext_id;\r
-               p_connection->init_port_id.field2 = ca_guid;\r
+               p_connection->init_port_id.field2 = p_path_rec->sgid.unicast.interface_id;\r
                p_connection->targ_port_id.field1 = ext_id;\r
                p_connection->targ_port_id.field2 = p_profile->ioc_guid;\r
                break;\r