Skip to content

Commit 91a7185

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 4bee61f commit 91a7185

File tree

4 files changed

+213
-71
lines changed

4 files changed

+213
-71
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) {
@@ -414,7 +414,7 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
414414
printf(" Generate Cqe only after <--cq-mod> completion\n");
415415
}
416416

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

527-
if (verb == SEND) {
527+
if (verb == SEND || verb == SEND_IMM) {
528528
printf(" --use-srq ");
529529
printf(" Use a Shared Receive Queue. --rx-depth controls max-wr size of the SRQ \n");
530530
}
@@ -752,6 +752,11 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
752752
#endif
753753
}
754754

755+
if ((tst == LAT || tst == BW) && verb == SEND) {
756+
printf(" --send_with_imm ");
757+
printf(" Use send-with-immediate verb instead of send\n");
758+
}
759+
755760
putchar('\n');
756761
}
757762
/******************************************************************************
@@ -874,8 +879,11 @@ static void init_perftest_params(struct perftest_parameters *user_param)
874879
user_param->use_mcg = OFF;
875880
user_param->use_rdma_cm = OFF;
876881
user_param->work_rdma_cm = OFF;
877-
user_param->rx_depth = (user_param->verb == SEND || user_param->verb == WRITE || user_param->verb == WRITE_IMM)
878-
? DEF_RX_SEND : DEF_RX_RDMA;
882+
user_param->rx_depth = (user_param->verb == SEND ||
883+
user_param->verb == SEND_IMM ||
884+
user_param->verb == WRITE ||
885+
user_param->verb == WRITE_IMM)
886+
? DEF_RX_SEND : DEF_RX_RDMA;
879887
user_param->duplex = OFF;
880888
user_param->noPeak = OFF;
881889
user_param->req_cq_mod = 0;
@@ -992,9 +1000,10 @@ static void init_perftest_params(struct perftest_parameters *user_param)
9921000
user_param->perform_warm_up = 0;
9931001
user_param->use_ooo = 0;
9941002
user_param->disable_pcir = 0;
995-
user_param->source_ip = NULL;
996-
user_param->has_source_ip = 0;
997-
user_param->use_write_with_imm = 0;
1003+
user_param->source_ip = NULL;
1004+
user_param->has_source_ip = 0;
1005+
user_param->use_write_with_imm = 0;
1006+
user_param->use_send_with_imm = 0;
9981007
user_param->use_unsolicited_write = 0;
9991008
user_param->congest_type = OFF;
10001009
user_param->no_lock = OFF;
@@ -1068,7 +1077,7 @@ static void change_conn_type(int *cptr, VerbType verb, const char *optarg)
10681077

10691078
} else if (strcmp(connStr[2], optarg)==0) {
10701079
*cptr = UD;
1071-
if (verb != SEND) {
1080+
if (verb != SEND && verb != SEND_IMM) {
10721081
fprintf(stderr," UD connection only possible in SEND verb\n");
10731082
exit(1);
10741083
}
@@ -1250,7 +1259,7 @@ static void force_dependecies(struct perftest_parameters *user_param)
12501259
user_param->tx_depth = user_param->iters;
12511260
}
12521261

1253-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) &&
1262+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM) &&
12541263
user_param->rx_depth > user_param->iters) {
12551264
user_param->rx_depth = user_param->iters;
12561265
}
@@ -1313,9 +1322,9 @@ static void force_dependecies(struct perftest_parameters *user_param)
13131322
exit (1);
13141323
}
13151324

1316-
if (user_param->use_srq && user_param->verb != SEND) {
1325+
if (user_param->use_srq && user_param->verb != SEND && user_param->verb != SEND_IMM) {
13171326
printf(RESULT_LINE);
1318-
printf(" Using SRQ only avavilible in SEND tests.\n");
1327+
printf(" Using SRQ only avavilible in SEND / SEND_IMM tests.\n");
13191328
exit (1);
13201329
}
13211330

@@ -1343,8 +1352,9 @@ static void force_dependecies(struct perftest_parameters *user_param)
13431352
if (user_param->connection_type == DC && !user_param->use_srq)
13441353
user_param->use_srq = ON;
13451354

1346-
if (user_param->use_srq && user_param->verb == SEND &&
1347-
user_param->num_of_qps > user_param->rx_depth) {
1355+
if (user_param->use_srq
1356+
&& (user_param->verb == SEND || user_param->verb == SEND_IMM)
1357+
&& (user_param->num_of_qps > user_param->rx_depth)) {
13481358
printf(RESULT_LINE);
13491359
printf(" Using SRQ depth should be greater than number of QPs.\n");
13501360
exit (1);
@@ -1597,8 +1607,8 @@ static void force_dependecies(struct perftest_parameters *user_param)
15971607
}
15981608
}
15991609

1600-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && user_param->tst == BW
1601-
&& user_param->machine == SERVER && !user_param->duplex ) {
1610+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)
1611+
&& user_param->tst == BW && user_param->machine == SERVER && !user_param->duplex ) {
16021612
if (user_param->noPeak == OFF)
16031613
printf(" WARNING: BW peak won't be measured in this run.\n");
16041614
user_param->noPeak = ON;
@@ -1623,9 +1633,10 @@ static void force_dependecies(struct perftest_parameters *user_param)
16231633

16241634
}
16251635

1626-
if (user_param->duplex && (user_param->verb == SEND || user_param->verb == WRITE_IMM)) {
1636+
if (user_param->duplex &&
1637+
(user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)) {
16271638
printf(RESULT_LINE);
1628-
fprintf(stderr," run_infinitely mode is not supported in SEND or WRITE_IMM "
1639+
fprintf(stderr," run_infinitely mode is not supported in SEND, SEND_IMM or WRITE_IMM "
16291640
"Bidirectional BW test\n");
16301641
exit(1);
16311642
}
@@ -1817,9 +1828,10 @@ static void force_dependecies(struct perftest_parameters *user_param)
18171828
}
18181829

18191830
if (user_param->rate_limit_type == SW_RATE_LIMIT) {
1820-
if (user_param->tst != BW || user_param->verb == ATOMIC || (user_param->verb == SEND && user_param->duplex)) {
1831+
if (user_param->tst != BW || user_param->verb == ATOMIC
1832+
|| ((user_param->verb == SEND || user_param->verb == SEND_IMM) && user_param->duplex)) {
18211833
printf(RESULT_LINE);
1822-
fprintf(stderr,"SW Rate limiter cann't be executed on non-BW, ATOMIC or bidirectional SEND tests\n");
1834+
fprintf(stderr,"SW Rate limiter cann't be executed on non-BW, ATOMIC or bidirectional SEND / SEND_IMM tests\n");
18231835
exit(1);
18241836
}
18251837
} else if (user_param->rate_limit_type == HW_RATE_LIMIT) {
@@ -1970,7 +1982,8 @@ static void force_dependecies(struct perftest_parameters *user_param)
19701982
}
19711983

19721984
/* WA for a bug when rx_depth is odd in SEND */
1973-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && (user_param->rx_depth % 2 == 1) && user_param->test_method == RUN_REGULAR)
1985+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)
1986+
&& (user_param->rx_depth % 2 == 1) && user_param->test_method == RUN_REGULAR)
19741987
user_param->rx_depth += 1;
19751988

19761989
if (user_param->test_type == ITERATIONS && user_param->iters > 20000 && user_param->noPeak == OFF && user_param->tst == BW) {
@@ -2445,6 +2458,7 @@ static void ctx_set_max_inline(struct ibv_context *context,struct perftest_param
24452458
switch(user_param->verb) {
24462459
case WRITE_IMM:
24472460
case WRITE: user_param->inline_size = (user_param->connection_type == DC)? DEF_INLINE_DC : DEF_INLINE_WRITE; break;
2461+
case SEND_IMM:
24482462
case SEND : user_param->inline_size = (user_param->connection_type == DC)? DEF_INLINE_DC : (user_param->connection_type == UD)? DEF_INLINE_SEND_UD :
24492463
DEF_INLINE_SEND_RC_UC_XRC ; break;
24502464
default : user_param->inline_size = 0;
@@ -2581,6 +2595,7 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
25812595
static int recv_post_list_flag = 0;
25822596
static int payload_flag = 0;
25832597
static int use_write_with_imm_flag = 0;
2598+
static int use_send_with_imm_flag = 0;
25842599
#ifdef HAVE_SRD_WITH_UNSOLICITED_WRITE_RECV
25852600
static int unsolicited_write_flag = 0;
25862601
#endif
@@ -2786,6 +2801,7 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
27862801
#endif
27872802
{.name = "bind_source_ip", .has_arg = 1, .flag = &source_ip_flag, .val = 1},
27882803
{.name = "write_with_imm", .has_arg = 0, .flag = &use_write_with_imm_flag, .val = 1 },
2804+
{.name = "send_with_imm", .has_arg = 0, .flag = &use_send_with_imm_flag, .val = 1 },
27892805
#ifdef HAVE_OOO_RECV_WRS
27902806
{ .name = "no_ddp", .has_arg = 0, .flag = &no_ddp_flag, .val = 1},
27912807
#endif
@@ -2883,7 +2899,8 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
28832899
break;
28842900
case 'M': GET_STRING(user_param->user_mgid,strdupa(optarg)); break;
28852901
case 'r': CHECK_VALUE_IN_RANGE(user_param->rx_depth,int,MIN_RX,MAX_RX," Rx depth",not_int_ptr);
2886-
if (user_param->verb != SEND && user_param->verb != WRITE && user_param->verb != WRITE_IMM && user_param->rx_depth > DEF_RX_RDMA) {
2902+
if (user_param->verb != SEND && user_param->verb != SEND_IMM &&
2903+
user_param->verb != WRITE && user_param->verb != WRITE_IMM && user_param->rx_depth > DEF_RX_RDMA) {
28872904
fprintf(stderr," On RDMA verbs rx depth can be only 1\n");
28882905
free(duplicates_checker);
28892906
return FAILURE;
@@ -3549,6 +3566,14 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
35493566
user_param->verb = WRITE_IMM;
35503567
use_write_with_imm_flag = 0;
35513568
}
3569+
if (use_send_with_imm_flag) {
3570+
if ((user_param->tst != LAT && user_param->tst != BW) || user_param->verb != SEND) {
3571+
fprintf(stderr, "Send_with_imm can only be used with send_lat and send_bw tests\n");
3572+
return FAILURE;
3573+
}
3574+
user_param->verb = SEND_IMM;
3575+
use_send_with_imm_flag = 0;
3576+
}
35523577
#ifdef HAVE_SRD_WITH_UNSOLICITED_WRITE_RECV
35533578
if (unsolicited_write_flag) {
35543579
user_param->use_unsolicited_write = 1;
@@ -4015,7 +4040,8 @@ void ctx_print_test_info(struct perftest_parameters *user_param)
40154040
if (user_param->recv_post_list > 1)
40164041
printf(" Recv Post List : %d\n", user_param->recv_post_list);
40174042

4018-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && (user_param->machine == SERVER || user_param->duplex)) {
4043+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)
4044+
&& (user_param->machine == SERVER || user_param->duplex)) {
40194045
printf(" RX depth : %d\n",user_param->rx_depth);
40204046
}
40214047

@@ -4163,7 +4189,7 @@ void print_report_bw (struct perftest_parameters *user_param, struct bw_report_d
41634189
exit(1);
41644190
}
41654191

4166-
run_inf_bi_factor = (user_param->duplex && user_param->test_method == RUN_INFINITELY) ? (user_param->verb == SEND ? 1 : 2) : 1 ;
4192+
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 ;
41674193
tsize = run_inf_bi_factor * user_param->size;
41684194
num_of_calculated_iters *= (user_param->test_type == DURATION) ? 1 : num_of_qps;
41694195
location_arr = (user_param->noPeak) ? 0 : num_of_calculated_iters - 1;
@@ -4201,8 +4227,9 @@ void print_report_bw (struct perftest_parameters *user_param, struct bw_report_d
42014227
my_bw_rep->msgRate_avg_p2 = msgRate_avg_p2;
42024228
my_bw_rep->sl = user_param->sl;
42034229

4204-
if (!user_param->duplex || ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && user_param->test_type == DURATION)
4205-
|| user_param->test_method == RUN_INFINITELY || user_param->connection_type == RawEth)
4230+
if (!user_param->duplex
4231+
|| ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM) && user_param->test_type == DURATION)
4232+
|| user_param->test_method == RUN_INFINITELY || user_param->connection_type == RawEth)
42064233
print_full_bw_report(user_param, my_bw_rep, NULL);
42074234

42084235
if (free_my_bw_rep == 1) {
@@ -4274,8 +4301,8 @@ static void write_test_info_to_file(int out_json_fds, struct perftest_parameters
42744301
if (user_param->recv_post_list > 1)
42754302
dprintf(out_json_fds, "\"Recv_Post_List\": %d,\n", user_param->recv_post_list);
42764303

4277-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) &&
4278-
(user_param->machine == SERVER || user_param->duplex)) {
4304+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM) &&
4305+
(user_param->machine == SERVER || user_param->duplex)) {
42794306
dprintf(out_json_fds, "\"RX_depth\": %d,\n",user_param->rx_depth);
42804307
}
42814308

@@ -4371,7 +4398,8 @@ void print_full_bw_report (struct perftest_parameters *user_param, struct bw_rep
43714398
msgRate_avg_p2 += rem_bw_rep->msgRate_avg_p2;
43724399
}
43734400

4374-
if ( (user_param->duplex && rem_bw_rep != NULL) || (!user_param->duplex && rem_bw_rep == NULL) || (user_param->duplex && user_param->verb == SEND)) {
4401+
if ((user_param->duplex && rem_bw_rep != NULL) || (!user_param->duplex && rem_bw_rep == NULL)
4402+
|| (user_param->duplex && (user_param->verb == SEND || user_param->verb == SEND_IMM))) {
43754403
/* Verify Limits */
43764404
if ( ((user_param->is_limit_bw == ON )&& (user_param->limit_bw > bw_avg)) )
43774405
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;
@@ -669,6 +669,7 @@ struct perftest_parameters {
669669
int has_source_ip;
670670
int ah_allocated;
671671
int use_write_with_imm;
672+
int use_send_with_imm;
672673
int use_unsolicited_write;
673674
int use_ddp;
674675
int no_ddp;

0 commit comments

Comments
 (0)