[ofw] [Patch 34/62] Reference implementation of NDv2

Fab Tillier ftillier at microsoft.com
Wed Feb 20 18:13:13 PST 2013


Fix a bug in the kal_cep_listen implementation.

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

diff -dwup3 -X excl.txt -r \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\al\kernel\al_cm_cep.c .\core\al\kernel\al_cm_cep.c
--- \dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\al\kernel\al_cm_cep.c	Fri Aug 03 17:24:07 2012
+++ .\core\al\kernel\al_cm_cep.c	Wed Aug 08 14:41:46 2012
@@ -4002,24 +4002,14 @@ __drep_cep(
 	AL_EXIT( AL_DBG_CM );
 }
 
-/* Called with CEP manager lock held. */
-static int32_t
-__cleanup_cep(
+
+static inline void
+__cleanup_mad_list(
 	IN				kcep_t* const				p_cep )
 {
 	ib_mad_element_t	*p_mad;
 	kcep_t				*p_new_cep;
 
-	AL_PRINT( TRACE_LEVEL_VERBOSE, AL_DBG_CM,
-		("[ p_cep = %p (CID = %d)\n", p_cep, p_cep->cid) );
-
-	CL_ASSERT( p_cep );
-	CL_ASSERT( KeGetCurrentIrql() == DISPATCH_LEVEL );
-
-	/* If we've already come through here, we're done. */
-	CL_ASSERT( p_cep->state != CEP_STATE_DESTROY &&
-		p_cep->state != CEP_STATE_DREQ_DESTROY );
-
 	/* Cleanup the pending MAD list. */
 	while( p_cep->p_mad_head )
 	{
@@ -4035,6 +4025,42 @@ __cleanup_cep(
 		}
 		ib_put_mad( p_mad );
 	}
+}
+
+
+static void
+__cancel_listen(
+    IN              kcep_t* const               p_cep )
+{
+    CL_ASSERT( p_cep->state == CEP_STATE_LISTEN );
+    /* Remove from listen map. */
+    cl_rbmap_remove_item( &gp_cep_mgr->listen_map, &p_cep->listen_item );
+
+    if( p_cep->p_cmp_buf )
+    {
+        cl_free( p_cep->p_cmp_buf );
+        p_cep->p_cmp_buf = NULL;
+    }
+}
+
+
+/* Called with CEP manager lock held. */
+static int32_t
+__cleanup_cep(
+	IN				kcep_t* const				p_cep )
+{
+	AL_PRINT( TRACE_LEVEL_VERBOSE, AL_DBG_CM,
+		("[ p_cep = %p (CID = %d)\n", p_cep, p_cep->cid) );
+
+	CL_ASSERT( p_cep );
+	CL_ASSERT( KeGetCurrentIrql() == DISPATCH_LEVEL );
+
+	/* If we've already come through here, we're done. */
+	CL_ASSERT( p_cep->state != CEP_STATE_DESTROY &&
+		p_cep->state != CEP_STATE_DREQ_DESTROY );
+
+	/* Cleanup the pending MAD list. */
+    __cleanup_mad_list( p_cep );
 
 	switch( p_cep->state )
 	{
@@ -4094,14 +4120,7 @@ __cleanup_cep(
 		break;
 
 	case CEP_STATE_LISTEN:
-		/* Remove from listen map. */
-		cl_rbmap_remove_item( &gp_cep_mgr->listen_map, &p_cep->listen_item );
-
-		if( p_cep->p_cmp_buf )
-		{
-			cl_free( p_cep->p_cmp_buf );
-			p_cep->p_cmp_buf = NULL;
-		}
+        __cancel_listen( p_cep );
 		break;
 
 	case CEP_STATE_PRE_REQ:
@@ -4291,15 +4310,10 @@ kal_cep_cancel_listen(
 		return IB_INVALID_HANDLE;
 	}
 
-	cl_atomic_inc( &p_cep->ref_cnt );
-    /*
-     * Note that __cleanup_cep will decrement the ref_cnt.
-     */
-	__cleanup_cep( p_cep );
-    /*
-     * __cleanup_cep flipped the state to DESTROY, move it to IDLE.
-     */
+    __cleanup_mad_list( p_cep );
+    __cancel_listen( p_cep );
     p_cep->state = CEP_STATE_IDLE;
+
 	KeReleaseInStackQueuedSpinLock( &hdl );
     return STATUS_SUCCESS;
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndv2.34.patch
Type: application/octet-stream
Size: 2902 bytes
Desc: ndv2.34.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20130221/e2579e8c/attachment.obj>


More information about the ofw mailing list