Skip to content

Commit 73e3cb1

Browse files
authored
Merge pull request #348 from mellowcandle/imm_cq_events
perftest: enable CQ events support for WRITE_IMM operations
2 parents 07d75db + 354163a commit 73e3cb1

File tree

4 files changed

+47
-9
lines changed

4 files changed

+47
-9
lines changed

src/perftest_parameters.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
327327
printf(" -D, --duration ");
328328
printf(" Run test for a customized period of seconds. (SYMMETRIC)\n");
329329

330-
if (verb != WRITE && verb != WRITE_IMM && connection_type != RawEth) {
330+
if (verb != WRITE && connection_type != RawEth) {
331331
printf(" -e, --events ");
332332
printf(" Sleep on CQ events (default poll)\n");
333333

@@ -1817,6 +1817,12 @@ static void force_dependecies(struct perftest_parameters *user_param)
18171817
}
18181818
}
18191819

1820+
if (user_param->use_event == ON && user_param->verb == WRITE) {
1821+
printf(RESULT_LINE);
1822+
fprintf(stderr," Events feature not available on WRITE verb\n");
1823+
exit(1);
1824+
}
1825+
18201826
if ((user_param->use_srq && (user_param->tst == LAT || user_param->machine == SERVER || user_param->duplex == ON)) || user_param->use_xrc)
18211827
user_param->srq_exists = 1;
18221828

@@ -3009,12 +3015,8 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
30093015
return FAILURE;
30103016
}
30113017
break;
3012-
case 'e': user_param->use_event = ON;
3013-
if (user_param->verb == WRITE || user_param->verb == WRITE_IMM) {
3014-
fprintf(stderr," Events feature not available on WRITE verb\n");
3015-
free(duplicates_checker);
3016-
return FAILURE;
3017-
}
3018+
case 'e':
3019+
user_param->use_event = ON;
30183020
break;
30193021
case 'X':
30203022
if (user_param->verb == WRITE || user_param->verb == WRITE_IMM) {

src/perftest_resources.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5220,7 +5220,7 @@ int run_iter_lat_write_imm(struct pingpong_context *ctx,struct perftest_paramete
52205220
uint64_t scnt = 0;
52215221
uint64_t ccnt = 0;
52225222
uint64_t rcnt = 0;
5223-
int ne;
5223+
int ne = 0;
52245224
int err = 0;
52255225
volatile char *post_buf = NULL;
52265226

@@ -5267,8 +5267,15 @@ int run_iter_lat_write_imm(struct pingpong_context *ctx,struct perftest_paramete
52675267
if ((rcnt < user_param->iters || user_param->test_type == DURATION) && !(scnt < 1 && user_param->machine == SERVER)) {
52685268
rcnt++;
52695269

5270+
if (user_param->use_event) {
5271+
if (ctx_notify_events(ctx->recv_channel)) {
5272+
fprintf(stderr , " Failed to notify events to CQ\n");
5273+
return 1;
5274+
}
5275+
}
5276+
52705277
/* Poll for a completion */
5271-
do { ne = ibv_poll_cq(ctx->recv_cq, 1, &wc); } while (ne == 0 && !(user_param->test_type == DURATION && user_param->state == END_STATE));
5278+
do { ne = ibv_poll_cq(ctx->recv_cq, 1, &wc); } while (!user_param->use_event && ne == 0 && !(user_param->test_type == DURATION && user_param->state == END_STATE));
52725279
if (ne > 0) {
52735280
if (wc.status != IBV_WC_SUCCESS) {
52745281
//coverity[uninit_use_in_call]
@@ -5328,6 +5335,13 @@ int run_iter_lat_write_imm(struct pingpong_context *ctx,struct perftest_paramete
53285335

53295336
if (ccnt < user_param->iters || user_param->test_type == DURATION) {
53305337

5338+
if (user_param->use_event && ne == 0) {
5339+
if (ctx_notify_events(ctx->send_channel)) {
5340+
fprintf(stderr, "Couldn't request CQ notification\n");
5341+
return 1;
5342+
}
5343+
}
5344+
53315345
do { ne = ibv_poll_cq(ctx->send_cq, 1, &wc); } while (ne == 0);
53325346

53335347
if(ne > 0) {

src/write_bw.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,17 @@ int main(int argc, char *argv[])
222222
ctx_print_pingpong_data(&rem_dest[i],&user_comm);
223223
}
224224

225+
if (user_param.use_event) {
226+
if (ibv_req_notify_cq(ctx.send_cq, 0)) {
227+
fprintf(stderr, " Couldn't request CQ notification\n");
228+
goto destroy_context;
229+
}
230+
if (ibv_req_notify_cq(ctx.recv_cq, 0)) {
231+
fprintf(stderr, " Couldn't request CQ notification\n");
232+
goto destroy_context;
233+
}
234+
}
235+
225236
/* An additional handshake is required after moving qp to RTR. */
226237
if (ctx_hand_shake(&user_comm,&my_dest[0],&rem_dest[0])) {
227238
fprintf(stderr," Failed to exchange data between server and clients\n");

src/write_lat.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,17 @@ int main(int argc, char *argv[])
243243
ctx_print_pingpong_data(&rem_dest[i],&user_comm);
244244
}
245245

246+
if (user_param.use_event) {
247+
if (ibv_req_notify_cq(ctx.send_cq, 0)) {
248+
fprintf(stderr, " Couldn't request CQ notification\n");
249+
goto destroy_context;
250+
}
251+
if (ibv_req_notify_cq(ctx.recv_cq, 0)) {
252+
fprintf(stderr, " Couldn't request CQ notification\n");
253+
goto destroy_context;
254+
}
255+
}
256+
246257
/* An additional handshake is required after moving qp to RTR. */
247258
if (ctx_hand_shake(&user_comm,my_dest,rem_dest)) {
248259
fprintf(stderr,"Failed to exchange data between server and clients\n");

0 commit comments

Comments
 (0)