<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0pt;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{margin:0pt;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:Arial;
color:windowtext;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>James, <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Please review patches to allow coexistence of 2.0 and 1.2 libraries.
I updated the dat.conf to provide configuration to both 1.2 and 2.0 providers. In
addition, the development package (headers) is not targeted to include/dat2
instead of include/dat. A patch for 1.2 will follow shortly.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> Modifications to DAT 2.0 package to coexist with 1.2
libraries<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> - cleanup CR-LF in dtestx<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> - fix RPM specfile, 2.0.1 package<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> - move devel to include/dat2<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> - change test examples to use new
2.0 provider names.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> Signed-off by: <st1:PersonName w:st="on">Arlin</st1:PersonName>
Davis <a href="mailto:ardavis@ichips.intel.com">ardavis@ichips.intel.com</a><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>diff --git a/Makefile.am b/Makefile.am<br>
index b3a0149..f473aaa 100755<br>
--- a/Makefile.am<br>
+++ b/Makefile.am<br>
@@ -66,7 +66,7 @@ dat_udat_libdat_la_SOURCES = dat/udat/udat.c \<br>
dat/common/dat_init.c
\<br>
dat/common/dat_dr.c
\<br>
dat/common/dat_sr.c<br>
-<br>
+# version-info current:revision:age<br>
</span></font><span lang=DE>dat_udat_libdat_la_LDFLAGS = -version-info
2:0:0 $(dat_version_script) -ldl <br>
<br>
</span>#<br>
@@ -178,11 +178,12 @@ dapl_udapl_libdaplcma_la_SOURCES = dapl/udapl/dapl_init.c
\<br>
dapl/openib_cma/dapl_ib_cm.c
\<br>
dapl/openib_cma/dapl_ib_mem.c
$(XPROGRAMS)<br>
<br>
+# version-info current:revision:age<br>
dapl_udapl_libdaplcma_la_LDFLAGS = -version-info 2:0:0
$(daplcma_version_script) \<br>
-Wl,-init,dapl_init -Wl,-fini,dapl_fini \<br>
-lpthread -libverbs -lrdmacm <br>
<br>
-libdatincludedir = $(includedir)/dat<br>
+libdatincludedir = $(includedir)/dat2<br>
<br>
libdatinclude_HEADERS = dat/include/dat/dat.h \<br>
<span
lang=DE>dat/include/dat/dat_error.h \<br>
</span>@@ -244,7 +245,7 @@ EXTRA_DIST = dat/common/dat_dictionary.h \<br>
dat/udat/libdat.map \<br>
doc/dat.conf \<br>
dapl/udapl/libdaplcma.map \<br>
- libdat.spec.in \<br>
+ libdat2.spec.in \<br>
$(man_MANS) \<br>
test/dapltest/include/dapl_bpool.h \<br>
test/dapltest/include/dapl_client_info.h \<br>
@@ -274,7 +275,7 @@ EXTRA_DIST = dat/common/dat_dictionary.h \<br>
test/dapltest/include/dapl_version.h \<br>
test/dapltest/mdep/linux/dapl_mdep_user.h<br>
<br>
-dist-hook: libdat.spec <br>
- cp libdat.spec $(distdir)<br>
+dist-hook: libdat2.spec <br>
+ cp libdat2.spec $(distdir)<br>
<br>
SUBDIRS = . test/dtest test/dapltest<br>
diff --git a/README b/README<br>
index 437c1f7..1fc55a2 100644<br>
--- a/README<br>
+++ b/README<br>
@@ -17,16 +17,18 @@ Building debug version:<br>
./configure --enable-debug<br>
make<br>
<br>
-Build example with OFED prefix (x86_64)<br>
------------------------------------------<br>
+Build example with OFED 1.2+ prefix (x86_64)<br>
+---------------------------------------------<br>
./autogen.sh<br>
-./configure --prefix /usr/local/ofed --libdir /usr/local/ofed/lib64
LDFLAGS=-L/usr/local/ofed/lib64 CPPFLAGS="-I/usr/local/ofed/include"<br>
+./configure --prefix /usr --sysconf=/etc --libdir /usr/lib64
LDFLAGS=-L/usr/lib64 CPPFLAGS="-I/usr/include"<br>
make<br>
<br>
Installing:<br>
----------<br>
make install<br>
<br>
+Note: The development package installs DAT 2.0 include files under
/usr/include/dat2 to co-exist with DAT 1.2 /usr/include/dat<br>
+<br>
NOTE: to link these libraries you must either use libtool and <br>
specify the full pathname of the library, or use the `-LLIBDIR' <br>
flag during linking and do at least one of the following:<br>
@@ -47,19 +49,32 @@ more information, such as the ld(1) and ld.so(8) manual
pages.<br>
sample /etc/dat.conf <br>
<br>
#<br>
-# DAT 1.2 configuration file, sample OFED<br>
+# DAT 1.2 and 2.0 configuration file<br>
#<br>
# Each entry should have the following fields:<br>
#<br>
# <ia_name> <api_version> <threadsafety>
<default> <lib_path> \<br>
#
<provider_version> <ia_params> <platform_params><br>
#<br>
-# For openib-cma provider you can specify <ia_params> as either:<br>
-# network address, network hostname, or netdev name and 0 for
port<br>
+# For the uDAPL cma provder, specify <ia_params> as one of the
following:<br>
+# network address, network hostname, or
netdev name and 0 for port<br>
+#<br>
+# Simple (OpenIB-cma) default with netdev name provided first on list<br>
+# to enable use of same dat.conf version on all nodes<br>
#<br>
-# This example shows netdev name, enabling administrator to use same copy
across cluster<br>
+# Add examples for multiple interfaces and IPoIB HA fail over, and bonding<br>
#<br>
-OpenIB-cma u1.2 nonthreadsafe default /usr/local/ofed/lib64/libdapl-cma.so
mv_dapl.1.2 "ib0 0" ""<br>
+OpenIB-cma u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "ib0
0" ""<br>
+OpenIB-cma-1 u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "ib1
0" ""<br>
+OpenIB-cma-2 u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "ib2
0" ""<br>
+OpenIB-cma-3 u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "ib3
0" ""<br>
+OpenIB-bond u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "bond0
0" ""<br>
+OpenIB-2-cma u2.0 nonthreadsafe default libdaplcma.so.2 dapl.2.0 "ib0
0" ""<br>
+OpenIB-2-cma-1 u2.0 nonthreadsafe default libdaplcma.so.2 dapl.2.0 "ib1
0" ""<br>
+OpenIB-2-cma-2 u2.0 nonthreadsafe default libdaplcma.so.2 dapl.2.0 "ib2
0" ""<br>
+OpenIB-2-cma-3 u2.0 nonthreadsafe default libdaplcma.so.2 dapl.2.0 "ib3
0" ""<br>
+OpenIB-2-bond u2.0 nonthreadsafe default libdaplcma.so.2 dapl.2.0 "bond0
0" ""<br>
+<br>
<br>
=============================<br>
3.0 Bugs/Known issues<br>
diff --git a/configure.in b/configure.in<br>
index 7608e64..4eda85f 100644<br>
--- a/configure.in<br>
+++ b/configure.in<br>
@@ -1,11 +1,11 @@<br>
dnl Process this file with autoconf to produce a configure script.<br>
<br>
AC_PREREQ(2.57)<br>
-AC_INIT(dapl, 2.0.0, openib-general@openib.org)<br>
+AC_INIT(dapl, 2.0.1, general@lists.openfabrics.org)<br>
AC_CONFIG_SRCDIR([dat/udat/udat.c])<br>
AC_CONFIG_AUX_DIR(config)<br>
AM_CONFIG_HEADER(config.h)<br>
-AM_INIT_AUTOMAKE(dapl, 2.0.0)<br>
+AM_INIT_AUTOMAKE(dapl, 2.0.1)<br>
<br>
AM_PROG_LIBTOOL<br>
<br>
@@ -86,6 +86,6 @@ AC_CACHE_CHECK(Check for RHEL5 system, ac_cv_rhel5,<br>
fi)<br>
AM_CONDITIONAL(OS_RHEL5, test "$ac_cv_rhel5" = "yes")<br>
<br>
-AC_CONFIG_FILES([Makefile test/dtest/Makefile test/dapltest/Makefile
libdat.spec])<br>
+AC_CONFIG_FILES([Makefile test/dtest/Makefile test/dapltest/Makefile
libdat2.spec])<br>
<br>
AC_OUTPUT<br>
diff --git a/doc/dat.conf b/doc/dat.conf<br>
index 2651673..005f9ee 100755<br>
--- a/doc/dat.conf<br>
+++ b/doc/dat.conf<br>
@@ -1,5 +1,5 @@<br>
#<br>
-# DAT 2.0 configuration file<br>
+# DAT 1.2 and 2.0 configuration file<br>
#<br>
# Each entry should have the following fields:<br>
#<br>
@@ -9,10 +9,18 @@<br>
# For the uDAPL cma provder, specify <ia_params> as one of the
following:<br>
# network address, network hostname,
or netdev name and 0 for port<br>
#<br>
-# Simple (OpenIB-cma) default configuration with netdev name provided first on
list <br>
-# to enable use of same dat.conf version on all nodes. Assumes x86_64
installation.<br>
+# Simple (OpenIB-cma) default with netdev name provided first on list<br>
+# to enable use of same dat.conf version on all nodes<br>
#<br>
-OpenIB-cma u2.0 nonthreadsafe default /usr/lib64/libdaplcma.so mv_dapl.2.0
"ib0 0" ""<br>
-OpenIB-cma-1 u2.0 nonthreadsafe default /usr/lib64/libdaplcma.so mv_dapl.2.0
"ib0 0" ""<br>
-OpenIB-cma-2 u2.0 nonthreadsafe default /usr/lib64/libdaplcma.so mv_dapl.2.0
"ib0 0" ""<br>
-OpenIB-cma-3 u2.0 nonthreadsafe default /usr/lib64/libdaplcma.so mv_dapl.2.0
"ib0 0" ""<br>
+# Add examples for multiple interfaces and IPoIB HA fail over, and bonding<br>
+#<br>
+OpenIB-cma u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "ib0
0" ""<br>
+OpenIB-cma-1 u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "ib1
0" ""<br>
+OpenIB-cma-2 u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "ib2
0" ""<br>
+OpenIB-cma-3 u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "ib3
0" ""<br>
+OpenIB-bond u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "bond0
0" ""<br>
+OpenIB-2-cma u2.0 nonthreadsafe default libdaplcma.so.2 dapl.2.0 "ib0
0" ""<br>
+OpenIB-2-cma-1 u2.0 nonthreadsafe default libdaplcma.so.2 dapl.2.0 "ib1
0" ""<br>
+OpenIB-2-cma-2 u2.0 nonthreadsafe default libdaplcma.so.2 dapl.2.0 "ib2
0" ""<br>
+OpenIB-2-cma-3 u2.0 nonthreadsafe default libdaplcma.so.2 dapl.2.0 "ib3
0" ""<br>
+OpenIB-2-bond u2.0 nonthreadsafe default libdaplcma.so.2 dapl.2.0 "bond0
0" ""<br>
diff --git a/test/dtest/dtest.c b/test/dtest/dtest.c<br>
index 07b40ec..ba12a58 100644<br>
--- a/test/dtest/dtest.c<br>
+++ b/test/dtest/dtest.c<br>
@@ -44,7 +44,7 @@<br>
#include <inttypes.h><br>
<br>
#ifndef DAPL_PROVIDER<br>
-#define DAPL_PROVIDER "OpenIB-cma"<br>
+#define DAPL_PROVIDER "OpenIB-2-cma"<br>
#endif<br>
<br>
#define MAX_POLLING_CNT 50000<br>
diff --git a/test/dtest/dtestx.c b/test/dtest/dtestx.c<br>
index 153ce76..04a0d5d 100755<br>
--- a/test/dtest/dtestx.c<br>
+++ b/test/dtest/dtestx.c<br>
@@ -30,785 +30,785 @@<br>
* SOFTWARE.<br>
*<br>
* $Id: $<br>
- */<o:p></o:p></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#include <stdio.h><o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#include <stdlib.h><o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#include <netdb.h><o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#include <sys/socket.h><o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#include <netinet/in.h><o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#include <netinet/tcp.h><o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#include <arpa/inet.h><o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#include <endian.h><o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#include <byteswap.h><o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#include "dat/udat.h"<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#include "dat/dat_ib_extensions.h"<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#define _OK(status, str) \<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-{ \<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- const char *maj_msg, *min_msg; \<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (status != DAT_SUCCESS) { \<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- dat_strerror(status,
&maj_msg, &min_msg); \<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- fprintf(stderr,
str " returned %s : %s\n", maj_msg, min_msg); \<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1); \<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } \<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-}<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>+ */<br>
+#include <stdio.h><br>
+#include <stdlib.h><br>
+#include <netdb.h><br>
+#include <sys/socket.h><br>
+#include <netinet/in.h><br>
+#include <netinet/tcp.h><br>
+#include <arpa/inet.h><br>
+#include <endian.h><br>
+#include <byteswap.h><br>
+<br>
+#include "dat/udat.h"<br>
+#include "dat/dat_ib_extensions.h"<br>
+<br>
+#define _OK(status, str) \<br>
+{ \<br>
+ const char *maj_msg, *min_msg; \<br>
+ if (status != DAT_SUCCESS) { \<br>
+ dat_strerror(status,
&maj_msg, &min_msg); \<br>
+ fprintf(stderr,
str " returned %s : %s\n", maj_msg, min_msg); \<br>
+ exit(1); \<br>
+ } \<br>
+}<br>
+<br>
#define DTO_TIMEOUT (1000*1000*5)<br>
#define CONN_TIMEOUT (1000*1000*10)<br>
-#define SERVER_TIMEOUT (1000*1000*120)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#define SERVER_CONN_QUAL 31111<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#define BUF_SIZE 256<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#define BUF_SIZE_ATOMIC 8<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#define REG_MEM_COUNT 10<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#define SND_RDMA_BUF_INDEX 0<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#define RCV_RDMA_BUF_INDEX 1<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#define SEND_BUF_INDEX 2<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-#define RECV_BUF_INDEX 3<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-u_int64_t *atomic_buf;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_LMR_HANDLE lmr_atomic;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_LMR_CONTEXT lmr_atomic_context;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_RMR_CONTEXT rmr_atomic_context;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_VLEN reg_atomic_size;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_VADDR reg_atomic_addr;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_LMR_HANDLE lmr[
REG_MEM_COUNT ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_LMR_CONTEXT lmr_context[
REG_MEM_COUNT ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_RMR_TRIPLET rmr[
REG_MEM_COUNT ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_RMR_CONTEXT rmr_context[
REG_MEM_COUNT ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_VLEN reg_size[
REG_MEM_COUNT ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_VADDR reg_addr[
REG_MEM_COUNT ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_RMR_TRIPLET * buf[ REG_MEM_COUNT ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_EP_HANDLE ep;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_EVD_HANDLE async_evd
= DAT_HANDLE_NULL;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_IA_HANDLE ia
= DAT_HANDLE_NULL;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_PZ_HANDLE pz
= DAT_HANDLE_NULL;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_EVD_HANDLE cr_evd
= DAT_HANDLE_NULL;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_EVD_HANDLE con_evd
= DAT_HANDLE_NULL;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_EVD_HANDLE dto_evd
= DAT_HANDLE_NULL;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_PSP_HANDLE psp =
DAT_HANDLE_NULL;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-DAT_CR_HANDLE cr
= DAT_HANDLE_NULL;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-int server;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-char *usage = "-s | hostname (default == -s)\n";<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-void<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-send_msg(<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- void *data,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COUNT size,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_LMR_CONTEXT context,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_DTO_COOKIE cookie,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COMPLETION_FLAGS flags)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-{<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_LMR_TRIPLET iov;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_EVENT event;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COUNT nmore;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_RETURN status;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_DTO_COMPLETION_EVENT_DATA *dto_event = <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &event.event_data.dto_completion_event_data;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- iov.lmr_context =
context;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- iov.virtual_address = (DAT_VADDR)(unsigned
long)data;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- iov.segment_length = (DAT_VLEN)size;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_ep_post_send(ep,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
1,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
&iov,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
cookie,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
flags);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_ep_post_send");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (! (flags &
DAT_COMPLETION_SUPPRESS_FLAG)) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_evd_wait(dto_evd, DTO_TIMEOUT, 1, &event, &nmore);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status,
"dat_evd_wait after dat_ep_post_send");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if
(event.event_number != DAT_DTO_COMPLETION_EVENT) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event waiting for post_send completion - 0x%x\n", event.event_number);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(dto_event->status,
"event status for post_send");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-}<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-int<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-connect_ep(char *hostname)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-{<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_SOCK_ADDR remote_addr;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_EP_ATTR ep_attr;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_RETURN status;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_REGION_DESCRIPTION region;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_EVENT event;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COUNT nmore;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_LMR_TRIPLET iov;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_RMR_TRIPLET r_iov;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_DTO_COOKIE cookie;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- int i;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_DTO_COMPLETION_EVENT_DATA *dto_event = <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &event.event_data.dto_completion_event_data;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_ia_open("OpenIB-cma",
8, &async_evd, &ia);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_ia_open");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_pz_create(ia, &pz);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_pz_create");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_create(ia, 10,
DAT_HANDLE_NULL, DAT_EVD_CR_FLAG, &cr_evd );<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_create CR");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_create(ia, 10,
DAT_HANDLE_NULL, DAT_EVD_CONNECTION_FLAG, &con_evd );<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_create CR");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_create(ia, 10,
DAT_HANDLE_NULL, DAT_EVD_DTO_FLAG, &dto_evd );<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_create DTO");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- memset(&ep_attr, 0, sizeof(ep_attr));<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.service_type
= DAT_SERVICE_TYPE_RC;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.max_rdma_size
= 0x10000;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.qos
= 0;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.recv_completion_flags
= 0;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.max_recv_dtos
= 10;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.max_request_dtos
= 10;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.max_recv_iov
= 1;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.max_request_iov
= 1;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.max_rdma_read_in
= 4;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.max_rdma_read_out
= 4;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.request_completion_flags
= DAT_COMPLETION_DEFAULT_FLAG;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.ep_transport_specific_count = 0;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.ep_transport_specific
= NULL;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.ep_provider_specific_count = 0;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ep_attr.ep_provider_specific
= NULL;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_ep_create(ia, pz, dto_evd,
dto_evd, con_evd, &ep_attr, &ep);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_ep_create");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- for (i = 0; i < REG_MEM_COUNT; i++) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- buf[ i ]
= (DAT_RMR_TRIPLET*)malloc(BUF_SIZE);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- region.for_va
= buf[ i ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_lmr_create(ia,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_MEM_TYPE_VIRTUAL,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- region,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- BUF_SIZE,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- pz,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_MEM_PRIV_ALL_FLAG|DAT_IB_MEM_PRIV_REMOTE_ATOMIC,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>+#define SERVER_TIMEOUT (1000*1000*120)<br>
+#define SERVER_CONN_QUAL 31111<br>
+#define BUF_SIZE 256<br>
+#define BUF_SIZE_ATOMIC 8<br>
+#define REG_MEM_COUNT 10<br>
+#define SND_RDMA_BUF_INDEX 0<br>
+#define RCV_RDMA_BUF_INDEX 1<br>
+#define SEND_BUF_INDEX 2<br>
+#define RECV_BUF_INDEX 3<br>
+<br>
+u_int64_t *atomic_buf;<br>
+DAT_LMR_HANDLE lmr_atomic;<br>
+DAT_LMR_CONTEXT lmr_atomic_context;<br>
+DAT_RMR_CONTEXT rmr_atomic_context;<br>
+DAT_VLEN reg_atomic_size;<br>
+DAT_VADDR reg_atomic_addr;<br>
+DAT_LMR_HANDLE lmr[
REG_MEM_COUNT ];<br>
+DAT_LMR_CONTEXT lmr_context[
REG_MEM_COUNT ];<br>
+DAT_RMR_TRIPLET rmr[ REG_MEM_COUNT
];<br>
+DAT_RMR_CONTEXT rmr_context[
REG_MEM_COUNT ];<br>
+DAT_VLEN reg_size[
REG_MEM_COUNT ];<br>
+DAT_VADDR reg_addr[ REG_MEM_COUNT ];<br>
+DAT_RMR_TRIPLET * buf[ REG_MEM_COUNT ];<br>
+DAT_EP_HANDLE ep;<br>
+DAT_EVD_HANDLE async_evd =
DAT_HANDLE_NULL;<br>
+DAT_IA_HANDLE ia =
DAT_HANDLE_NULL;<br>
+DAT_PZ_HANDLE pz =
DAT_HANDLE_NULL;<br>
+DAT_EVD_HANDLE cr_evd =
DAT_HANDLE_NULL;<br>
+DAT_EVD_HANDLE con_evd = DAT_HANDLE_NULL;<br>
+DAT_EVD_HANDLE dto_evd =
DAT_HANDLE_NULL;<br>
+DAT_PSP_HANDLE psp =
DAT_HANDLE_NULL;<br>
+DAT_CR_HANDLE cr =
DAT_HANDLE_NULL;<br>
+int server;<br>
+<br>
+char *usage = "-s | hostname (default == -s)\n";<br>
+<br>
+void<br>
+send_msg(<br>
+ void *data,<br>
+ DAT_COUNT size,<br>
+ DAT_LMR_CONTEXT context,<br>
+ DAT_DTO_COOKIE cookie,<br>
+ DAT_COMPLETION_FLAGS flags)<br>
+{<br>
+ DAT_LMR_TRIPLET iov;<br>
+ DAT_EVENT event;<br>
+ DAT_COUNT nmore;<br>
+ DAT_RETURN status;<br>
+ DAT_DTO_COMPLETION_EVENT_DATA *dto_event = <br>
+ &event.event_data.dto_completion_event_data;<br>
+<br>
+ iov.lmr_context = context;<br>
+ iov.virtual_address = (DAT_VADDR)(unsigned long)data;<br>
+ iov.segment_length = (DAT_VLEN)size;<br>
+<br>
+ status = dat_ep_post_send(ep,<br>
+
1,<br>
+
&iov,<br>
+
cookie,<br>
+
flags);<br>
+ _OK(status, "dat_ep_post_send");<br>
+<br>
+ if (! (flags & DAT_COMPLETION_SUPPRESS_FLAG)) {<br>
+ status =
dat_evd_wait(dto_evd, DTO_TIMEOUT, 1, &event, &nmore);<br>
+ _OK(status,
"dat_evd_wait after dat_ep_post_send");<br>
+<br>
+ if
(event.event_number != DAT_DTO_COMPLETION_EVENT) {<br>
+ printf("unexpected
event waiting for post_send completion - 0x%x\n", event.event_number);<br>
+ exit(1);<br>
+ }<br>
+<br>
+ _OK(dto_event->status,
"event status for post_send");<br>
+ }<br>
+}<br>
+<br>
+int<br>
+connect_ep(char *hostname)<br>
+{<br>
+ DAT_SOCK_ADDR remote_addr;<br>
+ DAT_EP_ATTR ep_attr;<br>
+ DAT_RETURN status;<br>
+ DAT_REGION_DESCRIPTION region;<br>
+ DAT_EVENT event;<br>
+ DAT_COUNT nmore;<br>
+ DAT_LMR_TRIPLET iov;<br>
+ DAT_RMR_TRIPLET r_iov;<br>
+ DAT_DTO_COOKIE cookie;<br>
+ int i;<br>
+ DAT_DTO_COMPLETION_EVENT_DATA *dto_event = <br>
+ &event.event_data.dto_completion_event_data;<br>
+<br>
+ status = dat_ia_open("OpenIB-2-cma", 8,
&async_evd, &ia);<br>
+ _OK(status, "dat_ia_open");<br>
+<br>
+ status = dat_pz_create(ia, &pz);<br>
+ _OK(status, "dat_pz_create");<br>
+<br>
+ status = dat_evd_create(ia, 10, DAT_HANDLE_NULL,
DAT_EVD_CR_FLAG, &cr_evd );<br>
+ _OK(status, "dat_evd_create CR");<br>
+ status = dat_evd_create(ia, 10, DAT_HANDLE_NULL,
DAT_EVD_CONNECTION_FLAG, &con_evd );<br>
+ _OK(status, "dat_evd_create CR");<br>
+ status = dat_evd_create(ia, 10, DAT_HANDLE_NULL,
DAT_EVD_DTO_FLAG, &dto_evd );<br>
+ _OK(status, "dat_evd_create DTO");<br>
+<br>
+ memset(&ep_attr, 0, sizeof(ep_attr));<br>
+ ep_attr.service_type
= DAT_SERVICE_TYPE_RC;<br>
+ ep_attr.max_rdma_size
= 0x10000;<br>
+ ep_attr.qos
= 0;<br>
+ ep_attr.recv_completion_flags
= 0;<br>
+ ep_attr.max_recv_dtos
= 10;<br>
+ ep_attr.max_request_dtos
= 10;<br>
+ ep_attr.max_recv_iov
= 1;<br>
+ ep_attr.max_request_iov
= 1;<br>
+ ep_attr.max_rdma_read_in
= 4;<br>
+ ep_attr.max_rdma_read_out
= 4;<br>
+ ep_attr.request_completion_flags =
DAT_COMPLETION_DEFAULT_FLAG;<br>
+ ep_attr.ep_transport_specific_count = 0;<br>
+ ep_attr.ep_transport_specific
= NULL;<br>
+ ep_attr.ep_provider_specific_count = 0;<br>
+ ep_attr.ep_provider_specific
= NULL;<br>
+<br>
+ status = dat_ep_create(ia, pz, dto_evd, dto_evd,
con_evd, &ep_attr, &ep);<br>
+ _OK(status, "dat_ep_create");<br>
+<br>
+ for (i = 0; i < REG_MEM_COUNT; i++) {<br>
+ buf[ i ] =
(DAT_RMR_TRIPLET*)malloc(BUF_SIZE);<br>
+ region.for_va =
buf[ i ];<br>
+ status = dat_lmr_create(ia,<br>
+ DAT_MEM_TYPE_VIRTUAL,<br>
+ region,<br>
+ BUF_SIZE,<br>
+ pz,<br>
+ DAT_MEM_PRIV_ALL_FLAG|DAT_IB_MEM_PRIV_REMOTE_ATOMIC,<br>
DAT_VA_TYPE_VA,<br>
- &lmr[
i ],<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &lmr_context[
i ],<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &rmr_context[
i ],<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ®_size[
i ],<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ®_addr[
i ]);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status,
"dat_lmr_create");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /* register atomic return buffer for original
data */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- atomic_buf = (u_int64_t*)malloc(BUF_SIZE);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- region.for_va = atomic_buf;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_lmr_create(ia,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_MEM_TYPE_VIRTUAL,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- region,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- BUF_SIZE_ATOMIC,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- pz,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_MEM_PRIV_ALL_FLAG|DAT_IB_MEM_PRIV_REMOTE_ATOMIC,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>+ &lmr[
i ],<br>
+ &lmr_context[
i ],<br>
+ &rmr_context[
i ],<br>
+ ®_size[
i ],<br>
+ ®_addr[
i ]);<br>
+ _OK(status,
"dat_lmr_create");<br>
+ }<br>
+<br>
+ /* register atomic return buffer for original data */<br>
+ atomic_buf = (u_int64_t*)malloc(BUF_SIZE);<br>
+ region.for_va = atomic_buf;<br>
+ status = dat_lmr_create(ia,<br>
+ DAT_MEM_TYPE_VIRTUAL,<br>
+ region,<br>
+ BUF_SIZE_ATOMIC,<br>
+ pz,<br>
+ DAT_MEM_PRIV_ALL_FLAG|DAT_IB_MEM_PRIV_REMOTE_ATOMIC,<br>
DAT_VA_TYPE_VA,<br>
- &lmr_atomic,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &lmr_atomic_context,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &rmr_atomic_context,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ®_atomic_size,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- ®_atomic_addr);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_lmr_create
atomic");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- for (i = RECV_BUF_INDEX; i <
REG_MEM_COUNT; i++) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie.as_64
= i;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- iov.lmr_context
= lmr_context[ i ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- iov.virtual_address
= (DAT_VADDR)(unsigned long)buf[ i ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- iov.segment_length
= BUF_SIZE;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_ep_post_recv(ep,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
1,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
&iov,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
cookie,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
DAT_COMPLETION_DEFAULT_FLAG);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status,
"dat_ep_post_recv");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /* setup receive buffer to initial string to
be overwritten */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- strcpy((char*)buf[ RCV_RDMA_BUF_INDEX ],
"blah, blah, blah\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (server) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- strcpy((char*)buf[
SND_RDMA_BUF_INDEX ], "server written data");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_psp_create(ia,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- SERVER_CONN_QUAL,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
cr_evd,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
DAT_PSP_CONSUMER_FLAG,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
&psp);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status,
"dat_psp_create");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Server
waiting for connect request\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_evd_wait(cr_evd, SERVER_TIMEOUT, 1, &event, &nmore);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status,
"listen dat_evd_wait");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if
(event.event_number != DAT_CONNECTION_REQUEST_EVENT) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event after dat_psp_create: 0x%x\n", event.event_number); <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if
((event.event_data.cr_arrival_event_data.conn_qual != SERVER_CONN_QUAL) ||<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
(event.event_data.cr_arrival_event_data.sp_handle.psp_handle != psp)) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("wrong
cr event data\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cr =
event.event_data.cr_arrival_event_data.cr_handle;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_cr_accept(cr, ep, 0, (DAT_PVOID)0);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } else {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- struct
addrinfo *target;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- int rval;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if
(getaddrinfo (hostname, NULL, NULL, &target) != 0) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Error
getting remote address.\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- rval =
((struct sockaddr_in *)target->ai_addr)->sin_addr.s_addr;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf
("Server Name: %s \n", hostname);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf
("Server Net Address: %d.%d.%d.%d\n",<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
(rval >> 0) & 0xff,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
(rval >> 8) & 0xff,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
(rval >> 16) & 0xff,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
(rval >> 24) & 0xff);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- remote_addr
= *((DAT_IA_ADDRESS_PTR)target->ai_addr);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- strcpy((char*)buf[
SND_RDMA_BUF_INDEX ], "client written data");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_ep_connect(ep,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
&remote_addr,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
SERVER_CONN_QUAL,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
CONN_TIMEOUT,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
0,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
(DAT_PVOID)0,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
0,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
DAT_CONNECT_DEFAULT_FLAG );<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status,
"dat_psp_create");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Client waiting for connect
response\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_wait(con_evd, CONN_TIMEOUT,
1, &event, &nmore);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status,
"connect dat_evd_wait");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (event.event_number !=
DAT_CONNECTION_EVENT_ESTABLISHED) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event after dat_ep_connect: 0x%x\n", event.event_number); <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Connected!\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /*<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- * Setup our remote memory and tell the
other side about it<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Sending RMR data to
remote\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- r_iov.rmr_context =
rmr_context[ RCV_RDMA_BUF_INDEX ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- r_iov.virtual_address = (DAT_VADDR)((unsigned
long)buf[ RCV_RDMA_BUF_INDEX ]);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- r_iov.segment_length = BUF_SIZE;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- *buf[ SEND_BUF_INDEX ] = r_iov;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- send_msg( buf[ SEND_BUF_INDEX ],<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sizeof(DAT_RMR_TRIPLET),<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- lmr_context[
SEND_BUF_INDEX ],<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COMPLETION_SUPPRESS_FLAG);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /*<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- * Wait for their RMR<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Waiting for remote to send RMR
data\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_wait(dto_evd, DTO_TIMEOUT,
1, &event, &nmore);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_wait after
dat_ep_post_send");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (event.event_number !=
DAT_DTO_COMPLETION_EVENT) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event waiting for RMR context - 0x%x\n", <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- event.event_number);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(dto_event->status, "event status
for post_send");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if ((dto_event->transfered_length !=
sizeof(DAT_RMR_TRIPLET)) ||<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
(dto_event->user_cookie.as_64 != RECV_BUF_INDEX)) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event data for receive: len=%d cookie=%d expected %d/%d\n",<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->transfered_length,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->user_cookie.as_64,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sizeof(DAT_RMR_TRIPLET),
RECV_BUF_INDEX);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- r_iov = *buf[ RECV_BUF_INDEX ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Received RMR from remote: r_iov:
ctx=%x,va=%p,len=%d\n",<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- r_iov.rmr_context,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (void*)(unsigned
long)r_iov.virtual_address,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- r_iov.segment_length);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- return(0);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-}<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-int<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-disconnect_ep()<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-{<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_RETURN status;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- int i;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_EVENT event;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COUNT nmore;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_ep_disconnect(ep,
DAT_CLOSE_DEFAULT);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_ep_disconnect");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>+ &lmr_atomic,<br>
+ &lmr_atomic_context,<br>
+ &rmr_atomic_context,<br>
+ ®_atomic_size,<br>
+ ®_atomic_addr);<br>
+ _OK(status, "dat_lmr_create atomic");<br>
+ <br>
+ for (i = RECV_BUF_INDEX; i < REG_MEM_COUNT; i++) {<br>
+ cookie.as_64
= i;<br>
+ iov.lmr_context
= lmr_context[ i ];<br>
+ iov.virtual_address
= (DAT_VADDR)(unsigned long)buf[ i ];<br>
+ iov.segment_length
= BUF_SIZE;<br>
+<br>
+ status =
dat_ep_post_recv(ep,<br>
+
1,<br>
+
&iov,<br>
+
cookie,<br>
+
DAT_COMPLETION_DEFAULT_FLAG);<br>
+ _OK(status,
"dat_ep_post_recv");<br>
+ }<br>
+<br>
+ /* setup receive buffer to initial string to be
overwritten */<br>
+ strcpy((char*)buf[ RCV_RDMA_BUF_INDEX ], "blah,
blah, blah\n");<br>
+<br>
+ if (server) {<br>
+<br>
+ strcpy((char*)buf[
SND_RDMA_BUF_INDEX ], "server written data");<br>
+<br>
+ status = dat_psp_create(ia,<br>
+ SERVER_CONN_QUAL,<br>
+
cr_evd,<br>
+
DAT_PSP_CONSUMER_FLAG,<br>
+
&psp);<br>
+ _OK(status,
"dat_psp_create");<br>
+<br>
+ printf("Server
waiting for connect request\n");<br>
+ status =
dat_evd_wait(cr_evd, SERVER_TIMEOUT, 1, &event, &nmore);<br>
+ _OK(status,
"listen dat_evd_wait");<br>
+<br>
+ if
(event.event_number != DAT_CONNECTION_REQUEST_EVENT) {<br>
+ printf("unexpected
event after dat_psp_create: 0x%x\n", event.event_number); <br>
+ exit(1);<br>
+ }<br>
+<br>
+ if
((event.event_data.cr_arrival_event_data.conn_qual != SERVER_CONN_QUAL) ||<br>
+
(event.event_data.cr_arrival_event_data.sp_handle.psp_handle != psp)) {<br>
+<br>
+ printf("wrong
cr event data\n");<br>
+ exit(1);<br>
+ }<br>
+<br>
+ cr =
event.event_data.cr_arrival_event_data.cr_handle;<br>
+ status =
dat_cr_accept(cr, ep, 0, (DAT_PVOID)0);<br>
+<br>
+ } else {<br>
+ struct addrinfo *target;<br>
+ int rval;<br>
+<br>
+ if (getaddrinfo
(hostname, NULL, NULL, &target) != 0) {<br>
+ printf("Error
getting remote address.\n");<br>
+ exit(1);<br>
+ }<br>
+<br>
+ rval = ((struct
sockaddr_in *)target->ai_addr)->sin_addr.s_addr;<br>
+ printf
("Server Name: %s \n", hostname);<br>
+ printf
("Server Net Address: %d.%d.%d.%d\n",<br>
+
(rval >> 0) & 0xff,<br>
+
(rval >> 8) & 0xff,<br>
+
(rval >> 16) & 0xff,<br>
+
(rval >> 24) & 0xff);<br>
+<br>
+ remote_addr =
*((DAT_IA_ADDRESS_PTR)target->ai_addr);<br>
+<br>
+ strcpy((char*)buf[
SND_RDMA_BUF_INDEX ], "client written data");<br>
+<br>
+ status =
dat_ep_connect(ep,<br>
+
&remote_addr,<br>
+
SERVER_CONN_QUAL,<br>
+
CONN_TIMEOUT,<br>
+
0,<br>
+
(DAT_PVOID)0,<br>
+
0,<br>
+
DAT_CONNECT_DEFAULT_FLAG );<br>
+ _OK(status,
"dat_psp_create");<br>
+ }<br>
+<br>
+ printf("Client waiting for connect
response\n");<br>
+ status = dat_evd_wait(con_evd, CONN_TIMEOUT, 1,
&event, &nmore);<br>
+ _OK(status,
"connect dat_evd_wait");<br>
+<br>
+ if (event.event_number != DAT_CONNECTION_EVENT_ESTABLISHED)
{<br>
+ printf("unexpected
event after dat_ep_connect: 0x%x\n", event.event_number); <br>
+ exit(1);<br>
+ }<br>
+<br>
+ printf("Connected!\n");<br>
+<br>
+ /*<br>
+ * Setup our remote memory and tell the other
side about it<br>
+ */<br>
+ printf("Sending RMR data to remote\n");<br>
+ r_iov.rmr_context = rmr_context[
RCV_RDMA_BUF_INDEX ];<br>
+ r_iov.virtual_address = (DAT_VADDR)((unsigned
long)buf[ RCV_RDMA_BUF_INDEX ]);<br>
+ r_iov.segment_length = BUF_SIZE;<br>
+<br>
+ *buf[ SEND_BUF_INDEX ] = r_iov;<br>
+<br>
+ send_msg( buf[ SEND_BUF_INDEX ],<br>
+ sizeof(DAT_RMR_TRIPLET),<br>
+ lmr_context[
SEND_BUF_INDEX ],<br>
+ cookie,<br>
+ DAT_COMPLETION_SUPPRESS_FLAG);<br>
+<br>
+ /*<br>
+ * Wait for their RMR<br>
+ */<br>
+ printf("Waiting for remote to send RMR
data\n");<br>
+ status = dat_evd_wait(dto_evd, DTO_TIMEOUT, 1,
&event, &nmore);<br>
+ _OK(status, "dat_evd_wait after
dat_ep_post_send");<br>
+<br>
+ if (event.event_number != DAT_DTO_COMPLETION_EVENT) {<br>
+ printf("unexpected
event waiting for RMR context - 0x%x\n", <br>
+ event.event_number);<br>
+ exit(1);<br>
+ }<br>
+<br>
+ _OK(dto_event->status, "event status for
post_send");<br>
+ if ((dto_event->transfered_length !=
sizeof(DAT_RMR_TRIPLET)) ||<br>
+
(dto_event->user_cookie.as_64 != RECV_BUF_INDEX)) {<br>
+ printf("unexpected
event data for receive: len=%d cookie=%d expected %d/%d\n",<br>
+ (int)dto_event->transfered_length,<br>
+ (int)dto_event->user_cookie.as_64,<br>
+ sizeof(DAT_RMR_TRIPLET),
RECV_BUF_INDEX);<br>
+ exit(1);<br>
+ }<br>
+<br>
+ r_iov = *buf[ RECV_BUF_INDEX ];<br>
+<br>
+ printf("Received RMR from remote: r_iov:
ctx=%x,va=%p,len=%d\n",<br>
+ r_iov.rmr_context,<br>
+ (void*)(unsigned
long)r_iov.virtual_address,<br>
+ r_iov.segment_length);<br>
+<br>
+ return(0);<br>
+}<br>
+<br>
+int<br>
+disconnect_ep()<br>
+{<br>
+ DAT_RETURN status;<br>
+ int i;<br>
+ DAT_EVENT event;<br>
+ DAT_COUNT nmore;<br>
+<br>
+ status = dat_ep_disconnect(ep, DAT_CLOSE_DEFAULT);<br>
+ _OK(status, "dat_ep_disconnect");<br>
+<br>
status = dat_evd_wait(con_evd, DAT_TIMEOUT_INFINITE,
1, &event, &nmore);<br>
_OK(status, "dat_ep_disconnect");<br>
- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (server) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_psp_free(psp);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status,
"dat_psp_free");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- for (i = 0; i < REG_MEM_COUNT; i++) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_lmr_free(lmr[ i ]);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status,
"dat_lmr_free");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_lmr_free(lmr_atomic);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_lmr_free_atomic");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_ep_free(ep);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_ep_free");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_free(dto_evd);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_free DTO");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_free(con_evd);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_free CON");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_free(cr_evd);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_free CR");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_pz_free(pz);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_pz_free");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_ia_close(ia, DAT_CLOSE_DEFAULT);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_ia_close");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- return(0);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-}<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-int<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-do_immediate()<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-{<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_REGION_DESCRIPTION region;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_EVENT event;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COUNT nmore;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_LMR_TRIPLET iov;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_RMR_TRIPLET r_iov;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_DTO_COOKIE cookie;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_RMR_CONTEXT their_context;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_RETURN status;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_UINT32 immed_data;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_UINT32 immed_data_recv;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_DTO_COMPLETION_EVENT_DATA *dto_event = <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &event.event_data.dto_completion_event_data;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_IB_EXTENSION_EVENT_DATA *ext_event = <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (DAT_IB_EXTENSION_EVENT_DATA
*)&event.event_extension_data[0];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("\nDoing RDMA WRITE IMMEDIATE
DATA\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (server) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- immed_data
= 0x1111;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } else {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- immed_data
= 0x7777;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie.as_64 = 0x5555;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- r_iov = *buf[ RECV_BUF_INDEX ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- iov.lmr_context =
lmr_context[ SND_RDMA_BUF_INDEX ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- iov.virtual_address = (DAT_VADDR)(unsigned
long)buf[ SND_RDMA_BUF_INDEX ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- iov.segment_length = BUF_SIZE;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie.as_64 = 0x9999;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_ib_post_rdma_write_immed(ep, //
ep_handle<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- 1, //
num_segments<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &iov, //
LMR<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie, //
user_cookie<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &r_iov, //
RMR<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- immed_data,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COMPLETION_DEFAULT_FLAG);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_ib_post_rdma_write_immed");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /*<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- * Collect first event, write
completion or the inbound recv with immed<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_wait(dto_evd, DTO_TIMEOUT,
1, &event, &nmore);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_wait after
dat_ib_post_rdma_write");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (event.event_number != DAT_IB_DTO_EVENT)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event # waiting for WR-IMMED - 0x%x\n", <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- event.event_number);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(dto_event->status, "event
status");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (ext_event->type ==
DAT_IB_RDMA_WRITE_IMMED)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if ((dto_event->transfered_length
!= BUF_SIZE) ||<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
(dto_event->user_cookie.as_64 != 0x9999)) <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
printf("unexpected event data for rdma_write_immed: len=%d
cookie=0x%x\n",<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->transfered_length,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->user_cookie.as_64);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- else if (ext_event->type ==
DAT_IB_RDMA_WRITE_IMMED_DATA)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if ((dto_event->transfered_length
!= BUF_SIZE) ||<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
(dto_event->user_cookie.as_64 != RECV_BUF_INDEX+1)) <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event data of immediate write: len=%d cookie=%d expected %d/%d\n",<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->transfered_length,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->user_cookie.as_64,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sizeof(int),
RECV_BUF_INDEX+1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /* get immediate data from event */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- immed_data_recv =
ext_event->val.immed.data;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- else<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
extension type for event - 0x%x, 0x%x\n", <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- event.event_number,
ext_event->type);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /*<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- * Collect second event, write
completion or the inbound recv with immed<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_wait(dto_evd, DTO_TIMEOUT,
1, &event, &nmore);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_wait after
dat_ib_post_rdma_write");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (event.event_number != DAT_IB_DTO_EVENT)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event # waiting for WR-IMMED - 0x%x\n", <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- event.event_number);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(dto_event->status, "event
status");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (ext_event->type ==
DAT_IB_RDMA_WRITE_IMMED)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if ((dto_event->transfered_length
!= BUF_SIZE) ||<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (dto_event->user_cookie.as_64
!= 0x9999)) <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
printf("unexpected event data for rdma_write_immed: len=%d
cookie=0x%x\n",<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->transfered_length,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->user_cookie.as_64);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- else if (ext_event->type ==
DAT_IB_RDMA_WRITE_IMMED_DATA)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if ((dto_event->transfered_length
!= BUF_SIZE) ||<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
(dto_event->user_cookie.as_64 != RECV_BUF_INDEX+1)) <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event data of immediate write: len=%d cookie=%d expected %d/%d\n",<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->transfered_length,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->user_cookie.as_64,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sizeof(int),
RECV_BUF_INDEX+1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /* get immediate data from event */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- immed_data_recv =
ext_event->val.immed.data;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- else<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
extension type for event - 0x%x, 0x%x\n", <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- event.event_number,
ext_event->type);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if ((server) && (immed_data_recv !=
0x7777))<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("ERROR:
Server got unexpected immed_data_recv 0x%x/0x%x\n", <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- 0x7777,
immed_data_recv);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- else if ((!server) &&
(immed_data_recv != 0x1111))<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("ERROR:
Client got unexpected immed_data_recv 0x%x/0x%x\n", <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- 0x1111,
immed_data_recv);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (server)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Server
received immed_data=0x%x\n", immed_data_recv);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- else<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Client
received immed_data=0x%x\n", immed_data_recv);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("rdma buffer %p contains:
%s\n", <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- buf[
RCV_RDMA_BUF_INDEX ], buf[ RCV_RDMA_BUF_INDEX ]);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("\n
RDMA_WRITE_WITH_IMMEDIATE_DATA test - PASSED\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- return (0);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-}<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-int<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-do_cmp_swap()<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-{<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_DTO_COOKIE cookie;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_RETURN status;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_EVENT event;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COUNT nmore;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_LMR_TRIPLET l_iov;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_RMR_TRIPLET r_iov;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- volatile DAT_UINT64 *target
= (DAT_UINT64*)buf[ RCV_RDMA_BUF_INDEX ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_DTO_COMPLETION_EVENT_DATA *dto_event = <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &event.event_data.dto_completion_event_data;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_IB_EXTENSION_EVENT_DATA *ext_event = <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (DAT_IB_EXTENSION_EVENT_DATA
*)&event.event_extension_data[0];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("\nDoing CMP and SWAP\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- r_iov = *buf[ RECV_BUF_INDEX ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- l_iov.lmr_context =
lmr_atomic_context;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- l_iov.virtual_address = (DAT_VADDR)(unsigned
long)atomic_buf;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- l_iov.segment_length = BUF_SIZE_ATOMIC;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie.as_64 = 3333;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (server) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- *target =
0x12345;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sleep(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /* server
does not compare and should not swap */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_ib_post_cmp_and_swap( ep, <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (DAT_UINT64)0x654321,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (DAT_UINT64)0x6789A,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &l_iov,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &r_iov,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COMPLETION_DEFAULT_FLAG);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } else {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- *target =
0x54321;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sleep(1);
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /* client
does compare and should swap */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_ib_post_cmp_and_swap( ep, <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span lang=DE
style='font-size:10.0pt'>- (DAT_UINT64)0x12345,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span lang=DE
style='font-size:10.0pt'>- (DAT_UINT64)0x98765,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &l_iov,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &r_iov,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COMPLETION_DEFAULT_FLAG);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status,
"dat_ib_post_cmp_and_swap");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_wait(dto_evd, DTO_TIMEOUT,
1, &event, &nmore);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_wait for compare
and swap");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (event.event_number != DAT_IB_DTO_EVENT) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event after post_cmp_and_swap: 0x%x\n", <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-
event.event_number); <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(dto_event->status, "event status
for CMP and SWAP");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (ext_event->type !=
DAT_IB_CMP_AND_SWAP) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event data of cmp and swap : type=%d cookie=%d original 0x%llx\n",<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)ext_event->type,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->user_cookie.as_64,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- *atomic_buf);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sleep(1); /* wait for other side to complete
swap */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (server) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Server got
original data = 0x%llx, expected
0x54321\n", *atomic_buf);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Client final
result (on server) = 0x%llx, expected 0x98765\n", *target);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (*atomic_buf != 0x54321
|| *target != 0x98765) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("ERROR:
Server CMP_SWAP\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } else {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Client got
original data = 0x%llx, expected
0x12345\n",*atomic_buf);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Server final
result (on client) = 0x%llx, expected 0x54321\n", *target);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (*atomic_buf != 0x12345
|| *target != 0x54321) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("ERROR:
Client CMP_SWAP\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("\n CMP_SWAP test -
PASSED\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- return(0);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-}<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-int<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-do_fetch_add()<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-{<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_DTO_COOKIE cookie;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_RETURN status;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_EVENT event;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COUNT nmore;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_LMR_TRIPLET l_iov;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_RMR_TRIPLET r_iov;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- volatile DAT_UINT64 *target
= (DAT_UINT64*)buf[ RCV_RDMA_BUF_INDEX ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_DTO_COMPLETION_EVENT_DATA *dto_event = <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &event.event_data.dto_completion_event_data;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_IB_EXTENSION_EVENT_DATA *ext_event = <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (DAT_IB_EXTENSION_EVENT_DATA
*)&event.event_extension_data[0];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("\nDoing FETCH and ADD\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- r_iov = *buf[ RECV_BUF_INDEX ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- l_iov.lmr_context =
lmr_atomic_context;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- l_iov.virtual_address = (DAT_VADDR)(unsigned
long)atomic_buf;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- l_iov.segment_length = BUF_SIZE_ATOMIC;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie.as_64 = 0x7777;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (server) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /* Wait
for client to finish cmp_swap */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- while
(*target != 0x98765)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sleep(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- *target =
0x10;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sleep(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_ib_post_fetch_and_add( ep, <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (DAT_UINT64)0x100,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &l_iov,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &r_iov,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COMPLETION_DEFAULT_FLAG);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } else {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /* Wait
for server, no swap so nothing to check */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- *target =
0x100;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sleep(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_ib_post_fetch_and_add( ep, <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (DAT_UINT64)0x10,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &l_iov,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &r_iov,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COMPLETION_DEFAULT_FLAG);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status,
"dat_ib_post_fetch_and_add");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_wait(dto_evd, DTO_TIMEOUT,
1, &event, &nmore);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_wait for fetch and
add");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (event.event_number != DAT_IB_DTO_EVENT) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event after post_fetch_and_add: 0x%x\n", event.event_number); <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(dto_event->status, "event status
for FETCH and ADD");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (ext_event->type !=
DAT_IB_FETCH_AND_ADD) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event data of fetch and add : type=%d cookie=%d original%d\n",<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)ext_event->type,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->user_cookie.as_64,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)*atomic_buf);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (server) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Client
original data (on server) = 0x%llx, expected 0x100\n", *atomic_buf);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } else {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Server
original data (on client) = 0x%llx, expected 0x10\n", *atomic_buf);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sleep(1); <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (server) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_ib_post_fetch_and_add( ep, <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (DAT_UINT64)0x100,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &l_iov,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &r_iov,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COMPLETION_DEFAULT_FLAG);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } else {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status =
dat_ib_post_fetch_and_add( ep, <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (DAT_UINT64)0x10,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &l_iov,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- cookie,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- &r_iov,
<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- DAT_COMPLETION_DEFAULT_FLAG);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- status = dat_evd_wait(dto_evd, DTO_TIMEOUT,
1, &event, &nmore);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(status, "dat_evd_wait for second
fetch and add");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (event.event_number != DAT_IB_DTO_EVENT) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event after second post_fetch_and_add: 0x%x\n", event.event_number); <o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- _OK(dto_event->status, "event status
for second FETCH and ADD");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (ext_event->type !=
DAT_IB_FETCH_AND_ADD) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("unexpected
event data of second fetch and add : type=%d cookie=%d original%d\n",<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)ext_event->type,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (int)dto_event->user_cookie.as_64,<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- (long)atomic_buf);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- sleep(1); /* wait for other side to complete
fetch_add */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (server) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Server got
original data = 0x%llx,
expected 0x200\n", *atomic_buf);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Client final
result (on server) = 0x%llx, expected 0x30\n", *target);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (*atomic_buf != 0x200
|| *target != 0x30) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("ERROR:
Server FETCH_ADD\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } else {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Server side
original data = 0x%llx, expected
0x20\n", *atomic_buf);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("Server final
result (on client) = 0x%llx, expected 0x300\n", *target);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (*atomic_buf != 0x20 ||
*target != 0x300) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("ERROR:
Server FETCH_ADD\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf("\n FETCH_ADD test -
PASSED\n");<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- return(0);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-}<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-int<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-main(int argc, char **argv)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-{<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- char *hostname;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (argc > 2) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- printf(usage);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if ((argc == 1) || strcmp(argv[ 1 ],
"-s") == 0)<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- server =
1;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- } else {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- server =
0;<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- hostname
= argv[ 1 ];<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- /*<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- * connect<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- */<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (connect_ep(hostname)) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (do_immediate()) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (do_cmp_swap()) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- if (do_fetch_add()) {<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- exit(1);<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- }<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>- return (disconnect_ep());<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-}<o:p></o:p></span></font></p>
<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>+ <br>
+ if (server) {<br>
+ status =
dat_psp_free(psp);<br>
+ _OK(status,
"dat_psp_free");<br>
+ }<br>
+<br>
+ for (i = 0; i < REG_MEM_COUNT; i++) {<br>
+ status =
dat_lmr_free(lmr[ i ]);<br>
+ _OK(status,
"dat_lmr_free");<br>
+ }<br>
+<br>
+ status = dat_lmr_free(lmr_atomic);<br>
+ _OK(status, "dat_lmr_free_atomic");<br>
+<br>
+ status = dat_ep_free(ep);<br>
+ _OK(status, "dat_ep_free");<br>
+<br>
+ status = dat_evd_free(dto_evd);<br>
+ _OK(status, "dat_evd_free DTO");<br>
+ status = dat_evd_free(con_evd);<br>
+ _OK(status, "dat_evd_free CON");<br>
+ status = dat_evd_free(cr_evd);<br>
+ _OK(status, "dat_evd_free CR");<br>
+<br>
+ status = dat_pz_free(pz);<br>
+ _OK(status, "dat_pz_free");<br>
+<br>
+ status = dat_ia_close(ia, DAT_CLOSE_DEFAULT);<br>
+ _OK(status, "dat_ia_close");<br>
+<br>
+ return(0);<br>
+}<br>
+<br>
+int<br>
+do_immediate()<br>
+{<br>
+ DAT_REGION_DESCRIPTION region;<br>
+ DAT_EVENT event;<br>
+ DAT_COUNT nmore;<br>
+ DAT_LMR_TRIPLET iov;<br>
+ DAT_RMR_TRIPLET r_iov;<br>
+ DAT_DTO_COOKIE cookie;<br>
+ DAT_RMR_CONTEXT their_context;<br>
+ DAT_RETURN status;<br>
+ DAT_UINT32 immed_data;<br>
+ DAT_UINT32 immed_data_recv;<br>
+ DAT_DTO_COMPLETION_EVENT_DATA *dto_event = <br>
+ &event.event_data.dto_completion_event_data;<br>
+ DAT_IB_EXTENSION_EVENT_DATA *ext_event = <br>
+ (DAT_IB_EXTENSION_EVENT_DATA
*)&event.event_extension_data[0];<br>
+<br>
+ printf("\nDoing RDMA WRITE IMMEDIATE
DATA\n");<br>
+<br>
+ if (server) {<br>
+ immed_data =
0x1111;<br>
+ } else {<br>
+ immed_data =
0x7777;<br>
+ }<br>
+<br>
+ cookie.as_64 = 0x5555;<br>
+ <br>
+ r_iov = *buf[ RECV_BUF_INDEX ];<br>
+<br>
+ iov.lmr_context =
lmr_context[ SND_RDMA_BUF_INDEX ];<br>
+ iov.virtual_address = (DAT_VADDR)(unsigned long)buf[
SND_RDMA_BUF_INDEX ];<br>
+ iov.segment_length = BUF_SIZE;<br>
+<br>
+ cookie.as_64 = 0x9999;<br>
+ <br>
+ status = dat_ib_post_rdma_write_immed(ep, //
ep_handle<br>
+ 1, //
num_segments<br>
+ &iov, //
LMR<br>
+ cookie, //
user_cookie<br>
+ &r_iov, //
RMR<br>
+ immed_data,<br>
+ DAT_COMPLETION_DEFAULT_FLAG);<br>
+ _OK(status,
"dat_ib_post_rdma_write_immed");<br>
+<br>
+ /*<br>
+ * Collect first event, write completion or the
inbound recv with immed<br>
+ */<br>
+ status = dat_evd_wait(dto_evd, DTO_TIMEOUT, 1,
&event, &nmore);<br>
+ _OK(status, "dat_evd_wait after
dat_ib_post_rdma_write");<br>
+ if (event.event_number != DAT_IB_DTO_EVENT)<br>
+ {<br>
+ printf("unexpected
event # waiting for WR-IMMED - 0x%x\n", <br>
+ event.event_number);<br>
+ exit(1);<br>
+ }<br>
+ <br>
+ _OK(dto_event->status, "event status");<br>
+ if (ext_event->type == DAT_IB_RDMA_WRITE_IMMED)<br>
+ {<br>
+ if ((dto_event->transfered_length !=
BUF_SIZE) ||<br>
+
(dto_event->user_cookie.as_64 != 0x9999)) <br>
+ {<br>
+
printf("unexpected event data for rdma_write_immed: len=%d
cookie=0x%x\n",<br>
+ (int)dto_event->transfered_length,<br>
+ (int)dto_event->user_cookie.as_64);<br>
+ exit(1);<br>
+ }<br>
+ } <br>
+ else if (ext_event->type ==
DAT_IB_RDMA_WRITE_IMMED_DATA)<br>
+ {<br>
+ if ((dto_event->transfered_length != BUF_SIZE)
||<br>
+
(dto_event->user_cookie.as_64 != RECV_BUF_INDEX+1)) <br>
+ {<br>
+ printf("unexpected
event data of immediate write: len=%d cookie=%d expected %d/%d\n",<br>
+ (int)dto_event->transfered_length,<br>
+ (int)dto_event->user_cookie.as_64,<br>
+ sizeof(int),
RECV_BUF_INDEX+1);<br>
+ exit(1);<br>
+ }<br>
+ <br>
+ /* get immediate data from event */<br>
+ immed_data_recv =
ext_event->val.immed.data;<br>
+ }<br>
+ else<br>
+ {<br>
+ printf("unexpected
extension type for event - 0x%x, 0x%x\n", <br>
+ event.event_number,
ext_event->type);<br>
+ exit(1);<br>
+ }<br>
+<br>
+<br>
+ /*<br>
+ * Collect second event, write completion or
the inbound recv with immed<br>
+ */<br>
+ status = dat_evd_wait(dto_evd, DTO_TIMEOUT, 1,
&event, &nmore);<br>
+ _OK(status, "dat_evd_wait after
dat_ib_post_rdma_write");<br>
+ if (event.event_number != DAT_IB_DTO_EVENT)<br>
+ {<br>
+ printf("unexpected
event # waiting for WR-IMMED - 0x%x\n", <br>
+ event.event_number);<br>
+ exit(1);<br>
+ }<br>
+ <br>
+ _OK(dto_event->status, "event status");<br>
+ if (ext_event->type == DAT_IB_RDMA_WRITE_IMMED)<br>
+ {<br>
+ if ((dto_event->transfered_length !=
BUF_SIZE) ||<br>
+
(dto_event->user_cookie.as_64 != 0x9999)) <br>
+ {<br>
+
printf("unexpected event data for rdma_write_immed: len=%d
cookie=0x%x\n",<br>
+ (int)dto_event->transfered_length,<br>
+ (int)dto_event->user_cookie.as_64);<br>
+ exit(1);<br>
+ }<br>
+ } <br>
+ else if (ext_event->type ==
DAT_IB_RDMA_WRITE_IMMED_DATA)<br>
+ {<br>
+ if ((dto_event->transfered_length !=
BUF_SIZE) ||<br>
+
(dto_event->user_cookie.as_64 != RECV_BUF_INDEX+1)) <br>
+ {<br>
+ printf("unexpected
event data of immediate write: len=%d cookie=%d expected %d/%d\n",<br>
+ (int)dto_event->transfered_length,<br>
+ (int)dto_event->user_cookie.as_64,<br>
+ sizeof(int),
RECV_BUF_INDEX+1);<br>
+ exit(1);<br>
+ }<br>
+ <br>
+ /* get immediate data from event */<br>
+ immed_data_recv = ext_event->val.immed.data;<br>
+ }<br>
+ else<br>
+ {<br>
+ printf("unexpected
extension type for event - 0x%x, 0x%x\n", <br>
+ event.event_number,
ext_event->type);<br>
+ exit(1);<br>
+ }<br>
+ <br>
+ if ((server) && (immed_data_recv != 0x7777))<br>
+ {<br>
+ printf("ERROR:
Server got unexpected immed_data_recv 0x%x/0x%x\n", <br>
+ 0x7777,
immed_data_recv);<br>
+ exit(1);<br>
+ } <br>
+ else if ((!server) && (immed_data_recv !=
0x1111))<br>
+ {<br>
+ printf("ERROR:
Client got unexpected immed_data_recv 0x%x/0x%x\n", <br>
+ 0x1111,
immed_data_recv);<br>
+ exit(1);<br>
+ }<br>
+<br>
+ if (server)<br>
+ printf("Server
received immed_data=0x%x\n", immed_data_recv);<br>
+ else<br>
+ printf("Client
received immed_data=0x%x\n", immed_data_recv);<br>
+ <br>
+ printf("rdma buffer %p contains: %s\n", <br>
+ buf[
RCV_RDMA_BUF_INDEX ], buf[ RCV_RDMA_BUF_INDEX ]);<br>
+<br>
+ printf("\n RDMA_WRITE_WITH_IMMEDIATE_DATA test -
PASSED\n");<br>
+ return (0);<br>
+}<br>
+<br>
+int<br>
+do_cmp_swap()<br>
+{<br>
+ DAT_DTO_COOKIE cookie;<br>
+ DAT_RETURN status;<br>
+ DAT_EVENT event;<br>
+ DAT_COUNT nmore;<br>
+ DAT_LMR_TRIPLET l_iov;<br>
+ DAT_RMR_TRIPLET r_iov;<br>
+ volatile DAT_UINT64 *target =
(DAT_UINT64*)buf[ RCV_RDMA_BUF_INDEX ];<br>
+ DAT_DTO_COMPLETION_EVENT_DATA *dto_event = <br>
+ &event.event_data.dto_completion_event_data;<br>
+ DAT_IB_EXTENSION_EVENT_DATA *ext_event = <br>
+ (DAT_IB_EXTENSION_EVENT_DATA
*)&event.event_extension_data[0];<br>
+<br>
+ printf("\nDoing CMP and SWAP\n");<br>
+ <br>
+ r_iov = *buf[ RECV_BUF_INDEX ];<br>
+ <br>
+ l_iov.lmr_context =
lmr_atomic_context;<br>
+ l_iov.virtual_address = (DAT_VADDR)(unsigned
long)atomic_buf;<br>
+ l_iov.segment_length = BUF_SIZE_ATOMIC;<br>
+<br>
+ cookie.as_64 = 3333;<br>
+ if (server) {<br>
+ *target =
0x12345;<br>
+ sleep(1);<br>
+ /* server does
not compare and should not swap */<br>
+ status =
dat_ib_post_cmp_and_swap( ep, <br>
+ (DAT_UINT64)0x654321,
<br>
+ (DAT_UINT64)0x6789A,
<br>
+ &l_iov,<br>
+ cookie,
<br>
+ &r_iov,
<br>
+ DAT_COMPLETION_DEFAULT_FLAG);<br>
+ } else {<br>
+ *target =
0x54321;<br>
+ sleep(1); <br>
+ /* client does
compare and should swap */<br>
+ status =
dat_ib_post_cmp_and_swap( ep, <br>
</span></font><span lang=DE>+ (DAT_UINT64)0x12345,
<br>
+ (DAT_UINT64)0x98765,<br>
</span>+ &l_iov,<br>
+ cookie,
<br>
+ &r_iov,
<br>
+ DAT_COMPLETION_DEFAULT_FLAG);<br>
+ }<br>
+ _OK(status, "dat_ib_post_cmp_and_swap");<br>
+ status = dat_evd_wait(dto_evd, DTO_TIMEOUT, 1,
&event, &nmore);<br>
+ _OK(status, "dat_evd_wait for compare and
swap");<br>
+ if (event.event_number != DAT_IB_DTO_EVENT) {<br>
+ printf("unexpected event
after post_cmp_and_swap: 0x%x\n", <br>
+
event.event_number); <br>
+ exit(1);<br>
+ }<br>
+<br>
+ _OK(dto_event->status, "event status for CMP
and SWAP");<br>
+ if (ext_event->type != DAT_IB_CMP_AND_SWAP) {<br>
+ printf("unexpected event data
of cmp and swap : type=%d cookie=%d original 0x%llx\n",<br>
+ (int)ext_event->type,<br>
+ (int)dto_event->user_cookie.as_64,<br>
+ *atomic_buf);<br>
+ exit(1);<br>
+ }<br>
+ sleep(1); /* wait for other side to complete swap */<br>
+ if (server) {<br>
+ printf("Server got original
data = 0x%llx, expected
0x54321\n", *atomic_buf);<br>
+ printf("Client final result
(on server) = 0x%llx, expected 0x98765\n", *target);<br>
+<br>
+ if (*atomic_buf != 0x54321 ||
*target != 0x98765) {<br>
+ printf("ERROR: Server
CMP_SWAP\n");<br>
+ exit(1);<br>
+ }<br>
+ } else {<br>
+ printf("Client got original
data = 0x%llx, expected
0x12345\n",*atomic_buf);<br>
+ printf("Server final result
(on client) = 0x%llx, expected 0x54321\n", *target);<br>
+<br>
+ if (*atomic_buf != 0x12345 ||
*target != 0x54321) {<br>
+ printf("ERROR: Client
CMP_SWAP\n");<br>
+ exit(1);<br>
+ }<br>
+ }<br>
+ printf("\n CMP_SWAP test - PASSED\n");<br>
+ return(0);<br>
+}<br>
+<br>
+int<br>
+do_fetch_add()<br>
+{<br>
+ DAT_DTO_COOKIE cookie;<br>
+ DAT_RETURN status;<br>
+ DAT_EVENT event;<br>
+ DAT_COUNT nmore;<br>
+ DAT_LMR_TRIPLET l_iov;<br>
+ DAT_RMR_TRIPLET r_iov;<br>
+ volatile DAT_UINT64 *target =
(DAT_UINT64*)buf[ RCV_RDMA_BUF_INDEX ];<br>
+ DAT_DTO_COMPLETION_EVENT_DATA *dto_event = <br>
+ &event.event_data.dto_completion_event_data;<br>
+ DAT_IB_EXTENSION_EVENT_DATA *ext_event = <br>
+ (DAT_IB_EXTENSION_EVENT_DATA
*)&event.event_extension_data[0];<br>
+<br>
+ printf("\nDoing FETCH and ADD\n");<br>
+<br>
+ r_iov = *buf[ RECV_BUF_INDEX ];<br>
+ <br>
+ l_iov.lmr_context =
lmr_atomic_context;<br>
+ l_iov.virtual_address = (DAT_VADDR)(unsigned
long)atomic_buf;<br>
+ l_iov.segment_length = BUF_SIZE_ATOMIC;<br>
+<br>
+ cookie.as_64 = 0x7777;<br>
+ if (server) {<br>
+ /* Wait for
client to finish cmp_swap */<br>
+ while (*target !=
0x98765)<br>
+ sleep(1);<br>
+ *target = 0x10;<br>
+ sleep(1);<br>
+ status = dat_ib_post_fetch_and_add( ep,
<br>
+ (DAT_UINT64)0x100,<br>
+ &l_iov,<br>
+ cookie,
<br>
+ &r_iov,
<br>
+ DAT_COMPLETION_DEFAULT_FLAG);<br>
+ } else {<br>
+ /* Wait for
server, no swap so nothing to check */<br>
+ *target = 0x100;<br>
+ sleep(1);<br>
+ status = dat_ib_post_fetch_and_add( ep,
<br>
+ (DAT_UINT64)0x10,
<br>
+ &l_iov,<br>
+ cookie,
<br>
+ &r_iov,
<br>
+ DAT_COMPLETION_DEFAULT_FLAG);<br>
+ }<br>
+ _OK(status, "dat_ib_post_fetch_and_add");<br>
+ status = dat_evd_wait(dto_evd, DTO_TIMEOUT, 1,
&event, &nmore);<br>
+ _OK(status, "dat_evd_wait for fetch and
add");<br>
+ if (event.event_number != DAT_IB_DTO_EVENT) {<br>
+ printf("unexpected
event after post_fetch_and_add: 0x%x\n", event.event_number); <br>
+ exit(1);<br>
+ }<br>
+<br>
+ _OK(dto_event->status, "event status for
FETCH and ADD");<br>
+ if (ext_event->type != DAT_IB_FETCH_AND_ADD) {<br>
+ printf("unexpected
event data of fetch and add : type=%d cookie=%d original%d\n",<br>
+ (int)ext_event->type,<br>
+ (int)dto_event->user_cookie.as_64,<br>
+ (int)*atomic_buf);<br>
+ exit(1);<br>
+ }<br>
+<br>
+ if (server) {<br>
+ printf("Client original data
(on server) = 0x%llx, expected 0x100\n", *atomic_buf);<br>
+ } else {<br>
+ printf("Server original data
(on client) = 0x%llx, expected 0x10\n", *atomic_buf);<br>
+ }<br>
+<br>
+ sleep(1); <br>
+<br>
+ if (server) {<br>
+ status =
dat_ib_post_fetch_and_add( ep, <br>
+ (DAT_UINT64)0x100,
<br>
+ &l_iov,<br>
+ cookie,
<br>
+ &r_iov,
<br>
+ DAT_COMPLETION_DEFAULT_FLAG);<br>
+ } else {<br>
+ status =
dat_ib_post_fetch_and_add( ep, <br>
+ (DAT_UINT64)0x10,<br>
+ &l_iov,<br>
+ cookie,
<br>
+ &r_iov,
<br>
+ DAT_COMPLETION_DEFAULT_FLAG);<br>
+ }<br>
+<br>
+ status = dat_evd_wait(dto_evd, DTO_TIMEOUT, 1,
&event, &nmore);<br>
+ _OK(status, "dat_evd_wait for second fetch and
add");<br>
+ if (event.event_number != DAT_IB_DTO_EVENT) {<br>
+ printf("unexpected
event after second post_fetch_and_add: 0x%x\n", event.event_number); <br>
+ exit(1);<br>
+ }<br>
+<br>
+ _OK(dto_event->status, "event status for
second FETCH and ADD");<br>
+ if (ext_event->type != DAT_IB_FETCH_AND_ADD) {<br>
+ printf("unexpected
event data of second fetch and add : type=%d cookie=%d original%d\n",<br>
+ (int)ext_event->type,<br>
+ (int)dto_event->user_cookie.as_64,<br>
+ (long)atomic_buf);<br>
+ exit(1);<br>
+ }<br>
+<br>
+ sleep(1); /* wait for other side to complete
fetch_add */<br>
+<br>
+ if (server) {<br>
+ printf("Server got original
data = 0x%llx, expected
0x200\n", *atomic_buf);<br>
+ printf("Client final result
(on server) = 0x%llx, expected 0x30\n", *target);<br>
+<br>
+ if (*atomic_buf != 0x200 ||
*target != 0x30) {<br>
+ printf("ERROR: Server
FETCH_ADD\n");<br>
+ exit(1);<br>
+ }<br>
+ } else {<br>
+ printf("Server side original
data = 0x%llx, expected 0x20\n",
*atomic_buf);<br>
+ printf("Server final result
(on client) = 0x%llx, expected 0x300\n", *target);<br>
+<br>
+ if (*atomic_buf != 0x20 || *target
!= 0x300) {<br>
+ printf("ERROR: Server
FETCH_ADD\n");<br>
+ exit(1);<br>
+ }<br>
+ }<br>
+ printf("\n FETCH_ADD test - PASSED\n");<br>
+ return(0);<br>
+}<br>
+<br>
+int<br>
+main(int argc, char **argv)<br>
+{<br>
+ char *hostname;<br>
+<br>
+ if (argc > 2) {<br>
+ printf(usage);<br>
+ exit(1);<br>
+ }<br>
+<br>
+ if ((argc == 1) || strcmp(argv[ 1 ], "-s")
== 0)<br>
+ {<br>
+ server = 1;<br>
+ } else {<br>
+ server = 0;<br>
+ hostname = argv[
1 ];<br>
+ }<br>
+<br>
+<br>
+ /*<br>
+ * connect<br>
+ */<br>
+ if (connect_ep(hostname)) {<br>
+ exit(1);<br>
+ }<br>
+ if (do_immediate()) {<br>
+ exit(1);<br>
+ }<br>
+ if (do_cmp_swap()) {<br>
+ exit(1);<br>
+ }<br>
+ if (do_fetch_add()) {<br>
+ exit(1);<br>
+ }<br>
+ return (disconnect_ep());<br>
+}<br>
<o:p> </o:p></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
</div>
</body>
</html>