From: leonidk Date: Tue, 28 Oct 2008 10:50:55 +0000 (+0000) Subject: [TOOLS] performance tests: changes for interoperability with Linux. X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=d2149994c6ed66f29e44527a4c8ec7d21c36e179;p=~shefty%2Frdma-win.git [TOOLS] performance tests: changes for interoperability with Linux. The main problem was, that Linux stores values like qpn, psn, lid in little endian format, while Windows - in big endian one. git-svn-id: svn://openib.tc.cornell.edu/gen1@1710 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/tools/perftests/user/perf_defs.h b/trunk/tools/perftests/user/perf_defs.h index 2b29ae15..e2370544 100644 --- a/trunk/tools/perftests/user/perf_defs.h +++ b/trunk/tools/perftests/user/perf_defs.h @@ -54,7 +54,7 @@ #include #define KEY_MSG_SIZE (sizeof "0000:000000:000000:00000000:0000000000000000") -#define KEY_PRINT_FMT "%04x:%06x:%06x:%08x:%x" +#define KEY_PRINT_FMT "%04x:%06x:%06x:%08x:%016I64x" #define KEY_SCAN_FMT "%x:%x:%x:%x:%x" #define VERSION 2.0 diff --git a/trunk/tools/perftests/user/perf_utils.c b/trunk/tools/perftests/user/perf_utils.c index b2e74773..e56f5ee7 100644 --- a/trunk/tools/perftests/user/perf_utils.c +++ b/trunk/tools/perftests/user/perf_utils.c @@ -76,8 +76,8 @@ static int pp_write_keys(SOCKET sockfd, const struct pingpong_dest *my_dest) { char msg[KEY_MSG_SIZE]; PERF_ENTER; - sprintf(msg, KEY_PRINT_FMT,my_dest->lid, my_dest->qpn, - my_dest->psn, my_dest->rkey, my_dest->vaddr); + sprintf(msg, KEY_PRINT_FMT,cl_hton16(my_dest->lid), cl_hton32(my_dest->qpn), + cl_hton32(my_dest->psn), cl_hton32(my_dest->rkey), my_dest->vaddr); if (send(sockfd, msg, sizeof msg,0) != sizeof msg) { perror("pp_write_keys"); @@ -101,8 +101,12 @@ static int pp_read_keys(SOCKET sockfd, return -1; } - parsed = sscanf(msg, KEY_SCAN_FMT, &rem_dest->lid, &rem_dest->qpn, + parsed = sscanf(msg, KEY_PRINT_FMT, &rem_dest->lid, &rem_dest->qpn, &rem_dest->psn,&rem_dest->rkey, &rem_dest->vaddr); + rem_dest->lid = cl_ntoh16(rem_dest->lid); + rem_dest->qpn = cl_ntoh32(rem_dest->qpn); + rem_dest->psn = cl_ntoh32(rem_dest->psn); + rem_dest->rkey = cl_ntoh32(rem_dest->rkey); if (parsed != 5) { fprintf(stderr, "Couldn't parse line <%.*s > parsed = %d %s\n", diff --git a/trunk/tools/perftests/user/read_bw/read_bw.c b/trunk/tools/perftests/user/read_bw/read_bw.c index e2bfd630..6637037f 100644 --- a/trunk/tools/perftests/user/read_bw/read_bw.c +++ b/trunk/tools/perftests/user/read_bw/read_bw.c @@ -399,7 +399,7 @@ static SOCKET pp_open_port(struct pingpong_context *ctx, const char * servername * We do it by exchanging data over a TCP socket connection. */ my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid; - my_dest[i].psn = rand() & 0xffffff; + my_dest[i].psn = cl_hton32(rand() & 0xffffff); if (!my_dest[i].lid) { fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n"); return 1; diff --git a/trunk/tools/perftests/user/read_lat/read_lat.c b/trunk/tools/perftests/user/read_lat/read_lat.c index d3484321..0c15f83c 100644 --- a/trunk/tools/perftests/user/read_lat/read_lat.c +++ b/trunk/tools/perftests/user/read_lat/read_lat.c @@ -410,7 +410,7 @@ static SOCKET pp_open_port(struct pingpong_context *ctx, const char * servername * We do it by exchanging data over a TCP socket connection. */ my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid; - my_dest[i].psn = rand() & 0xffffff; + my_dest[i].psn = cl_hton32(rand() & 0xffffff); if (!my_dest[i].lid) { fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n"); return 1; diff --git a/trunk/tools/perftests/user/send_bw/send_bw.c b/trunk/tools/perftests/user/send_bw/send_bw.c index 25e5201c..ae12cde5 100644 --- a/trunk/tools/perftests/user/send_bw/send_bw.c +++ b/trunk/tools/perftests/user/send_bw/send_bw.c @@ -502,7 +502,7 @@ static SOCKET pp_open_port(struct pingpong_context *ctx, const char * servername * We do it by exchanging data over a TCP socket connection. */ my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid; - my_dest[i].psn = rand() & 0xffffff; + my_dest[i].psn = cl_hton32(rand() & 0xffffff); if (!my_dest[i].lid) { fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n"); return 1; @@ -606,16 +606,16 @@ int run_iter_bi(struct pingpong_context *ctx, struct user_parameters *user_param /********************************************* * Important note : * In case of UD/UC this is NOT the way to measure - * BW sicen we are running with loop on the send side - * while we should run on the recieve side or enable retry in SW + * BW since we are running with loop on the send side + * while we should run on the receive side or enable retry in SW * Since the sender may be faster than the reciver than although * we had posted recieve it is not enough and might end this will * result in deadlock of test since both sides are stuck on poll cq * In this test i do not solve this for the general test ,need to write - * seperate test for UC/UD but in case the tx_depth is ~1/3 from the + * separate test for UC/UD but in case the tx_depth is ~1/3 from the * number of iterations this should be ok . * Also note that the sender is limited in the number of send, ans - * i try to make the reciver full + * i try to make the receiver full *********************************************/ /* send */ if (user_param->connection_type==UD) { diff --git a/trunk/tools/perftests/user/send_lat/send_lat.c b/trunk/tools/perftests/user/send_lat/send_lat.c index a78194f4..7c704084 100644 --- a/trunk/tools/perftests/user/send_lat/send_lat.c +++ b/trunk/tools/perftests/user/send_lat/send_lat.c @@ -488,7 +488,7 @@ static SOCKET pp_open_port(struct pingpong_context *ctx, const char * servername * We do it by exchanging data over a TCP socket connection. */ my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid; - my_dest[i].psn = rand() & 0xffffff; + my_dest[i].psn = cl_hton32(rand() & 0xffffff); if (!my_dest[i].lid) { fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n"); return 1; diff --git a/trunk/tools/perftests/user/write_bw/write_bw.c b/trunk/tools/perftests/user/write_bw/write_bw.c index 8ba5010a..c62ced1a 100644 --- a/trunk/tools/perftests/user/write_bw/write_bw.c +++ b/trunk/tools/perftests/user/write_bw/write_bw.c @@ -429,7 +429,7 @@ static SOCKET pp_open_port(struct pingpong_context *ctx, const char * servername * We do it by exchanging data over a TCP socket connection. */ my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid; - my_dest[i].psn = rand() & 0xffffff; + my_dest[i].psn = cl_hton32(rand() & 0xffffff); if (!my_dest[i].lid) { fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n"); return 1; diff --git a/trunk/tools/perftests/user/write_lat/write_lat.c b/trunk/tools/perftests/user/write_lat/write_lat.c index 28d89a65..5eb21aff 100644 --- a/trunk/tools/perftests/user/write_lat/write_lat.c +++ b/trunk/tools/perftests/user/write_lat/write_lat.c @@ -419,7 +419,7 @@ static SOCKET pp_open_port(struct pingpong_context *ctx, const char * servername * We do it by exchanging data over a TCP socket connection. */ my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid; - my_dest[i].psn = rand() & 0xffffff; + my_dest[i].psn = cl_hton32(rand() & 0xffffff); if (!my_dest[i].lid) { fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n"); return 1;