<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2>Index: perf_defs.h</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2>===================================================================</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>--- perf_defs.h (revision 1304)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>+++ perf_defs.h (working copy)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>@@ -114,6 +114,7 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> volatile
char *poll_buf;<BR> <BR> int *scnt,*ccnt;<BR>+ cl_waitobj_handle_t cq_waitobj;<BR> };<BR> <BR> <BR>Index:
send_bw/send_bw.c</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2>===================================================================</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>--- send_bw/send_bw.c (revision
1304)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>+++ send_bw/send_bw.c (working
copy)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>@@ -51,7 +51,7 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2> int iters;<BR> int tx_depth;<BR> int duplex;<BR>-
int
use_event;<BR>+ int use_event;<BR> };<BR> <BR> static
int page_size;<BR>@@ -62,7 +62,7 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2> <BR> void<BR> pp_cq_comp_cb(<BR>- IN const ib_cq_handle_t h_cq,<BR>+ IN const ib_cq_handle_t
h_cq,<BR> IN void *cq_context
)<BR> {<BR> UNUSED_PARAM( h_cq );<BR>@@ -72,7 +72,8
@@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> <BR> <BR> <BR>-static struct
pingpong_context *pp_init_ctx(unsigned size,int port, struct user_parameters
*user_parm)<BR>+static struct pingpong_context *pp_init_ctx(unsigned size,int
port, <BR>+ struct user_parameters
*user_parm)<BR> {<BR> <BR> struct
pingpong_context *ctx;<BR>@@ -101,14 +102,14 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> ctx->tx_depth =
user_parm->tx_depth;<BR> /* in case of UD need space for the GRH
*/<BR> if (user_parm->connection_type==UD)
{<BR>- ctx->buf = malloc(( size + 40 ) * 2); //PORTED
ALINGED<BR>+ ctx->buf = malloc(( size + 40 ) *
2);<BR> if (!ctx->buf)
{<BR> fprintf(stderr, "Couldn't allocate work
buf.\n");<BR> return
NULL;<BR> }<BR> memset(ctx->buf, 0, ( size
+ 40 ) * 2);<BR> } else {<BR>- ctx->buf = malloc( size
* 2); //PORTED ALINGED<BR>+ ctx->buf = malloc( size *
2);<BR> if (!ctx->buf)
{<BR> fprintf(stderr, "Couldn't allocate work
buf.\n");<BR> return NULL;<BR>@@ -199,17 +200,9
@@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2> }<BR> }<BR> }<BR>- <BR>- if
(user_parm->use_event) {<BR>-//PORTED ctx->channel =
ibv_create_comp_channel(ctx->context);<BR>- ctx->channel =
NULL;//remove when PORTED<BR>- if (!ctx->channel)
{<BR>- fprintf(stderr, "Couldn't create completion
channel\n");<BR>- return NULL;<BR>- }<BR>- }
else<BR>- ctx->channel =
NULL;
<BR> <BR>+ ctx->channel = NULL;<BR>+<BR> ib_status =
ib_alloc_pd(ctx->ca
,<BR> IB_PDT_NORMAL,<BR> ctx,
//pd_context<BR>@@ -241,16 +234,42 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> return
NULL;<BR> }<BR> <BR>+ if
(user_parm->use_event) {<BR>+ cl_status_t
cl_status;<BR>+<BR>+ cl_status = cl_waitobj_create( FALSE,
&ctx->cq_waitobj );<BR>+ if( cl_status != CL_SUCCESS )
{<BR>+ ctx->cq_waitobj =
NULL;<BR>+ fprintf(stderr, "cl_waitobj_create() returned
%s\n", CL_STATUS_MSG(cl_status) );<BR>+ return
NULL;<BR>+ }<BR>+<BR>+ cq_create.h_wait_obj =
ctx->cq_waitobj;<BR>+ cq_create.pfn_comp_cb =
NULL;<BR>+ } else {<BR>+ cq_create.h_wait_obj =
NULL;<BR>+ cq_create.pfn_comp_cb =
pp_cq_comp_cb;<BR>+ }<BR>+<BR> cq_create.size =
user_parm->tx_depth*2;<BR>- cq_create.h_wait_obj =
NULL;<BR>- cq_create.pfn_comp_cb =
pp_cq_comp_cb;<BR> ib_status =
ib_create_cq(ctx->ca,&cq_create ,ctx, NULL,
&ctx->scq);<BR> if (ib_status != IB_SUCCESS)
{<BR> fprintf(stderr, "Couldn't create
CQ\n");<BR>+ fprintf(stderr, "ib_status = %d\n",
ib_status);<BR> return
NULL;<BR> }<BR>+<BR>+ if (user_parm->use_event)
{<BR>+ ib_status = ib_rearm_cq( ctx->scq, FALSE
);<BR>+ if( ib_status
)<BR>+ {<BR>+ ib_destroy_cq(
ctx->scq, NULL );<BR>+ fprintf(stderr,"ib_rearm_cq
returned %s\n", ib_get_err_str( ib_status ));<BR>+ return
NULL;<BR>+ }<BR>+ }<BR> }<BR>- <BR>+<BR> {<BR> ib_qp_create_t qp_create;<BR> memset(&qp_create,
0, sizeof(ib_qp_create_t));<BR>@@ -579,7 +598,7 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> struct pingpong_dest *rem_dest,
int
size)<BR> {<BR> <BR>- ib_qp_handle_t qp;<BR>+ ib_qp_handle_t
qp;<BR> int scnt, ccnt,
rcnt;<BR> ib_recv_wr_t *bad_wr_recv;<BR> ib_api_status_t ib_status;<BR>@@
-648,24 +667,19 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> p_wc_free =
&wc;<BR> p_wc_free->p_next =
NULL;<BR> p_wc_done = NULL;<BR>-#if
PORTED<BR>+<BR> if (user_param->use_event)
{<BR>- struct ibv_cq
*ev_cq;<BR>- void
*ev_ctx;<BR>- if (ibv_get_cq_event(ctx->channel,
&ev_cq, &ev_ctx)) {<BR>- fprintf(stderr,
"Failed to get
cq_event\n");<BR>+ cl_status_t cl_status;<BR>+<BR>+ PERF_DEBUG("%s:%d
IN cl_waitobj_wait_on", __FUNCTION__,
__LINE__);<BR>+ cl_status = cl_waitobj_wait_on(
ctx->cq_waitobj, EVENT_NO_TIMEOUT, TRUE );<BR>+ if(
cl_status != CL_SUCCESS
)<BR>+ {<BR>+ fprintf(stderr,
"cl_waitobj_wait_on() (%d)\n",
cl_status);<BR> return
1;<BR>- }
<BR>- if (ev_cq != ctx->cq)
{<BR>- fprintf(stderr, "CQ event for unknown CQ
%p\n", ev_cq);<BR>- return
1;<BR> }<BR>- if
(ibv_req_notify_cq(ctx->cq, 0))
{<BR>- fprintf(stderr, "Couldn't request CQ
notification\n");<BR>- return
1;<BR>- }<BR>- }<BR>-#endif<BR>+ }
<BR>+<BR> do {<BR> ib_status
= ib_poll_cq(ctx->scq, &p_wc_free,
&p_wc_done);<BR> if (ib_status == IB_SUCCESS )
{<BR>@@ -678,6 +692,7 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> scnt,
ccnt);<BR> return
1;<BR> }<BR>+<BR> switch
((int) p_wc_done->wr_id) {<BR> case
PINGPONG_SEND_WRID:<BR> tcompleted[ccnt]
= get_cycles();<BR>@@ -716,6 +731,15 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> return
1;<BR> }<BR> <BR>+ if
(user_param->use_event) {<BR>+ ib_status =
ib_rearm_cq( ctx->scq, FALSE );<BR>+ if( ib_status
)<BR>+ {<BR>+ ib_destroy_cq(
ctx->scq, NULL
);<BR>+ fprintf(stderr,"ib_rearm_cq returned %s\n",
ib_get_err_str( ib_status ));<BR>+ return
1;<BR>+ }<BR>+ }<BR> }<BR> }<BR> return(0);<BR>@@
-726,7 +750,7 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> struct pingpong_dest *rem_dest,
int
size)<BR> {<BR> <BR>- ib_qp_handle_t qp;<BR>+ ib_qp_handle_t
qp;<BR> int scnt, ccnt,
rcnt;<BR> ib_recv_wr_t *bad_wr_recv;<BR> ib_api_status_t ib_status;<BR>@@
-770,25 +794,21 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> p_wc_free->p_next =
NULL;<BR> <BR> /*Server is polling
on recieve first */<BR>-#if PORTED<BR> if
(user_param->use_event) {<BR>- struct ibv_cq
*ev_cq;<BR>- void
*ev_ctx;<BR>- if (ibv_get_cq_event(ctx->channel,
&ev_cq, &ev_ctx)) {<BR>- fprintf(stderr,
"Failed to get
cq_event\n");<BR>+ cl_status_t cl_status;<BR>+<BR>+ PERF_DEBUG("%s:%d
IN cl_waitobj_wait_on\n", __FUNCTION__,
__LINE__);<BR>+ cl_status = cl_waitobj_wait_on(
ctx->cq_waitobj, EVENT_NO_TIMEOUT, TRUE );<BR>+ if(
cl_status != CL_SUCCESS
)<BR>+ {<BR>+ fprintf(stderr,
"cl_waitobj_wait_on() (%d)\n",
cl_status);<BR> return
1;<BR>- }
<BR>- if (ev_cq != ctx->cq)
{<BR>- fprintf(stderr, "CQ event for unknown CQ
%p\n", ev_cq);<BR>- return
1;<BR> }<BR>- if
(ibv_req_notify_cq(ctx->cq, 0)) {<BR>- fprintf(stderr,
"Couldn't request CQ notification\n");<BR>- return
1;<BR>- }<BR>- }<BR>-#endif<BR>+ PERF_DEBUG("%s:%d
OUT cl_waitobj_wait_on\n", __FUNCTION__, __LINE__);<BR>+ }
<BR>+<BR> do
{<BR>+<BR> ib_status = ib_poll_cq(ctx->scq,
&p_wc_free, &p_wc_done);<BR> if (ib_status
== IB_SUCCESS) {<BR> tcompleted[ccnt] =
get_cycles();<BR>@@ -818,20 +838,29 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2> p_wc_free->p_next =
NULL;<BR> p_wc_done =
NULL;<BR> }<BR>- <BR>- <BR> }
while (ib_status == IB_SUCCESS);<BR> if (ib_status !=
IB_NOT_FOUND) {<BR> fprintf(stderr, "Poll Recieve
CQ failed %d\n", ib_status);<BR> return
12;<BR> }<BR> <BR>+ if
(user_param->use_event) {<BR>+ ib_status =
ib_rearm_cq( ctx->scq, FALSE );<BR>+ if( ib_status
)<BR>+ {<BR>+ ib_destroy_cq(
ctx->scq, NULL
);<BR>+ fprintf(stderr,"ib_rearm_cq returned %s\n",
ib_get_err_str( ib_status ));<BR>+ return
1;<BR>+ }<BR>+ }<BR>+<BR> }<BR> }
else {<BR> /* client is posting and not receiving.
*/<BR> while (scnt < user_param->iters || ccnt <
user_param->iters) {<BR> while (scnt <
user_param->iters && (scnt - ccnt) < user_param->tx_depth )
{<BR> ib_send_wr_t *bad_wr;<BR>+<BR> tposted[scnt]
= get_cycles();<BR> ib_status = ib_post_send(qp,
&ctx->wr, &bad_wr);<BR> if (ib_status !=
IB_SUCCESS) {<BR>@@ -850,25 +879,20 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> p_wc_free =
&wc;<BR> p_wc_free->p_next =
NULL;<BR> p_wc_done =
NULL;<BR>- <BR>-#if PORTED<BR>- if
(user_param->use_event) {<BR>- struct ibv_cq
*ev_cq;<BR>- void
*ev_ctx;<BR>- if (ibv_get_cq_event(ctx->channel,
&ev_cq, &ev_ctx))
{<BR>- fprintf(stderr, "Failed to get
cq_event\n");<BR>+<BR>+ if ( (user_param->use_event) )
{<BR>+ cl_status_t cl_status;<BR>+<BR>+ PERF_DEBUG("%s:%d
IN cl_waitobj_wait_on\n", __FUNCTION__,
__LINE__);<BR>+ cl_status = cl_waitobj_wait_on(
ctx->cq_waitobj, EVENT_NO_TIMEOUT, TRUE
);<BR>+ if( cl_status != CL_SUCCESS
)<BR>+ {<BR>+ fprintf(stderr,
"cl_waitobj_wait_on() (%d)\n",
cl_status);<BR> return
1;<BR>- }
<BR>- if (ev_cq != ctx->cq)
{<BR>- fprintf(stderr, "CQ event for unknown
CQ %p\n", ev_cq);<BR>- return
1;<BR> }<BR>- if
(ibv_req_notify_cq(ctx->cq, 0))
{<BR>- fprintf(stderr, "Couldn't request CQ
notification\n");<BR>- return
1;<BR>- }<BR>+ PERF_DEBUG("%s:%d
OUT cl_waitobj_wait_on\n", __FUNCTION__,
__LINE__);<BR> }
<BR>-#endif<BR>+<BR> do
{<BR> ib_status = ib_poll_cq(ctx->scq,
&p_wc_free, &p_wc_done);<BR> if
(ib_status == IB_SUCCESS ) {<BR>@@ -887,13 +911,22 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2> p_wc_free->p_next =
NULL;<BR> p_wc_done =
NULL;<BR> }<BR>-<BR>- }
while (ib_status == IB_SUCCESS );<BR>+ } while
(ib_status == IB_SUCCESS );<BR> if (ib_status !=
IB_NOT_FOUND) {<BR> fprintf(stderr, "poll CQ
failed %d\n", ib_status);<BR> return
1;<BR> }<BR> <BR>+ if (
(user_param->use_event) ) {<BR>+ ib_status =
ib_rearm_cq( ctx->scq, FALSE );<BR>+ if(
ib_status
)<BR>+ {<BR>+ ib_destroy_cq(
ctx->scq, NULL
);<BR>+ fprintf(stderr,"ib_rearm_cq returned
%s\n", ib_get_err_str( ib_status
));<BR>+ return
1;<BR>+ }<BR>+ }<BR>+<BR> PERF_DEBUG("ccnt
= %d \n",ccnt);<BR> }<BR> }<BR>@@
-904,21 +937,20 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> <BR> int __cdecl main(int argc, char
*argv[])<BR> {<BR>- struct pingpong_context *ctx;<BR>- struct
pingpong_dest *my_dest;<BR>- struct
pingpong_dest *rem_dest;<BR>- struct
user_parameters user_param;<BR>+ struct
pingpong_context *ctx;<BR>+ struct
pingpong_dest *my_dest;<BR>+ struct
pingpong_dest *rem_dest;<BR>+ struct
user_parameters user_param;<BR> char *ib_devname
= NULL;<BR> int port =
18515;<BR> int ib_port =
1;<BR> unsigned size =
65536;<BR>- SOCKET sockfd =
INVALID_SOCKET;<BR>+ SOCKET sockfd =
INVALID_SOCKET;<BR> int i =
0;<BR> int size_max_pow =
24;<BR>- WSADATA wsaData;<BR>+ WSADATA wsaData;<BR> int iResult;<BR> <BR>- <BR> <BR> /*
init default values to user's parameters
*/<BR> memset(&user_param, 0, sizeof(struct
user_parameters));<BR>@@ -985,7 +1017,7 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2> break;<BR> case
'i':<BR> ib_port = strtol(optarg, NULL,
0);<BR>- if (ib_port < 0) {<BR>+ if
(ib_port <= 0)
{<BR> usage(argv[0]);<BR> return
1;<BR> }<BR>@@ -1081,15 +1113,10 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> if (sockfd ==
INVALID_SOCKET)<BR> return 9;<BR> <BR>-#if
PORTED<BR> if (user_param.use_event)
{<BR> printf("Test with events.\n");<BR>- if
(ibv_req_notify_cq(ctx->cq, 0)) {<BR>- fprintf(stderr,
"Couldn't request CQ notification\n");<BR>- return
1;<BR>- }
<BR> }<BR>-#endif<BR>+<BR> printf("------------------------------------------------------------------\n");<BR> printf("
#bytes #iterations BW peak[MB/sec] BW
average[MB/sec] \n");<BR> <BR>@@ -1164,7 +1191,18 @@</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> goto
end;<BR> <BR> <BR>-end: <BR>+end:<BR>+ if
(user_param.use_event) {<BR>+ cl_status_t
cl_status;<BR>+<BR>+ cl_status = cl_waitobj_destroy(
ctx->cq_waitobj );<BR>+ if( cl_status != CL_SUCCESS
)<BR>+ {<BR>+ fprintf
(stderr,<BR>+ "cl_waitobj_destroy() returned %s\n",
CL_STATUS_MSG(cl_status));<BR>+ }<BR>+ }<BR>+<BR> WSACleanup();<BR> return
0;<BR> }</FONT></DIV></BODY></HTML>