Skip to content

Commit 6f13593

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 943db6a commit 6f13593

File tree

4 files changed

+216
-71
lines changed

4 files changed

+216
-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");
@@ -521,7 +521,7 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
521521
printf(" Force the link(s) to a specific type: IB or Ethernet.\n");
522522
}
523523

524-
if (verb == SEND) {
524+
if (verb == SEND || verb == SEND_IMM) {
525525
printf(" --use-srq ");
526526
printf(" Use a Shared Receive Queue. --rx-depth controls max-wr size of the SRQ \n");
527527
}
@@ -749,6 +749,11 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
749749
#endif
750750
}
751751

752+
if ((tst == LAT || tst == BW) && verb == SEND) {
753+
printf(" --send_with_imm ");
754+
printf(" Use send-with-immediate verb instead of send\n");
755+
}
756+
752757
putchar('\n');
753758
}
754759
/******************************************************************************
@@ -871,8 +876,11 @@ static void init_perftest_params(struct perftest_parameters *user_param)
871876
user_param->use_mcg = OFF;
872877
user_param->use_rdma_cm = OFF;
873878
user_param->work_rdma_cm = OFF;
874-
user_param->rx_depth = (user_param->verb == SEND || user_param->verb == WRITE || user_param->verb == WRITE_IMM)
875-
? DEF_RX_SEND : DEF_RX_RDMA;
879+
user_param->rx_depth = (user_param->verb == SEND ||
880+
user_param->verb == SEND_IMM ||
881+
user_param->verb == WRITE ||
882+
user_param->verb == WRITE_IMM)
883+
? DEF_RX_SEND : DEF_RX_RDMA;
876884
user_param->duplex = OFF;
877885
user_param->noPeak = OFF;
878886
user_param->req_cq_mod = 0;
@@ -989,9 +997,10 @@ static void init_perftest_params(struct perftest_parameters *user_param)
989997
user_param->perform_warm_up = 0;
990998
user_param->use_ooo = 0;
991999
user_param->disable_pcir = 0;
992-
user_param->source_ip = NULL;
993-
user_param->has_source_ip = 0;
994-
user_param->use_write_with_imm = 0;
1000+
user_param->source_ip = NULL;
1001+
user_param->has_source_ip = 0;
1002+
user_param->use_write_with_imm = 0;
1003+
user_param->use_send_with_imm = 0;
9951004
user_param->use_unsolicited_write = 0;
9961005
user_param->congest_type = OFF;
9971006
user_param->no_lock = OFF;
@@ -1064,7 +1073,7 @@ static void change_conn_type(int *cptr, VerbType verb, const char *optarg)
10641073

10651074
} else if (strcmp(connStr[2], optarg)==0) {
10661075
*cptr = UD;
1067-
if (verb != SEND) {
1076+
if (verb != SEND && verb != SEND_IMM) {
10681077
fprintf(stderr," UD connection only possible in SEND verb\n");
10691078
exit(1);
10701079
}
@@ -1246,7 +1255,7 @@ static void force_dependecies(struct perftest_parameters *user_param)
12461255
user_param->tx_depth = user_param->iters;
12471256
}
12481257

1249-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) &&
1258+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM) &&
12501259
user_param->rx_depth > user_param->iters) {
12511260
user_param->rx_depth = user_param->iters;
12521261
}
@@ -1309,9 +1318,9 @@ static void force_dependecies(struct perftest_parameters *user_param)
13091318
exit (1);
13101319
}
13111320

1312-
if (user_param->use_srq && user_param->verb != SEND) {
1321+
if (user_param->use_srq && user_param->verb != SEND && user_param->verb != SEND_IMM) {
13131322
printf(RESULT_LINE);
1314-
printf(" Using SRQ only avavilible in SEND tests.\n");
1323+
printf(" Using SRQ only avavilible in SEND / SEND_IMM tests.\n");
13151324
exit (1);
13161325
}
13171326

@@ -1339,8 +1348,9 @@ static void force_dependecies(struct perftest_parameters *user_param)
13391348
if (user_param->connection_type == DC && !user_param->use_srq)
13401349
user_param->use_srq = ON;
13411350

1342-
if (user_param->use_srq && user_param->verb == SEND &&
1343-
user_param->num_of_qps > user_param->rx_depth) {
1351+
if (user_param->use_srq
1352+
&& (user_param->verb == SEND || user_param->verb == SEND_IMM)
1353+
&& (user_param->num_of_qps > user_param->rx_depth)) {
13441354
printf(RESULT_LINE);
13451355
printf(" Using SRQ depth should be greater than number of QPs.\n");
13461356
exit (1);
@@ -1593,8 +1603,8 @@ static void force_dependecies(struct perftest_parameters *user_param)
15931603
}
15941604
}
15951605

1596-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && user_param->tst == BW
1597-
&& user_param->machine == SERVER && !user_param->duplex ) {
1606+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)
1607+
&& user_param->tst == BW && user_param->machine == SERVER && !user_param->duplex ) {
15981608
if (user_param->noPeak == OFF)
15991609
printf(" WARNING: BW peak won't be measured in this run.\n");
16001610
user_param->noPeak = ON;
@@ -1619,9 +1629,10 @@ static void force_dependecies(struct perftest_parameters *user_param)
16191629

16201630
}
16211631

1622-
if (user_param->duplex && (user_param->verb == SEND || user_param->verb == WRITE_IMM)) {
1632+
if (user_param->duplex &&
1633+
(user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)) {
16231634
printf(RESULT_LINE);
1624-
fprintf(stderr," run_infinitely mode is not supported in SEND or WRITE_IMM "
1635+
fprintf(stderr," run_infinitely mode is not supported in SEND, SEND_IMM or WRITE_IMM "
16251636
"Bidirectional BW test\n");
16261637
exit(1);
16271638
}
@@ -1813,9 +1824,10 @@ static void force_dependecies(struct perftest_parameters *user_param)
18131824
}
18141825

18151826
if (user_param->rate_limit_type == SW_RATE_LIMIT) {
1816-
if (user_param->tst != BW || user_param->verb == ATOMIC || (user_param->verb == SEND && user_param->duplex)) {
1827+
if (user_param->tst != BW || user_param->verb == ATOMIC
1828+
|| ((user_param->verb == SEND || user_param->verb == SEND_IMM) && user_param->duplex)) {
18171829
printf(RESULT_LINE);
1818-
fprintf(stderr,"SW Rate limiter cann't be executed on non-BW, ATOMIC or bidirectional SEND tests\n");
1830+
fprintf(stderr,"SW Rate limiter cann't be executed on non-BW, ATOMIC or bidirectional SEND / SEND_IMM tests\n");
18191831
exit(1);
18201832
}
18211833
} else if (user_param->rate_limit_type == HW_RATE_LIMIT) {
@@ -1966,7 +1978,8 @@ static void force_dependecies(struct perftest_parameters *user_param)
19661978
}
19671979

19681980
/* WA for a bug when rx_depth is odd in SEND */
1969-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && (user_param->rx_depth % 2 == 1) && user_param->test_method == RUN_REGULAR)
1981+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)
1982+
&& (user_param->rx_depth % 2 == 1) && user_param->test_method == RUN_REGULAR)
19701983
user_param->rx_depth += 1;
19711984

19721985
if (user_param->test_type == ITERATIONS && user_param->iters > 20000 && user_param->noPeak == OFF && user_param->tst == BW) {
@@ -2432,6 +2445,7 @@ static void ctx_set_max_inline(struct ibv_context *context,struct perftest_param
24322445
switch(user_param->verb) {
24332446
case WRITE_IMM:
24342447
case WRITE: user_param->inline_size = (user_param->connection_type == DC)? DEF_INLINE_DC : DEF_INLINE_WRITE; break;
2448+
case SEND_IMM:
24352449
case SEND : user_param->inline_size = (user_param->connection_type == DC)? DEF_INLINE_DC : (user_param->connection_type == UD)? DEF_INLINE_SEND_UD :
24362450
DEF_INLINE_SEND_RC_UC_XRC ; break;
24372451
default : user_param->inline_size = 0;
@@ -2568,6 +2582,7 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
25682582
static int recv_post_list_flag = 0;
25692583
static int payload_flag = 0;
25702584
static int use_write_with_imm_flag = 0;
2585+
static int use_send_with_imm_flag = 0;
25712586
#ifdef HAVE_SRD_WITH_UNSOLICITED_WRITE_RECV
25722587
static int unsolicited_write_flag = 0;
25732588
#endif
@@ -2772,6 +2787,7 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
27722787
#endif
27732788
{.name = "bind_source_ip", .has_arg = 1, .flag = &source_ip_flag, .val = 1},
27742789
{.name = "write_with_imm", .has_arg = 0, .flag = &use_write_with_imm_flag, .val = 1 },
2790+
{.name = "send_with_imm", .has_arg = 0, .flag = &use_send_with_imm_flag, .val = 1 },
27752791
#ifdef HAVE_OOO_RECV_WRS
27762792
{ .name = "no_ddp", .has_arg = 0, .flag = &no_ddp_flag, .val = 1},
27772793
#endif
@@ -2868,7 +2884,8 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
28682884
break;
28692885
case 'M': GET_STRING(user_param->user_mgid,strdupa(optarg)); break;
28702886
case 'r': CHECK_VALUE_IN_RANGE(user_param->rx_depth,int,MIN_RX,MAX_RX," Rx depth",not_int_ptr);
2871-
if (user_param->verb != SEND && user_param->verb != WRITE && user_param->verb != WRITE_IMM && user_param->rx_depth > DEF_RX_RDMA) {
2887+
if (user_param->verb != SEND && user_param->verb != SEND_IMM &&
2888+
user_param->verb != WRITE && user_param->verb != WRITE_IMM && user_param->rx_depth > DEF_RX_RDMA) {
28722889
fprintf(stderr," On RDMA verbs rx depth can be only 1\n");
28732890
free(duplicates_checker);
28742891
return FAILURE;
@@ -3534,6 +3551,14 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
35343551
user_param->verb = WRITE_IMM;
35353552
use_write_with_imm_flag = 0;
35363553
}
3554+
if (use_send_with_imm_flag) {
3555+
if ((user_param->tst != LAT && user_param->tst != BW) || user_param->verb != SEND) {
3556+
fprintf(stderr, "Send_with_imm can only be used with send_lat and send_bw tests\n");
3557+
return FAILURE;
3558+
}
3559+
user_param->verb = SEND_IMM;
3560+
use_send_with_imm_flag = 0;
3561+
}
35373562
#ifdef HAVE_SRD_WITH_UNSOLICITED_WRITE_RECV
35383563
if (unsolicited_write_flag) {
35393564
user_param->use_unsolicited_write = 1;
@@ -3994,7 +4019,8 @@ void ctx_print_test_info(struct perftest_parameters *user_param)
39944019
if (user_param->recv_post_list > 1)
39954020
printf(" Recv Post List : %d\n", user_param->recv_post_list);
39964021

3997-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && (user_param->machine == SERVER || user_param->duplex)) {
4022+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM)
4023+
&& (user_param->machine == SERVER || user_param->duplex)) {
39984024
printf(" RX depth : %d\n",user_param->rx_depth);
39994025
}
40004026

@@ -4138,7 +4164,7 @@ void print_report_bw (struct perftest_parameters *user_param, struct bw_report_d
41384164
exit(1);
41394165
}
41404166

4141-
run_inf_bi_factor = (user_param->duplex && user_param->test_method == RUN_INFINITELY) ? (user_param->verb == SEND ? 1 : 2) : 1 ;
4167+
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 ;
41424168
tsize = run_inf_bi_factor * user_param->size;
41434169
num_of_calculated_iters *= (user_param->test_type == DURATION) ? 1 : num_of_qps;
41444170
location_arr = (user_param->noPeak) ? 0 : num_of_calculated_iters - 1;
@@ -4176,8 +4202,9 @@ void print_report_bw (struct perftest_parameters *user_param, struct bw_report_d
41764202
my_bw_rep->msgRate_avg_p2 = msgRate_avg_p2;
41774203
my_bw_rep->sl = user_param->sl;
41784204

4179-
if (!user_param->duplex || ((user_param->verb == SEND || user_param->verb == WRITE_IMM) && user_param->test_type == DURATION)
4180-
|| user_param->test_method == RUN_INFINITELY || user_param->connection_type == RawEth)
4205+
if (!user_param->duplex
4206+
|| ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM) && user_param->test_type == DURATION)
4207+
|| user_param->test_method == RUN_INFINITELY || user_param->connection_type == RawEth)
41814208
print_full_bw_report(user_param, my_bw_rep, NULL);
41824209

41834210
if (free_my_bw_rep == 1) {
@@ -4249,8 +4276,8 @@ static void write_test_info_to_file(int out_json_fds, struct perftest_parameters
42494276
if (user_param->recv_post_list > 1)
42504277
dprintf(out_json_fds, "\"Recv_Post_List\": %d,\n", user_param->recv_post_list);
42514278

4252-
if ((user_param->verb == SEND || user_param->verb == WRITE_IMM) &&
4253-
(user_param->machine == SERVER || user_param->duplex)) {
4279+
if ((user_param->verb == SEND || user_param->verb == SEND_IMM || user_param->verb == WRITE_IMM) &&
4280+
(user_param->machine == SERVER || user_param->duplex)) {
42544281
dprintf(out_json_fds, "\"RX_depth\": %d,\n",user_param->rx_depth);
42554282
}
42564283

@@ -4346,7 +4373,8 @@ void print_full_bw_report (struct perftest_parameters *user_param, struct bw_rep
43464373
msgRate_avg_p2 += rem_bw_rep->msgRate_avg_p2;
43474374
}
43484375

4349-
if ( (user_param->duplex && rem_bw_rep != NULL) || (!user_param->duplex && rem_bw_rep == NULL) || (user_param->duplex && user_param->verb == SEND)) {
4376+
if ((user_param->duplex && rem_bw_rep != NULL) || (!user_param->duplex && rem_bw_rep == NULL)
4377+
|| (user_param->duplex && (user_param->verb == SEND || user_param->verb == SEND_IMM))) {
43504378
/* Verify Limits */
43514379
if ( ((user_param->is_limit_bw == ON )&& (user_param->limit_bw > bw_avg)) )
43524380
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)