[IBAL] Convert ib_api_status_t to NTSTATUS for al_cep_get_pdata to make the IRP handl...
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 2 Jul 2008 11:12:53 +0000 (11:12 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 2 Jul 2008 11:12:53 +0000 (11:12 +0000)
Signed-off-by: Fab Tillier <ftillier@microsoft.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1320 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/al_cm_cep.h
core/al/kernel/al_cm_cep.c
core/al/kernel/al_proxy_cep.c

index 4dc4fec..e500107 100644 (file)
@@ -280,7 +280,7 @@ al_cep_get_cid(
        IN              PIRP                                                            h_ioctl\r
        );\r
 \r
-ib_api_status_t\r
+NTSTATUS\r
 al_cep_get_pdata(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              net32_t                                         cid,\r
index 8360950..3d232ef 100644 (file)
@@ -6365,7 +6365,7 @@ exit:
 }\r
 \r
 \r
-ib_api_status_t\r
+NTSTATUS\r
 al_cep_get_pdata(\r
        IN                              ib_al_handle_t                          h_al,\r
        IN                              net32_t                                         cid,\r
@@ -6374,7 +6374,7 @@ al_cep_get_pdata(
 {\r
        kcep_t                          *p_cep;\r
        KLOCK_QUEUE_HANDLE      hdl;\r
-       uint8_t remainder;\r
+       uint8_t             copy_len;\r
 \r
        AL_ENTER( AL_DBG_CM );\r
 \r
@@ -6387,34 +6387,22 @@ al_cep_get_pdata(
                KeReleaseInStackQueuedSpinLock( &hdl );\r
                AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, \r
                        ("CEP not found for cid %d, h_al %p\n", cid, h_al ));\r
-               return IB_INVALID_HANDLE;\r
+               return STATUS_CONNECTION_INVALID;\r
        }\r
 \r
-       if ( *p_psize < p_cep->psize )\r
-       {\r
-               KeReleaseInStackQueuedSpinLock( &hdl );\r
-               AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, \r
-                       ("Insufficient size: *p_psize %d, max %d, cid %d, h_al %p\n", \r
-                       *p_psize, p_cep->psize, cid, h_al ));\r
-               return IB_INVALID_PARAMETER;\r
-       }\r
-       \r
-       memcpy( pdata, p_cep->pdata, p_cep->psize );\r
-       remainder = *p_psize - p_cep->psize;\r
-       if (remainder)\r
-               cl_memclr( &pdata[p_cep->psize], remainder );\r
-       *p_psize = p_cep->psize;\r
-       if ( !*p_psize )\r
-       {\r
-               AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, \r
-                       ("p_cep->psize is zero for cid %d, h_al %p\n", cid, h_al ));\r
-       }\r
+    copy_len = min( *p_psize, p_cep->psize );\r
+\r
+    if( copy_len )\r
+        RtlCopyMemory( pdata, p_cep->pdata, copy_len );\r
+\r
+    // Always report the maximum available user private data.\r
+    *p_psize = p_cep->psize;\r
 \r
        AL_PRINT(TRACE_LEVEL_INFORMATION ,AL_DBG_CM ,\r
                ("al_cep_get_pdata: get %d of pdata from CEP with cid %d, h_al %p, context %p \n", \r
-               p_cep->psize, cid, h_al, p_cep->context ));\r
+               copy_len, cid, h_al, p_cep->context ));\r
 \r
        KeReleaseInStackQueuedSpinLock( &hdl );\r
        AL_EXIT( AL_DBG_CM );\r
-       return IB_SUCCESS;\r
+       return STATUS_SUCCESS;\r
 }\r
index a6bd447..5ff8f77 100644 (file)
@@ -899,10 +899,8 @@ proxy_cep_get_pdata(
 {\r
        al_dev_open_context_t           *p_context;\r
        ual_cep_get_pdata_ioctl_t       *p_ioctl;\r
-       ib_qp_handle_t VOID_PTR64                               h_qp = NULL;\r
-       net32_t                                         cid;\r
-       ib_api_status_t                         status;\r
-       cl_status_t                                     cl_status;\r
+       al_conn_qp_t                            *p_qp;\r
+       NTSTATUS                    status;\r
 \r
        AL_ENTER( AL_DBG_CM );\r
 \r
@@ -921,47 +919,34 @@ proxy_cep_get_pdata(
                return CL_INVALID_PARAMETER;\r
        }\r
 \r
-       *p_ret_bytes = sizeof(struct _ual_cep_get_pdata_ioctl_out);\r
-\r
        if ( p_ioctl->in.h_qp )\r
        {\r
                /* Get the kernel QP handle. */\r
-               h_qp = (ib_qp_handle_t VOID_PTR64)al_hdl_ref(\r
+               p_qp = (al_conn_qp_t*)al_hdl_ref(\r
                        p_context->h_al, p_ioctl->in.h_qp, AL_OBJ_TYPE_H_QP );\r
-               if( !h_qp )\r
+               if( !p_qp )\r
                {\r
                        AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, \r
                                ("Invalid QP handle\n"));\r
                        return CL_CONNECTION_INVALID;\r
                }\r
-               cid = ((al_conn_qp_t*)h_qp)->cid;\r
-       }\r
-       else\r
-       {\r
-               cid = p_ioctl->in.cid;\r
+               p_ioctl->in.cid = p_qp->cid;\r
+               deref_al_obj( &p_qp->qp.obj );\r
        }\r
 \r
        p_ioctl->out.pdata_len = sizeof(p_ioctl->out.pdata);\r
-       status = al_cep_get_pdata( p_context->h_al, cid, \r
+       status = al_cep_get_pdata( p_context->h_al, p_ioctl->in.cid, \r
                (uint8_t*)&p_ioctl->out.pdata_len, p_ioctl->out.pdata );\r
 \r
-       if ( status == IB_SUCCESS )\r
+       if( NT_SUCCESS( status ) )\r
        {\r
-               cl_status = CL_SUCCESS;\r
-               *p_ret_bytes = p_ioctl->out.pdata_len;\r
+               *p_ret_bytes = sizeof(struct _ual_cep_get_pdata_ioctl_out);\r
                AL_PRINT(TRACE_LEVEL_INFORMATION ,AL_DBG_CM ,\r
                        ("proxy_cep_get_pdata: get %d of pdata \n", (int)*p_ret_bytes ));\r
        }\r
-       else\r
-       {\r
-               cl_status = CL_CONNECTION_INVALID;\r
-       }\r
-\r
-       if ( h_qp )\r
-               deref_al_obj( &h_qp->obj );\r
 \r
        AL_EXIT( AL_DBG_CM );\r
-       return cl_status;\r
+       return status;\r
 }\r
 \r
 cl_status_t cep_ioctl(\r