}\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
{\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
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
{\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
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