Skip to content

Commit 760fa10

Browse files
committed
Perftest: Add support for Send with Immediate verb
Currently, perftest supports RDMA Write / Write-with-Immediate / Send / Read and Atomic operations, but lacks Send-with-Immediate support. This commit adds Send-with-Immediate functionality, allowing users to test it via ib_send_bw with --send_with_imm flag. Additionally, to verify the completion logic for operations with immediate data is correct, completion events are now validated to ensure the IBV_WC_WITH_IMM flag is set. Signed-off-by: Zelong Yue <[email protected]>
1 parent 799923f commit 760fa10

File tree

4 files changed

+210
-70
lines changed

4 files changed

+210
-70
lines changed

src/perftest_parameters.c

Lines changed: 58 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define HEX_BASE (16)
3232
#define DEFAULT_JSON_FILE_NAME "perftest_out.json"
3333
static const char *connStr[] = {"RC","UC","UD","RawEth","XRC","DC","SRD"};
34-
static const char *testsStr[] = {"Send","RDMA_Write","RDMA_Write_imm","RDMA_Read","Atomic"};
34+
static const char *testsStr[] = {"Send", "Send_imm", "RDMA_Write","RDMA_Write_imm","RDMA_Read","Atomic"};
3535
static const char *portStates[] = {"Nop","Down","Init","Armed","","Active Defer"};
3636
static const char *qp_state[] = {"OFF","ON"};
3737
static const char *exchange_state[] = {"Ethernet","rdma_cm"};
@@ -283,7 +283,7 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
283283
}
284284

285285
if (connection_type != RawEth) {
286-
if (verb == SEND) {
286+
if (verb == SEND || verb == SEND_IMM) {
287287
printf(" -c, --connection=<RC/XRC/UC/UD/DC/SRD> ");
288288
printf(" Connection type RC/XRC/UC/UD/DC/SRD (default RC) (SYMMETRIC)\n");
289289
} else if (verb == WRITE || verb == WRITE_IMM) {
@@ -417,7 +417,7 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
417417
printf(" Generate Cqe only after <--cq-mod> completion\n");
418418
}
419419

420-
if ((verb == SEND || verb == WRITE_IMM) && tst != FS_RATE) {
420+
if ((verb == SEND || verb == SEND_IMM || verb == WRITE_IMM) && tst != FS_RATE) {
421421
printf(" -r, --rx-depth=<dep> ");
422422
printf(" Rx queue size (default %d).",DEF_RX_SEND);
423423
printf(" If using srq, rx-depth controls max-wr size of the srq\n");
@@ -527,7 +527,7 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
527527
printf(" Force the link(s) to a specific type: IB or Ethernet.\n");
528528
}
529529

530-
if (verb == SEND) {
530+
if (verb == SEND || verb == SEND_IMM) {
531531
printf(" --use-srq ");
532532
printf(" Use a Shared Receive Queue. --rx-depth controls max-wr size of the SRQ \n");
533533
}
@@ -755,6 +755,11 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
755755
#endif
756756
}
757757

758+
if ((tst == LAT || tst == BW) && verb == SEND) {
759+
printf(" --send_with_imm ");
760+
printf(" Use send-with-immediate verb instead of send\n");
761+
}
762+
758763
putchar('\n');
759764
}
760765
/******************************************************************************
@@ -877,8 +882,11 @@ static void init_perftest_params(struct perftest_parameters *user_param)
877882
user_param->use_mcg = OFF;
878883
user_param->use_rdma_cm = OFF;
879884
user_param->work_rdma_cm = OFF;
880-
user_param->rx_depth = (user_param->verb == SEND || user_param->verb == WRITE || user_param->verb == WRITE_IMM)
881-
? DEF_RX_SEND : DEF_RX_RDMA;
885+
user_param->rx_depth = (user_param->verb == SEND ||
886+
user_param->verb == SEND_IMM ||
887+
user_param->verb == WRITE ||
888+
user_param->verb == WRITE_IMM)
889+
? DEF_RX_SEND : DEF_RX_RDMA;
882890
user_param->duplex = OFF;
883891
user_param->noPeak = OFF;
884892
user_param->req_cq_mod = 0;
@@ -995,9 +1003,10 @@ static void init_perftest_params(struct perftest_parameters *user_param)
9951003
user_param->perform_warm_up = 0;
9961004
user_param->use_ooo = 0;
9971005
user_param->disable_pcir = 0;
998-
user_param->source_ip = NULL;
999-
user_param->has_source_ip = 0;
1000-
user_param->use_write_with_imm = 0;
1006+
user_param->source_ip = NULL;
1007+
user_param->has_source_ip = 0;
1008+
user_param->use_write_with_imm = 0;
1009+
user_param->use_send_with_imm = 0;
10011010
user_param->use_unsolicited_write = 0;
10021011
user_param->congest_type = OFF;
10031012
user_param->no_lock = OFF;
@@ -1071,7 +1080,7 @@ static void change_conn_type(int *cptr, VerbType verb, const char *optarg)
10711080

10721081
} else if (strcmp(connStr[2], optarg)==0) {
10731082
*cptr = UD;
1074-
if (verb != SEND) {
1083+
if (verb != SEND && verb != SEND_IMM) {
10751084
fprintf(stderr," UD connection only possible in SEND verb\n");
10761085
exit(1);
10771086
}
@@ -1253,7 +1262,7 @@ static void force_dependecies(struct perftest_parameters *user_param)
12531262
user_param->tx_depth = user_param->iters;
12541263
}
12551264

1256-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) &&
1265+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM) &&
12571266
user_param->rx_depth > user_param->iters) {
12581267
user_param->rx_depth = user_param->iters;
12591268
}
@@ -1316,9 +1325,9 @@ static void force_dependecies(struct perftest_parameters *user_param)
13161325
exit (1);
13171326
}
13181327

1319-
if (user_param->use_srq && user_param->verb != SEND) {
1328+
if (user_param->use_srq && user_param->verb != SEND && user_param->verb != SEND_IMM) {
13201329
printf(RESULT_LINE);
1321-
printf(" Using SRQ only avavilible in SEND tests.\n");
1330+
printf(" Using SRQ only avavilible in SEND / SEND_IMM tests.\n");
13221331
exit (1);
13231332
}
13241333

@@ -1346,8 +1355,9 @@ static void force_dependecies(struct perftest_parameters *user_param)
13461355
if (user_param->connection_type == DC && !user_param->use_srq)
13471356
user_param->use_srq = ON;
13481357

1349-
if (user_param->use_srq && user_param->verb == SEND &&
1350-
user_param->num_of_qps > user_param->rx_depth) {
1358+
if (user_param->use_srq
1359+
&& (user_param->verb == SEND || user_param->verb == SEND_IMM)
1360+
&& (user_param->num_of_qps > user_param->rx_depth)) {
13511361
printf(RESULT_LINE);
13521362
printf(" Using SRQ depth should be greater than number of QPs.\n");
13531363
exit (1);
@@ -1600,8 +1610,8 @@ static void force_dependecies(struct perftest_parameters *user_param)
16001610
}
16011611
}
16021612

1603-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && user_param->tst == BW
1604-
&& user_param->machine == SERVER && !user_param->duplex ) {
1613+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)
1614+
&& user_param->tst == BW && user_param->machine == SERVER && !user_param->duplex ) {
16051615
if (user_param->noPeak == OFF)
16061616
printf(" WARNING: BW peak won't be measured in this run.\n");
16071617
user_param->noPeak = ON;
@@ -1626,9 +1636,10 @@ static void force_dependecies(struct perftest_parameters *user_param)
16261636

16271637
}
16281638

1629-
if (user_param->duplex && (user_param->verb == SEND || user_param->verb == WRITE_IMM)) {
1639+
if (user_param->duplex &&
1640+
(user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)) {
16301641
printf(RESULT_LINE);
1631-
fprintf(stderr," run_infinitely mode is not supported in SEND or WRITE_IMM "
1642+
fprintf(stderr," run_infinitely mode is not supported in SEND, SEND_IMM or WRITE_IMM "
16321643
"Bidirectional BW test\n");
16331644
exit(1);
16341645
}
@@ -1820,9 +1831,10 @@ static void force_dependecies(struct perftest_parameters *user_param)
18201831
}
18211832

18221833
if (user_param->rate_limit_type == SW_RATE_LIMIT) {
1823-
if (user_param->tst != BW || user_param->verb == ATOMIC || (user_param->verb == SEND && user_param->duplex)) {
1834+
if (user_param->tst != BW || user_param->verb == ATOMIC
1835+
|| ((user_param->verb == SEND || user_param->verb == SEND_IMM) && user_param->duplex)) {
18241836
printf(RESULT_LINE);
1825-
fprintf(stderr,"SW Rate limiter cann't be executed on non-BW, ATOMIC or bidirectional SEND tests\n");
1837+
fprintf(stderr,"SW Rate limiter cann't be executed on non-BW, ATOMIC or bidirectional SEND / SEND_IMM tests\n");
18261838
exit(1);
18271839
}
18281840
} else if (user_param->rate_limit_type == HW_RATE_LIMIT) {
@@ -1973,7 +1985,8 @@ static void force_dependecies(struct perftest_parameters *user_param)
19731985
}
19741986

19751987
/* WA for a bug when rx_depth is odd in SEND */
1976-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && (user_param->rx_depth % 2 == 1) && user_param->test_method == RUN_REGULAR)
1988+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)
1989+
&& (user_param->rx_depth % 2 == 1) && user_param->test_method == RUN_REGULAR)
19771990
user_param->rx_depth += 1;
19781991

19791992
if (user_param->test_type == ITERATIONS && user_param->iters > 20000 && user_param->noPeak == OFF && user_param->tst == BW) {
@@ -2460,6 +2473,7 @@ static void ctx_set_max_inline(struct ibv_context *context,struct perftest_param
24602473
switch(user_param->verb) {
24612474
case WRITE_IMM:
24622475
case WRITE: user_param->inline_size = (user_param->connection_type == DC)? DEF_INLINE_DC : DEF_INLINE_WRITE; break;
2476+
case SEND_IMM:
24632477
case SEND : user_param->inline_size = (user_param->connection_type == DC)? DEF_INLINE_DC : (user_param->connection_type == UD)? DEF_INLINE_SEND_UD :
24642478
DEF_INLINE_SEND_RC_UC_XRC ; break;
24652479
default : user_param->inline_size = 0;
@@ -2607,6 +2621,7 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
26072621
static int recv_post_list_flag = 0;
26082622
static int payload_flag = 0;
26092623
static int use_write_with_imm_flag = 0;
2624+
static int use_send_with_imm_flag = 0;
26102625
#ifdef HAVE_SRD_WITH_UNSOLICITED_WRITE_RECV
26112626
static int unsolicited_write_flag = 0;
26122627
#endif
@@ -2812,6 +2827,7 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
28122827
#endif
28132828
{.name = "bind_source_ip", .has_arg = 1, .flag = &source_ip_flag, .val = 1},
28142829
{.name = "write_with_imm", .has_arg = 0, .flag = &use_write_with_imm_flag, .val = 1 },
2830+
{.name = "send_with_imm", .has_arg = 0, .flag = &use_send_with_imm_flag, .val = 1 },
28152831
#ifdef HAVE_OOO_RECV_WRS
28162832
{ .name = "no_enhanced_reorder", .has_arg = 0, .flag = &no_enhanced_reorder_flag, .val = 1},
28172833
#endif
@@ -2909,7 +2925,8 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
29092925
break;
29102926
case 'M': GET_STRING(user_param->user_mgid,strdupa(optarg)); break;
29112927
case 'r': CHECK_VALUE_IN_RANGE(user_param->rx_depth,int,MIN_RX,MAX_RX," Rx depth",not_int_ptr);
2912-
if (user_param->verb != SEND && user_param->verb != WRITE && user_param->verb != WRITE_IMM && user_param->rx_depth > DEF_RX_RDMA) {
2928+
if (user_param->verb != SEND && user_param->verb != SEND_IMM &&
2929+
user_param->verb != WRITE && user_param->verb != WRITE_IMM && user_param->rx_depth > DEF_RX_RDMA) {
29132930
fprintf(stderr," On RDMA verbs rx depth can be only 1\n");
29142931
free(duplicates_checker);
29152932
return FAILURE;
@@ -3575,6 +3592,14 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
35753592
user_param->verb = WRITE_IMM;
35763593
use_write_with_imm_flag = 0;
35773594
}
3595+
if (use_send_with_imm_flag) {
3596+
if ((user_param->tst != LAT && user_param->tst != BW) || user_param->verb != SEND) {
3597+
fprintf(stderr, "Send_with_imm can only be used with send_lat and send_bw tests\n");
3598+
return FAILURE;
3599+
}
3600+
user_param->verb = SEND_IMM;
3601+
use_send_with_imm_flag = 0;
3602+
}
35783603
#ifdef HAVE_SRD_WITH_UNSOLICITED_WRITE_RECV
35793604
if (unsolicited_write_flag) {
35803605
user_param->use_unsolicited_write = 1;
@@ -4041,7 +4066,8 @@ void ctx_print_test_info(struct perftest_parameters *user_param)
40414066
if (user_param->recv_post_list > 1)
40424067
printf(" Recv Post List : %d\n", user_param->recv_post_list);
40434068

4044-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && (user_param->machine == SERVER || user_param->duplex)) {
4069+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)
4070+
&& (user_param->machine == SERVER || user_param->duplex)) {
40454071
printf(" RX depth : %d\n",user_param->rx_depth);
40464072
}
40474073

@@ -4189,7 +4215,7 @@ void print_report_bw (struct perftest_parameters *user_param, struct bw_report_d
41894215
exit(1);
41904216
}
41914217

4192-
run_inf_bi_factor = (user_param->duplex && user_param->test_method == RUN_INFINITELY) ? (user_param->verb == SEND ? 1 : 2) : 1 ;
4218+
run_inf_bi_factor = (user_param->duplex && user_param->test_method == RUN_INFINITELY) ? ((user_param->verb == SEND || user_param->verb == SEND_IMM) ? 1 : 2) : 1 ;
41934219
tsize = run_inf_bi_factor * user_param->size;
41944220
num_of_calculated_iters *= (user_param->test_type == DURATION) ? 1 : num_of_qps;
41954221
location_arr = (user_param->noPeak) ? 0 : num_of_calculated_iters - 1;
@@ -4227,8 +4253,9 @@ void print_report_bw (struct perftest_parameters *user_param, struct bw_report_d
42274253
my_bw_rep->msgRate_avg_p2 = msgRate_avg_p2;
42284254
my_bw_rep->sl = user_param->sl;
42294255

4230-
if (!user_param->duplex || ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && user_param->test_type == DURATION)
4231-
|| user_param->test_method == RUN_INFINITELY || user_param->connection_type == RawEth)
4256+
if (!user_param->duplex
4257+
|| ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM) && user_param->test_type == DURATION)
4258+
|| user_param->test_method == RUN_INFINITELY || user_param->connection_type == RawEth)
42324259
print_full_bw_report(user_param, my_bw_rep, NULL);
42334260

42344261
if (free_my_bw_rep == 1) {
@@ -4300,8 +4327,8 @@ static void write_test_info_to_file(int out_json_fds, struct perftest_parameters
43004327
if (user_param->recv_post_list > 1)
43014328
dprintf(out_json_fds, "\"Recv_Post_List\": %d,\n", user_param->recv_post_list);
43024329

4303-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) &&
4304-
(user_param->machine == SERVER || user_param->duplex)) {
4330+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM) &&
4331+
(user_param->machine == SERVER || user_param->duplex)) {
43054332
dprintf(out_json_fds, "\"RX_depth\": %d,\n",user_param->rx_depth);
43064333
}
43074334

@@ -4397,7 +4424,8 @@ void print_full_bw_report (struct perftest_parameters *user_param, struct bw_rep
43974424
msgRate_avg_p2 += rem_bw_rep->msgRate_avg_p2;
43984425
}
43994426

4400-
if ( (user_param->duplex && rem_bw_rep != NULL) || (!user_param->duplex && rem_bw_rep == NULL) || (user_param->duplex && user_param->verb == SEND)) {
4427+
if ((user_param->duplex && rem_bw_rep != NULL) || (!user_param->duplex && rem_bw_rep == NULL)
4428+
|| (user_param->duplex && (user_param->verb == SEND || user_param->verb == SEND_IMM))) {
44014429
/* Verify Limits */
44024430
if ( ((user_param->is_limit_bw == ON )&& (user_param->limit_bw > bw_avg)) )
44034431
user_param->is_bw_limit_passed |= 0;

src/perftest_parameters.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@
324324
} while (0)
325325

326326
/* The Verb of the benchmark. */
327-
typedef enum { SEND , WRITE, WRITE_IMM, READ, ATOMIC } VerbType;
327+
typedef enum { SEND, SEND_IMM, WRITE, WRITE_IMM, READ, ATOMIC } VerbType;
328328

329329
/* The type of the test */
330330
typedef enum { LAT , BW , LAT_BY_BW, FS_RATE } TestType;
@@ -673,6 +673,7 @@ struct perftest_parameters {
673673
int has_source_ip;
674674
int ah_allocated;
675675
int use_write_with_imm;
676+
int use_send_with_imm;
676677
int use_unsolicited_write;
677678
int use_enhanced_reorder;
678679
int no_enhanced_reorder;

0 commit comments

Comments
 (0)