]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
ALTS: Add create/destroy QP test case
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 6 Sep 2005 19:30:32 +0000 (19:30 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 6 Sep 2005 19:30:32 +0000 (19:30 +0000)
Submitted by Yossi Leybovich <sleybo@mellanox.co.il>

git-svn-id: svn://openib.tc.cornell.edu/gen1@61 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/tests/alts/alts_common.h
trunk/tests/alts/createanddestroycq.c
trunk/tests/alts/createanddestroyqp.c [new file with mode: 0644]
trunk/tests/alts/user/SOURCES
trunk/tests/alts/user/alts_main.c
trunk/tests/alts/user/alts_sources.c [deleted file]

index dc355b60a3b3f6ff94681a8954710f496acb3837..fce87c22e2e59bcb3c6674ccb182eb474db8d087 100644 (file)
@@ -157,6 +157,9 @@ typedef enum alts_dev_ops
                                        IOCTL_CODE(ALDEV_KEY, CmTests)\r
 \r
 \r
+#define ALTS_CQ_SIZE 0x50\r
+\r
+\r
 /*\r
  * Function Prototypes for the above test cases\r
  */\r
@@ -187,6 +190,14 @@ al_test_create_destroy_cq( void );
 ib_api_status_t\r
 al_test_query_modify_cq( void );\r
 \r
+\r
+ib_api_status_t\r
+al_test_create_destroy_qp( void );\r
+\r
+ib_api_status_t\r
+al_test_query_modify_qp( void );\r
+\r
+\r
 ib_api_status_t\r
 al_test_create_destroy_eec( void );\r
 \r
@@ -253,4 +264,30 @@ void
 alts_print_ca_attr( ib_ca_attr_t *alts_ca_attr );\r
 \r
 \r
+void\r
+alts_qp_err_cb(\r
+       ib_async_event_rec_t                            *p_err_rec );\r
+\r
+void\r
+alts_qp_destroy_cb(\r
+       void    *context );\r
+\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
 #endif // __ALTS_COMMON_H__\r
index ef0a1ebb3bda035b4f6efbdf296bce9c43207f2c..778033c186a7a78f1d1aed3bc6172c366501c2cb 100644 (file)
 #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
@@ -52,21 +48,6 @@ alts_cq(
        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
@@ -210,8 +191,8 @@ alts_cq(
                        }\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
@@ -229,10 +210,20 @@ alts_cq(
                                                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
@@ -243,8 +234,8 @@ alts_cq(
                                        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
diff --git a/trunk/tests/alts/createanddestroyqp.c b/trunk/tests/alts/createanddestroyqp.c
new file mode 100644 (file)
index 0000000..a7c72e0
--- /dev/null
@@ -0,0 +1,283 @@
+/*\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
index 6903187422e82532f32b087fbef71d8b064d57dd..499a534be1059e96ad5720f72077b469056794df 100644 (file)
@@ -9,6 +9,7 @@ SOURCES=alts_main.c                     \
        ..\alts_misc.c                  \\r
        ..\cmtests.c                    \\r
        ..\createanddestroycq.c \\r
+       ..\createanddestroyqp.c \\r
        ..\createdestroyav.c    \\r
        ..\creatememwindow.c    \\r
        ..\ibquery.c                    \\r
index 3213edf7a6e0d9041f3475feddd878e1ea4ac7c9..ef97cc39a111795ff7c1aec5654f4a92b54e2508 100644 (file)
@@ -182,9 +182,7 @@ ib_api_status_t ib_status = IB_ERROR;
                ib_status = al_test_query_modify_av();\r
                break;\r
        case CreateDestroyQP:\r
-               CL_PRINT( ALTS_DBG_VERBOSE, alts_dbg_lvl,\r
-                       ("altsapp: CreateDestroyQP not implemented.\n") );\r
-               ib_status = IB_SUCCESS;\r
+               ib_status = al_test_create_destroy_qp();\r
                break;\r
        case QueryAndModifyQP:\r
                CL_PRINT( ALTS_DBG_VERBOSE, alts_dbg_lvl,\r
diff --git a/trunk/tests/alts/user/alts_sources.c b/trunk/tests/alts/user/alts_sources.c
deleted file mode 100644 (file)
index bc33fcf..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*\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