[ofw] [PATCH v2] Remove TO_LONG_PTR from IOCTL structures

Fab Tillier ftillier at windows.microsoft.com
Fri Jul 11 16:27:13 PDT 2008


> This patch removes all instances of TO_LONG_PTR from internal IOCTL
> structures.  The only place TO_LONG_PTR should be used is in public
> structures that contain pointers and are exchanged between user-mode
> and kernel-mode.  Actually, the code should ideally have proxy
> structures for such API structures into which API structure members are
> copied member-wise, and whose size is fixed.  Unused pointers should be
> stripped from the IOCTL proxy structures.  But that's a change for some
> other time...
>
> All fields in internal IOCTL structures that were formerly TO_LONG_PTR
> are not uint64_t, and all uses have appropriate casts.

Too bad my patch doesn't apply cleanly...  It includes the pd_context changes too.  Here it is again with those changes stripped out so that if things are applied in the order I sent them, everything goes peachy.

Signed-off-by: Fab Tillier <ftillier at microsoft.com>

diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\al_mad_pool.h trunk\core\al\al_mad_pool.h
--- old\core\al\al_mad_pool.h   Fri Jul 11 16:24:31 2008
+++ trunk\core\al\al_mad_pool.h Fri Jul 11 16:07:29 2008
@@ -139,7 +139,7 @@ typedef struct _al_mad_element
        uint8_t                                 mad_buf[MAD_BLOCK_GRH_SIZE];
 #endif

-       TO_LONG_PTR(ib_mad_element_t*, h_proxy_element) ; /* For user-mode support */
+       uint64_t                                h_proxy_element; /* For user-mode support */

 }      al_mad_element_t;

diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\al_proxy_ioctl.h trunk\core\al\al_proxy_ioctl.h
--- old\core\al\al_proxy_ioctl.h        Fri Jul 11 16:24:31 2008
+++ trunk\core\al\al_proxy_ioctl.h      Fri Jul 11 16:07:29 2008
@@ -87,10 +87,10 @@ typedef union _misc_cb_ioctl_rec
        /* Multicast record */
        struct _mcast_cb_ioctl_rec
        {
-               TO_LONG_PTR(const void* ,                       mcast_context) ;
+               uint64_t                                        mcast_context;
                ib_api_status_t                         status;
                ib_net16_t                                      error_status;
-TO_LONG_PTR(           ib_mcast_handle_t ,                     h_mcast) ;
+               uint64_t                                        h_mcast;
                ib_member_rec_t                         member_rec;

        }       mcast_cb_ioctl_rec;
@@ -99,9 +99,9 @@ TO_LONG_PTR(          ib_mcast_handle_t ,                     h_mc
        /* Mad send */
        struct _mad_send_cb_ioctl_rec
        {
-               TO_LONG_PTR(ib_mad_element_t* , p_um_mad) ;
+               uint64_t                                        p_um_mad;
                ib_wc_status_t                          wc_status;
-               TO_LONG_PTR(void* ,                             mad_svc_context) ;
+               uint64_t                                        mad_svc_context;

        }       mad_send_cb_ioctl_rec;

@@ -111,8 +111,8 @@ TO_LONG_PTR(                ib_mcast_handle_t ,                     h_mc
        {
                uint64_t                                        h_mad;
                uint32_t                                        elem_size;
-               TO_LONG_PTR(void* ,                             mad_svc_context) ;
-               TO_LONG_PTR(ib_mad_element_t* , p_send_mad) ;
+               uint64_t                                        mad_svc_context;
+               uint64_t                                        p_send_mad;

        }       mad_recv_cb_ioctl_rec;

@@ -143,7 +143,7 @@ TO_LONG_PTR(                ib_mcast_handle_t ,                     h_mc

 typedef struct _comp_cb_ioctl_info
 {
-       TO_LONG_PTR(void* ,                                     cq_context) ;
+       uint64_t                                                cq_context;

 }      comp_cb_ioctl_info_t;

diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\kernel\al_proxy.c trunk\core\al\kernel\al_proxy.c
--- old\core\al\kernel\al_proxy.c       Fri Jul 11 16:24:32 2008
+++ trunk\core\al\kernel\al_proxy.c     Fri Jul 11 16:07:29 2008
@@ -912,8 +912,8 @@ proxy_reg_pnp(
        pnp_req.pnp_context = p_open_context;
        pnp_req.pfn_pnp_cb = __proxy_pnp_cb;

-       p_user_status = p_ioctl->p_status;
-       p_user_hdl = p_ioctl->p_hdl;
+       p_user_status = (ib_api_status_t*)(ULONG_PTR)p_ioctl->p_status;
+       p_user_hdl = (uint64_t*)(ULONG_PTR)p_ioctl->p_hdl;

        if( pnp_get_flag( p_ioctl->pnp_class ) & IB_PNP_FLAG_REG_SYNC )
        {
@@ -1087,7 +1087,7 @@ proxy_rearm_pnp(
                p_context->h_al, p_ioctl->last_evt_hdl, AL_OBJ_TYPE_H_PNP_EVENT );
        if( p_evt )
        {
-               p_evt->evt_context = p_ioctl->last_evt_context;
+               p_evt->evt_context = (void*)(ULONG_PTR)p_ioctl->last_evt_context;
                p_evt->evt_status = p_ioctl->last_evt_status;
                cl_event_signal( &p_evt->event );
        }
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\kernel\al_proxy_cep.c trunk\core\al\kernel\al_proxy_cep.c
--- old\core\al\kernel\al_proxy_cep.c   Fri Jul 11 16:24:32 2008
+++ trunk\core\al\kernel\al_proxy_cep.c Fri Jul 11 16:07:29 2008
@@ -303,7 +303,8 @@ proxy_cep_pre_rep(

        cid = AL_INVALID_CID;
        p_ioctl->out.status = al_cep_pre_rep( p_context->h_al, p_ioctl->in.cid,
-               p_ioctl->in.context, NULL, &p_ioctl->in.cm_rep, &cid, &p_ioctl->out.init );
+               (void*)(ULONG_PTR)p_ioctl->in.context, NULL, &p_ioctl->in.cm_rep,
+               &cid, &p_ioctl->out.init );

        deref_al_obj( &h_qp->obj );

@@ -786,7 +787,8 @@ proxy_cep_poll(
        *p_ret_bytes = sizeof(ual_cep_poll_ioctl_t);

        p_ioctl->status = al_cep_poll( p_context->h_al,
-               *(net32_t*)cl_ioctl_in_buf( h_ioctl ), &p_ioctl->context,
+               *(net32_t*)cl_ioctl_in_buf( h_ioctl ),
+               &(void*)(ULONG_PTR)p_ioctl->context,
                &p_ioctl->new_cid, &p_mad );

        if( p_ioctl->status == IB_SUCCESS )
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\kernel\al_proxy_ndi.c trunk\core\al\kernel\al_proxy_ndi.c
--- old\core\al\kernel\al_proxy_ndi.c   Fri Jul 11 16:24:32 2008
+++ trunk\core\al\kernel\al_proxy_ndi.c Fri Jul 11 16:07:29 2008
@@ -111,8 +111,8 @@ __ndi_create_cq(
        if( status != IB_SUCCESS )
                goto proxy_create_cq_err2;

-       status = create_cq( h_ca, &cq_create, p_ioctl->in.context,
-               pfn_ev, &h_cq, p_umv_buf );
+       status = create_cq( h_ca, &cq_create,
+               (void*)(ULONG_PTR)p_ioctl->in.context, pfn_ev, &h_cq, p_umv_buf );

        if( status != IB_SUCCESS )
                goto proxy_create_cq_err2;
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\kernel\al_proxy_subnet.c trunk\core\al\kernel\al_proxy_subnet.c
--- old\core\al\kernel\al_proxy_subnet.c        Fri Jul 11 16:24:32 2008
+++ trunk\core\al\kernel\al_proxy_subnet.c      Fri Jul 11 16:07:29 2008
@@ -247,8 +247,8 @@ proxy_send_sa_req(
        CL_ASSERT( p_ioctl );

        /* Must save user's pointers in case req completes before call returns. */
-       p_usr_status = p_ioctl->in.p_status;
-       p_usr_hdl = p_ioctl->in.ph_sa_req;
+       p_usr_status = (ib_api_status_t*)(ULONG_PTR)p_ioctl->in.p_status;
+       p_usr_hdl = (uint64_t*)(ULONG_PTR)p_ioctl->in.ph_sa_req;

        if( p_ioctl->in.sa_req.attr_size > IB_SA_DATA_SIZE )
        {
@@ -445,7 +445,8 @@ proxy_send_mad(

        /* Now copy the mad element with all info */
        status = ib_convert_cl_status( cl_copy_from_user( p_mad_el,
-               p_ioctl->in.p_mad_element, sizeof(ib_mad_element_t) ) );
+               (void*)(ULONG_PTR)p_ioctl->in.p_mad_element,
+               sizeof(ib_mad_element_t) ) );
        if( status != IB_SUCCESS )
                goto proxy_send_mad_err2;

@@ -463,7 +464,7 @@ proxy_send_mad(
         * MAD receive completion could fail to be delivered to the app even though
         * the response was properly received in the kernel.
         */
-       p_mad_el->context1 = p_ioctl->in.p_mad_element;
+       p_mad_el->context1 = (void*)(ULONG_PTR)p_ioctl->in.p_mad_element;

        /* Set the kernel AV handle. This is either NULL or a valid KM handle. */
        p_mad_el->h_av = h_av;
@@ -485,7 +486,8 @@ proxy_send_mad(

        /* Copy the handle to UM to allow cancelling. */
        status = ib_convert_cl_status( cl_copy_to_user(
-               p_ioctl->in.ph_proxy, p_mad_el, sizeof(ib_mad_element_t*) ) );
+               (void*)(ULONG_PTR)p_ioctl->in.ph_proxy,
+               &p_mad_el, sizeof(ib_mad_element_t*) ) );
        if( status != IB_SUCCESS )
                goto proxy_send_mad_err2;

@@ -563,7 +565,8 @@ proxy_mad_comp(
         * for correcting all pointers.
         */
        status = ib_convert_cl_status( cl_copy_to_user(
-               p_ioctl->in.p_user_mad, p_mad, sizeof(ib_mad_element_t) ) );
+               (void*)(ULONG_PTR)p_ioctl->in.p_user_mad,
+               p_mad, sizeof(ib_mad_element_t) ) );
        if( status != IB_SUCCESS )
        {
                AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
@@ -573,7 +576,7 @@ proxy_mad_comp(

        /* Copy the MAD buffer. */
        status = ib_convert_cl_status( cl_copy_to_user(
-               p_ioctl->in.p_mad_buf, p_mad->p_mad_buf, p_mad->size ) );
+               (void*)(ULONG_PTR)p_ioctl->in.p_mad_buf, p_mad->p_mad_buf, p_mad->size ) );
        if( status != IB_SUCCESS )
        {
                AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
@@ -585,7 +588,7 @@ proxy_mad_comp(
        if( p_mad->grh_valid )
        {
                status = ib_convert_cl_status( cl_copy_to_user(
-                       p_ioctl->in.p_grh, p_mad->p_grh, sizeof(ib_grh_t) ) );
+                       (void*)(ULONG_PTR)p_ioctl->in.p_grh, p_mad->p_grh, sizeof(ib_grh_t) ) );
                if( status != IB_SUCCESS )
                {
                        AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
@@ -659,7 +662,7 @@ __proxy_mad_send_cb(
                cb_info.ioctl_rec.mad_send_cb_ioctl_rec.p_um_mad =
                        p_al_el->h_proxy_element;
                cb_info.ioctl_rec.mad_send_cb_ioctl_rec.mad_svc_context =
-                       mad_svc_context;
+                       (ULONG_PTR)mad_svc_context;

                /* Queue this mad completion notification for the user. */
                proxy_queue_cb_buf( UAL_GET_MISC_CB_INFO, p_context, &cb_info,
@@ -694,10 +697,10 @@ __proxy_mad_recv_cb(

        /* Set up context and callback record type appropriate for UAL */
        cb_info.rec_type = MAD_RECV_REC;
-       cb_info.ioctl_rec.mad_recv_cb_ioctl_rec.mad_svc_context = mad_svc_context;
+       cb_info.ioctl_rec.mad_recv_cb_ioctl_rec.mad_svc_context = (ULONG_PTR)mad_svc_context;
        cb_info.ioctl_rec.mad_recv_cb_ioctl_rec.elem_size = p_mad_element->size;
        cb_info.ioctl_rec.mad_recv_cb_ioctl_rec.p_send_mad =
-               (ib_mad_element_t*)p_mad_element->send_context1;
+               (ULONG_PTR)p_mad_element->send_context1;

        /*
         * If we're already closing the device - do not queue a callback, since
@@ -1015,8 +1018,8 @@ proxy_cancel_mad(
                return CL_SUCCESS;
        }

-       p_ioctl->out.status =
-               ib_cancel_mad( h_mad_svc, p_ioctl->in.h_proxy_element );
+       p_ioctl->out.status = ib_cancel_mad( h_mad_svc,
+               (ib_mad_element_t*)(ULONG_PTR)p_ioctl->in.h_proxy_element );

        /*
         * The clean up of resources allocated for the sent mad will
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\kernel\al_proxy_verbs.c trunk\core\al\kernel\al_proxy_verbs.c
--- old\core\al\kernel\al_proxy_verbs.c Fri Jul 11 16:24:32 2008
+++ trunk\core\al\kernel\al_proxy_verbs.c       Fri Jul 11 16:07:29 2008
@@ -401,7 +401,7 @@ proxy_open_ca(
                goto proxy_open_ca_err;

        status = open_ca( p_context->h_al, p_ioctl->in.guid, proxy_ca_err_cb,
-               p_ioctl->in.context, &h_ca, p_umv_buf );
+               (void*)(ULONG_PTR)p_ioctl->in.context, &h_ca, p_umv_buf );
        if( status != IB_SUCCESS )
                goto proxy_open_ca_err;

@@ -502,14 +502,16 @@ proxy_query_ca(
        {
                __try
                {
-                       ProbeForWrite( p_ioctl->in.p_ca_attr, byte_cnt, sizeof(void*) );
-                       ib_copy_ca_attr( p_ioctl->in.p_ca_attr, p_ca_attr );
+                       ProbeForWrite( (void*)(ULONG_PTR)p_ioctl->in.p_ca_attr,
+                               byte_cnt, sizeof(void*) );
+                       ib_copy_ca_attr( (void*)(ULONG_PTR)p_ioctl->in.p_ca_attr,
+                               p_ca_attr );
                }
                __except(EXCEPTION_EXECUTE_HANDLER)
                {
                        AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
                                ("Failed to copy CA attributes to user buffer %016I64x\n",
-                               (LONG64)p_ioctl->in.p_ca_attr) );
+                               p_ioctl->in.p_ca_attr) );
                        status = IB_INVALID_PERMISSION;
                }
        }
@@ -877,8 +879,8 @@ proxy_alloc_pd(
        if( status != IB_SUCCESS )
                goto proxy_alloc_pd_err;

-       status = alloc_pd( h_ca, p_ioctl->in.type, p_ioctl->in.context,
-               &h_pd, p_umv_buf );
+       status = alloc_pd( h_ca, p_ioctl->in.type,
+               (void*)(ULONG_PTR)p_ioctl->in.context, &h_pd, p_umv_buf );

        if( status != IB_SUCCESS )
                goto proxy_alloc_pd_err;
@@ -1049,8 +1051,8 @@ proxy_create_srq(
        else
                pfn_ev = NULL;

-       status = create_srq( h_pd, &p_ioctl->in.srq_attr, p_ioctl->in.context,
-               pfn_ev, &h_srq, p_umv_buf );
+       status = create_srq( h_pd, &p_ioctl->in.srq_attr,
+               (void*)(ULONG_PTR)p_ioctl->in.context, pfn_ev, &h_srq, p_umv_buf );
        if( status != IB_SUCCESS )
                goto proxy_create_srq_err1;

@@ -1387,8 +1389,8 @@ proxy_create_qp(
        else
                pfn_ev = NULL;

-       status = create_qp( h_pd, &p_ioctl->in.qp_create, p_ioctl->in.context,
-               pfn_ev, &h_qp, p_umv_buf );
+       status = create_qp( h_pd, &p_ioctl->in.qp_create,
+               (void*)(ULONG_PTR)p_ioctl->in.context, pfn_ev, &h_qp, p_umv_buf );
        /* TODO: The create_qp call should return the attributes... */
        if( status != IB_SUCCESS )
                goto proxy_create_qp_err1;
@@ -2003,7 +2005,7 @@ proxy_cq_comp_cb(
        }

        /* Set up context and callback record type appropriate for UAL */
-       cb_info.cq_context = cq_context;
+       cb_info.cq_context = (ULONG_PTR)cq_context;

        /* The proxy handle must be valid now. */
        if( !h_cq->obj.hdl_valid )
@@ -2123,8 +2125,8 @@ proxy_create_cq(
        else
                pfn_ev = NULL;

-       status = create_cq( h_ca, &cq_create, p_ioctl->in.context,
-               pfn_ev, &h_cq, p_umv_buf );
+       status = create_cq( h_ca, &cq_create,
+               (void*)(ULONG_PTR)p_ioctl->in.context, pfn_ev, &h_cq, p_umv_buf );

        if( status != IB_SUCCESS )
                goto proxy_create_cq_err2;
@@ -3603,7 +3605,8 @@ proxy_get_spl_qp(

        /* We obtain the pool_key separately from the special QP. */
        status = get_spl_qp( h_pd, p_ioctl->in.port_guid,
-               &p_ioctl->in.qp_create, p_ioctl->in.context, proxy_qp_err_cb, NULL, &h_qp, p_umv_buf );
+               &p_ioctl->in.qp_create, (void*)(ULONG_PTR)p_ioctl->in.context,
+               proxy_qp_err_cb, NULL, &h_qp, p_umv_buf );
        if( status != IB_SUCCESS )
                goto proxy_get_spl_qp_err;

diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\kernel\al_smi.c trunk\core\al\kernel\al_smi.c
--- old\core\al\kernel\al_smi.c Fri Jul 11 16:24:31 2008
+++ trunk\core\al\kernel\al_smi.c       Fri Jul 11 16:07:29 2008
@@ -141,6 +141,22 @@ spl_qp_send_comp_cb(
        IN                              void                                            *cq_context );

 void
+spl_qp_send_dpc_cb(
+    IN              KDPC                        *p_dpc,
+    IN              void                        *context,
+    IN              void                        *arg1,
+    IN              void                        *arg2
+    );
+
+void
+spl_qp_recv_dpc_cb(
+    IN              KDPC                        *p_dpc,
+    IN              void                        *context,
+    IN              void                        *arg1,
+    IN              void                        *arg2
+    );
+
+void
 spl_qp_recv_comp_cb(
        IN              const   ib_cq_handle_t                          h_cq,
        IN                              void                                            *cq_context );
@@ -554,7 +570,17 @@ create_spl_qp_svc(
        cl_qlist_init( &p_spl_qp_svc->send_queue );
        cl_qlist_init( &p_spl_qp_svc->recv_queue );
        cl_spinlock_init(&p_spl_qp_svc->cache_lock);
-
+
+    /* Initialize the DPCs. */
+    KeInitializeDpc( &p_spl_qp_svc->send_dpc, spl_qp_send_dpc_cb, p_spl_qp_svc );
+    KeInitializeDpc( &p_spl_qp_svc->recv_dpc, spl_qp_recv_dpc_cb, p_spl_qp_svc );
+
+    if( qp_type == IB_QPT_QP0 )
+    {
+        KeSetImportanceDpc( &p_spl_qp_svc->send_dpc, HighImportance );
+        KeSetImportanceDpc( &p_spl_qp_svc->recv_dpc, HighImportance );
+    }
+
 #if defined( CL_USE_MUTEX )
        /* Initialize async callbacks and flags for send/receive processing. */
        p_spl_qp_svc->send_async_queued = FALSE;
@@ -2461,6 +2487,8 @@ spl_qp_send_comp_cb(

        AL_ENTER( AL_DBG_SMI );

+       UNREFERENCED_PARAMETER( h_cq );
+
        CL_ASSERT( cq_context );
        p_spl_qp_svc = cq_context;

@@ -2477,21 +2505,55 @@ spl_qp_send_comp_cb(
        cl_spinlock_release( &p_spl_qp_svc->obj.lock );

 #else
+    cl_spinlock_acquire( &p_spl_qp_svc->obj.lock );
+       if( p_spl_qp_svc->state != SPL_QP_ACTIVE )
+       {
+               cl_spinlock_release( &p_spl_qp_svc->obj.lock );
+        AL_EXIT( AL_DBG_SMI );
+               return;
+       }
+       cl_atomic_inc( &p_spl_qp_svc->in_use_cnt );
+       cl_spinlock_release( &p_spl_qp_svc->obj.lock );

-       /* Invoke the callback directly. */
+    /* Queue the DPC. */
        CL_ASSERT( h_cq == p_spl_qp_svc->h_send_cq );
-       spl_qp_comp( p_spl_qp_svc, h_cq, IB_WC_SEND );
+    KeInsertQueueDpc( &p_spl_qp_svc->send_dpc, NULL, NULL );
+#endif
+
+       AL_EXIT( AL_DBG_SMI );
+}
+
+
+void
+spl_qp_send_dpc_cb(
+    IN              KDPC                        *p_dpc,
+    IN              void                        *context,
+    IN              void                        *arg1,
+    IN              void                        *arg2
+    )
+{
+       spl_qp_svc_t*                   p_spl_qp_svc;
+
+       AL_ENTER( AL_DBG_SMI );
+
+       CL_ASSERT( context );
+       p_spl_qp_svc = context;
+
+    UNREFERENCED_PARAMETER( p_dpc );
+    UNREFERENCED_PARAMETER( arg1 );
+    UNREFERENCED_PARAMETER( arg2 );
+
+       spl_qp_comp( p_spl_qp_svc, p_spl_qp_svc->h_send_cq, IB_WC_SEND );

        /* Continue processing any queued MADs on the QP. */
        special_qp_resume_sends( p_spl_qp_svc->h_qp );

-#endif
+    cl_atomic_dec( &p_spl_qp_svc->in_use_cnt );

-       AL_EXIT( AL_DBG_SMI );
+    AL_EXIT( AL_DBG_SMI );
 }


-
 #if defined( CL_USE_MUTEX )
 void
 spl_qp_send_async_cb(
@@ -2536,6 +2598,8 @@ spl_qp_recv_comp_cb(

        AL_ENTER( AL_DBG_SMI );

+       UNREFERENCED_PARAMETER( h_cq );
+
        CL_ASSERT( cq_context );
        p_spl_qp_svc = cq_context;

@@ -2552,16 +2616,51 @@ spl_qp_recv_comp_cb(
        cl_spinlock_release( &p_spl_qp_svc->obj.lock );

 #else
+    cl_spinlock_acquire( &p_spl_qp_svc->obj.lock );
+       if( p_spl_qp_svc->state != SPL_QP_ACTIVE )
+       {
+               cl_spinlock_release( &p_spl_qp_svc->obj.lock );
+        AL_EXIT( AL_DBG_SMI );
+               return;
+       }
+       cl_atomic_inc( &p_spl_qp_svc->in_use_cnt );
+       cl_spinlock_release( &p_spl_qp_svc->obj.lock );

+    /* Queue the DPC. */
        CL_ASSERT( h_cq == p_spl_qp_svc->h_recv_cq );
-       spl_qp_comp( p_spl_qp_svc, h_cq, IB_WC_RECV );
-
+    KeInsertQueueDpc( &p_spl_qp_svc->recv_dpc, NULL, NULL );
 #endif

        AL_EXIT( AL_DBG_SMI );
 }


+void
+spl_qp_recv_dpc_cb(
+    IN              KDPC                        *p_dpc,
+    IN              void                        *context,
+    IN              void                        *arg1,
+    IN              void                        *arg2
+    )
+{
+       spl_qp_svc_t*                   p_spl_qp_svc;
+
+       AL_ENTER( AL_DBG_SMI );
+
+       CL_ASSERT( context );
+       p_spl_qp_svc = context;
+
+    UNREFERENCED_PARAMETER( p_dpc );
+    UNREFERENCED_PARAMETER( arg1 );
+    UNREFERENCED_PARAMETER( arg2 );
+
+       spl_qp_comp( p_spl_qp_svc, p_spl_qp_svc->h_recv_cq, IB_WC_RECV );
+
+    cl_atomic_dec( &p_spl_qp_svc->in_use_cnt );
+
+    AL_EXIT( AL_DBG_SMI );
+}
+

 #if defined( CL_USE_MUTEX )
 void
@@ -2589,7 +2688,7 @@ spl_qp_recv_async_cb(
 #endif


-
+#define SPL_QP_MAX_POLL 16
 /*
  * Special QP completion handler.
  */
@@ -2607,6 +2706,7 @@ spl_qp_comp(
        ib_mad_element_t*               p_mad_element;
        ib_smp_t*                               p_smp;
        ib_api_status_t                 status;
+    int                     max_poll = SPL_QP_MAX_POLL;

        AL_ENTER( AL_DBG_SMI_CB );

@@ -2625,7 +2725,7 @@ spl_qp_comp(

        wc.p_next = NULL;
        /* Process work completions. */
-       while( ib_poll_cq( h_cq, &p_free_wc, &p_done_wc ) == IB_SUCCESS )
+       while( max_poll && ib_poll_cq( h_cq, &p_free_wc, &p_done_wc ) == IB_SUCCESS )
        {
                /* Process completions one at a time. */
                CL_ASSERT( p_done_wc );
@@ -2713,13 +2813,25 @@ spl_qp_comp(
                        spl_qp_svc_reset( p_spl_qp_svc );
                }
                p_free_wc = &wc;
+        --max_poll;
        }

-       /* Rearm the CQ. */
-       status = ib_rearm_cq( h_cq, FALSE );
-       CL_ASSERT( status == IB_SUCCESS );
+    if( max_poll == 0 )
+    {
+        /* We already have an in_use_cnt reference - use it to queue the DPC. */
+        if( wc_type == IB_WC_SEND )
+            KeInsertQueueDpc( &p_spl_qp_svc->send_dpc, NULL, NULL );
+        else
+            KeInsertQueueDpc( &p_spl_qp_svc->recv_dpc, NULL, NULL );
+    }
+    else
+    {
+           /* Rearm the CQ. */
+           status = ib_rearm_cq( h_cq, FALSE );
+           CL_ASSERT( status == IB_SUCCESS );

-       cl_atomic_dec( &p_spl_qp_svc->in_use_cnt );
+           cl_atomic_dec( &p_spl_qp_svc->in_use_cnt );
+    }
        AL_EXIT( AL_DBG_SMI_CB );
 }

diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\kernel\al_smi.h trunk\core\al\kernel\al_smi.h
--- old\core\al\kernel\al_smi.h Fri Jul 11 16:24:31 2008
+++ trunk\core\al\kernel\al_smi.h       Fri Jul 11 16:07:29 2008
@@ -157,6 +157,9 @@ typedef struct _spl_qp_svc
        ib_pool_key_t                           pool_key;
        ib_mad_svc_handle_t                     h_mad_svc;

+    KDPC                        send_dpc;
+    KDPC                        recv_dpc;
+
 }      spl_qp_svc_t;


diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\user\ual_ca.c trunk\core\al\user\ual_ca.c
--- old\core\al\user\ual_ca.c   Fri Jul 11 16:24:31 2008
+++ trunk\core\al\user\ual_ca.c Fri Jul 11 16:07:29 2008
@@ -169,7 +169,7 @@ ual_open_ca(
        }

        ca_ioctl.in.guid = ca_guid;
-       ca_ioctl.in.context = p_ci_ca;
+       ca_ioctl.in.context = (ULONG_PTR)p_ci_ca;

        cl_status = do_al_dev_ioctl( UAL_OPEN_CA,
                &ca_ioctl.in, sizeof(ca_ioctl.in), &ca_ioctl.out, sizeof(ca_ioctl.out),
@@ -273,7 +273,7 @@ ual_query_ca(
        cl_memclr( &ca_ioctl, sizeof(ca_ioctl) );

        ca_ioctl.in.h_ca = h_ca->obj.p_ci_ca->obj.hdl;
-       ca_ioctl.in.p_ca_attr = p_ca_attr;
+       ca_ioctl.in.p_ca_attr = (ULONG_PTR)p_ca_attr;
        ca_ioctl.in.byte_cnt = *p_size;

        /* Call the uvp pre call if the vendor library provided a valid ca handle */
@@ -336,7 +336,7 @@ ual_modify_ca(
        uvp_interface_t                         uvp_intf = h_ca->obj.p_ci_ca->verbs.user_verbs;

        AL_ENTER( AL_DBG_CA );
-    cl_memclr(&ca_ioctl, sizeof(ca_ioctl));
+
        /* Call the uvp pre call if the vendor library provided a valid ca handle */
        if( h_ca->obj.p_ci_ca->h_ci_ca && uvp_intf.pre_modify_ca )
        {
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\user\ual_cm_cep.c trunk\core\al\user\ual_cm_cep.c
--- old\core\al\user\ual_cm_cep.c       Fri Jul 11 16:24:32 2008
+++ trunk\core\al\user\ual_cm_cep.c     Fri Jul 11 16:14:00 2008
@@ -267,13 +267,14 @@ __create_ucep(

        /* Store user parameters. */
        p_cep->pfn_cb = pfn_cb;
-       p_cep->destroy_context = context; //TODO: context will no be longer __ptr64
+       p_cep->destroy_context = context;

        /* Create a kernel CEP only if we don't already have a CID. */
        if( cid == AL_INVALID_CID )
        {
-               if( !DeviceIoControl( g_al_device, UAL_CREATE_CEP, &context,
-                       sizeof(context), &ioctl, sizeof(ioctl), &bytes_ret, NULL ) ||
+               uint64_t cep_context = (ULONG_PTR)context;
+               if( !DeviceIoControl( g_al_device, UAL_CREATE_CEP, &cep_context,
+                       sizeof(cep_context), &ioctl, sizeof(ioctl), &bytes_ret, NULL ) ||
                        bytes_ret != sizeof(ioctl) )
                {
                        __destroy_ucep( p_cep );
@@ -648,7 +649,7 @@ al_cep_pre_rep(
        p_cep->destroy_context = context;
        cl_spinlock_release( &gp_cep_mgr->obj.lock );

-       ioctl.in.context = context;
+       ioctl.in.context = (ULONG_PTR)context;
        ioctl.in.cid = cid;
        ioctl.in.cm_rep = *p_cm_rep;
        ioctl.in.cm_rep.h_qp = (ib_qp_handle_t)HDL_TO_PTR(p_cm_rep->h_qp->obj.hdl);
@@ -1384,7 +1385,7 @@ al_cep_poll(

                cl_memcpy( p_mad->p_mad_buf, ioctl.mad_buf, MAD_BLOCK_SIZE );

-               *p_context = ioctl.context;
+               *p_context = (void*)(ULONG_PTR)ioctl.context;
                *p_new_cid = ioctl.new_cid;
                *pp_mad = p_mad;
        }
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\user\ual_cq.c trunk\core\al\user\ual_cq.c
--- old\core\al\user\ual_cq.c   Fri Jul 11 16:24:31 2008
+++ trunk\core\al\user\ual_cq.c Fri Jul 11 16:07:29 2008
@@ -78,8 +78,8 @@ ual_create_cq(

        cq_ioctl.in.h_ca = p_ci_ca->obj.hdl;
        cq_ioctl.in.size = p_cq_create->size;
-       cq_ioctl.in.h_wait_obj = p_cq_create->h_wait_obj;
-       cq_ioctl.in.context = h_cq;
+       cq_ioctl.in.h_wait_obj = HandleToHandle64( p_cq_create->h_wait_obj );
+       cq_ioctl.in.context = (ULONG_PTR)h_cq;
        cq_ioctl.in.ev_notify = (h_cq->pfn_event_cb != NULL) ? TRUE : FALSE;

        cl_status = do_al_dev_ioctl( UAL_CREATE_CQ,
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\user\ual_mad.c trunk\core\al\user\ual_mad.c
--- old\core\al\user\ual_mad.c  Fri Jul 11 16:24:31 2008
+++ trunk\core\al\user\ual_mad.c        Fri Jul 11 16:07:29 2008
@@ -202,7 +202,7 @@ ual_send_one_mad(
        AL_ENTER( AL_DBG_MAD );

        CL_ASSERT( p_mad_element );
-    cl_memclr(&ioctl_buf, sizeof(ioctl_buf));
+
        p_al_element = PARENT_STRUCT(
                p_mad_element, al_mad_element_t, element );

@@ -223,9 +223,9 @@ ual_send_one_mad(
        else
                ioctl_buf.in.h_av = AL_INVALID_HANDLE;

-       ioctl_buf.in.p_mad_element = p_mad_element;
+       ioctl_buf.in.p_mad_element = (ULONG_PTR)p_mad_element;
        ioctl_buf.in.size = p_mad_element->size;
-       ioctl_buf.in.ph_proxy = &p_al_element->h_proxy_element;
+       ioctl_buf.in.ph_proxy = (ULONG_PTR)&p_al_element->h_proxy_element;

        cl_status = do_al_dev_ioctl( UAL_MAD_SEND,
                &ioctl_buf.in, sizeof(ioctl_buf.in),
@@ -439,7 +439,7 @@ ual_get_recv_mad(
         * Note that we issue the IOCTL regardless of failure of ib_get_mad.
         * This is done in order to release the kernel-mode MAD.
         */
-       ioctl_buf.in.p_user_mad = p_mad;
+       ioctl_buf.in.p_user_mad = (ULONG_PTR)p_mad;

        if( p_mad )
        {
@@ -447,8 +447,8 @@ ual_get_recv_mad(
                p_mad_buf = p_mad->p_mad_buf;
                p_grh = p_mad->p_grh;

-               ioctl_buf.in.p_mad_buf = p_mad_buf;
-               ioctl_buf.in.p_grh = p_grh;
+               ioctl_buf.in.p_mad_buf = (ULONG_PTR)p_mad_buf;
+               ioctl_buf.in.p_grh = (ULONG_PTR)p_grh;
        }
        ioctl_buf.in.h_mad = h_mad;

@@ -500,7 +500,7 @@ ual_local_mad(
        ib_api_status_t                         status = IB_SUCCESS;

        AL_ENTER( AL_DBG_CA );
-    cl_memclr(&local_mad_ioctl, sizeof (local_mad_ioctl));
+
        local_mad_ioctl.in.h_ca = h_ca->obj.p_ci_ca->obj.hdl;
        local_mad_ioctl.in.port_num = port_num;
        cl_memcpy( local_mad_ioctl.in.mad_in, p_mad_in,
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\user\ual_mcast.c trunk\core\al\user\ual_mcast.c
--- old\core\al\user\ual_mcast.c        Fri Jul 11 16:24:32 2008
+++ trunk\core\al\user\ual_mcast.c      Fri Jul 11 16:07:29 2008
@@ -99,7 +99,7 @@ ual_attach_mcast(
                status = ioctl_buf.out.status;
                if( status == IB_SUCCESS ){
                        h_mcast->obj.hdl = ioctl_buf.out.h_attach;
-                       h_mcast->h_ci_mcast = (ib_mcast_handle_t) HDL_TO_PTR(ioctl_buf.out.h_attach);
+                       h_mcast->h_ci_mcast = (ib_mcast_handle_t)(ULONG_PTR)ioctl_buf.out.h_attach;
                }
        }

diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\user\ual_mgr.c trunk\core\al\user\ual_mgr.c
--- old\core\al\user\ual_mgr.c  Fri Jul 11 16:24:32 2008
+++ trunk\core\al\user\ual_mgr.c        Fri Jul 11 16:07:29 2008
@@ -162,11 +162,11 @@ ual_create_async_file(
        uintn_t                                 bytes_ret;

        AL_ENTER( AL_DBG_MGR );
-    cl_memclr(&ioctl, sizeof (ual_bind_file_ioctl_t));
+
        /* Create a file object on which to issue all SA requests. */
-       ioctl.h_file = CreateFileW( L"\\\\.\\ibal",
+       ioctl.h_file = HandleToHandle64( CreateFileW( L"\\\\.\\ibal",
                GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
-               NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL );
+               NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL ) );
        if( ioctl.h_file == INVALID_HANDLE_VALUE )
        {
                AL_PRINT_EXIT(TRACE_LEVEL_ERROR ,AL_DBG_ERROR,
@@ -646,11 +646,12 @@ __process_misc_cb(
                /* We got a send completion. */
                ib_mad_element_t                        *p_element;

-               ib_mad_svc_handle_t                     h_mad_svc = (ib_mad_svc_handle_t)
+               ib_mad_svc_handle_t                     h_mad_svc = (ib_mad_svc_handle_t)(ULONG_PTR)
                        p_misc_cb_info->ioctl_rec.mad_send_cb_ioctl_rec.mad_svc_context;

                /* Copy the data to the user's element. */
-               p_element = p_misc_cb_info->ioctl_rec.mad_send_cb_ioctl_rec.p_um_mad;
+               p_element = (ib_mad_element_t*)(ULONG_PTR)
+                       p_misc_cb_info->ioctl_rec.mad_send_cb_ioctl_rec.p_um_mad;
                /* Only update the status if a receive wasn't failed. */
                if( p_element->status != IB_WCS_TIMEOUT_RETRY_ERR )
                {
@@ -682,10 +683,10 @@ __process_misc_cb(
                ib_mad_t                                *p_mad_buf = NULL;
                ib_grh_t                                *p_grh = NULL;

-               h_mad_svc = (ib_mad_svc_handle_t)
+               h_mad_svc = (ib_mad_svc_handle_t)(ULONG_PTR)
                        p_misc_cb_info->ioctl_rec.mad_recv_cb_ioctl_rec.mad_svc_context;

-               p_send_mad =
+               p_send_mad = (ib_mad_element_t*)(ULONG_PTR)
                        p_misc_cb_info->ioctl_rec.mad_recv_cb_ioctl_rec.p_send_mad;

                cl_memclr( &ioctl_buf, sizeof(ioctl_buf) );
@@ -708,7 +709,7 @@ __process_misc_cb(
                else if( p_send_mad )
                        p_send_mad->status = IB_WCS_TIMEOUT_RETRY_ERR;

-               ioctl_buf.in.p_user_mad = p_mad;
+               ioctl_buf.in.p_user_mad = (ULONG_PTR)p_mad;

                if( p_mad )
                {
@@ -716,8 +717,8 @@ __process_misc_cb(
                        p_mad_buf = p_mad->p_mad_buf;
                        p_grh = p_mad->p_grh;

-                       ioctl_buf.in.p_mad_buf = p_mad_buf;
-                       ioctl_buf.in.p_grh = p_grh;
+                       ioctl_buf.in.p_mad_buf = (ULONG_PTR)p_mad_buf;
+                       ioctl_buf.in.p_grh = (ULONG_PTR)p_grh;
                }
                ioctl_buf.in.h_mad = p_misc_cb_info->ioctl_rec.mad_recv_cb_ioctl_rec.h_mad;

diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\user\ual_pd.c trunk\core\al\user\ual_pd.c
--- old\core\al\user\ual_pd.c   Fri Jul 11 16:24:31 2008
+++ trunk\core\al\user\ual_pd.c Fri Jul 11 16:07:29 2008
@@ -80,7 +80,7 @@ ual_allocate_pd(

        pd_ioctl.in.h_ca = h_ca->obj.p_ci_ca->obj.hdl;
        pd_ioctl.in.type = pd_type;
-       pd_ioctl.in.context = h_pd;
+       pd_ioctl.in.context = (ULONG_PTR)h_pd;

        cl_status = do_al_dev_ioctl( UAL_ALLOC_PD,
                &pd_ioctl.in, sizeof(pd_ioctl.in), &pd_ioctl.out, sizeof(pd_ioctl.out),
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\user\ual_pnp.c trunk\core\al\user\ual_pnp.c
--- old\core\al\user\ual_pnp.c  Fri Jul 11 16:24:31 2008
+++ trunk\core\al\user\ual_pnp.c        Fri Jul 11 16:07:29 2008
@@ -321,14 +321,14 @@ ib_reg_pnp(

        /* Copy the request information. */
        p_reg->pfn_pnp_cb = p_pnp_req->pfn_pnp_cb;
-    cl_memclr(&in, sizeof(in));
+
        in.pnp_class = p_pnp_req->pnp_class;
-       in.p_status = &status;
-       in.p_hdl = &p_reg->obj.hdl;
+       in.p_status = (ULONG_PTR)&status;
+       in.p_hdl = (ULONG_PTR)&p_reg->obj.hdl;

        if( pnp_get_flag( p_pnp_req->pnp_class ) & IB_PNP_FLAG_REG_SYNC )
        {
-               in.sync_event = CreateEvent( NULL, FALSE, FALSE, NULL );
+               in.sync_event = HandleToHandle64( CreateEvent( NULL, FALSE, FALSE, NULL ) );
                if( !in.sync_event )
                {
                        p_reg->obj.pfn_destroy( &p_reg->obj, NULL );
@@ -458,9 +458,10 @@ __pnp_async_cb(
        AL_ENTER( AL_DBG_PNP );

        p_reg = PARENT_STRUCT( p_item, al_pnp_t, async_item );
-    cl_memclr(&in, sizeof(in));
+
        in.pnp_hdl = p_reg->obj.hdl;
        in.last_evt_hdl = p_reg->rearm.evt_hdl;
+       in.last_evt_context = 0;

        if( p_reg->rearm.evt_size )
        {
@@ -491,12 +492,11 @@ __pnp_async_cb(
                                }
                                p_pnp_rec->pnp_context = (void*)p_reg->obj.context;
                                in.last_evt_status = p_reg->pfn_pnp_cb( p_pnp_rec );
-                               in.last_evt_context = p_pnp_rec->context;
+                               in.last_evt_context = (ULONG_PTR)p_pnp_rec->context;
                        }
                        else
                        {
                                in.last_evt_status = IB_SUCCESS;
-                               in.last_evt_context = NULL;
                        }

                        if( p_pnp_rec )
@@ -505,13 +505,11 @@ __pnp_async_cb(
                else
                {
                        in.last_evt_status = IB_SUCCESS;
-                       in.last_evt_context = NULL;
                }
        }
        else
        {
                in.last_evt_status = IB_SUCCESS;
-               in.last_evt_context = NULL;
        }

        /* Request the next PnP event. */
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\user\ual_qp.c trunk\core\al\user\ual_qp.c
--- old\core\al\user\ual_qp.c   Fri Jul 11 16:24:32 2008
+++ trunk\core\al\user\ual_qp.c Fri Jul 11 16:07:29 2008
@@ -320,7 +320,7 @@ ual_create_qp(
        if (p_qp_create->h_srq)
                qp_ioctl.in.qp_create.h_srq =
                        (ib_srq_handle_t)HDL_TO_PTR(p_qp_create->h_srq->obj.hdl);
-       qp_ioctl.in.context = h_qp;
+       qp_ioctl.in.context = (ULONG_PTR)h_qp;
        qp_ioctl.in.ev_notify = (h_qp->pfn_event_cb != NULL) ? TRUE : FALSE;

        cl_status = do_al_dev_ioctl( UAL_CREATE_QP,
@@ -620,7 +620,7 @@ ual_init_qp_alias(
                qp_ioctl.in.h_pd = h_pd->obj.hdl;
                qp_ioctl.in.port_guid = port_guid;
                qp_ioctl.in.qp_create = *p_qp_create;
-               qp_ioctl.in.context = &p_qp_alias->qp;
+               qp_ioctl.in.context = (ULONG_PTR)&p_qp_alias->qp;

                cl_status = do_al_dev_ioctl( UAL_GET_SPL_QP_ALIAS,
                        &qp_ioctl.in, sizeof(qp_ioctl.in),
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\user\ual_sa_req.c trunk\core\al\user\ual_sa_req.c
--- old\core\al\user\ual_sa_req.c       Fri Jul 11 16:24:31 2008
+++ trunk\core\al\user\ual_sa_req.c     Fri Jul 11 16:07:29 2008
@@ -198,8 +198,8 @@ al_send_sa_req(
        p_sa_req->ioctl.in.sa_req = *p_sa_req_data;
        cl_memcpy( p_sa_req->ioctl.in.attr,
                p_sa_req_data->p_attr, p_sa_req_data->attr_size );
-       p_sa_req->ioctl.in.ph_sa_req = &p_sa_req->hdl;
-       p_sa_req->ioctl.in.p_status = &p_sa_req->status;
+       p_sa_req->ioctl.in.ph_sa_req = (ULONG_PTR)&p_sa_req->hdl;
+       p_sa_req->ioctl.in.p_status = (ULONG_PTR)&p_sa_req->status;

        if( flags & IB_FLAGS_SYNC )
                h_dev = g_al_device;
@@ -299,7 +299,7 @@ al_cancel_sa_req(
        size_t                                          bytes_ret;

        AL_ENTER( AL_DBG_SA_REQ );
-    cl_memclr(&ioctl, sizeof(ioctl));
+
        ioctl.h_sa_req = p_sa_req->hdl;

        do_al_dev_ioctl(
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\core\al\user\ual_srq.c trunk\core\al\user\ual_srq.c
--- old\core\al\user\ual_srq.c  Fri Jul 11 16:24:31 2008
+++ trunk\core\al\user\ual_srq.c        Fri Jul 11 16:07:29 2008
@@ -200,7 +200,7 @@ ual_create_srq(
         */
        srq_ioctl.in.h_pd = h_pd->obj.hdl;
        srq_ioctl.in.srq_attr = *p_srq_attr;
-       srq_ioctl.in.context = h_srq;
+       srq_ioctl.in.context = (ULONG_PTR)h_srq;
        srq_ioctl.in.ev_notify = (h_srq->pfn_event_cb != NULL) ? TRUE : FALSE;

        cl_status = do_al_dev_ioctl( UAL_CREATE_SRQ,
diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: old\inc\iba\ib_al_ioctl.h trunk\inc\iba\ib_al_ioctl.h
--- old\inc\iba\ib_al_ioctl.h   Fri Jul 11 16:24:32 2008
+++ trunk\inc\iba\ib_al_ioctl.h Fri Jul 11 16:11:52 2008
@@ -42,7 +42,6 @@
 #include <iba/ib_al.h>


-
 /*
 * Typedefs
 *
@@ -70,7 +69,7 @@
 */
 typedef struct _ual_bind_file_ioctl
 {
-       TO_LONG_PTR(void* ,                     h_file) ;
+       void* __ptr64                   h_file; /* __ptr64 is correct for HANDLE types. */

 }      ual_bind_file_ioctl_t;
 /*
@@ -146,7 +145,7 @@ typedef union _ual_open_ca_ioctl
        {
                ci_umv_buf_t                            umv_buf;
                ib_net64_t                                      guid;
-               TO_LONG_PTR(void* ,                             context) ;
+               uint64_t                                        context;

        }       in;

@@ -203,7 +202,7 @@ typedef union _ual_query_ca_ioctl
                ci_umv_buf_t                            umv_buf;
                uint64_t                                        h_ca;
                uint32_t                                        byte_cnt;
-               TO_LONG_PTR(ib_ca_attr_t* ,             p_ca_attr) ;
+               uint64_t                                        p_ca_attr;

        }       in;
        struct _ual_query_ca_ioctl_out
@@ -414,7 +413,7 @@ typedef union _ual_alloc_pd_ioctl
                ci_umv_buf_t                            umv_buf;
                uint64_t                                        h_ca;
                ib_pd_type_t                            type;
-               TO_LONG_PTR(void* ,                             context) ;
+               uint64_t                                        context;

        }       in;
        struct _ual_alloc_pd_ioctl_out
@@ -687,14 +686,14 @@ typedef union _ual_create_srq_ioctl
                ci_umv_buf_t                            umv_buf;
                uint64_t                                        h_pd;
                ib_srq_attr_t                           srq_attr;
-               TO_LONG_PTR(void* ,                             context) ;
-               boolean_t                               ev_notify;
+               uint64_t                                        context;
+               boolean_t                                       ev_notify;

        }       in;
        struct _ual_create_srq_ioctl_out
        {
                ci_umv_buf_t                            umv_buf;
-               ib_api_status_t                 status;
+               ib_api_status_t                         status;
                uint64_t                                        h_srq;

        }       out;
@@ -883,7 +882,7 @@ typedef union _ual_create_qp_ioctl
                ci_umv_buf_t                            umv_buf;
                uint64_t                                        h_pd;
                ib_qp_create_t                          qp_create;
-               TO_LONG_PTR(void* ,                             context) ;
+               uint64_t                                        context;
                boolean_t                                       ev_notify;

        }       in;
@@ -1086,8 +1085,8 @@ typedef union _ual_create_cq_ioctl
        {
                ci_umv_buf_t                            umv_buf;
                uint64_t                                        h_ca;
-               TO_LONG_PTR(void* ,                             h_wait_obj) ;
-               TO_LONG_PTR(void* ,                             context) ;
+               void* __ptr64                           h_wait_obj;     /* __ptr64 is correct for HANDLE types. */
+               uint64_t                                        context;
                uint32_t                                        size;
                boolean_t                                       ev_notify;

@@ -2288,9 +2287,9 @@ typedef union _ual_send_mad_ioctl
                uint64_t                                                h_mad_svc;
                uint64_t                                                pool_key;
                uint64_t                                                h_av;
-               TO_LONG_PTR(ib_mad_element_t* ,         p_mad_element) ;
+               uint64_t                                                p_mad_element;
                uint32_t                                                size;
-               TO_LONG_PTR(void* *, /*__ptr64*/                ph_proxy) ;
+               uint64_t                                                ph_proxy;

        }       in;
        struct _ual_send_mad_ioctl_out
@@ -2341,7 +2340,7 @@ typedef union _ual_cancel_mad_ioctl
        struct _ual_cancel_mad_ioctl_in
        {
                uint64_t                                        h_mad_svc;
-               TO_LONG_PTR(void* ,                             h_proxy_element) ;
+               uint64_t                                        h_proxy_element;

        }       in;
        struct _ual_cancel_mad_ioctl_out
@@ -2383,7 +2382,7 @@ typedef union _ual_spl_qp_ioctl
                uint64_t                                        h_pd;
                ib_net64_t                                      port_guid;
                ib_qp_create_t                          qp_create;
-               TO_LONG_PTR(void* ,                             context) ;
+               uint64_t                                        context;

        }       in;
        struct _ual_spl_qp_ioctl_out
@@ -2433,9 +2432,9 @@ typedef union _ual_mad_recv_ioctl
        struct _ual_mad_recv_comp_ioctl_in
        {
                uint64_t                                        h_mad;
-               TO_LONG_PTR(ib_mad_element_t* , p_user_mad) ;
-               TO_LONG_PTR(ib_mad_t* ,                 p_mad_buf) ;
-               TO_LONG_PTR(ib_grh_t* ,                 p_grh) ;
+               uint64_t                                        p_user_mad;
+               uint64_t                                        p_mad_buf;
+               uint64_t                                        p_grh;

        }       in;
        struct _ual_mad_recv_comp_ioctl_out
@@ -2481,13 +2480,13 @@ typedef union _ual_local_mad_ioctl
        {
                uint64_t                                        h_ca;
                __declspec(align(8)) uint8_t mad_in[MAD_BLOCK_SIZE];
-               uint8_t                                         port_num;
+               uint8_t                                 port_num;


        }       in;
        struct _ual_local_mad_ioctl_out
        {
-               ib_api_status_t                         status;
+               ib_api_status_t                 status;
                uint32_t                                        _pad; /* 8-byte alignment needed for ia64 */
                __declspec(align(8)) uint8_t mad_out[MAD_BLOCK_SIZE];

@@ -2537,29 +2536,6 @@ typedef struct _ual_create_cep_ioctl
 *              CID of the created CEP.
 *****/

-/****s* User-mode Access Layer/ual_create_cep_ioctl_in
-* NAME
-*      ual_create_cep_ioctl_in
-*
-* DESCRIPTION
-*      IOCTL structure containing the input parameters to
-*      create a CEP.
-*
-* SYNOPSIS
-*/
-
-typedef struct _ual_create_cep_ioctl_in
-{
-    TO_LONG_PTR(void* , context);
-} ual_create_cep_ioctl_in;
-
-/*
-* FIELDS
-*      context
-*
-*
-*****/
-

 /****s* User-mode Access Layer/ual_cep_listen_ioctl_t
 * NAME
@@ -2653,7 +2629,7 @@ typedef union _ual_cep_rep_ioctl
 {
        struct _ual_cep_rep_ioctl_in
        {
-               TO_LONG_PTR(void* ,                             context) ;
+               uint64_t                                        context;
                net32_t                                         cid;
                ib_cm_rep_t                                     cm_rep;
                uint8_t                                         pdata[IB_REP_PDATA_SIZE];
@@ -3077,7 +3053,7 @@ typedef struct _ual_cep_get_timewait_ioc
 typedef struct _ual_cep_poll_ioctl
 {
        ib_api_status_t                         status;
-       TO_LONG_PTR(void* ,                             context) ;
+       uint64_t                                        context;
        net32_t                                         new_cid;
        ib_mad_element_t                        element;
        ib_grh_t                                        grh;
@@ -3229,8 +3205,8 @@ typedef union _ual_send_sa_req_ioctl
                uint32_t                                        retry_cnt;
                ib_user_query_t                         sa_req;
                uint8_t                                         attr[IB_SA_DATA_SIZE];
-               TO_LONG_PTR(uint64_t* ,                 ph_sa_req) ;
-               TO_LONG_PTR(ib_api_status_t* ,  p_status) ;
+               uint64_t                                        ph_sa_req;
+               uint64_t                                        p_status;

        }       in;
        struct _ual_send_sa_req_ioctl_out
@@ -3305,9 +3281,9 @@ typedef struct _ual_cancel_sa_req_ioctl
 typedef struct _ual_reg_pnp_ioctl_in
 {
        ib_pnp_class_t                          pnp_class;
-       TO_LONG_PTR(void* ,                             sync_event) ;
-       TO_LONG_PTR(ib_api_status_t* ,  p_status) ;
-       TO_LONG_PTR(uint64_t* ,                 p_hdl) ;
+       void* __ptr64                           sync_event; /* __ptr64 is correct for HANDLE types. */
+       uint64_t                                        p_status;
+       uint64_t                                        p_hdl;

 }      ual_reg_pnp_ioctl_in_t;
 /*
@@ -3381,7 +3357,7 @@ typedef struct _ual_rearm_pnp_ioctl_in
 {
        uint64_t                                        pnp_hdl;
        uint64_t                                        last_evt_hdl;
-       TO_LONG_PTR(void* ,                             last_evt_context) ;
+       uint64_t                                        last_evt_context;
        ib_api_status_t                         last_evt_status;

 }      ual_rearm_pnp_ioctl_in_t;
@@ -3508,6 +3484,7 @@ typedef struct _ual_ndi_req_cm_ioctl_in
        uint64_t                                        h_qp;
        net64_t                                         guid;
        uint16_t                                        dst_port;
+    uint16_t                    pkey;
     uint8_t                     resp_res;
     uint8_t                     init_depth;
        uint8_t                                         prot;
@@ -3529,6 +3506,9 @@ typedef struct _ual_ndi_req_cm_ioctl_in
 *      dst_port
 *              Destination port number.
 *
+*   pkey
+*       Partition key.
+*
 *   resp_res
 *       Responder resources for the QP.
 *
@@ -3583,7 +3563,7 @@ typedef struct _ual_ndi_rep_cm_ioctl_in
 *      resp_res
 *              The maximum number of RDMA read/atomic operations from the recipient.
 *
-*      pdata_size
+*      pdata_size
 *              The size of following private data
 *
 *      pdata
@@ -3616,7 +3596,7 @@ typedef struct _ual_ndi_rej_cm_ioctl_in
 *      cid
 *              Connection ID.
 *
-*      pdata_size
+*      pdata_size
 *              The size of following private data
 *
 *      pdata
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ioctl_cleanup.patch
Type: application/octet-stream
Size: 39137 bytes
Desc: ioctl_cleanup.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080711/633ea132/attachment.obj>


More information about the ofw mailing list