Skip to content

Commit 5856a7f

Browse files
Merge pull request #224 from changchengx/flow_label
perftest: support set flow_label through env variable FLOW_LABEL
2 parents e3f0700 + 69bc866 commit 5856a7f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/perftest_parameters.c

+11-1
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,11 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
544544
printf(" --tclass=<value> ");
545545
printf(" Set the Traffic Class in GRH (if GRH is in use)\n");
546546

547+
if (connection_type != RawEth) {
548+
printf(" --flow_label=<value> ");
549+
printf(" Set the flow_label in GRH (if GRH is in use)\n");
550+
}
551+
547552
if (cuda_memory_supported()) {
548553
printf(" --use_cuda=<cuda device id>");
549554
printf(" Use CUDA specific device for GPUDirect RDMA testing\n");
@@ -841,6 +846,7 @@ static void init_perftest_params(struct perftest_parameters *user_param)
841846
user_param->mr_per_qp = 0;
842847
user_param->dlid = 0;
843848
user_param->traffic_class = 0;
849+
user_param->flow_label = 0;
844850
user_param->flows = DEF_FLOWS;
845851
user_param->flows_burst = 1;
846852
user_param->perform_warm_up = 0;
@@ -2819,7 +2825,11 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
28192825
use_hl_flag = 0;
28202826
}
28212827
if (flow_label_flag) {
2822-
CHECK_VALUE_NON_NEGATIVE(user_param->flow_label,int,"flow label",not_int_ptr);
2828+
CHECK_VALUE(user_param->flow_label,int,"flow label",not_int_ptr);
2829+
if (user_param->connection_type == RawEth && user_param->flow_label < 0) {
2830+
fprintf(stderr," flow label must be non-negative for RawEth\n");
2831+
return FAILURE;
2832+
}
28232833
flow_label_flag = 0;
28242834
}
28252835
if (retry_count_flag) {

src/perftest_resources.c

+1
Original file line numberDiff line numberDiff line change
@@ -2524,6 +2524,7 @@ static int ctx_modify_qp_to_rtr(struct ibv_qp *qp,
25242524
attr->ah_attr.grh.sgid_index = (attr->ah_attr.port_num == user_param->ib_port) ? user_param->gid_index : user_param->gid_index2;
25252525
attr->ah_attr.grh.hop_limit = 0xFF;
25262526
attr->ah_attr.grh.traffic_class = user_param->traffic_class;
2527+
attr->ah_attr.grh.flow_label = user_param->flow_label;
25272528
}
25282529
if (user_param->connection_type != UD && user_param->connection_type != SRD) {
25292530
if (user_param->connection_type == DC) {

0 commit comments

Comments
 (0)