Version: 1
-Previous: d10925f961fd03dab355b8f5eda6b1ffddd284bf
-Head: 21f6757e4f664eaf7a40391b04558dad88b1992a
+Previous: 0c1e2e94e216d875f17f223b10171a3a94f1e295
+Head: a7ee9e9907d1f29e106ff6538c583cfd4016f6df
Applied:
sync: 452ce3b051e10e10363baa77834962a89267e052
pre-af-ib: 73504ef1f812bea6d1fd59f194f90e5194ca2efa
gai: 22a27cbc8c17e08322878c0b84167c75dde413d2
getreq: e7e1236356b8048c88055b7ff076d0674fd35de9
ep: a320aeb996239abb6e7b792863d758c704a0bfcc
- samples: c8f95e89834d07c8eff1d0fda4856d7845e7aabc
- refresh-temp: 21f6757e4f664eaf7a40391b04558dad88b1992a
+ samples: a7ee9e9907d1f29e106ff6538c583cfd4016f6df
Unapplied:
cq-status: d4535a68c8d41302c9ee9d44b98a75ea19b4f172
wv-rm-ioctl: 2c4f8b27f89993bc9c1215e8c358046b2934f755
+++ /dev/null
-Bottom: 09f967cd87e4b0cf73dc498ed3513fad0e2106e5
-Top: 97cc703ba6aa74f1f87ee5abc25c5f4c98db0649
-Author: Sean Hefty <sean.hefty@intel.com>
-Date: 2010-08-16 13:45:50 -0700
-
-Refresh of samples
-
----
-
-diff --git a/trunk/ulp/librdmacm/examples/rdma_client/SOURCES b/trunk/ulp/librdmacm/examples/rdma_client/SOURCES
-index 2072676..3073041 100644
---- a/trunk/ulp/librdmacm/examples/rdma_client/SOURCES
-+++ b/trunk/ulp/librdmacm/examples/rdma_client/SOURCES
-@@ -6,9 +6,6 @@ UMTYPE = console
- UMENTRY = main\r
- \r
- USE_MSVCRT = 1\r
--USE_STL = 1\r
--USE_NATIVE_EH = 1\r
--USE_IOSTREAM = 1\r
- \r
- SOURCES = rdma_client.c\r
- \r
-diff --git a/trunk/ulp/librdmacm/examples/rdma_client/rdma_client.c b/trunk/ulp/librdmacm/examples/rdma_client/rdma_client.c
-index 7a59d97..438493d 100644
---- a/trunk/ulp/librdmacm/examples/rdma_client/rdma_client.c
-+++ b/trunk/ulp/librdmacm/examples/rdma_client/rdma_client.c
-@@ -27,13 +27,13 @@
- * SOFTWARE.
- */
-
--#include <stdio.h>
--#include <stdlib.h>
--#include <string.h>
--#include <errno.h>
--#include <getopt.h>
--#include <rdma/rdma_cma.h>
--#include <rdma/rdma_verbs.h>
-+#include <stdio.h>\r
-+#include <stdlib.h>\r
-+#include <string.h>\r
-+\r
-+#include "..\..\..\..\etc\user\getopt.c"\r
-+#include <rdma/rdma_verbs.h>\r
-+#include <rdma/rdma_cma.h>\r
-
- static char *server = "127.0.0.1";
- static char *port = "7471";
-diff --git a/trunk/ulp/librdmacm/examples/rdma_server/SOURCES b/trunk/ulp/librdmacm/examples/rdma_server/SOURCES
-index d658889..70396d0 100644
---- a/trunk/ulp/librdmacm/examples/rdma_server/SOURCES
-+++ b/trunk/ulp/librdmacm/examples/rdma_server/SOURCES
-@@ -6,9 +6,6 @@ UMTYPE = console
- UMENTRY = main\r
- \r
- USE_MSVCRT = 1\r
--USE_STL = 1\r
--USE_NATIVE_EH = 1\r
--USE_IOSTREAM = 1\r
- \r
- SOURCES = rdma_server.c\r
- \r
-diff --git a/trunk/ulp/librdmacm/examples/rdma_server/rdma_server.c b/trunk/ulp/librdmacm/examples/rdma_server/rdma_server.c
-index 2831d0c..575ad44 100644
---- a/trunk/ulp/librdmacm/examples/rdma_server/rdma_server.c
-+++ b/trunk/ulp/librdmacm/examples/rdma_server/rdma_server.c
-@@ -1,149 +1,148 @@
--/*
-- * Copyright (c) 2005-2009 Intel Corporation. All rights reserved.
-- *
-- * This software is available to you under the OpenIB.org BSD license
-- * below:
-- *
-- * Redistribution and use in source and binary forms, with or
-- * without modification, are permitted provided that the following
-- * conditions are met:
-- *
-- * - Redistributions of source code must retain the above
-- * copyright notice, this list of conditions and the following
-- * disclaimer.
-- *
-- * - Redistributions in binary form must reproduce the above
-- * copyright notice, this list of conditions and the following
-- * disclaimer in the documentation and/or other materials
-- * provided with the distribution.
-- *
-- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
-- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- * SOFTWARE.
-- */
--
--#include <stdio.h>
--#include <stdlib.h>
--#include <string.h>
--#include <errno.h>
--#include <getopt.h>
--#include <netdb.h>
--#include <rdma/rdma_cma.h>
--#include <rdma/rdma_verbs.h>
--
--static char *port = "7471";
--
--struct rdma_cm_id *listen_id, *id;
--struct ibv_mr *mr;
--uint8_t send_msg[16];
--uint8_t recv_msg[16];
--
--static int run(void)
--{
-- struct rdma_addrinfo hints, *res;
-- struct ibv_qp_init_attr attr;
-- struct ibv_wc wc;
-- int ret;
--
-- memset(&hints, 0, sizeof hints);
-- hints.ai_flags = RAI_PASSIVE;
-- hints.ai_port_space = RDMA_PS_TCP;
-- ret = rdma_getaddrinfo(NULL, port, &hints, &res);
-- if (ret) {
-- printf("rdma_getaddrinfo %d\n", errno);
-- return ret;
-- }
--
-- memset(&attr, 0, sizeof attr);
-- attr.cap.max_send_wr = attr.cap.max_recv_wr = 1;
-- attr.cap.max_send_sge = attr.cap.max_recv_sge = 1;
-- attr.cap.max_inline_data = 16;
-- attr.sq_sig_all = 1;
-- ret = rdma_create_ep(&listen_id, res, NULL, &attr);
-- rdma_freeaddrinfo(res);
-- if (ret) {
-- printf("rdma_create_ep %d\n", errno);
-- return ret;
-- }
--
-- ret = rdma_listen(listen_id, 0);
-- if (ret) {
-- printf("rdma_listen %d\n", errno);
-- return ret;
-- }
--
-- ret = rdma_get_request(listen_id, &id);
-- if (ret) {
-- printf("rdma_get_request %d\n", errno);
-- return ret;
-- }
--
-- mr = rdma_reg_msgs(id, recv_msg, 16);
-- if (!mr) {
-- printf("rdma_reg_msgs %d\n", errno);
-- return ret;
-- }
--
-- ret = rdma_post_recv(id, NULL, recv_msg, 16, mr);
-- if (ret) {
-- printf("rdma_post_recv %d\n", errno);
-- return ret;
-- }
--
-- ret = rdma_accept(id, NULL);
-- if (ret) {
-- printf("rdma_connect %d\n", errno);
-- return ret;
-- }
--
-- ret = rdma_get_recv_comp(id, &wc);
-- if (ret <= 0) {
-- printf("rdma_get_recv_comp %d\n", ret);
-- return ret;
-- }
--
-- ret = rdma_post_send(id, NULL, send_msg, 16, NULL, IBV_SEND_INLINE);
-- if (ret) {
-- printf("rdma_post_send %d\n", errno);
-- return ret;
-- }
--
-- ret = rdma_get_send_comp(id, &wc);
-- if (ret <= 0) {
-- printf("rdma_get_send_comp %d\n", ret);
-- return ret;
-- }
--
-- rdma_disconnect(id);
-- rdma_dereg_mr(mr);
-- rdma_destroy_ep(id);
-- rdma_destroy_ep(listen_id);
-- return 0;
--}
--
--int main(int argc, char **argv)
--{
-- int op, ret;
--
-- while ((op = getopt(argc, argv, "p:")) != -1) {
-- switch (op) {
-- case 'p':
-- port = optarg;
-- break;
-- default:
-- printf("usage: %s\n", argv[0]);
-- printf("\t[-p port_number]\n");
-- exit(1);
-- }
-- }
--
-- printf("rdma_server: start\n");
-- ret = run();
-- printf("rdma_server: end %d\n", ret);
-- return ret;
--}
-+/*\r
-+ * Copyright (c) 2005-2010 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 AWV\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
-+\r
-+#include <stdio.h>\r
-+#include <stdlib.h>\r
-+#include <string.h>\r
-+\r
-+#include "..\..\..\..\etc\user\getopt.c"\r
-+#include <rdma/rdma_verbs.h>\r
-+#include <rdma/rdma_cma.h>\r
-+\r
-+static char *port = "7471";\r
-+\r
-+struct rdma_cm_id *listen_id, *id;\r
-+struct ibv_mr *mr;\r
-+uint8_t send_msg[16];\r
-+uint8_t recv_msg[16];\r
-+\r
-+static int run(void)\r
-+{\r
-+ struct rdma_addrinfo hints, *res;\r
-+ struct ibv_qp_init_attr attr;\r
-+ struct ibv_wc wc;\r
-+ int ret;\r
-+\r
-+ memset(&hints, 0, sizeof hints);\r
-+ hints.ai_flags = RAI_PASSIVE;\r
-+ hints.ai_port_space = RDMA_PS_TCP;\r
-+ ret = rdma_getaddrinfo(NULL, port, &hints, &res);\r
-+ if (ret) {\r
-+ printf("rdma_getaddrinfo %d\n", errno);\r
-+ return ret;\r
-+ }\r
-+\r
-+ memset(&attr, 0, sizeof attr);\r
-+ attr.cap.max_send_wr = attr.cap.max_recv_wr = 1;\r
-+ attr.cap.max_send_sge = attr.cap.max_recv_sge = 1;\r
-+ attr.cap.max_inline_data = 16;\r
-+ attr.sq_sig_all = 1;\r
-+ ret = rdma_create_ep(&listen_id, res, NULL, &attr);\r
-+ rdma_freeaddrinfo(res);\r
-+ if (ret) {\r
-+ printf("rdma_create_ep %d\n", errno);\r
-+ return ret;\r
-+ }\r
-+\r
-+ ret = rdma_listen(listen_id, 0);\r
-+ if (ret) {\r
-+ printf("rdma_listen %d\n", errno);\r
-+ return ret;\r
-+ }\r
-+\r
-+ ret = rdma_get_request(listen_id, &id);\r
-+ if (ret) {\r
-+ printf("rdma_get_request %d\n", errno);\r
-+ return ret;\r
-+ }\r
-+\r
-+ mr = rdma_reg_msgs(id, recv_msg, 16);\r
-+ if (!mr) {\r
-+ printf("rdma_reg_msgs %d\n", errno);\r
-+ return ret;\r
-+ }\r
-+\r
-+ ret = rdma_post_recv(id, NULL, recv_msg, 16, mr);\r
-+ if (ret) {\r
-+ printf("rdma_post_recv %d\n", errno);\r
-+ return ret;\r
-+ }\r
-+\r
-+ ret = rdma_accept(id, NULL);\r
-+ if (ret) {\r
-+ printf("rdma_connect %d\n", errno);\r
-+ return ret;\r
-+ }\r
-+\r
-+ ret = rdma_get_recv_comp(id, &wc);\r
-+ if (ret <= 0) {\r
-+ printf("rdma_get_recv_comp %d\n", ret);\r
-+ return ret;\r
-+ }\r
-+\r
-+ ret = rdma_post_send(id, NULL, send_msg, 16, NULL, IBV_SEND_INLINE);\r
-+ if (ret) {\r
-+ printf("rdma_post_send %d\n", errno);\r
-+ return ret;\r
-+ }\r
-+\r
-+ ret = rdma_get_send_comp(id, &wc);\r
-+ if (ret <= 0) {\r
-+ printf("rdma_get_send_comp %d\n", ret);\r
-+ return ret;\r
-+ }\r
-+\r
-+ rdma_disconnect(id);\r
-+ rdma_dereg_mr(mr);\r
-+ rdma_destroy_ep(id);\r
-+ rdma_destroy_ep(listen_id);\r
-+ return 0;\r
-+}\r
-+\r
-+int main(int argc, char **argv)\r
-+{\r
-+ int op, ret;\r
-+\r
-+ while ((op = getopt(argc, argv, "p:")) != -1) {\r
-+ switch (op) {\r
-+ case 'p':\r
-+ port = optarg;\r
-+ break;\r
-+ default:\r
-+ printf("usage: %s\n", argv[0]);\r
-+ printf("\t[-p port_number]\n");\r
-+ exit(1);\r
-+ }\r
-+ }\r
-+\r
-+ printf("rdma_server: start\n");\r
-+ ret = run();\r
-+ printf("rdma_server: end %d\n", ret);\r
-+ return ret;\r
-+}
Bottom: df75a059b0d2b3c5fd0544055c2f2cbbb05a2707
-Top: 09f967cd87e4b0cf73dc498ed3513fad0e2106e5
+Top: 97cc703ba6aa74f1f87ee5abc25c5f4c98db0649
Author: Sean Hefty <sean.hefty@intel.com>
Date: 2010-08-16 12:05:39 -0700
+ rdma_client\r
diff --git a/trunk/ulp/librdmacm/examples/rdma_client/SOURCES b/trunk/ulp/librdmacm/examples/rdma_client/SOURCES
new file mode 100644
-index 0000000..2072676
+index 0000000..3073041
--- /dev/null
+++ b/trunk/ulp/librdmacm/examples/rdma_client/SOURCES
-@@ -0,0 +1,31 @@
+@@ -0,0 +1,28 @@
+TARGETNAME = rdma_client\r
+TARGETPATH = ..\..\..\..\bin\user\obj$(BUILD_ALT_DIR)\r
+TARGETTYPE = PROGRAM\r
+UMENTRY = main\r
+\r
+USE_MSVCRT = 1\r
-+USE_STL = 1\r
-+USE_NATIVE_EH = 1\r
-+USE_IOSTREAM = 1\r
+\r
+SOURCES = rdma_client.c\r
+ \r
+!INCLUDE ..\..\..\..\inc\openib.def\r
diff --git a/trunk/ulp/librdmacm/examples/rdma_client/rdma_client.c b/trunk/ulp/librdmacm/examples/rdma_client/rdma_client.c
new file mode 100644
-index 0000000..7a59d97
+index 0000000..438493d
--- /dev/null
+++ b/trunk/ulp/librdmacm/examples/rdma_client/rdma_client.c
@@ -0,0 +1,134 @@
+ * SOFTWARE.
+ */
+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <errno.h>
-+#include <getopt.h>
-+#include <rdma/rdma_cma.h>
-+#include <rdma/rdma_verbs.h>
++#include <stdio.h>\r
++#include <stdlib.h>\r
++#include <string.h>\r
++\r
++#include "..\..\..\..\etc\user\getopt.c"\r
++#include <rdma/rdma_verbs.h>\r
++#include <rdma/rdma_cma.h>\r
+
+static char *server = "127.0.0.1";
+static char *port = "7471";
+}
diff --git a/trunk/ulp/librdmacm/examples/rdma_server/SOURCES b/trunk/ulp/librdmacm/examples/rdma_server/SOURCES
new file mode 100644
-index 0000000..d658889
+index 0000000..70396d0
--- /dev/null
+++ b/trunk/ulp/librdmacm/examples/rdma_server/SOURCES
-@@ -0,0 +1,31 @@
+@@ -0,0 +1,28 @@
+TARGETNAME = rdma_server\r
+TARGETPATH = ..\..\..\..\bin\user\obj$(BUILD_ALT_DIR)\r
+TARGETTYPE = PROGRAM\r
+UMENTRY = main\r
+\r
+USE_MSVCRT = 1\r
-+USE_STL = 1\r
-+USE_NATIVE_EH = 1\r
-+USE_IOSTREAM = 1\r
+\r
+SOURCES = rdma_server.c\r
+ \r
+!INCLUDE ..\..\..\..\inc\openib.def\r
diff --git a/trunk/ulp/librdmacm/examples/rdma_server/rdma_server.c b/trunk/ulp/librdmacm/examples/rdma_server/rdma_server.c
new file mode 100644
-index 0000000..2831d0c
+index 0000000..575ad44
--- /dev/null
+++ b/trunk/ulp/librdmacm/examples/rdma_server/rdma_server.c
-@@ -0,0 +1,149 @@
-+/*
-+ * Copyright (c) 2005-2009 Intel Corporation. All rights reserved.
-+ *
-+ * This software is available to you under the OpenIB.org BSD license
-+ * below:
-+ *
-+ * Redistribution and use in source and binary forms, with or
-+ * without modification, are permitted provided that the following
-+ * conditions are met:
-+ *
-+ * - Redistributions of source code must retain the above
-+ * copyright notice, this list of conditions and the following
-+ * disclaimer.
-+ *
-+ * - Redistributions in binary form must reproduce the above
-+ * copyright notice, this list of conditions and the following
-+ * disclaimer in the documentation and/or other materials
-+ * provided with the distribution.
-+ *
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
-+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-+ * SOFTWARE.
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <errno.h>
-+#include <getopt.h>
-+#include <netdb.h>
-+#include <rdma/rdma_cma.h>
-+#include <rdma/rdma_verbs.h>
-+
-+static char *port = "7471";
-+
-+struct rdma_cm_id *listen_id, *id;
-+struct ibv_mr *mr;
-+uint8_t send_msg[16];
-+uint8_t recv_msg[16];
-+
-+static int run(void)
-+{
-+ struct rdma_addrinfo hints, *res;
-+ struct ibv_qp_init_attr attr;
-+ struct ibv_wc wc;
-+ int ret;
-+
-+ memset(&hints, 0, sizeof hints);
-+ hints.ai_flags = RAI_PASSIVE;
-+ hints.ai_port_space = RDMA_PS_TCP;
-+ ret = rdma_getaddrinfo(NULL, port, &hints, &res);
-+ if (ret) {
-+ printf("rdma_getaddrinfo %d\n", errno);
-+ return ret;
-+ }
-+
-+ memset(&attr, 0, sizeof attr);
-+ attr.cap.max_send_wr = attr.cap.max_recv_wr = 1;
-+ attr.cap.max_send_sge = attr.cap.max_recv_sge = 1;
-+ attr.cap.max_inline_data = 16;
-+ attr.sq_sig_all = 1;
-+ ret = rdma_create_ep(&listen_id, res, NULL, &attr);
-+ rdma_freeaddrinfo(res);
-+ if (ret) {
-+ printf("rdma_create_ep %d\n", errno);
-+ return ret;
-+ }
-+
-+ ret = rdma_listen(listen_id, 0);
-+ if (ret) {
-+ printf("rdma_listen %d\n", errno);
-+ return ret;
-+ }
-+
-+ ret = rdma_get_request(listen_id, &id);
-+ if (ret) {
-+ printf("rdma_get_request %d\n", errno);
-+ return ret;
-+ }
-+
-+ mr = rdma_reg_msgs(id, recv_msg, 16);
-+ if (!mr) {
-+ printf("rdma_reg_msgs %d\n", errno);
-+ return ret;
-+ }
-+
-+ ret = rdma_post_recv(id, NULL, recv_msg, 16, mr);
-+ if (ret) {
-+ printf("rdma_post_recv %d\n", errno);
-+ return ret;
-+ }
-+
-+ ret = rdma_accept(id, NULL);
-+ if (ret) {
-+ printf("rdma_connect %d\n", errno);
-+ return ret;
-+ }
-+
-+ ret = rdma_get_recv_comp(id, &wc);
-+ if (ret <= 0) {
-+ printf("rdma_get_recv_comp %d\n", ret);
-+ return ret;
-+ }
-+
-+ ret = rdma_post_send(id, NULL, send_msg, 16, NULL, IBV_SEND_INLINE);
-+ if (ret) {
-+ printf("rdma_post_send %d\n", errno);
-+ return ret;
-+ }
-+
-+ ret = rdma_get_send_comp(id, &wc);
-+ if (ret <= 0) {
-+ printf("rdma_get_send_comp %d\n", ret);
-+ return ret;
-+ }
-+
-+ rdma_disconnect(id);
-+ rdma_dereg_mr(mr);
-+ rdma_destroy_ep(id);
-+ rdma_destroy_ep(listen_id);
-+ return 0;
-+}
-+
-+int main(int argc, char **argv)
-+{
-+ int op, ret;
-+
-+ while ((op = getopt(argc, argv, "p:")) != -1) {
-+ switch (op) {
-+ case 'p':
-+ port = optarg;
-+ break;
-+ default:
-+ printf("usage: %s\n", argv[0]);
-+ printf("\t[-p port_number]\n");
-+ exit(1);
-+ }
-+ }
-+
-+ printf("rdma_server: start\n");
-+ ret = run();
-+ printf("rdma_server: end %d\n", ret);
-+ return ret;
+@@ -0,0 +1,148 @@
++/*\r
++ * Copyright (c) 2005-2010 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 AWV\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
++\r
++#include <stdio.h>\r
++#include <stdlib.h>\r
++#include <string.h>\r
++\r
++#include "..\..\..\..\etc\user\getopt.c"\r
++#include <rdma/rdma_verbs.h>\r
++#include <rdma/rdma_cma.h>\r
++\r
++static char *port = "7471";\r
++\r
++struct rdma_cm_id *listen_id, *id;\r
++struct ibv_mr *mr;\r
++uint8_t send_msg[16];\r
++uint8_t recv_msg[16];\r
++\r
++static int run(void)\r
++{\r
++ struct rdma_addrinfo hints, *res;\r
++ struct ibv_qp_init_attr attr;\r
++ struct ibv_wc wc;\r
++ int ret;\r
++\r
++ memset(&hints, 0, sizeof hints);\r
++ hints.ai_flags = RAI_PASSIVE;\r
++ hints.ai_port_space = RDMA_PS_TCP;\r
++ ret = rdma_getaddrinfo(NULL, port, &hints, &res);\r
++ if (ret) {\r
++ printf("rdma_getaddrinfo %d\n", errno);\r
++ return ret;\r
++ }\r
++\r
++ memset(&attr, 0, sizeof attr);\r
++ attr.cap.max_send_wr = attr.cap.max_recv_wr = 1;\r
++ attr.cap.max_send_sge = attr.cap.max_recv_sge = 1;\r
++ attr.cap.max_inline_data = 16;\r
++ attr.sq_sig_all = 1;\r
++ ret = rdma_create_ep(&listen_id, res, NULL, &attr);\r
++ rdma_freeaddrinfo(res);\r
++ if (ret) {\r
++ printf("rdma_create_ep %d\n", errno);\r
++ return ret;\r
++ }\r
++\r
++ ret = rdma_listen(listen_id, 0);\r
++ if (ret) {\r
++ printf("rdma_listen %d\n", errno);\r
++ return ret;\r
++ }\r
++\r
++ ret = rdma_get_request(listen_id, &id);\r
++ if (ret) {\r
++ printf("rdma_get_request %d\n", errno);\r
++ return ret;\r
++ }\r
++\r
++ mr = rdma_reg_msgs(id, recv_msg, 16);\r
++ if (!mr) {\r
++ printf("rdma_reg_msgs %d\n", errno);\r
++ return ret;\r
++ }\r
++\r
++ ret = rdma_post_recv(id, NULL, recv_msg, 16, mr);\r
++ if (ret) {\r
++ printf("rdma_post_recv %d\n", errno);\r
++ return ret;\r
++ }\r
++\r
++ ret = rdma_accept(id, NULL);\r
++ if (ret) {\r
++ printf("rdma_connect %d\n", errno);\r
++ return ret;\r
++ }\r
++\r
++ ret = rdma_get_recv_comp(id, &wc);\r
++ if (ret <= 0) {\r
++ printf("rdma_get_recv_comp %d\n", ret);\r
++ return ret;\r
++ }\r
++\r
++ ret = rdma_post_send(id, NULL, send_msg, 16, NULL, IBV_SEND_INLINE);\r
++ if (ret) {\r
++ printf("rdma_post_send %d\n", errno);\r
++ return ret;\r
++ }\r
++\r
++ ret = rdma_get_send_comp(id, &wc);\r
++ if (ret <= 0) {\r
++ printf("rdma_get_send_comp %d\n", ret);\r
++ return ret;\r
++ }\r
++\r
++ rdma_disconnect(id);\r
++ rdma_dereg_mr(mr);\r
++ rdma_destroy_ep(id);\r
++ rdma_destroy_ep(listen_id);\r
++ return 0;\r
++}\r
++\r
++int main(int argc, char **argv)\r
++{\r
++ int op, ret;\r
++\r
++ while ((op = getopt(argc, argv, "p:")) != -1) {\r
++ switch (op) {\r
++ case 'p':\r
++ port = optarg;\r
++ break;\r
++ default:\r
++ printf("usage: %s\n", argv[0]);\r
++ printf("\t[-p port_number]\n");\r
++ exit(1);\r
++ }\r
++ }\r
++\r
++ printf("rdma_server: start\n");\r
++ ret = run();\r
++ printf("rdma_server: end %d\n", ret);\r
++ return ret;\r
+}