#include <alts_common.h>\r
\r
\r
-/*\r
- * //NoteNote parameter that can be changed to test CQ functionality\r
- */\r
\r
-#define ALTS_CQ_SIZE 0x50\r
\r
/*\r
* Function prototypes\r
boolean_t modify_cq_attr\r
);\r
\r
-void\r
-alts_cq_comp_cb(\r
- IN const ib_cq_handle_t h_cq,\r
- IN void *cq_context );\r
-\r
-void\r
-alts_cq_err_cb(\r
- ib_async_event_rec_t *p_err_rec );\r
-\r
-void\r
-alts_cq_destroy_cb(\r
- void *context );\r
-\r
-\r
-\r
/*\r
* Test Case CrateDestroyCQ\r
*/\r
}\r
CL_ASSERT(h_cq);\r
ALTS_PRINT( ALTS_DBG_INFO,\\r
- ("ib_create_cq successful status = %s\n",\r
- ib_get_err_str(ib_status)) );\r
+ ("ib_create_cq successful size = 0x%x status = %s\n",\r
+ cq_create.size, ib_get_err_str(ib_status)) );\r
\r
while( modify_cq_attr == TRUE )\r
{\r
ib_get_err_str(ib_status)) );\r
break;\r
}\r
+\r
+ if(cq_size != cq_create.size)\r
+ {\r
+ ALTS_PRINT( ALTS_DBG_ERROR,\r
+ ("ib_query_cq failed cq_size=0x%x cq_create.cq_size=0x%x\n",\r
+ cq_size,cq_create.size));\r
+ ib_status = IB_INVALID_CQ_SIZE;\r
+ break;\r
+ }\r
+ \r
ALTS_PRINT( ALTS_DBG_INFO,\r
- ("ib_query_cq cq_size = %d\n", cq_size) );\r
+ ("ib_query_cq cq_size = 0x%x\n", cq_size) );\r
\r
- cq_size = 0x50;\r
+ cq_size = 0x90;\r
\r
ib_status = ib_modify_cq(h_cq,&cq_size);\r
if(ib_status != IB_SUCCESS)\r
break;\r
}\r
\r
- ALTS_PRINT( ALTS_DBG_INFO,\r
- ("ib_modify_cq passed for cq_size = %d\n", cq_size) );\r
+ ALTS_PRINT( ALTS_DBG_INFO,\r
+ ("ib_modify_cq passed for cq_size = 0x%x\n", cq_size) );\r
\r
break; //Break for the while\r
}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+#include <iba/ib_types.h>\r
+#include <iba/ib_al.h>\r
+#include <complib/cl_memory.h>\r
+#include <alts_debug.h>\r
+#include <alts_common.h>\r
+\r
+\r
+\r
+\r
+/*\r
+ * Function prototypes\r
+ */\r
+ib_api_status_t\r
+alts_qp(\r
+ boolean_t modify_cq_attr\r
+ );\r
+\r
+\r
+\r
+/*\r
+ * Test Case CrateDestroyQP\r
+ */\r
+\r
+\r
+ib_api_status_t\r
+al_test_create_destroy_qp(void)\r
+{\r
+ boolean_t modify_qp_attr = FALSE;\r
+\r
+ return alts_qp(modify_qp_attr);\r
+}\r
+\r
+ib_api_status_t\r
+al_test_query_modify_qp(void)\r
+{\r
+ boolean_t modify_qp_attr = TRUE;\r
+\r
+ return alts_qp(modify_qp_attr);\r
+}\r
+\r
+\r
+/* Internal Functions */\r
+\r
+ib_api_status_t\r
+alts_qp(\r
+ boolean_t modify_cq_attr\r
+ )\r
+{\r
+ ib_api_status_t ib_status = IB_SUCCESS;\r
+ ib_al_handle_t h_al = NULL;\r
+ ib_ca_handle_t h_ca;\r
+ ib_cq_handle_t h_cq = NULL;\r
+ ib_qp_handle_t h_qp = NULL; \r
+ ib_pd_handle_t h_pd; \r
+ cl_status_t cl_status;\r
+ ib_cq_create_t cq_create;\r
+ ib_qp_create_t qp_create; \r
+ uint32_t bsize; \r
+ ib_ca_attr_t *p_ca_attr = NULL;\r
+ ib_qp_attr_t p_qp_attr;\r
+\r
+\r
+ ALTS_ENTER( ALTS_DBG_VERBOSE );\r
+\r
+ while(1)\r
+ {\r
+ /* Open AL */\r
+ ib_status = alts_open_al(&h_al);\r
+\r
+ if(ib_status != IB_SUCCESS)\r
+ break;\r
+\r
+ CL_ASSERT(h_al);\r
+\r
+ /* Open CA */\r
+ ib_status = alts_open_ca(h_al,&h_ca);\r
+ if(ib_status != IB_SUCCESS)\r
+ break;\r
+\r
+ CL_ASSERT(h_ca);\r
+\r
+ /*\r
+ * Allocate a PD required for CQ\r
+ */\r
+ ib_status = ib_alloc_pd(h_ca, IB_PDT_NORMAL, NULL, &h_pd); //passing null context\r
+\r
+ if(ib_status != IB_SUCCESS)\r
+ {\r
+ ALTS_PRINT( ALTS_DBG_ERROR,\r
+ ("\tib_alloc_pd failed status = %s\n", ib_get_err_str(ib_status)) );\r
+ alts_close_ca(h_ca);\r
+ break;\r
+ }\r
+ ALTS_PRINT( ALTS_DBG_ERROR,\r
+ ("\tib_pd handle = %p\n",h_pd));\r
+\r
+ /*\r
+ * Get the CA Attributest\r
+ * Check for two active ports\r
+ */\r
+\r
+ /*\r
+ * Query the CA\r
+ */\r
+ bsize = 0;\r
+ ib_status = ib_query_ca(h_ca, NULL, &bsize);\r
+ if(ib_status != IB_INSUFFICIENT_MEMORY)\r
+ {\r
+ ALTS_PRINT(ALTS_DBG_ERROR,\r
+ ("ib_query_ca failed with status = %d\n", ib_status) );\r
+ break;\r
+ }\r
+ CL_ASSERT(bsize);\r
+\r
+\r
+\r
+ p_ca_attr = (ib_ca_attr_t *)cl_zalloc(bsize);\r
+ if (!p_ca_attr)\r
+ {\r
+ ALTS_PRINT( ALTS_DBG_ERROR,\r
+ ("zalloc() failed for p_ca_attr!\n") );\r
+ break;\r
+ }\r
+\r
+ ib_status = ib_query_ca(h_ca, p_ca_attr, &bsize);\r
+ if(ib_status != IB_SUCCESS)\r
+ {\r
+ ALTS_PRINT( ALTS_DBG_ERROR,\r
+ ("ib_query_ca failed with status = %d\n", ib_status) );\r
+ break;\r
+ }\r
+\r
+\r
+\r
+\r
+ /*\r
+ * Create CQ Attributes\r
+ */\r
+ cq_create.size = ALTS_CQ_SIZE;\r
+ cq_create.pfn_comp_cb = alts_cq_comp_cb;\r
+ cq_create.h_wait_obj = NULL;\r
+\r
+ ib_status = ib_create_cq(\r
+ h_ca,\r
+ &cq_create,\r
+ NULL,\r
+ alts_cq_err_cb,\r
+ &h_cq );\r
+ CL_ASSERT(ib_status == IB_SUCCESS);\r
+\r
+\r
+ \r
+ /*\r
+ * Create QP Attributes\r
+ */\r
+ qp_create.sq_depth= 1;\r
+ qp_create.rq_depth= 1;\r
+ qp_create.sq_sge = 1;\r
+ qp_create.rq_sge = 1;\r
+ qp_create.h_sq_cq = h_cq; //NULL\r
+ qp_create.h_rq_cq = h_cq;\r
+\r
+ qp_create.sq_signaled = TRUE;\r
+\r
+ qp_create.qp_type = IB_QPT_RELIABLE_CONN;\r
+\r
+ \r
+ ib_status = ib_create_qp(\r
+ h_pd,\r
+ &qp_create,\r
+ NULL,\r
+ alts_qp_err_cb,\r
+ &h_qp);\r
+\r
+ if (ib_status != IB_SUCCESS)\r
+ {\r
+ ALTS_PRINT(ALTS_DBG_ERROR,\r
+ ("Error in ib_create_qp()! %s\n",\r
+ ib_get_err_str(ib_status)));\r
+ ALTS_EXIT(ALTS_DBG_VERBOSE);\r
+ return (ib_status);\r
+ }\r
+\r
+ ib_status = ib_query_qp(h_qp,\r
+ &p_qp_attr);\r
+\r
+ if (ib_status != IB_SUCCESS)\r
+ {\r
+ ALTS_PRINT(ALTS_DBG_ERROR,\r
+ ("Error in query_qp()! %s\n",\r
+ ib_get_err_str(ib_status)));\r
+\r
+ ib_destroy_qp(h_qp,alts_qp_destroy_cb);\r
+ ALTS_EXIT(ALTS_DBG_VERBOSE);\r
+ return (ib_status);\r
+ }\r
+\r
+ ib_status = ib_destroy_qp(h_qp, alts_qp_destroy_cb);\r
+\r
+ if (h_cq)\r
+ ib_status = ib_destroy_cq(h_cq, alts_qp_destroy_cb);\r
+\r
+\r
+ ib_status = ib_dealloc_pd(h_pd,alts_pd_destroy_cb);\r
+ if(ib_status != IB_SUCCESS)\r
+ {\r
+ ALTS_PRINT( ALTS_DBG_ERROR,\r
+ ("ib_dealloc_pd failed status = %s\n",\r
+ ib_get_err_str(ib_status)) );\r
+ }\r
+\r
+ alts_close_ca(h_ca);\r
+\r
+ break; //End of while\r
+ }\r
+\r
+ /* Close AL */\r
+ if(h_al)\r
+ alts_close_al(h_al);\r
+\r
+ ALTS_EXIT( ALTS_DBG_VERBOSE);\r
+ return ib_status;\r
+}\r
+\r
+void\r
+alts_qp_err_cb(\r
+ ib_async_event_rec_t *p_err_rec )\r
+{\r
+ ALTS_ENTER( ALTS_DBG_VERBOSE );\r
+\r
+ UNUSED_PARAM( p_err_rec );\r
+\r
+ ALTS_EXIT( ALTS_DBG_VERBOSE);\r
+}\r
+\r
+void\r
+alts_qp_destroy_cb(\r
+ void *context\r
+ )\r
+{\r
+ ALTS_ENTER( ALTS_DBG_VERBOSE );\r
+\r
+ UNUSED_PARAM( context );\r
+\r
+ ALTS_EXIT( ALTS_DBG_VERBOSE);\r
+}\r
+\r
+\r
+\r
+\r
+++ /dev/null
-/*\r
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
- *\r
- * This software is available to you under the OpenIB.org BSD license\r
- * below:\r
- *\r
- * Redistribution and use in source and binary forms, with or\r
- * without modification, are permitted provided that the following\r
- * conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer.\r
- *\r
- * - Redistributions in binary form must reproduce the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer in the documentation and/or other materials\r
- * provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id$\r
- */\r
-\r
-/* \r
- * Include all files that are not in the current directory.\r
- */\r
-\r
-#include "../../shared/alts/allocdeallocpd.c"\r
-#include "../../shared/alts/alts_misc.c"\r
-#include "../../shared/alts/cmtests.c"\r
-#include "../../shared/alts/createanddestroycq.c"\r
-#include "../../shared/alts/createdestroyav.c"\r
-#include "../../shared/alts/creatememwindow.c"\r
-#include "../../shared/alts/ibquery.c"\r
-#include "../../shared/alts/madtests.c"\r
-#include "../../shared/alts/multisendrecv.c"\r
-#include "../../shared/alts/openclose.c"\r
-#include "../../shared/alts/querycaattr.c"\r
-#include "../../shared/alts/registermemregion.c"\r
-#include "../../shared/alts/registerpnp.c"\r
-#include "../../shared/alts/smatests.c"\r