[ofw] [PATCH 1/4] ib_cm: drop incoming REQs if backlog is full

Sean Hefty sean.hefty at intel.com
Tue Mar 10 16:36:47 PDT 2009


Simply drop, rather than reject, received REQs if the user's current
backlog of REQs is full.  This avoids rejecting REQs that come in a
large connection burst.

Without this patch, large connection tests can fail when using winverbs to
establish connections.  Winverbs requires a waiting endpoint to
associated with a new REQ in order to avoids storing a potentially
growing list of pending REQs.

A similar feature was added to the Linux stack to support SDP.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
If I can get an ACK on this, I will commit with the other patches in
this series.

diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\core\al/al_cm_cep.h branches\winverbs\core\al/al_cm_cep.h
--- trunk\core\al/al_cm_cep.h	2009-01-24 11:15:06.093750000 -0800
+++ branches\winverbs\core\al/al_cm_cep.h	2009-03-10 15:38:41.304125000 -0700
@@ -199,7 +199,8 @@ kal_cep_config_pre_rep_copy_cid(
 void
 kal_cep_destroy(
 	IN				ib_al_handle_t				h_al,
-	IN				net32_t						cid );
+	IN				net32_t						cid,
+	IN				NTSTATUS					status );
 #endif
 
 ib_api_status_t
Only in branches\winverbs\core\al: Driver
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\core\al/kernel/al_cm.c branches\winverbs\core\al/kernel/al_cm.c
--- trunk\core\al/kernel/al_cm.c	2009-01-23 15:17:35.684875600 -0800
+++ branches\winverbs\core\al/kernel/al_cm.c	2009-03-03 15:50:40.891280600 -0800
@@ -90,7 +90,7 @@ cm_cep_handler(const ib_al_handle_t h_al
 
 			id = cm_alloc_id(listen_id->callback, listen_id);
 			if (id == NULL) {
-				kal_cep_destroy(h_al, new_cid);
+				kal_cep_destroy(h_al, new_cid, STATUS_NO_MORE_ENTRIES);
 				ib_put_mad(mad);
 				continue;
 			}
@@ -103,7 +103,7 @@ cm_cep_handler(const ib_al_handle_t h_al
 		status = id->callback(id, &event);
 		if (!NT_SUCCESS(status)) {
 			kal_cep_config(h_al, new_cid, NULL, NULL, NULL);
-			kal_cep_destroy(h_al, id->cid);
+			kal_cep_destroy(h_al, id->cid, status);
 			cm_free_id(id);
 		}
 		ib_put_mad(mad);
@@ -139,7 +139,7 @@ cm_destroy_id(iba_cm_id *p_id)
 	iba_cm_id_priv	*id;
 
 	id = CONTAINING_RECORD(p_id, iba_cm_id_priv, id);
-	kal_cep_destroy(gh_al, p_id->cid);
+	kal_cep_destroy(gh_al, p_id->cid, STATUS_SUCCESS);
 	KeWaitForSingleObject(&id->destroy_event, Executive, KernelMode, FALSE, NULL);
 	cm_free_id(p_id);
 }
diff -up -r -X trunk\docs\dontdiff.txt -I '\$Id:' trunk\core\al/kernel/al_cm_cep.c branches\winverbs\core\al/kernel/al_cm_cep.c
--- trunk\core\al/kernel/al_cm_cep.c	2009-03-02 14:58:52.596000000 -0800
+++ branches\winverbs\core\al/kernel/al_cm_cep.c	2009-03-10 15:38:41.319750000 -0700
@@ -4207,9 +4207,35 @@ al_destroy_cep(
 void
 kal_cep_destroy(
 	IN				ib_al_handle_t				h_al,
-	IN				net32_t						cid )
+	IN				net32_t						cid,
+	IN				NTSTATUS					status )
 {
-	al_destroy_cep(h_al, &cid, FALSE);
+	KLOCK_QUEUE_HANDLE	hdl;
+	kcep_t				*p_cep;
+    ib_pfn_destroy_cb_t pfn_destroy_cb;
+	void				*context;
+	int32_t				ref_cnt;
+
+	KeAcquireInStackQueuedSpinLock( &gp_cep_mgr->lock, &hdl );
+	p_cep = __lookup_cep( h_al, cid );
+	CL_ASSERT( p_cep );
+
+	context = p_cep->context;
+	pfn_destroy_cb = p_cep->pfn_destroy_cb;
+
+	__unbind_cep( p_cep );
+	/* Drop new REQs so they can be retried when resources may be available */
+	if( status == STATUS_NO_MORE_ENTRIES &&
+		(p_cep->state == CEP_STATE_REQ_RCVD ||
+		 p_cep->state == CEP_STATE_REQ_MRA_SENT) )
+	{
+		p_cep->state = CEP_STATE_IDLE;
+	}
+	ref_cnt = __cleanup_cep( p_cep );
+	KeReleaseInStackQueuedSpinLock( &hdl );
+
+	if( !ref_cnt && pfn_destroy_cb )
+		pfn_destroy_cb( context );
 }
 
 





More information about the ofw mailing list