[ofw][patch][WinVerbs tests] Re: fix IPv6 related connection problem
Leonid Keller
leonid at mellanox.co.il
Wed Feb 18 11:21:57 PST 2009
This is an updated patch to WinVerbs tests.
It solves two problems:
1. Support correct work with both IPv6 and IPv4 host addresses;
2. Calculate correctly the latencies on win2k8.
After the fix WinVerbs' performance tests shows approximately the same
results as Ibal's ones.
Index: tests/perftest/rdma_bw/rdma_bw.c
===================================================================
--- tests/perftest/rdma_bw/rdma_bw.c (revision 1977)
+++ tests/perftest/rdma_bw/rdma_bw.c (working copy)
@@ -384,10 +384,10 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof
n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
Index: tests/perftest/rdma_lat/rdma_lat.c
===================================================================
--- tests/perftest/rdma_lat/rdma_lat.c (revision 1977)
+++ tests/perftest/rdma_lat/rdma_lat.c (working copy)
@@ -439,8 +439,8 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
- n = 1;
-
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
@@ -1177,7 +1177,6 @@
if (scnt < iters) {
struct ibv_send_wr *bad_wr;
- tstamp[scnt] = get_cycles();
*post_buf = (char)++scnt;
if (ibv_post_send(qp, wr, &bad_wr)) {
@@ -1185,6 +1184,7 @@
scnt);
return 11;
}
+ tstamp[scnt-1] = get_cycles();
}
if (ccnt < iters) {
Index: tests/perftest/read_bw/read_bw.c
===================================================================
--- tests/perftest/read_bw/read_bw.c (revision 1977)
+++ tests/perftest/read_bw/read_bw.c (working copy)
@@ -208,10 +208,10 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
Index: tests/perftest/read_lat/read_lat.c
===================================================================
--- tests/perftest/read_lat/read_lat.c (revision 1977)
+++ tests/perftest/read_lat/read_lat.c (working copy)
@@ -252,10 +252,10 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
@@ -675,12 +675,12 @@
while (scnt < user_param->iters ) {
struct ibv_send_wr *bad_wr;
*post_buf = (char)++scnt;
- tstamp[scnt - 1] = get_cycles();
if (ibv_post_send(qp, wr, &bad_wr)) {
fprintf(stderr, "Couldn't post send: scnt=%d\n",
scnt);
return 11;
}
+ tstamp[scnt - 1] = get_cycles();
if (user_param->use_event) {
struct ibv_cq *ev_cq;
void *ev_ctx;
Index: tests/perftest/send_bw/send_bw.c
===================================================================
--- tests/perftest/send_bw/send_bw.c (revision 1977)
+++ tests/perftest/send_bw/send_bw.c (working copy)
@@ -223,10 +223,10 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
Index: tests/perftest/send_lat/send_lat.c
===================================================================
--- tests/perftest/send_lat/send_lat.c (revision 1977)
+++ tests/perftest/send_lat/send_lat.c (working copy)
@@ -263,10 +263,9 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
@@ -911,13 +910,13 @@
}
/* client post first */
- tstamp[scnt] = get_cycles();
*post_buf = (char)++scnt;
if (ibv_post_send(qp, wr, &bad_wr)) {
fprintf(stderr, "Couldn't post send: scnt=%d\n",
scnt);
return 11;
}
+ tstamp[scnt-1] = get_cycles();
}
if (poll == 1) {
struct ibv_wc wc;
Index: tests/perftest/write_bw/write_bw.c
===================================================================
--- tests/perftest/write_bw/write_bw.c (revision 1977)
+++ tests/perftest/write_bw/write_bw.c (working copy)
@@ -217,10 +217,10 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
Index: tests/perftest/write_bw_postlist/write_bw_postlist.c
===================================================================
--- tests/perftest/write_bw_postlist/write_bw_postlist.c (revision 1977)
+++ tests/perftest/write_bw_postlist/write_bw_postlist.c (working copy)
@@ -220,10 +220,10 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd >= 0) {
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &n, sizeof n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
close(sockfd);
Index: tests/perftest/write_lat/write_lat.c
===================================================================
--- tests/perftest/write_lat/write_lat.c (revision 1977)
+++ tests/perftest/write_lat/write_lat.c (working copy)
@@ -249,10 +249,10 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
@@ -711,7 +711,6 @@
if (scnt < user_param->iters) {
struct ibv_send_wr *bad_wr;
- tstamp[scnt] = get_cycles();
*post_buf = (char)++scnt;
@@ -720,6 +719,7 @@
scnt);
return 11;
}
+ tstamp[scnt-1] = get_cycles();
}
if (ccnt < user_param->iters) {
Index: ulp/libibverbs/examples/rc_pingpong/rc_pingpong.c
===================================================================
--- ulp/libibverbs/examples/rc_pingpong/rc_pingpong.c (revision 1977)
+++ ulp/libibverbs/examples/rc_pingpong/rc_pingpong.c (working copy)
@@ -207,10 +207,10 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
Index: ulp/libibverbs/examples/srq_pingpong/srq_pingpong.c
===================================================================
--- ulp/libibverbs/examples/srq_pingpong/srq_pingpong.c (revision 1977)
+++ ulp/libibverbs/examples/srq_pingpong/srq_pingpong.c (working copy)
@@ -248,10 +248,10 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd >= 0) {
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &n, sizeof n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
close(sockfd);
Index: ulp/libibverbs/examples/uc_pingpong/uc_pingpong.c
===================================================================
--- ulp/libibverbs/examples/uc_pingpong/uc_pingpong.c (revision 1977)
+++ ulp/libibverbs/examples/uc_pingpong/uc_pingpong.c (working copy)
@@ -194,10 +194,10 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
Index: ulp/libibverbs/examples/ud_pingpong/ud_pingpong.c
===================================================================
--- ulp/libibverbs/examples/ud_pingpong/ud_pingpong.c (revision 1977)
+++ ulp/libibverbs/examples/ud_pingpong/ud_pingpong.c (working copy)
@@ -195,10 +195,10 @@
for (t = res; t; t = t->ai_next) {
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd != INVALID_SOCKET) {
+ n = 0;
+ setsockopt(sockfd,IPPROTO_IPV6,IPV6_V6ONLY,(char *) &n, sizeof n);
n = 1;
-
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof n);
-
if (!bind(sockfd, t->ai_addr, t->ai_addrlen))
break;
closesocket(sockfd);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090218/b858bbfc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wv_tests1.patch
Type: application/octet-stream
Size: 9973 bytes
Desc: wv_tests1.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090218/b858bbfc/attachment.obj>
More information about the ofw
mailing list