]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[IBAL] improvements to NDI_CREATE_CQ, NDI_NOTIFY_CQ and NDI_CANCEL_CQ ioctls support.
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 17 Sep 2007 19:12:08 +0000 (19:12 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 17 Sep 2007 19:12:08 +0000 (19:12 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1@801 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

branches/Ndi/core/al/al_cq.c
branches/Ndi/core/al/kernel/al_proxy_ndi.c
branches/Ndi/core/al/kernel/al_proxy_ndi.h

index f70f24dba2ff437f619e33379e241853ab88dfa2..f53de5f2a58e38d5ede5e9ce601e3aec6f57196e 100644 (file)
@@ -97,6 +97,14 @@ create_cq(
        {\r
                return IB_INSUFFICIENT_MEMORY;\r
        }\r
+\r
+#ifdef CL_KERNEL\r
+               /* cancel pending IRPS for NDI type CQ */\r
+               if( !NT_SUCCESS( proxy_ndi_init( h_cq ) ) )\r
+               {\r
+                       return IB_ERROR;\r
+               }\r
+#endif\r
        \r
        if( p_umv_buf )\r
                obj_type |= AL_OBJ_SUBTYPE_UM_EXPORT;\r
@@ -210,12 +218,13 @@ destroying_cq(
                }\r
        }\r
 \r
+       cl_spinlock_release( &h_cq->obj.lock );\r
+\r
 #ifdef CL_KERNEL\r
        /* cancel pending IRPS for NDI type CQ */\r
        proxy_ndi_flush_ques( h_cq );\r
 #endif\r
 \r
-       cl_spinlock_release( &h_cq->obj.lock );\r
 }\r
 \r
 \r
index a21ed341f80bac32e1159e1606b45a9a589ebbb7..f02dc9f2d8ae94b937cecf41846dc58cf395df9c 100644 (file)
 
 #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;
index 8d5cd03c62df3850eb181bdb08289478c433b539..37b08857d6101a010b90c9631285b8d07fdd9e67 100644 (file)
@@ -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