]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
Update to connection manager
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Fri, 29 Jul 2005 06:06:27 +0000 (06:06 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Fri, 29 Jul 2005 06:06:27 +0000 (06:06 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@52 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/core/al/al_cm_cep.h
trunk/core/al/al_cm_qp.c
trunk/core/al/kernel/al_cm_cep.c
trunk/core/al/kernel/al_proxy_cep.c
trunk/core/al/user/ual_cm_cep.c
trunk/inc/iba/ib_al.h
trunk/inc/iba/ib_al_ioctl.h

index aff72d77e20ad61627b2fee07a3f38345eeda7e7..a3f330745aa014b53cff845337563b56e97b5038 100644 (file)
 typedef void\r
 (*al_pfn_cep_cb_t)(\r
        IN              const   ib_al_handle_t                          h_al,\r
-       IN                              ib_cep_t* const                         p_cep );\r
+       IN              const   net32_t                                         cid );\r
 /* PARAMETERS\r
 *      h_al\r
 *              [in] Handle to the AL instance to pass into the al_cep_poll call.\r
 *\r
-*      p_cep\r
-*              [in] Pointer to an ib_cep_t structure containing the CID and context\r
-*              for the CEP on which the event occured.  The CID should be passed\r
-*              into the al_cep_poll call.\r
+*      cid\r
+*              [in] CID of the CEP on which the event occurred.  The CID should\r
+*              be passed into the al_cep_poll call.\r
 *\r
 * RETURN VALUES:\r
 *      This function does not return a value.\r
@@ -96,7 +95,7 @@ ib_api_status_t
 al_create_cep(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              al_pfn_cep_cb_t                         pfn_cb,\r
-       IN                              void                                            *context,\r
+       IN                              void* __ptr64                           context,\r
                OUT                     net32_t* const                          p_cid );\r
 /*\r
 * NOTES\r
@@ -114,14 +113,6 @@ al_destroy_cep(
        IN                              net32_t                                         cid,\r
        IN                              ib_pfn_destroy_cb_t                     pfn_destroy_cb );\r
 /*\r
-* NOTES\r
-*      Destruction is synchronous.\r
-*      Clients must not invoke this function from a CEP callback, but should\r
-*      instead return IB_CANCELLED or other appropriate value.\r
-*\r
-*      The reason parameter is passed as input to KeWaitForSingleObject.\r
-*      The user-mode proxy sets this to UserRequest.  Kernel clients should set\r
-*      this to Executive.\r
 *********/\r
 \r
 ib_api_status_t\r
@@ -149,7 +140,7 @@ ib_api_status_t
 al_cep_pre_rep(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              net32_t                                         cid,\r
-       IN                              void                                            *context,\r
+       IN                              void* __ptr64                           context,\r
        IN              const   ib_cm_rep_t* const                      p_cm_rep,\r
                OUT                     ib_qp_mod_t* const                      p_init );\r
 \r
@@ -259,7 +250,8 @@ ib_api_status_t
 al_cep_poll(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              net32_t                                         cid,\r
-       IN      OUT                     ib_cep_t* const                         p_new_cep,\r
+               OUT                     void* __ptr64 *                         p_context,\r
+               OUT                     net32_t* const                          p_new_cid,\r
                OUT                     ib_mad_element_t** const        pp_mad );\r
 \r
 \r
index 93570efc2fea2d727ba64053810a0189c94be163..976e36e477307c054cbcd48ca2171c02c52bfeb7 100644 (file)
@@ -63,7 +63,7 @@ typedef struct _cep_async_mad
 {\r
        cl_async_proc_item_t    item;\r
        ib_al_handle_t                  h_al;\r
-       ib_cep_t                                cep;\r
+       net32_t                                 cid;\r
 \r
 }      cep_async_mad_t;\r
 \r
@@ -220,7 +220,7 @@ __format_req_rec(
 static void\r
 __listen_req(\r
        IN                              al_listen_t* const                      p_listen,\r
-       IN              const   ib_cep_t* const                         p_new_cep,\r
+       IN              const   net32_t                                         new_cid,\r
        IN              const   mad_cm_req_t* const                     p_req )\r
 {\r
        ib_cm_req_rec_t         req_rec;\r
@@ -228,7 +228,7 @@ __listen_req(
        AL_ENTER( AL_DBG_CM );\r
 \r
        CL_ASSERT( p_listen );\r
-       CL_ASSERT( p_new_cep );\r
+       CL_ASSERT( new_cid != AL_INVALID_CID );\r
        CL_ASSERT( p_req );\r
 \r
        /* Format the callback record. */\r
@@ -237,9 +237,9 @@ __listen_req(
        /* update listen based rec */\r
        req_rec.context = p_listen->obj.context;\r
 \r
-       req_rec.h_cm_req.cid = p_new_cep->cid;\r
+       req_rec.h_cm_req.cid = new_cid;\r
        req_rec.h_cm_req.h_al = p_listen->obj.h_al;\r
-       req_rec.h_cm_req.h_qp = p_new_cep->context;\r
+       req_rec.h_cm_req.h_qp = NULL;\r
 \r
        req_rec.h_cm_listen = p_listen;\r
 \r
@@ -253,7 +253,7 @@ __listen_req(
 static void\r
 __proc_listen(\r
        IN                              al_listen_t* const                      p_listen,\r
-       IN                              ib_cep_t* const                         p_new_cep,\r
+       IN              const   net32_t                                         new_cid,\r
        IN              const   ib_mad_t* const                         p_mad )\r
 {\r
        AL_ENTER( AL_DBG_CM );\r
@@ -263,7 +263,7 @@ __proc_listen(
        {\r
        case CM_REQ_ATTR_ID:\r
                __listen_req(\r
-                       p_listen, p_new_cep, (mad_cm_req_t*)p_mad );\r
+                       p_listen, new_cid, (mad_cm_req_t*)p_mad );\r
                break;\r
 \r
        case CM_SIDR_REQ_ATTR_ID:\r
@@ -272,7 +272,7 @@ __proc_listen(
                CL_ASSERT( p_mad->attr_id == CM_REQ_ATTR_ID ||\r
                        p_mad->attr_id == CM_SIDR_REQ_ATTR_ID );\r
                /* Destroy the new CEP as it won't ever be reported to the user. */\r
-               al_destroy_cep( p_listen->obj.h_al, p_new_cep->cid, NULL );\r
+               al_destroy_cep( p_listen->obj.h_al, new_cid, NULL );\r
        }\r
 \r
        AL_EXIT( AL_DBG_CM );\r
@@ -780,10 +780,14 @@ __proc_conn(
        switch( p_mad->attr_id )\r
        {\r
        case CM_REQ_ATTR_ID:\r
+               CL_ASSERT( ((al_conn_qp_t*)p_cm->h_qp)->cid == (int32_t)p_cm->cid ||\r
+                       ((al_conn_qp_t*)p_cm->h_qp)->cid == AL_INVALID_CID );\r
                __proc_peer_req( p_cm, (mad_cm_req_t*)p_mad );\r
                break;\r
 \r
        case CM_MRA_ATTR_ID:\r
+               CL_ASSERT( ((al_conn_qp_t*)p_cm->h_qp)->cid == (int32_t)p_cm->cid ||\r
+                       ((al_conn_qp_t*)p_cm->h_qp)->cid == AL_INVALID_CID );\r
                __proc_mra( p_cm, (mad_cm_mra_t*)p_mad );\r
                break;\r
 \r
@@ -792,26 +796,38 @@ __proc_conn(
                break;\r
 \r
        case CM_REP_ATTR_ID:\r
+               CL_ASSERT( ((al_conn_qp_t*)p_cm->h_qp)->cid == (int32_t)p_cm->cid ||\r
+                       ((al_conn_qp_t*)p_cm->h_qp)->cid == AL_INVALID_CID );\r
                __proc_rep( p_cm, (mad_cm_rep_t*)p_mad );\r
                break;\r
 \r
        case CM_RTU_ATTR_ID:\r
+               CL_ASSERT( ((al_conn_qp_t*)p_cm->h_qp)->cid == (int32_t)p_cm->cid ||\r
+                       ((al_conn_qp_t*)p_cm->h_qp)->cid == AL_INVALID_CID );\r
                __proc_rtu( p_cm, (mad_cm_rtu_t*)p_mad );\r
                break;\r
 \r
        case CM_DREQ_ATTR_ID:\r
+               CL_ASSERT( ((al_conn_qp_t*)p_cm->h_qp)->cid == (int32_t)p_cm->cid ||\r
+                       ((al_conn_qp_t*)p_cm->h_qp)->cid == AL_INVALID_CID );\r
                __proc_dreq( p_cm, (mad_cm_dreq_t*)p_mad );\r
                break;\r
 \r
        case CM_DREP_ATTR_ID:\r
+               CL_ASSERT( ((al_conn_qp_t*)p_cm->h_qp)->cid == (int32_t)p_cm->cid ||\r
+                       ((al_conn_qp_t*)p_cm->h_qp)->cid == AL_INVALID_CID );\r
                __proc_drep( p_cm, (mad_cm_drep_t*)p_mad );\r
                break;\r
 \r
        case CM_LAP_ATTR_ID:\r
+               CL_ASSERT( ((al_conn_qp_t*)p_cm->h_qp)->cid == (int32_t)p_cm->cid ||\r
+                       ((al_conn_qp_t*)p_cm->h_qp)->cid == AL_INVALID_CID );\r
                __proc_lap( p_cm, (mad_cm_lap_t*)p_mad );\r
                break;\r
 \r
        case CM_APR_ATTR_ID:\r
+               CL_ASSERT( ((al_conn_qp_t*)p_cm->h_qp)->cid == (int32_t)p_cm->cid ||\r
+                       ((al_conn_qp_t*)p_cm->h_qp)->cid == AL_INVALID_CID );\r
                __proc_apr( p_cm, (mad_cm_apr_t*)p_mad );\r
                break;\r
 \r
@@ -844,36 +860,37 @@ static void
 __cm_handler(\r
 #endif\r
        IN              const   ib_al_handle_t                          h_al,\r
-       IN                              ib_cep_t* const                         p_cep )\r
+       IN              const   net32_t                                         cid )\r
 {\r
        ib_api_status_t         status;\r
-       ib_cep_t                        new_cep;\r
+       void* __ptr64           context;\r
+       net32_t                         new_cid;\r
        ib_mad_element_t        *p_mad;\r
        ib_cm_handle_t          h_cm;\r
 \r
        AL_ENTER( AL_DBG_CM );\r
 \r
-       for( status = al_cep_poll( h_al, p_cep->cid, &new_cep, &p_mad );\r
+       for( status = al_cep_poll( h_al, cid, &context, &new_cid, &p_mad );\r
                status == IB_SUCCESS;\r
-               status = al_cep_poll( h_al, p_cep->cid, &new_cep, &p_mad ) )\r
+               status = al_cep_poll( h_al, cid, &context, &new_cid, &p_mad ) )\r
        {\r
                /* Something to do - WOOT!!! */\r
-               if( new_cep.cid != AL_INVALID_CID )\r
+               if( new_cid != AL_INVALID_CID )\r
                {\r
-                       __proc_listen( (al_listen_t*)p_cep->context,\r
-                               &new_cep, ib_get_mad_buf( p_mad ) );\r
+                       __proc_listen( (al_listen_t* __ptr64)context,\r
+                               new_cid, ib_get_mad_buf( p_mad ) );\r
                }\r
                else if( p_mad->status != IB_SUCCESS )\r
                {\r
                        /* Context is a QP handle, and a sent MAD timed out. */\r
                        __proc_failed_send(\r
-                               (ib_qp_handle_t)p_cep->context, ib_get_mad_buf( p_mad ) );\r
+                               (ib_qp_handle_t)context, ib_get_mad_buf( p_mad ) );\r
                }\r
                else\r
                {\r
                        h_cm.h_al = h_al;\r
-                       h_cm.cid = p_cep->cid;\r
-                       h_cm.h_qp = (ib_qp_handle_t)p_cep->context;\r
+                       h_cm.cid = cid;\r
+                       h_cm.h_qp = (ib_qp_handle_t)context;\r
                        __proc_conn( &h_cm, ib_get_mad_buf( p_mad ) );\r
                }\r
                ib_put_mad( p_mad );\r
@@ -893,7 +910,7 @@ __process_cep_async(
 \r
        p_async_mad = PARENT_STRUCT( p_item, cep_async_mad_t, item );\r
 \r
-       __process_cep_cb( p_async_mad->h_al, &p_async_mad->cep );\r
+       __process_cep_cb( p_async_mad->h_al, p_async_mad->cid );\r
 \r
        cl_free( p_async_mad );\r
 \r
@@ -909,7 +926,7 @@ __process_cep_async(
 static void\r
 __cm_handler(\r
        IN              const   ib_al_handle_t                          h_al,\r
-       IN                              ib_cep_t* const                         p_cep )\r
+       IN              const   net32_t                                         cid )\r
 {\r
        cep_async_mad_t *p_async_mad;\r
 \r
@@ -925,7 +942,7 @@ __cm_handler(
        }\r
 \r
        p_async_mad->h_al = h_al;\r
-       p_async_mad->cep = *p_cep;\r
+       p_async_mad->cid = cid;\r
        p_async_mad->item.pfn_callback = __process_cep_async;\r
 \r
        /* Queue the MAD for asynchronous processing. */\r
@@ -1241,28 +1258,16 @@ __cep_rts_qp(
 static ib_api_status_t\r
 __cep_pre_rep(\r
        IN              const   ib_cm_handle_t                          h_cm,\r
+       IN                              ib_qp_mod_t* const                      p_qp_mod,\r
        IN              const   ib_cm_rep_t* const                      p_cm_rep )\r
 {\r
        ib_api_status_t         status;\r
-       al_conn_qp_t            *p_qp;\r
-       ib_qp_mod_t                     qp_mod;\r
 \r
        AL_ENTER( AL_DBG_CM );\r
 \r
-       p_qp = (al_conn_qp_t*)p_cm_rep->h_qp;\r
-\r
-       status = al_cep_pre_rep(\r
-               h_cm.h_al, h_cm.cid, p_cm_rep->h_qp, p_cm_rep, &qp_mod );\r
-       if( status != IB_SUCCESS )\r
-       {\r
-               AL_TRACE_EXIT( AL_DBG_ERROR,\r
-                       ("al_cep_pre_rep returned %s.\n", ib_get_err_str( status )) );\r
-               return status;\r
-       }\r
-\r
        /* Transition the QP to the INIT state. */\r
-       qp_mod.state.init.access_ctrl = p_cm_rep->access_ctrl;\r
-       status = __cep_init_qp( p_cm_rep->h_qp, &qp_mod );\r
+       p_qp_mod->state.init.access_ctrl = p_cm_rep->access_ctrl;\r
+       status = __cep_init_qp( p_cm_rep->h_qp, p_qp_mod );\r
        if( status != IB_SUCCESS )\r
        {\r
                AL_TRACE_EXIT( AL_DBG_ERROR,\r
@@ -1304,6 +1309,8 @@ __cep_conn_rep(
 {\r
        ib_api_status_t         status;\r
        net32_t                         cid;\r
+       ib_qp_mod_t                     qp_mod;\r
+       boolean_t                       qp_linked = FALSE;\r
 \r
        AL_ENTER( AL_DBG_CM );\r
 \r
@@ -1324,8 +1331,20 @@ __cep_conn_rep(
        ((al_conn_qp_t*)p_cm_rep->h_qp)->pfn_cm_lap_cb = p_cm_rep->pfn_cm_lap_cb;\r
        ((al_conn_qp_t*)p_cm_rep->h_qp)->pfn_cm_dreq_cb = p_cm_rep->pfn_cm_dreq_cb;\r
 \r
+       status = al_cep_pre_rep(\r
+               h_cm.h_al, h_cm.cid, p_cm_rep->h_qp, p_cm_rep, &qp_mod );\r
+       if( status != IB_SUCCESS )\r
+       {\r
+               AL_TRACE_EXIT( AL_DBG_ERROR,\r
+                       ("al_cep_pre_rep returned %s.\n", ib_get_err_str( status )) );\r
+               goto err;\r
+       }\r
+\r
+       /* The QP has been set as the context for the CEP. */\r
+       qp_linked = TRUE;\r
+\r
        /* Transition QP through state machine */\r
-       status = __cep_pre_rep( h_cm, p_cm_rep );\r
+       status = __cep_pre_rep( h_cm, &qp_mod, p_cm_rep );\r
        if( status != IB_SUCCESS )\r
        {\r
                AL_TRACE_EXIT( AL_DBG_ERROR,\r
@@ -1342,13 +1361,20 @@ err:
                cl_atomic_xchg(\r
                        &((al_conn_qp_t*)p_cm_rep->h_qp)->cid, AL_INVALID_CID );\r
 \r
-               ref_al_obj( &p_cm_rep->h_qp->obj );\r
-\r
                /* Reject and abort the connection. */\r
                al_cep_rej( h_cm.h_al, h_cm.cid, IB_REJ_INSUF_QP, NULL, 0, NULL, 0 );\r
 \r
-               if( al_destroy_cep( h_cm.h_al, h_cm.cid, deref_al_obj ) != IB_SUCCESS )\r
-                       deref_al_obj( &p_cm_rep->h_qp->obj );\r
+               if( qp_linked )\r
+               {\r
+                       ref_al_obj( &p_cm_rep->h_qp->obj );\r
+\r
+                       if( al_destroy_cep( h_cm.h_al, h_cm.cid, deref_al_obj ) != IB_SUCCESS )\r
+                               deref_al_obj( &p_cm_rep->h_qp->obj );\r
+               }\r
+               else\r
+               {\r
+                       al_destroy_cep( h_cm.h_al, h_cm.cid, NULL );\r
+               }\r
        }\r
 \r
        AL_EXIT( AL_DBG_CM );\r
@@ -1388,7 +1414,7 @@ ib_cm_rep(
                        AL_TRACE_EXIT( AL_DBG_ERROR, ("IB_INVALID_QP_HANDLE\n") );\r
                        status = IB_INVALID_QP_HANDLE;\r
                }\r
-               if( p_cm_rep->h_qp->obj.h_al != h_cm_req.h_al )\r
+               else if( p_cm_rep->h_qp->obj.h_al != h_cm_req.h_al )\r
                {\r
                        AL_TRACE_EXIT( AL_DBG_ERROR, ("IB_INVALID_QP_HANDLE\n") );\r
                        status = IB_INVALID_QP_HANDLE;\r
index 2bcbfbcf799e7cdc3a63b5b3be02799cd904773a..b99e16887ae47998591b50796aee33ebb36b6910 100644 (file)
@@ -219,7 +219,8 @@ typedef struct _al_kcep_av
 \r
 typedef struct _al_kcep\r
 {\r
-       ib_cep_t                                        cep;\r
+       net32_t                                         cid;\r
+       void*                                           context;\r
 \r
        struct _cep_cid                         *p_cid;\r
 \r
@@ -417,7 +418,7 @@ __bind_cep(
        IN                              kcep_t* const                           p_cep,\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              al_pfn_cep_cb_t                         pfn_cb,\r
-       IN                              void                                            *context );\r
+       IN                              void* __ptr64                           context );\r
 \r
 static inline void\r
 __unbind_cep(\r
@@ -2170,7 +2171,7 @@ __cep_mad_send_cb(
 \r
 done:\r
        pfn_destroy_cb = p_cep->pfn_destroy_cb;\r
-       cep_context = p_cep->cep.context;\r
+       cep_context = p_cep->context;\r
 \r
        if( !cl_atomic_dec( &p_cep->ref_cnt ) && pfn_destroy_cb )\r
                pfn_destroy_cb( cep_context );\r
@@ -2480,11 +2481,7 @@ __lookup_cep(
        /* Mask off the counter bits so we get the index in our vector. */\r
        idx = cid & CEP_MAX_CID_MASK;\r
 \r
-       /*\r
-        * Remove the CEP from the CID vector - no further API calls\r
-        * will succeed for it.\r
-        */\r
-       if( idx > cl_vector_get_size( &gp_cep_mgr->cid_vector ) )\r
+       if( idx >= cl_vector_get_size( &gp_cep_mgr->cid_vector ) )\r
                return NULL;\r
 \r
        p_cid = (cep_cid_t*)cl_vector_get_ptr( &gp_cep_mgr->cid_vector, idx );\r
@@ -3326,12 +3323,12 @@ __process_cep(
 \r
        /* Signal to the user there are callback waiting. */\r
        if( p_cep->pfn_cb )\r
-               p_cep->pfn_cb( p_cep->p_cid->h_al, &p_cep->cep );\r
+               p_cep->pfn_cb( p_cep->p_cid->h_al, p_cep->cid );\r
        else\r
                __cep_complete_irp( p_cep, STATUS_SUCCESS, IO_NETWORK_INCREMENT );\r
 \r
        pfn_destroy_cb = p_cep->pfn_destroy_cb;\r
-       context = p_cep->cep.context;\r
+       context = p_cep->context;\r
 \r
        /*\r
         * Release the reference for the callback and invoke the destroy\r
@@ -3399,7 +3396,7 @@ __create_cep()
        p_cep->signalled = FALSE;\r
 \r
        /* Find a free entry in the CID vector. */\r
-       p_cep->p_cid = __get_lcid( &p_cep->cep.cid );\r
+       p_cep->p_cid = __get_lcid( &p_cep->cid );\r
 \r
        if( !p_cep->p_cid )\r
        {\r
@@ -3413,10 +3410,10 @@ __create_cep()
         * We don't ever want a modifier of zero for the CID at index zero\r
         * since it would result in a total CID of zero.\r
         */\r
-       if( !p_cep->cep.cid && !p_cep->p_cid->modifier )\r
+       if( !p_cep->cid && !p_cep->p_cid->modifier )\r
                p_cep->p_cid->modifier++;\r
 \r
-       p_cep->local_comm_id = p_cep->cep.cid | (p_cep->p_cid->modifier << 24);\r
+       p_cep->local_comm_id = p_cep->cid | (p_cep->p_cid->modifier << 24);\r
        p_cep->tid = p_cep->local_comm_id;\r
 \r
        p_cep->p_cid->p_cep = p_cep;\r
@@ -3433,7 +3430,7 @@ __bind_cep(
        IN                              kcep_t* const                           p_cep,\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              al_pfn_cep_cb_t                         pfn_cb,\r
-       IN                              void                                            *context )\r
+       IN                              void* __ptr64                           context )\r
 {\r
        CL_ASSERT( p_cep );\r
        CL_ASSERT( p_cep->p_cid );\r
@@ -3441,7 +3438,7 @@ __bind_cep(
 \r
        p_cep->p_cid->h_al = h_al;\r
        p_cep->pfn_cb = pfn_cb;\r
-       p_cep->cep.context = context;\r
+       p_cep->context = context;\r
 \r
        /* Track the CEP in its owning AL instance. */\r
        cl_spinlock_acquire( &h_al->obj.lock );\r
@@ -3830,15 +3827,15 @@ __destroy_cep(
        AL_ENTER( AL_DBG_CM );\r
 \r
        CL_ASSERT(\r
-               p_cep->cep.cid < cl_vector_get_size( &gp_cep_mgr->cid_vector ) );\r
+               p_cep->cid < cl_vector_get_size( &gp_cep_mgr->cid_vector ) );\r
 \r
        CL_ASSERT( p_cep->p_cid == (cep_cid_t*)cl_vector_get_ptr(\r
-               &gp_cep_mgr->cid_vector, p_cep->cep.cid ) );\r
+               &gp_cep_mgr->cid_vector, p_cep->cid ) );\r
 \r
        /* Free the CID. */\r
        p_cep->p_cid->p_cep = (kcep_t*)(uintn_t)gp_cep_mgr->free_cid;\r
        p_cep->p_cid->h_al = NULL;\r
-       gp_cep_mgr->free_cid = p_cep->cep.cid;\r
+       gp_cep_mgr->free_cid = p_cep->cid;\r
 \r
        KeCancelTimer( &p_cep->timewait_timer );\r
 \r
@@ -3854,7 +3851,7 @@ ib_api_status_t
 al_create_cep(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              al_pfn_cep_cb_t                         pfn_cb,\r
-       IN                              void                                            *context,\r
+       IN                              void* __ptr64                           context,\r
                OUT                     net32_t* const                          p_cid )\r
 {\r
        kcep_t                          *p_cep;\r
@@ -3876,7 +3873,7 @@ al_create_cep(
 \r
        __bind_cep( p_cep, h_al, pfn_cb, context );\r
 \r
-       *p_cid = p_cep->cep.cid;\r
+       *p_cid = p_cep->cid;\r
 \r
        AL_EXIT( AL_DBG_CM );\r
        return IB_SUCCESS;\r
@@ -3912,7 +3909,7 @@ al_destroy_cep(
                return IB_INVALID_PARAMETER;\r
        }\r
 \r
-       context = p_cep->cep.context;\r
+       context = p_cep->context;\r
        p_cep->pfn_destroy_cb = pfn_destroy_cb;\r
 \r
        /* Cancel any queued IRP */\r
@@ -4382,11 +4379,11 @@ __save_user_req(
         * We don't ever want a modifier of zero for the CID at index zero\r
         * since it would result in a total CID of zero.\r
         */\r
-       if( !p_cep->cep.cid && !p_cep->p_cid->modifier )\r
+       if( !p_cep->cid && !p_cep->p_cid->modifier )\r
                p_cep->p_cid->modifier++;\r
 \r
        /* Store pertinent information in the connection. */\r
-       p_cep->local_comm_id = p_cep->cep.cid | (p_cep->p_cid->modifier << 24);\r
+       p_cep->local_comm_id = p_cep->cid | (p_cep->p_cid->modifier << 24);\r
        p_cep->remote_comm_id = 0;\r
 \r
        /* Cache the local QPN. */\r
@@ -4675,7 +4672,7 @@ ib_api_status_t
 al_cep_pre_rep(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              net32_t                                         cid,\r
-       IN                              void                                            *context,\r
+       IN                              void* __ptr64                           context,\r
        IN              const   ib_cm_rep_t* const                      p_cm_rep,\r
                OUT                     ib_qp_mod_t* const                      p_init )\r
 {\r
@@ -4734,7 +4731,7 @@ al_cep_pre_rep(
                        p_cep->av[p_cep->idx_primary].pkey_index;\r
                p_init->state.init.access_ctrl = IB_AC_LOCAL_WRITE;\r
 \r
-               p_cep->cep.context = context;\r
+               p_cep->context = context;\r
 \r
                /* Just OR in the PREP bit into the state. */\r
                p_cep->state |= CEP_STATE_PREP;\r
@@ -5783,7 +5780,8 @@ ib_api_status_t
 al_cep_poll(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              net32_t                                         cid,\r
-       IN      OUT                     ib_cep_t* const                         p_new_cep,\r
+               OUT                     void* __ptr64 *                         p_context,\r
+               OUT                     net32_t* const                          p_new_cid,\r
                OUT                     ib_mad_element_t** const        pp_mad )\r
 {\r
        ib_api_status_t         status;\r
@@ -5793,7 +5791,7 @@ al_cep_poll(
        AL_ENTER( AL_DBG_CM );\r
 \r
        CL_ASSERT( h_al );\r
-       CL_ASSERT( p_new_cep );\r
+       CL_ASSERT( p_new_cid );\r
        CL_ASSERT( pp_mad );\r
 \r
        KeAcquireInStackQueuedSpinLock( &gp_cep_mgr->lock, &hdl );\r
@@ -5805,6 +5803,8 @@ al_cep_poll(
                return IB_INVALID_HANDLE;\r
        }\r
 \r
+       *p_context = p_cep->context;\r
+\r
        if( !p_cep->p_mad_head )\r
        {\r
                p_cep->signalled = FALSE;\r
@@ -5820,14 +5820,9 @@ al_cep_poll(
        /* We're done with the input CEP.  Reuse the variable */\r
        p_cep = (kcep_t* __ptr64)(*pp_mad)->send_context1;\r
        if( p_cep )\r
-       {\r
-               *p_new_cep = p_cep->cep;\r
-       }\r
+               *p_new_cid = p_cep->cid;\r
        else\r
-       {\r
-               p_new_cep->context = NULL;\r
-               p_new_cep->cid = AL_INVALID_CID;\r
-       }\r
+               *p_new_cid = AL_INVALID_CID;\r
 \r
        status = IB_SUCCESS;\r
 \r
@@ -5945,7 +5940,7 @@ al_cep_cleanup_al(
                 * remove it from the list, allowing the next CEP to be cleaned up\r
                 * in the next pass through.\r
                 */\r
-               cid = PARENT_STRUCT( p_item, kcep_t, al_item )->cep.cid;\r
+               cid = PARENT_STRUCT( p_item, kcep_t, al_item )->cid;\r
                cl_spinlock_release( &h_al->obj.lock );\r
                al_destroy_cep( h_al, cid, NULL );\r
                cl_spinlock_acquire( &h_al->obj.lock );\r
index 69d22cd17ff3085ca3f94c1c19485ac1dfa856a3..20ae219eaf956a760586db9a452fec0efa521864 100644 (file)
@@ -46,6 +46,7 @@ proxy_create_cep(
                OUT     size_t                                  *p_ret_bytes )\r
 {\r
        al_dev_open_context_t           *p_context;\r
+       void* __ptr64 *                         p_user_context;\r
        ual_create_cep_ioctl_t          *p_ioctl;\r
 \r
        AL_ENTER( AL_DBG_CM );\r
@@ -54,15 +55,18 @@ proxy_create_cep(
        p_ioctl = (ual_create_cep_ioctl_t*)cl_ioctl_out_buf( h_ioctl );\r
 \r
        /* Validate user parameters. */\r
-       if( cl_ioctl_out_size( h_ioctl ) != sizeof(ual_create_cep_ioctl_t) )\r
+       if( cl_ioctl_in_size( h_ioctl ) != sizeof(void* __ptr64) ||\r
+               cl_ioctl_out_size( h_ioctl ) != sizeof(ual_create_cep_ioctl_t) )\r
        {\r
                AL_EXIT( AL_DBG_CM );\r
                return CL_INVALID_PARAMETER;\r
        }\r
 \r
+       p_user_context = cl_ioctl_in_buf( h_ioctl );\r
+\r
        /* We use IRPs as notification mechanism so the callback is NULL. */\r
        p_ioctl->status = al_create_cep( p_context->h_al, NULL,\r
-               p_context, &p_ioctl->cid );\r
+               *p_user_context, &p_ioctl->cid );\r
 \r
        *p_ret_bytes = sizeof(ual_create_cep_ioctl_t);\r
 \r
@@ -289,7 +293,7 @@ proxy_cep_pre_rep(
        p_ioctl->in.cm_rep.h_qp = h_qp;\r
 \r
        p_ioctl->out.status = al_cep_pre_rep( p_context->h_al, p_ioctl->in.cid,\r
-               p_context, &p_ioctl->in.cm_rep, &p_ioctl->out.init );\r
+               p_ioctl->in.context, &p_ioctl->in.cm_rep, &p_ioctl->out.init );\r
 \r
        deref_al_obj( &h_qp->obj );\r
 \r
@@ -774,7 +778,8 @@ proxy_cep_poll(
        *p_ret_bytes = sizeof(ual_cep_poll_ioctl_t);\r
 \r
        p_ioctl->status = al_cep_poll( p_context->h_al,\r
-               *(net32_t*)cl_ioctl_in_buf( h_ioctl ), &p_ioctl->new_cep, &p_mad );\r
+               *(net32_t*)cl_ioctl_in_buf( h_ioctl ), &p_ioctl->context,\r
+               &p_ioctl->new_cid, &p_mad );\r
 \r
        if( p_ioctl->status == IB_SUCCESS )\r
        {\r
@@ -791,7 +796,7 @@ proxy_cep_poll(
        else\r
        {\r
                cl_memclr( &p_ioctl->mad_buf, sizeof(MAD_BLOCK_SIZE) );\r
-               cl_memclr( &p_ioctl->new_cep, sizeof(ib_cep_t) );\r
+               p_ioctl->new_cid = AL_INVALID_CID;\r
        }\r
 \r
        AL_EXIT( AL_DBG_CM );\r
index 355acd405cb2fb1e5578d705ecc42c3f993b3ce6..505b3206c98116b1fa454c69a139a63bfb911b20 100644 (file)
@@ -65,12 +65,13 @@ typedef struct _ual_cep_mgr
 \r
 typedef struct _al_ucep\r
 {\r
-       ib_cep_t                                        cep;\r
        al_pfn_cep_cb_t                         pfn_cb;\r
        ib_al_handle_t                          h_al;\r
        cl_list_item_t                          al_item;\r
 \r
        ib_pfn_destroy_cb_t                     pfn_destroy_cb;\r
+       void*                                           destroy_context;\r
+       net32_t                                         cid;\r
 \r
        OVERLAPPED                                      ov;\r
        atomic32_t                                      ref_cnt;\r
@@ -209,7 +210,7 @@ al_cep_cleanup_al(
                 * remove it from the list, allowing the next CEP to be cleaned up\r
                 * in the next pass through.\r
                 */\r
-               cid = PARENT_STRUCT( p_item, ucep_t, al_item )->cep.cid;\r
+               cid = PARENT_STRUCT( p_item, ucep_t, al_item )->cid;\r
                cl_spinlock_release( &h_al->obj.lock );\r
                al_destroy_cep( h_al, cid, NULL );\r
                cl_spinlock_acquire( &h_al->obj.lock );\r
@@ -225,7 +226,7 @@ __destroy_ucep(
        IN                              ucep_t* const                           p_cep )\r
 {\r
        if( p_cep->pfn_destroy_cb )\r
-               p_cep->pfn_destroy_cb( p_cep->cep.context );\r
+               p_cep->pfn_destroy_cb( p_cep->destroy_context );\r
        cl_free( p_cep );\r
 }\r
 \r
@@ -235,7 +236,7 @@ __create_ucep(
        IN                              ib_al_handle_t                          h_al,\r
        IN                              net32_t                                         cid,\r
        IN                              al_pfn_cep_cb_t                         pfn_cb,\r
-       IN                              void                                            *context,\r
+       IN                              void* __ptr64                           context,\r
                OUT                     net32_t* const                          p_cid )\r
 {\r
        ucep_t                                  *p_cep;\r
@@ -256,13 +257,13 @@ __create_ucep(
 \r
        /* Store user parameters. */\r
        p_cep->pfn_cb = pfn_cb;\r
-       p_cep->cep.context = context;\r
+       p_cep->destroy_context = context;\r
 \r
        /* Create a kernel CEP only if we don't already have a CID. */\r
        if( cid == AL_INVALID_CID )\r
        {\r
-               if( !DeviceIoControl( g_al_device, UAL_CREATE_CEP, NULL, 0,\r
-                       &ioctl, sizeof(ioctl), &bytes_ret, NULL ) ||\r
+               if( !DeviceIoControl( g_al_device, UAL_CREATE_CEP, &context,\r
+                       sizeof(context), &ioctl, sizeof(ioctl), &bytes_ret, NULL ) ||\r
                        bytes_ret != sizeof(ioctl) )\r
                {\r
                        __destroy_ucep( p_cep );\r
@@ -279,33 +280,33 @@ __create_ucep(
                        return ioctl.status;\r
                }\r
 \r
-               p_cep->cep.cid = ioctl.cid;\r
+               p_cep->cid = ioctl.cid;\r
        }\r
        else\r
        {\r
-               p_cep->cep.cid = cid;\r
+               p_cep->cid = cid;\r
        }\r
 \r
        /* Track the CEP before we issue any further IOCTLs on it. */\r
        cl_spinlock_acquire( &gp_cep_mgr->obj.lock );\r
-       cl_ptr_vector_set_min_size( &gp_cep_mgr->cep_vector, p_cep->cep.cid + 1 );\r
-       CL_ASSERT( !cl_ptr_vector_get( &gp_cep_mgr->cep_vector, p_cep->cep.cid ) );\r
-       cl_ptr_vector_set( &gp_cep_mgr->cep_vector, p_cep->cep.cid, p_cep );\r
+       cl_ptr_vector_set_min_size( &gp_cep_mgr->cep_vector, p_cep->cid + 1 );\r
+       CL_ASSERT( !cl_ptr_vector_get( &gp_cep_mgr->cep_vector, p_cep->cid ) );\r
+       cl_ptr_vector_set( &gp_cep_mgr->cep_vector, p_cep->cid, p_cep );\r
        cl_spinlock_release( &gp_cep_mgr->obj.lock );\r
 \r
        /* Now issue a poll request.  This request is async. */\r
        if( DeviceIoControl( gp_cep_mgr->h_file, UAL_CEP_GET_EVENT,\r
-               &p_cep->cep.cid, sizeof(p_cep->cep.cid),\r
+               &p_cep->cid, sizeof(p_cep->cid),\r
                NULL, 0, NULL, &p_cep->ov ) ||\r
                GetLastError() != ERROR_IO_PENDING )\r
        {\r
                AL_TRACE( AL_DBG_ERROR, ("Failed to issue CEP poll IOCTL.\n") );\r
                cl_spinlock_acquire( &gp_cep_mgr->obj.lock );\r
-               cl_ptr_vector_set( &gp_cep_mgr->cep_vector, p_cep->cep.cid, NULL );\r
+               cl_ptr_vector_set( &gp_cep_mgr->cep_vector, p_cep->cid, NULL );\r
                cl_spinlock_release( &gp_cep_mgr->obj.lock );\r
 \r
-               DeviceIoControl( g_al_device, UAL_DESTROY_CEP, &p_cep->cep.cid,\r
-                       sizeof(p_cep->cep.cid), NULL, 0, &bytes_ret, NULL );\r
+               DeviceIoControl( g_al_device, UAL_DESTROY_CEP, &p_cep->cid,\r
+                       sizeof(p_cep->cid), NULL, 0, &bytes_ret, NULL );\r
 \r
                __destroy_ucep( p_cep );\r
                AL_EXIT( AL_DBG_CM );\r
@@ -320,7 +321,7 @@ __create_ucep(
        cl_spinlock_release( &h_al->obj.lock );\r
 \r
        if( p_cid )\r
-               *p_cid = p_cep->cep.cid;\r
+               *p_cid = p_cep->cid;\r
 \r
        AL_EXIT( AL_DBG_CM );\r
        return IB_SUCCESS;\r
@@ -331,7 +332,7 @@ ib_api_status_t
 al_create_cep(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              al_pfn_cep_cb_t                         pfn_cb,\r
-       IN                              void                                            *context,\r
+       IN                              void* __ptr64                           context,\r
                OUT                     net32_t* const                          p_cid )\r
 {\r
        ib_api_status_t         status;\r
@@ -394,8 +395,8 @@ al_destroy_cep(
        cl_spinlock_release( &h_al->obj.lock );\r
 \r
        /* Destroy the kernel CEP right away. */\r
-       DeviceIoControl( g_al_device, UAL_DESTROY_CEP, &p_cep->cep.cid,\r
-               sizeof(p_cep->cep.cid), NULL, 0, &bytes_ret, NULL );\r
+       DeviceIoControl( g_al_device, UAL_DESTROY_CEP, &p_cep->cid,\r
+               sizeof(p_cep->cid), NULL, 0, &bytes_ret, NULL );\r
 \r
        if( !cl_atomic_dec( &p_cep->ref_cnt ) )\r
        {\r
@@ -576,7 +577,7 @@ ib_api_status_t
 al_cep_pre_rep(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              net32_t                                         cid,\r
-       IN                              void                                            *context,\r
+       IN                              void* __ptr64                           context,\r
        IN              const   ib_cm_rep_t* const                      p_cm_rep,\r
                OUT                     ib_qp_mod_t* const                      p_init )\r
 {\r
@@ -613,9 +614,10 @@ al_cep_pre_rep(
                AL_EXIT( AL_DBG_ERROR );\r
                return IB_INVALID_PARAMETER;\r
        }\r
-       p_cep->cep.context = context;\r
+       p_cep->destroy_context = context;\r
        cl_spinlock_release( &gp_cep_mgr->obj.lock );\r
 \r
+       ioctl.in.context = context;\r
        ioctl.in.cid = cid;\r
        ioctl.in.cm_rep = *p_cm_rep;\r
        ioctl.in.cm_rep.h_qp = (ib_qp_handle_t)p_cm_rep->h_qp->obj.hdl;\r
@@ -1258,7 +1260,8 @@ ib_api_status_t
 al_cep_poll(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              net32_t                                         cid,\r
-       IN      OUT                     ib_cep_t* const                         p_new_cep,\r
+               OUT                     void* __ptr64 *                         p_context,\r
+               OUT                     net32_t* const                          p_new_cid,\r
                OUT                     ib_mad_element_t** const        pp_mad )\r
 {\r
        ucep_t                                  *p_cep;\r
@@ -1277,7 +1280,7 @@ al_cep_poll(
                return IB_INVALID_HANDLE;\r
        }\r
 \r
-       if( !p_new_cep || !pp_mad )\r
+       if( !p_new_cid || !pp_mad )\r
        {\r
                AL_EXIT( AL_DBG_CM );\r
                return IB_INVALID_PARAMETER;\r
@@ -1318,15 +1321,15 @@ al_cep_poll(
 \r
        if( ioctl.status == IB_SUCCESS )\r
        {\r
-               if( ioctl.new_cep.cid != AL_INVALID_CID )\r
+               if( ioctl.new_cid != AL_INVALID_CID )\r
                {\r
                        /* Need to create a new CEP for user-mode. */\r
-                       status = __create_ucep( p_cep->h_al, ioctl.new_cep.cid,\r
-                               p_cep->pfn_cb, ioctl.new_cep.context, NULL );\r
+                       status = __create_ucep( p_cep->h_al, ioctl.new_cid,\r
+                               p_cep->pfn_cb, NULL, NULL );\r
                        if( status != IB_SUCCESS )\r
                        {\r
                                DeviceIoControl( g_al_device, UAL_DESTROY_CEP,\r
-                                       &ioctl.new_cep.cid, sizeof(ioctl.new_cep.cid),\r
+                                       &ioctl.new_cid, sizeof(ioctl.new_cid),\r
                                        NULL, 0, &bytes_ret, NULL );\r
                                goto err;\r
                        }\r
@@ -1341,7 +1344,8 @@ al_cep_poll(
                \r
                cl_memcpy( p_mad->p_mad_buf, ioctl.mad_buf, MAD_BLOCK_SIZE );\r
 \r
-               *p_new_cep = ioctl.new_cep;\r
+               *p_context = ioctl.context;\r
+               *p_new_cid = ioctl.new_cid;\r
                *pp_mad = p_mad;\r
        }\r
        else\r
@@ -1373,10 +1377,10 @@ cm_cb(
 \r
        if( !error_code  )\r
        {\r
-               p_cep->pfn_cb( p_cep->h_al, &p_cep->cep );\r
+               p_cep->pfn_cb( p_cep->h_al, p_cep->cid );\r
 \r
                if( !DeviceIoControl( gp_cep_mgr->h_file, UAL_CEP_GET_EVENT,\r
-                       &p_cep->cep.cid, sizeof(p_cep->cep.cid), NULL, 0,\r
+                       &p_cep->cid, sizeof(p_cep->cid), NULL, 0,\r
                        NULL, &p_cep->ov ) && GetLastError() == ERROR_IO_PENDING )\r
                {\r
                        AL_EXIT( AL_DBG_CM );\r
index 69ae4a897ec62596927949942fb1836abb1614bc..13d5ed269be289dab9558aa26d815b9cb95846a9 100644 (file)
@@ -5949,14 +5949,6 @@ ib_cm_handoff(
 *****/\r
 \r
 \r
-typedef struct _ib_cep\r
-{\r
-       void                            *context;\r
-       net32_t                         cid;\r
-\r
-}      ib_cep_t;\r
-\r
-\r
 /****s* Access Layer/ib_cep_listen_t\r
 * NAME\r
 *      ib_cep_listen_t\r
index b3a9e9071f122c6ed0289266b04ef327b433ec98..f1d2b70ea6c71959e02fa8aa764e929cec2163e9 100644 (file)
@@ -2347,6 +2347,7 @@ typedef union _ual_cep_rep_ioctl
 {\r
        struct _ual_cep_rep_ioctl_in\r
        {\r
+               void* __ptr64                           context;\r
                net32_t                                         cid;\r
                ib_cm_rep_t                                     cm_rep;\r
                uint8_t                                         pdata[IB_REP_PDATA_SIZE];\r
@@ -2770,7 +2771,8 @@ typedef struct _ual_cep_get_timewait_ioctl
 typedef struct _ual_cep_poll_ioctl\r
 {\r
        ib_api_status_t                         status;\r
-       ib_cep_t                                        new_cep;\r
+       void* __ptr64                           context;\r
+       net32_t                                         new_cid;\r
        ib_mad_element_t                        element;\r
        ib_grh_t                                        grh;\r
        uint8_t                                         mad_buf[MAD_BLOCK_SIZE];\r