From: leonidk Date: Mon, 17 Sep 2007 19:12:08 +0000 (+0000) Subject: [IBAL] improvements to NDI_CREATE_CQ, NDI_NOTIFY_CQ and NDI_CANCEL_CQ ioctls support. X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=bc9dcafd02f6c24fe177f370e062e7243128a34c;p=~shefty%2Frdma-win.git [IBAL] improvements to NDI_CREATE_CQ, NDI_NOTIFY_CQ and NDI_CANCEL_CQ ioctls support. git-svn-id: svn://openib.tc.cornell.edu/gen1@801 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/branches/Ndi/core/al/al_cq.c b/branches/Ndi/core/al/al_cq.c index f70f24db..f53de5f2 100644 --- a/branches/Ndi/core/al/al_cq.c +++ b/branches/Ndi/core/al/al_cq.c @@ -97,6 +97,14 @@ create_cq( { return IB_INSUFFICIENT_MEMORY; } + +#ifdef CL_KERNEL + /* cancel pending IRPS for NDI type CQ */ + if( !NT_SUCCESS( proxy_ndi_init( h_cq ) ) ) + { + return IB_ERROR; + } +#endif if( p_umv_buf ) obj_type |= AL_OBJ_SUBTYPE_UM_EXPORT; @@ -210,12 +218,13 @@ destroying_cq( } } + cl_spinlock_release( &h_cq->obj.lock ); + #ifdef CL_KERNEL /* cancel pending IRPS for NDI type CQ */ proxy_ndi_flush_ques( h_cq ); #endif - cl_spinlock_release( &h_cq->obj.lock ); } diff --git a/branches/Ndi/core/al/kernel/al_proxy_ndi.c b/branches/Ndi/core/al/kernel/al_proxy_ndi.c index a21ed341..f02dc9f2 100644 --- a/branches/Ndi/core/al/kernel/al_proxy_ndi.c +++ b/branches/Ndi/core/al/kernel/al_proxy_ndi.c @@ -60,16 +60,15 @@ #pragma warning(disable:4706) static inline void __ndi_flush_que( - IN ib_cq_handle_t h_cq, - IN PIO_CSQ Csq, + IN ndi_io_csq_t* p_ndi_csq, IN NTSTATUS completion_code ) { PIRP Irp; - while( Irp = IoCsqRemoveNextIrp( Csq, NULL ) ) + while( Irp = IoCsqRemoveNextIrp( &p_ndi_csq->csq, NULL ) ) { cl_ioctl_complete( Irp, completion_code, 0 ); - deref_al_obj( &h_cq->obj ); + deref_al_obj( &p_ndi_csq->h_cq->obj ); } } #pragma warning(default:4706) @@ -86,7 +85,7 @@ static void __ndi_cq_compl_cb( { UNUSED_PARAM( cq_context ); AL_ENTER( AL_DBG_NDI ); - __ndi_flush_que( h_cq, (PIO_CSQ)&h_cq->compl, STATUS_SUCCESS ); + __ndi_flush_que( &h_cq->compl, STATUS_SUCCESS ); AL_EXIT( AL_DBG_NDI ); } @@ -95,8 +94,8 @@ static void __ndi_cq_error_cb( { ib_cq_handle_t h_cq = p_err_rec->handle.h_cq; AL_ENTER( AL_DBG_NDI ); - __ndi_flush_que( h_cq, (PIO_CSQ)&h_cq->compl, STATUS_INTERNAL_ERROR ); - __ndi_flush_que( h_cq, (PIO_CSQ)&h_cq->error, STATUS_INTERNAL_ERROR ); + __ndi_flush_que( &h_cq->compl, STATUS_INTERNAL_ERROR ); + __ndi_flush_que( &h_cq->error, STATUS_INTERNAL_ERROR ); AL_EXIT( AL_DBG_NDI ); } @@ -115,8 +114,8 @@ proxy_ndi_flush_ques( AL_ENTER( AL_DBG_NDI ); if ( h_cq->pfn_user_comp_cb == __ndi_cq_compl_cb ) { - __ndi_flush_que( h_cq, (PIO_CSQ)&h_cq->compl, STATUS_CANCELLED ); - __ndi_flush_que( h_cq, (PIO_CSQ)&h_cq->error, STATUS_CANCELLED ); + __ndi_flush_que( &h_cq->compl, STATUS_CANCELLED ); + __ndi_flush_que( &h_cq->error, STATUS_CANCELLED ); } AL_EXIT( AL_DBG_NDI ); } @@ -191,7 +190,9 @@ static PIRP __ndi_peek_next_irp( /* for now PeekContext is not used */ } else + { break; + } nextIrp = NULL; nextEntry = nextEntry->Flink; @@ -243,8 +244,8 @@ static VOID __ndi_complete_cancelled_irp( AL_EXIT( AL_DBG_NDI ); } -static NTSTATUS -__ndi_init( +NTSTATUS +proxy_ndi_init( IN ib_cq_handle_t h_cq ) { @@ -252,14 +253,14 @@ __ndi_init( AL_ENTER( AL_DBG_NDI ); - status = IoCsqInitialize( (PIO_CSQ)&h_cq->compl, + status = IoCsqInitialize( &h_cq->compl.csq, __ndi_insert_irp, __ndi_remove_irp, __ndi_peek_next_irp, __ndi_acquire_lock, __ndi_release_lock, __ndi_complete_cancelled_irp ); if ( !NT_SUCCESS( status ) ) goto exit; - status = IoCsqInitialize( (PIO_CSQ)&h_cq->error, + status = IoCsqInitialize( &h_cq->error.csq, __ndi_insert_irp, __ndi_remove_irp, __ndi_peek_next_irp, __ndi_acquire_lock, __ndi_release_lock, __ndi_complete_cancelled_irp ); @@ -285,7 +286,7 @@ exit: ******************************************************************/ /* - * Process the ioctl UAL_CREATE_CQ: + * Process the ioctl UAL_NDI_CREATE_CQ: */ static cl_status_t __ndi_create_cq( @@ -341,12 +342,6 @@ __ndi_create_cq( if( status != IB_SUCCESS ) goto proxy_create_cq_err2; - if( !NT_SUCCESS( __ndi_init( h_cq ) ) ) - { - status = IB_ERROR; - goto proxy_create_cq_err3; - } - status = cpyout_umvbuf( &p_ioctl->out.umv_buf, p_umv_buf ); if( status == IB_SUCCESS ) { @@ -357,7 +352,6 @@ __ndi_create_cq( } else { -proxy_create_cq_err3: h_cq->obj.pfn_destroy( &h_cq->obj, NULL ); proxy_create_cq_err2: @@ -424,9 +418,9 @@ __ndi_notify_cq( /* enqueue the IRP */ ref_al_obj( &h_cq->obj ); if (p_ioctl->notify_type == NdCqNotifyErrors) - IoCsqInsertIrp( (PIO_CSQ)&h_cq->error, h_ioctl, NULL ); + IoCsqInsertIrp( &h_cq->error.csq, h_ioctl, NULL ); else - IoCsqInsertIrp( (PIO_CSQ)&h_cq->compl, h_ioctl, NULL ); + IoCsqInsertIrp( &h_cq->compl.csq, h_ioctl, NULL ); *p_ret_bytes = 0; cl_status = CL_PENDING; diff --git a/branches/Ndi/core/al/kernel/al_proxy_ndi.h b/branches/Ndi/core/al/kernel/al_proxy_ndi.h index 8d5cd03c..37b08857 100644 --- a/branches/Ndi/core/al/kernel/al_proxy_ndi.h +++ b/branches/Ndi/core/al/kernel/al_proxy_ndi.h @@ -68,6 +68,9 @@ void proxy_ndi_flush_ques( IN ib_cq_handle_t h_cq ); +NTSTATUS +proxy_ndi_init( + IN ib_cq_handle_t h_cq ); #endif