[Openib-windows] [PATCH] query-cq

Yossi Leybovich sleybo at mellanox.co.il
Tue Sep 6 07:15:30 PDT 2005


Hello Fab,

Attached is a patch for query cq, the patch also includes few checks to the
alts test. 
Our verification team found that the return size in query_cq is different
from the size that was return in create_cq VERB.
The reason is that when creating cq  the THH layer allocate some spare cqes
(for DB coalsing) and return the size that was requested by the user 
But the query_cq IOCTL use the kernel tables for the size which use the
actual size (usually a bigger size).
The patch simply finish the query in UL without calling the IOCTL so the UL
always get the same size .
(its very similar to the query_av )

Thanks, 
Yossi


Signed-off-by: Yossi Leybovich <sleybo at mellanox.co.il>

Index: core/al/user/ual_cq.c
===================================================================
--- core/al/user/ual_cq.c	(revision 346)
+++ core/al/user/ual_cq.c	(working copy)
@@ -306,13 +306,24 @@
 	{
 		/* Pre call to the UVP library */
 		status = uvp_intf.pre_query_cq( h_cq->h_ci_cq,
&cq_ioctl.in.umv_buf );
-		if( status != IB_SUCCESS )
+		if( status == IB_VERBS_PROCESSING_DONE )
 		{
+			/* Creation is done entirely in user mode.  Issue
the post call */
+			if( uvp_intf.post_query_cq)
+			{
+				uvp_intf.post_query_cq( h_cq->h_ci_cq,
+					IB_SUCCESS, p_size,
&cq_ioctl.out.umv_buf );
+			}
 			AL_EXIT( AL_DBG_CQ );
+			return IB_SUCCESS;
+		}
+		else if( status != IB_SUCCESS )
+		{
+			AL_EXIT( AL_DBG_CQ );
 			return status;
 		}
 	}
-
+		
 	cq_ioctl.in.h_cq = h_cq->obj.hdl;
 
 	cl_status = do_al_dev_ioctl( UAL_QUERY_CQ,
@@ -329,17 +340,18 @@
 	else
 	{
 		status = cq_ioctl.out.status;
-		if( status == IB_SUCCESS )
-			*p_size = cq_ioctl.out.size;
 	}
 
 	/* Post uvp call */
 	if( h_cq->h_ci_cq && uvp_intf.post_query_cq )
 	{
 		uvp_intf.post_query_cq( h_cq->h_ci_cq,
-			status, cq_ioctl.out.size, &cq_ioctl.out.umv_buf );
+			status, &cq_ioctl.out.size, &cq_ioctl.out.umv_buf );
 	}
 
+	if( status == IB_SUCCESS )
+		*p_size = cq_ioctl.out.size;
+	
 	AL_EXIT( AL_DBG_CQ );
 	return status;
 }
Index: hw/mt23108/user/mlnx_ual_cq.c
===================================================================
--- hw/mt23108/user/mlnx_ual_cq.c	(revision 346)
+++ hw/mt23108/user/mlnx_ual_cq.c	(working copy)
@@ -48,8 +48,8 @@
     p_uvp->pre_create_cq  = mlnx_pre_create_cq;
     p_uvp->post_create_cq = mlnx_post_create_cq;
   
-    p_uvp->pre_query_cq  = NULL;
-    p_uvp->post_query_cq = NULL;
+    p_uvp->pre_query_cq  = mlnx_pre_query_cq;
+    p_uvp->post_query_cq = mlnx_post_query_cq;
 
     p_uvp->pre_resize_cq  = mlnx_pre_resize_cq;
     p_uvp->post_resize_cq = mlnx_post_resize_cq;
@@ -441,22 +441,37 @@
     CL_ASSERT(p_umv_buf);
     p_umv_buf->command = TRUE;
     FUNC_EXIT;
-    return IB_SUCCESS;
+    return IB_VERBS_PROCESSING_DONE;
 }
 
 
 void
 mlnx_post_query_cq (
-    IN		const ib_cq_handle_t		h_uvp_cq,
-    IN		ib_api_status_t			ioctl_status,
-    IN OUT	ci_umv_buf_t			*p_umv_buf)
+    IN		const 	ib_cq_handle_t		h_uvp_cq,
+    IN				ib_api_status_t		ioctl_status,
+    IN OUT			uint32_t*  const 		p_size,
+    IN 				ci_umv_buf_t
*p_umv_buf)
 {
+    ib_api_status_t status;
+    mlnx_ual_cq_info_t *p_cq_info = (mlnx_ual_cq_info_t *)((void*) 
+ h_uvp_cq);
+
     FUNC_ENTER;
+    CL_ASSERT(p_umv_buf);
+    CL_ASSERT(p_cq_info);
+
+    status = ioctl_status;
+    if (status == IB_SUCCESS)
+    {
+    	*p_size = p_cq_info->cq_size;
+
+        status = IB_VERBS_PROCESSING_DONE;
+    }
+    
     FUNC_EXIT;
-    return;
+    return;	
 }
+   
 
-
 ib_api_status_t
 mlnx_pre_destroy_cq (
     IN		const ib_cq_handle_t			h_uvp_cq)
Index: hw/mt23108/user/mlnx_ual_main.c
===================================================================
--- hw/mt23108/user/mlnx_ual_main.c	(revision 346)
+++ hw/mt23108/user/mlnx_ual_main.c	(working copy)
@@ -32,7 +32,7 @@
 
 #include "mlnx_ual_main.h"
 
-u_int32_t	mlnx_dbg_lvl = 0; // MLNX_TRACE_LVL_8;
+u_int32_t	mlnx_dbg_lvl = MLNX_TRACE_LVL_8;
 
 
 static void uvp_init();
Index: hw/mt23108/user/mlnx_ual_main.h
===================================================================
--- hw/mt23108/user/mlnx_ual_main.h	(revision 346)
+++ hw/mt23108/user/mlnx_ual_main.h	(working copy)
@@ -257,6 +257,7 @@
 mlnx_post_query_cq (
     IN		const ib_cq_handle_t		h_uvp_cq,
     IN		ib_api_status_t				ioctl_status,
+    IN OUT	uint32_t* 			const p_size,
     IN OUT	ci_umv_buf_t				*p_umv_buf);
 
 ib_api_status_t  
Index: inc/user/iba/ib_uvp.h
===================================================================
--- inc/user/iba/ib_uvp.h	(revision 346)
+++ inc/user/iba/ib_uvp.h	(working copy)
@@ -1789,7 +1789,7 @@
 (AL_API *uvp_post_query_cq_t) (
 	IN		const	ib_cq_handle_t
h_uvp_cq,
 	IN				ib_api_status_t
ioctl_status,
-	IN		const	uint32_t
size,
+	IN OUT			uint32_t
*size,
 	IN				ci_umv_buf_t
*p_umv_buf );
 
 /*
@@ -1803,7 +1803,7 @@
 *	ioctl_status
 *		[in] The ioctl status of the AL API.
 *	size
-*		[in] The size of the CQ retuned by the IOCTL.
+*		[in out] On input size of the CQ retuned by the IOCTL.
 *	p_umv_buf
 *		[in out] On input, it contains any vendor-specific private
information
 *		exchanged with the vendor's Verbs Provider Driver
(uvp_pre_query_cq).
Index: tests/alts/createanddestroycq.c
===================================================================
--- tests/alts/createanddestroycq.c	(revision 346)
+++ tests/alts/createanddestroycq.c	(working copy)
@@ -210,8 +210,8 @@
 			}
 			CL_ASSERT(h_cq);
 			ALTS_PRINT( ALTS_DBG_INFO,\
-				("ib_create_cq successful status = %s\n",
-				ib_get_err_str(ib_status)) );
+				("ib_create_cq successful size = 0x%x status
= %s\n",
+				cq_create.size, ib_get_err_str(ib_status))
);
 
 			while( modify_cq_attr == TRUE )
 			{
@@ -229,10 +229,20 @@
 						ib_get_err_str(ib_status))
);
 					break;
 				}
+
+				if(cq_size != cq_create.size)
+				{
+					ALTS_PRINT( ALTS_DBG_ERROR,
+						("ib_query_cq failed
cq_size=0x%x cq_create.cq_size=0x%x\n",
+						cq_size,cq_create.size));
+					ib_status = IB_INVALID_CQ_SIZE;
+					break;
+				}
+				
 				ALTS_PRINT( ALTS_DBG_INFO,
-					("ib_query_cq cq_size = %d\n",
cq_size) );
+					("ib_query_cq cq_size = 0x%x\n",
cq_size) );
 
-				cq_size = 0x50;
+				cq_size = 0x90;
 
 				ib_status = ib_modify_cq(h_cq,&cq_size);
 				if(ib_status != IB_SUCCESS)
@@ -243,8 +253,8 @@
 					break;
 				}
 
-			ALTS_PRINT( ALTS_DBG_INFO,
-				("ib_modify_cq passed for cq_size = %d\n",
cq_size) );
+				ALTS_PRINT( ALTS_DBG_INFO,
+					("ib_modify_cq passed for cq_size =
0x%x\n", cq_size) );
 
 				break; //Break for the while
 			}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20050906/5aa5a251/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: query_cq.patch
Type: application/octet-stream
Size: 5840 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20050906/5aa5a251/attachment.obj>


More information about the ofw mailing list