[ipoib] Change network connection status when pkey added/removed in SM.
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 10 Nov 2008 18:04:52 +0000 (18:04 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 10 Nov 2008 18:04:52 +0000 (18:04 +0000)
Signed off by: anatolyg@voltaire.com

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

ulp/ipoib/kernel/ipoib_adapter.c
ulp/ipoib/kernel/ipoib_adapter.h
ulp/ipoib/kernel/ipoib_port.c

index d94fefc..6c2a946 100644 (file)
@@ -548,19 +548,19 @@ ipoib_query_pkey_index(ipoib_adapter_t    *p_adapter)
                                                 p_adapter->p_ifc->get_err_str( status )) );\r
                goto pkey_end;\r
        }\r
-\r
-       CL_ASSERT(ca_attr->p_port_attr->p_pkey_table[0] == IB_DEFAULT_PKEY);\r
-       for(index = 0; index < ca_attr->p_port_attr->num_pkeys; index++)\r
+       CL_ASSERT(ca_attr->p_port_attr[p_adapter->p_port->port_num -1].p_pkey_table[0] == IB_DEFAULT_PKEY);\r
+       for(index = 0; index < ca_attr->p_port_attr[p_adapter->p_port->port_num -1].num_pkeys; index++)\r
        {\r
-               if(cl_hton16(p_adapter->guids.port_guid.pkey) == ca_attr->p_port_attr->p_pkey_table[index])\r
+               if(cl_hton16(p_adapter->guids.port_guid.pkey) == ca_attr->p_port_attr[p_adapter->p_port->port_num -1].p_pkey_table[index])\r
                        break;\r
        }\r
-       if(index >= ca_attr->p_port_attr->num_pkeys)\r
+       if(index >= ca_attr->p_port_attr[p_adapter->p_port->port_num -1].num_pkeys)\r
        {\r
                IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
                                                ("Pkey table is invalid, index not found\n"));\r
                NdisWriteErrorLogEntry( p_adapter->h_adapter,\r
                        EVENT_IPOIB_PARTITION_ERR, 1, p_adapter->guids.port_guid.pkey );\r
+               status = IB_NOT_FOUND;\r
                p_adapter->p_port->pkey_index = PKEY_INVALID_INDEX;\r
                goto pkey_end;\r
        }\r
@@ -755,7 +755,11 @@ __ipoib_pnp_cb(
                        {\r
                                status = ipoib_query_pkey_index(p_adapter);\r
                                if(status != IB_SUCCESS)\r
-                                       break;\r
+                               {\r
+                                  cl_obj_lock( &p_adapter->obj );\r
+                                  p_adapter->state = IB_PNP_PORT_INIT;\r
+                                  cl_obj_unlock( &p_adapter->obj );\r
+                               }\r
                        }\r
 \r
                case IB_PNP_SM_CHANGE:\r
@@ -1071,12 +1075,13 @@ ipoib_set_rate(
 }\r
 \r
 \r
-void\r
+ib_api_status_t\r
 ipoib_set_active(\r
        IN                              ipoib_adapter_t* const          p_adapter )\r
 {\r
        ib_pnp_event_t  old_state;\r
        uint8_t                 i;\r
+       ib_api_status_t status = IB_SUCCESS;\r
 \r
        IPOIB_ENTER( IPOIB_DBG_INIT );\r
 \r
@@ -1105,8 +1110,13 @@ ipoib_set_active(
 \r
        default:\r
                if (p_adapter->guids.port_guid.pkey != IB_DEFAULT_PKEY)\r
-                       ipoib_query_pkey_index(p_adapter);\r
-\r
+               {\r
+                       status = ipoib_query_pkey_index(p_adapter);\r
+                       if( IB_SUCCESS != status)\r
+                       {\r
+                               break;\r
+                       }\r
+               }\r
                /* Join all programmed multicast groups. */\r
                for( i = 0; i < p_adapter->mcast_array_size; i++ )\r
                {\r
@@ -1144,6 +1154,7 @@ ipoib_set_active(
        }\r
 \r
        IPOIB_EXIT( IPOIB_DBG_INIT );\r
+       return  status;\r
 }\r
 \r
 \r
index a20e3fb..f6600a2 100644 (file)
@@ -413,7 +413,7 @@ ipoib_set_rate(
        IN              const   uint8_t                                         link_speed );\r
 \r
 \r
-void\r
+ib_api_status_t\r
 ipoib_set_active(\r
        IN                              ipoib_adapter_t* const          p_adapter );\r
 \r
index 2d55dbf..9761301 100644 (file)
@@ -5823,7 +5823,35 @@ err:
        cl_spinlock_release( &p_port->recv_lock );\r
 \r
        /* Notify the adapter that we now have an active connection. */\r
-       ipoib_set_active( p_port->p_adapter );\r
+       status = ipoib_set_active( p_port->p_adapter );\r
+       if( status != IB_SUCCESS )\r
+       {\r
+               ib_qp_mod_t                     qp_mod;\r
+               ipoib_set_inactive( p_port->p_adapter );\r
+               KeSetEvent( &p_port->sa_event, EVENT_INCREMENT, FALSE );\r
+               IPOIB_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,\r
+                       ("ipoib_set_active returned %s.\n",p_port->p_adapter->p_ifc->get_err_str( status )));\r
+               cl_spinlock_acquire( &p_port->recv_lock );\r
+               cl_obj_lock( &p_port->obj );\r
+               p_port->state = IB_QPS_ERROR;\r
+               if( p_port->ib_mgr.h_query )\r
+               {\r
+                       p_port->p_adapter->p_ifc->cancel_query(\r
+                               p_port->p_adapter->h_al, p_port->ib_mgr.h_query );\r
+                       p_port->ib_mgr.h_query = NULL;\r
+               }\r
+               cl_obj_unlock( &p_port->obj );\r
+               cl_spinlock_release( &p_port->recv_lock );\r
+\r
+               CL_ASSERT( p_port->ib_mgr.h_qp );\r
+               cl_memclr( &qp_mod, sizeof(ib_qp_mod_t) );\r
+               qp_mod.req_state = IB_QPS_ERROR;\r
+               status = p_port->p_adapter->p_ifc->modify_qp( p_port->ib_mgr.h_qp, &qp_mod );\r
+               __endpt_mgr_reset_all( p_port );\r
+\r
+               ipoib_port_deref( p_port, ref_join_bcast );\r
+               return;\r
+       }\r
 \r
        /* garbage collector timer is needed when link is active */\r
        gc_due_time.QuadPart = -(int64_t)(((uint64_t)p_port->p_adapter->params.mc_leave_rescan * 2000000) * 10);\r