]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[IPoIB] Synchronized port down event handling with SA queries.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 10 May 2006 22:26:54 +0000 (22:26 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 10 May 2006 22:26:54 +0000 (22:26 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@336 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

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

index 72e96f7b1bb2b480ef767015a88961647368904e..79d5d03801c2f7b70f735e6c86e8c5b1bee94d68 100644 (file)
 #include "ipoib_port.tmh"\r
 #endif\r
 \r
-/*\r
- * PR 102492 relates to the SA not accepting wildcard values for MCMemberRecord\r
- * Sets used to create/join Multicast groups.  Defining this keyword causes all\r
- * member record fields to be hard coded to well known values.\r
- */\r
-//#define PR_102492\r
-\r
-/*\r
- * PR 102801 relates to the SA ignoring the MGID when doing a GET_TABLE\r
- * request that specifies an MGID.  The ESM returns every McMemberRecord\r
- * instead.\r
- */\r
-//#define PR_102801\r
-\r
 \r
 /* Amount of physical memory to register. */\r
 #define MEM_REG_SIZE   0xFFFFFFFFFFFFFFFF\r
@@ -429,16 +415,16 @@ __endpt_mgr_add_bcast(
 * MCast operations.\r
 *\r
 ******************************************************************************/\r
-static void\r
-__port_get_mcast(\r
+static ib_api_status_t\r
+__port_get_bcast(\r
        IN                              ipoib_port_t* const                     p_port );\r
 \r
-static void\r
+static ib_api_status_t\r
 __port_join_bcast(\r
        IN                              ipoib_port_t* const                     p_port,\r
        IN                              ib_member_rec_t* const          p_member_rec );\r
 \r
-static void\r
+static ib_api_status_t\r
 __port_create_bcast(\r
        IN                              ipoib_port_t* const                     p_port );\r
 \r
@@ -557,6 +543,8 @@ __port_construct(
 \r
        __endpt_mgr_construct( p_port );\r
 \r
+       KeInitializeEvent( &p_port->sa_event, NotificationEvent, TRUE );\r
+\r
        IPOIB_EXIT( IPOIB_DBG_INIT );\r
 }\r
 \r
@@ -4300,7 +4288,7 @@ __endpt_mgr_add_bcast(
                return status;\r
        }\r
 \r
-       /* Add the broadcast endpoint to the enpoint map. */\r
+       /* Add the broadcast endpoint to the endpoint map. */\r
        cl_memset( &bcast_mac, 0xFF, sizeof(bcast_mac) );\r
        __endpt_mgr_insert_locked( p_port, bcast_mac, p_endpt );\r
 \r
@@ -4431,11 +4419,14 @@ ipoib_port_up(
 \r
        IPOIB_ENTER( IPOIB_DBG_INIT );\r
 \r
-       /* Wait for all receives to get flushed. */\r
-       while( p_port->recv_mgr.depth )\r
+       /* Wait for all work requests to get flushed. */\r
+       while( p_port->recv_mgr.depth || p_port->send_mgr.depth )\r
                cl_thread_suspend( 0 );\r
 \r
-       p_port->state = IB_QPS_RTS;\r
+       cl_obj_lock( &p_port->obj );\r
+       p_port->state = IB_QPS_INIT;\r
+       KeResetEvent( &p_port->sa_event );\r
+       cl_obj_unlock( &p_port->obj );\r
 \r
        info.method = IB_MAD_METHOD_GET;\r
        info.attr_id = IB_MAD_ATTR_PORTINFO_RECORD;\r
@@ -4459,11 +4450,12 @@ ipoib_port_up(
        /* reference the object for the multicast query. */\r
        cl_obj_ref( &p_port->obj );\r
 \r
-       status =\r
-               p_port->p_adapter->p_ifc->query( p_port->p_adapter->h_al, &query, &p_port->ib_mgr.h_query );\r
+       status = p_port->p_adapter->p_ifc->query(\r
+               p_port->p_adapter->h_al, &query, &p_port->ib_mgr.h_query );\r
        if( status != IB_SUCCESS )\r
        {\r
-               p_port->p_adapter->hung = TRUE;\r
+               KeSetEvent( &p_port->sa_event, EVENT_INCREMENT, FALSE );\r
+               ipoib_set_inactive( p_port->p_adapter );\r
                cl_obj_deref( &p_port->obj );\r
                IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
                        ("ib_query returned %s\n", \r
@@ -4504,8 +4496,8 @@ __endpt_mgr_add_local(
        av_attr.dlid = p_port_info->base_lid;\r
        av_attr.static_rate = ib_port_info_compute_rate( p_port_info );\r
        av_attr.path_bits = 0;\r
-       status =\r
-               p_port->p_adapter->p_ifc->create_av( p_port->ib_mgr.h_pd, &av_attr, &p_endpt->h_av );\r
+       status = p_port->p_adapter->p_ifc->create_av(\r
+               p_port->ib_mgr.h_pd, &av_attr, &p_endpt->h_av );\r
        if( status != IB_SUCCESS )\r
        {\r
                cl_obj_destroy( &p_endpt->obj );\r
@@ -4515,7 +4507,10 @@ __endpt_mgr_add_local(
                return status;\r
        }\r
 \r
-       __endpt_mgr_insert_locked( p_port, p_port->p_adapter->mac, p_endpt );\r
+       /* __endpt_mgr_insert expects *one* reference to be held. */\r
+       cl_atomic_inc( &p_port->endpt_rdr );\r
+       __endpt_mgr_insert( p_port, p_port->p_adapter->mac, p_endpt );\r
+       cl_atomic_dec( &p_port->endpt_rdr );\r
 \r
        p_port->p_local_endpt = p_endpt;\r
 \r
@@ -4538,9 +4533,16 @@ __port_info_cb(
 \r
        cl_obj_lock( &p_port->obj );\r
        p_port->ib_mgr.h_query = NULL;\r
-       cl_obj_unlock( &p_port->obj );\r
 \r
-       switch( p_query_rec->status )\r
+       if( p_port->state != IB_QPS_INIT )\r
+       {\r
+               status = IB_CANCELED;\r
+               goto done;\r
+       }\r
+\r
+       status = p_query_rec->status;\r
+\r
+       switch( status )\r
        {\r
        case IB_SUCCESS:\r
                /* Note that the we report the rate from the port info. */\r
@@ -4561,7 +4563,7 @@ __port_info_cb(
                                p_port_rec->port_info.link_width_active,\r
                                ib_port_info_get_link_speed_active( &p_port_rec->port_info ) );\r
 \r
-                       __port_get_mcast( p_port );\r
+                       status = __port_get_bcast( p_port );\r
                }\r
                else\r
                {\r
@@ -4581,7 +4583,6 @@ __port_info_cb(
                        EVENT_IPOIB_PORT_INFO_TIMEOUT, 0 );\r
                IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,\r
                        ("Port info query timed out.\n") );\r
-               ipoib_set_inactive( p_port->p_adapter );\r
                break;\r
 \r
        case IB_REMOTE_ERROR:\r
@@ -4589,7 +4590,6 @@ __port_info_cb(
                        EVENT_IPOIB_PORT_INFO_REJECT, 0 );\r
                IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,\r
                        ("Port info query rejected by SA.\n") );\r
-               ipoib_set_inactive( p_port->p_adapter );\r
                break;\r
 \r
        default:\r
@@ -4598,7 +4598,17 @@ __port_info_cb(
                /* Hopefully we'll get an SM change event that will restart things. */\r
                IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,\r
                        ("Port info query failed.\n") );\r
-               ipoib_set_inactive( p_port->p_adapter );\r
+       }\r
+\r
+done:\r
+       cl_obj_unlock( &p_port->obj );\r
+\r
+       if( status != IB_SUCCESS )\r
+       {\r
+               if( status != IB_CANCELED )\r
+                       ipoib_set_inactive( p_port->p_adapter );\r
+\r
+               KeSetEvent( &p_port->sa_event, EVENT_INCREMENT, FALSE );\r
        }\r
 \r
        /* Return the response MAD to AL. */\r
@@ -4612,8 +4622,8 @@ __port_info_cb(
 }\r
 \r
 \r
-static void\r
-__port_get_mcast(\r
+static ib_api_status_t\r
+__port_get_bcast(\r
        IN                              ipoib_port_t* const                     p_port )\r
 {\r
        ib_api_status_t         status;\r
@@ -4645,18 +4655,18 @@ __port_get_mcast(
        /* reference the object for the multicast query. */\r
        cl_obj_ref( &p_port->obj );\r
 \r
-       status =\r
-               p_port->p_adapter->p_ifc->query( p_port->p_adapter->h_al, &query, &p_port->ib_mgr.h_query );\r
+       status = p_port->p_adapter->p_ifc->query(\r
+               p_port->p_adapter->h_al, &query, &p_port->ib_mgr.h_query );\r
        if( status != IB_SUCCESS )\r
        {\r
                cl_obj_deref( &p_port->obj );\r
-               IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+               IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
                        ("ib_query returned %s\n", \r
                        p_port->p_adapter->p_ifc->get_err_str( status )) );\r
-               return;\r
        }\r
 \r
        IPOIB_EXIT( IPOIB_DBG_MCAST );\r
+       return status;\r
 }\r
 \r
 \r
@@ -4667,9 +4677,7 @@ __bcast_get_cb(
 {\r
        ipoib_port_t            *p_port;\r
        ib_member_rec_t         *p_mc_req;\r
-#ifdef PR_102801\r
-       uint32_t                        i;\r
-#endif\r
+       ib_api_status_t         status;\r
 \r
        IPOIB_ENTER( IPOIB_DBG_MCAST );\r
 \r
@@ -4677,61 +4685,52 @@ __bcast_get_cb(
 \r
        cl_obj_lock( &p_port->obj );\r
        p_port->ib_mgr.h_query = NULL;\r
-       cl_obj_unlock( &p_port->obj );\r
+       if( p_port->state != IB_QPS_INIT )\r
+       {\r
+               status = IB_CANCELED;\r
+               goto done;\r
+       }\r
 \r
-       switch( p_query_rec->status )\r
+       status = p_query_rec->status;\r
+\r
+       switch( status )\r
        {\r
        case IB_SUCCESS:\r
-               if( !p_query_rec->result_cnt )\r
-               {\r
-                       __port_create_bcast( p_port );\r
-                       break;\r
-               }\r
-#ifdef PR_102801\r
-               p_mc_req = NULL;\r
-               /* Loop through the records until we find one with the proper MGID. */\r
-               for( i = 0; i < p_query_rec->result_cnt; i++ )\r
+               if( p_query_rec->result_cnt )\r
                {\r
                        p_mc_req = (ib_member_rec_t*)\r
-                               ib_get_query_result( p_query_rec->p_result_mad, i );\r
-                       if( cl_memcmp(\r
-                               &p_mc_req->mgid, &bcast_mgid_template, sizeof(ib_gid_t) ) == 0 )\r
-                       {\r
-                               break;\r
-                       }\r
-               }\r
-               /*\r
-                * If we didn't get any records with the desired MGID,\r
-                * create the group.\r
-                */\r
-               if( i == p_query_rec->result_cnt )\r
-               {\r
-                       __port_create_bcast( p_port );\r
+                               ib_get_query_result( p_query_rec->p_result_mad, 0 );\r
+\r
+                       /* Join the broadcast group. */\r
+                       status = __port_join_bcast( p_port, p_mc_req );\r
                        break;\r
                }\r
-#else\r
-               p_mc_req = (ib_member_rec_t*)\r
-                       ib_get_query_result( p_query_rec->p_result_mad, 0 );\r
-#endif\r
-               /* Join the broadcast group. */\r
-               __port_join_bcast( p_port, p_mc_req );\r
-               break;\r
+               /* Fall through. */\r
 \r
        case IB_REMOTE_ERROR:\r
-               /*\r
-                * SA failed the query.  Broadcast group doesn't exist, so create it.\r
-                */\r
-               __port_create_bcast( p_port );\r
+               /* SA failed the query.  Broadcast group doesn't exist, create it. */\r
+               status = __port_create_bcast( p_port );\r
                break;\r
 \r
        case IB_CANCELED:\r
                IPOIB_PRINT(TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,\r
                        ("Instance destroying - Aborting.\n") );\r
-       \r
+               break;\r
+\r
        default:\r
                NdisWriteErrorLogEntry( p_port->p_adapter->h_adapter,\r
                        EVENT_IPOIB_BCAST_GET, 1, p_query_rec->status );\r
-               ipoib_set_inactive( p_port->p_adapter );\r
+       }\r
+\r
+done:\r
+       cl_obj_unlock( &p_port->obj );\r
+\r
+       if( status != IB_SUCCESS )\r
+       {\r
+               if( status != IB_CANCELED )\r
+                       ipoib_set_inactive( p_port->p_adapter );\r
+\r
+               KeSetEvent( &p_port->sa_event, EVENT_INCREMENT, FALSE );\r
        }\r
 \r
        /* Return the response MAD to AL. */\r
@@ -4745,7 +4744,7 @@ __bcast_get_cb(
 }\r
 \r
 \r
-static void\r
+static ib_api_status_t\r
 __port_join_bcast(\r
        IN                              ipoib_port_t* const                     p_port,\r
        IN                              ib_member_rec_t* const          p_member_rec )\r
@@ -4768,7 +4767,7 @@ __port_join_bcast(
                        EVENT_IPOIB_BCAST_RATE, 2,\r
                        (uint32_t)(p_member_rec->rate & 0x3F),\r
                        (uint32_t)p_port->ib_mgr.rate );\r
-               return;\r
+               return IB_ERROR;\r
        }\r
 \r
        /* Join the broadcast group. */\r
@@ -4799,20 +4798,21 @@ __port_join_bcast(
        /* reference the object for the multicast join request. */\r
        cl_obj_ref( &p_port->obj );\r
 \r
-       status = p_port->p_adapter->p_ifc->join_mcast( p_port->ib_mgr.h_qp, &mcast_req );\r
+       status = p_port->p_adapter->p_ifc->join_mcast(\r
+               p_port->ib_mgr.h_qp, &mcast_req );\r
        if( status != IB_SUCCESS )\r
        {\r
                cl_obj_deref( &p_port->obj );\r
-               IPOIB_PRINT_EXIT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
+               IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
                        ("ib_join_mcast returned %s\n", \r
                        p_port->p_adapter->p_ifc->get_err_str( status )) );\r
-               return;\r
        }\r
        IPOIB_EXIT( IPOIB_DBG_MCAST );\r
+       return status;\r
 }\r
 \r
 \r
-static void\r
+static ib_api_status_t\r
 __port_create_bcast(\r
        IN                              ipoib_port_t* const                     p_port )\r
 {\r
@@ -4837,21 +4837,13 @@ __port_create_bcast(
         * IPOIB spec requires that the QKEY have the MSb set so that the QKEY\r
         * from the QP is used rather than the QKEY in the send WR.\r
         */\r
-#ifdef PR_102492\r
-       mcast_req.member_rec.qkey = CL_HTON32(0x80000B1B);\r
-#else\r
        mcast_req.member_rec.qkey =\r
                (uint32_t)(uintn_t)p_port | IB_QP_PRIVILEGED_Q_KEY;\r
-#endif\r
        mcast_req.member_rec.mtu =\r
                (IB_PATH_SELECTOR_EXACTLY << 6) | IB_MTU_2048;\r
 \r
        mcast_req.member_rec.pkey = IB_DEFAULT_PKEY;\r
 \r
-#ifdef PR_102492\r
-       mcast_req.member_rec.rate =\r
-               (IB_PATH_SELECTOR_LARGEST << 6);// | IB_PATH_RECORD_RATE_10_GBS;\r
-#endif\r
        mcast_req.member_rec.sl_flow_hop = ib_member_set_sl_flow_hop( 0, 0, 0 );\r
        mcast_req.member_rec.scope_state =\r
                ib_member_set_scope_state( 2, IB_MC_REC_STATE_FULL_MEMBER );\r
@@ -4875,6 +4867,7 @@ __port_create_bcast(
                        p_port->p_adapter->p_ifc->get_err_str( status )) );\r
        }\r
        IPOIB_EXIT( IPOIB_DBG_MCAST );\r
+       return status;\r
 }\r
 \r
 \r
@@ -4896,11 +4889,15 @@ ipoib_port_down(
 \r
        if( p_port->ib_mgr.h_query )\r
        {\r
-               p_port->p_adapter->p_ifc->cancel_query( p_port->p_adapter->h_al, p_port->ib_mgr.h_query );\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
 \r
+       KeWaitForSingleObject(\r
+               &p_port->sa_event, Executive, KernelMode, FALSE, NULL );\r
+\r
        /*\r
         * Put the QP in the error state.  This removes the need to\r
         * synchronize with send/receive callbacks.\r
@@ -4937,22 +4934,27 @@ __bcast_cb(
        p_port = (ipoib_port_t* __ptr64)p_mcast_rec->mcast_context;\r
 \r
        cl_obj_lock( &p_port->obj );\r
-       if( p_port->state == IB_QPS_ERROR )\r
+       if( p_port->state != IB_QPS_INIT )\r
        {\r
                cl_obj_unlock( &p_port->obj );\r
+               if( p_mcast_rec->status == IB_SUCCESS )\r
+                       p_port->p_adapter->p_ifc->leave_mcast( p_mcast_rec->h_mcast, NULL );\r
+\r
+               KeSetEvent( &p_port->sa_event, EVENT_INCREMENT, FALSE );\r
                cl_obj_deref( &p_port->obj );\r
                IPOIB_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,\r
-                       ("Instance destroying - Aborting.\n") );\r
+                       ("Invalid state - Aborting.\n") );\r
                return;\r
        }\r
-       cl_obj_unlock( &p_port->obj );\r
 \r
-       if( p_mcast_rec->status != IB_SUCCESS )\r
+       status = p_mcast_rec->status;\r
+\r
+       if( status != IB_SUCCESS )\r
        {\r
                IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
                        ("Multicast join for broadcast group returned %s.\n",\r
                        p_port->p_adapter->p_ifc->get_err_str( p_mcast_rec->status )) );\r
-               if( p_mcast_rec->status == IB_REMOTE_ERROR )\r
+               if( status == IB_REMOTE_ERROR )\r
                {\r
                        /*\r
                         * Either:\r
@@ -4966,22 +4968,29 @@ __bcast_cb(
                         * over with the Get.\r
                         */\r
                        /* TODO: Assert is a place holder.  Can we ever get here if the\r
-                       state isn't IB_PNP_PORT_ADD or PORT_DOWN? */\r
+                       state isn't IB_PNP_PORT_ADD or PORT_DOWN or PORT_INIT? */\r
                        CL_ASSERT( p_port->p_adapter->state == IB_PNP_PORT_ADD ||\r
-                               p_port->p_adapter->state == IB_PNP_PORT_DOWN );\r
-                       __port_get_mcast( p_port );\r
+                               p_port->p_adapter->state == IB_PNP_PORT_DOWN ||\r
+                               p_port->p_adapter->state == IB_PNP_PORT_INIT );\r
+                       status = __port_get_bcast( p_port );\r
                }\r
                else\r
                {\r
                        NdisWriteErrorLogEntry( p_port->p_adapter->h_adapter,\r
                                EVENT_IPOIB_BCAST_JOIN, 1, p_mcast_rec->status );\r
-                       ipoib_set_inactive( p_port->p_adapter );\r
                }\r
 \r
+               cl_obj_unlock( &p_port->obj );\r
+               if( status != IB_SUCCESS )\r
+               {\r
+                       ipoib_set_inactive( p_port->p_adapter );\r
+                       KeSetEvent( &p_port->sa_event, EVENT_INCREMENT, FALSE );\r
+               }\r
                cl_obj_deref( &p_port->obj );\r
                IPOIB_EXIT( IPOIB_DBG_INIT );\r
                return;\r
        }\r
+       cl_obj_unlock( &p_port->obj );\r
 \r
        status = __endpt_mgr_add_bcast( p_port, p_mcast_rec );\r
        if( status != IB_SUCCESS )\r
@@ -4991,11 +5000,7 @@ __bcast_cb(
                        p_port->p_adapter->p_ifc->get_err_str( status )) );\r
                status = p_port->p_adapter->p_ifc->leave_mcast( p_mcast_rec->h_mcast, NULL );\r
                CL_ASSERT( status == IB_SUCCESS );\r
-               /* Flag the adapter as hung. */\r
-               p_port->p_adapter->hung = TRUE;\r
-               cl_obj_deref( &p_port->obj );\r
-               IPOIB_EXIT( IPOIB_DBG_INIT );\r
-               return;\r
+               goto err;\r
        }\r
 \r
        /* Get the QP ready for action. */\r
@@ -5005,16 +5010,26 @@ __bcast_cb(
                IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,\r
                        ("__ib_mgr_activate returned %s\n", \r
                        p_port->p_adapter->p_ifc->get_err_str( status )) );\r
+\r
+err:\r
                /* Flag the adapter as hung. */\r
                p_port->p_adapter->hung = TRUE;\r
+               KeSetEvent( &p_port->sa_event, EVENT_INCREMENT, FALSE );\r
                cl_obj_deref( &p_port->obj );\r
                IPOIB_EXIT( IPOIB_DBG_INIT );\r
                return;\r
        }\r
 \r
+       cl_obj_lock( &p_port->obj );\r
+       /* Only change the state if we're still in INIT. */\r
+       if( p_port->state == IB_QPS_INIT )\r
+               p_port->state = IB_QPS_RTS;\r
+       cl_obj_unlock( &p_port->obj );\r
+\r
        /* Notify the adapter that we now have an active connection. */\r
        ipoib_set_active( p_port->p_adapter );\r
 \r
+       KeSetEvent( &p_port->sa_event, EVENT_INCREMENT, FALSE );\r
        cl_obj_deref( &p_port->obj );\r
        IPOIB_EXIT( IPOIB_DBG_INIT );\r
 }\r
@@ -5026,9 +5041,7 @@ __qp_event(
 {\r
        UNUSED_PARAM( p_event_rec );\r
        CL_ASSERT( p_event_rec->context );\r
-       /* Place holder for proper error handler. */\r
-       cl_msg_out( "Async QP event: %d\n", p_event_rec->code );\r
-       CL_ASSERT( p_event_rec->code == IB_AE_UNKNOWN );\r
+       ((ipoib_port_t* __ptr64)p_event_rec->context)->p_adapter->hung = TRUE;\r
 }\r
 \r
 \r
@@ -5038,8 +5051,7 @@ __cq_event(
 {\r
        UNUSED_PARAM( p_event_rec );\r
        CL_ASSERT( p_event_rec->context );\r
-       /* Place holder for proper error handler. */\r
-       CL_ASSERT( p_event_rec->code == IB_AE_UNKNOWN );\r
+       ((ipoib_port_t* __ptr64)p_event_rec->context)->p_adapter->hung = TRUE;\r
 }\r
 \r
 \r
@@ -5227,12 +5239,15 @@ __mcast_cb(
        p_port = (ipoib_port_t* __ptr64)p_mcast_rec->mcast_context;\r
 \r
        cl_obj_lock( &p_port->obj );\r
-       if( p_port->state == IB_QPS_ERROR )\r
+       if( p_port->state != IB_QPS_RTS )\r
        {\r
                cl_obj_unlock( &p_port->obj );\r
+               if( p_mcast_rec->status == IB_SUCCESS )\r
+                       p_port->p_adapter->p_ifc->leave_mcast( p_mcast_rec->h_mcast, NULL );\r
+\r
                cl_obj_deref( &p_port->obj );\r
                IPOIB_PRINT_EXIT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_INIT,\r
-                       ("Instance destroying - Aborting.\n") );\r
+                       ("Invalid state - Aborting.\n") );\r
                return;\r
        }\r
        cl_obj_unlock( &p_port->obj );\r
index c9c8cc4e521645f68f47f3827cbb588bace8b1b9..9f16152632a161027a1fc26bf9d6c65b1e7d5f39 100644 (file)
@@ -482,6 +482,7 @@ typedef struct _ipoib_port
        struct _ipoib_adapter   *p_adapter;\r
        uint8_t                                 port_num;\r
 \r
+       KEVENT                                  sa_event;\r
        ipoib_ib_mgr_t                  ib_mgr;\r
 \r
        ipoib_buf_mgr_t                 buf_mgr;\r