Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perftest: support set flow_label list val in GRH with RR method #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion man/perftest.1
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ many different options and modes.
Not relevant for raw_ethernet_fs_rate.
System support required.
.TP
.B --flow_label
.B --flow_label=<fl0, fl1,...>
IPv6 flow label.
Not relevant for raw_ethernet_fs_rate.
.TP
Expand Down
52 changes: 46 additions & 6 deletions src/perftest_parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,47 @@ static int parse_ethertype_from_str(char *ether_str, uint16_t *ethertype_val)
return SUCCESS;
}

static int parse_flow_label_from_str(struct perftest_parameters *user_param, char *flow_label_str)
{
int fl_cnt = 1;
const char* sep = NULL;

sep = strchr(flow_label_str, ',');
if (sep != NULL)
do {
fl_cnt++;
sep = strchr(sep + 1, ',');
} while (sep);

int *flow_label = calloc(fl_cnt + 2, sizeof(int));
flow_label[0] = fl_cnt;
flow_label[1] = 0;
flow_label[2] = strtol(flow_label_str, NULL, 0);
sep = strchr(flow_label_str, ',');

for (int i = 3; i < fl_cnt + 2; i++) {
flow_label[i] = strtol(sep + 1, NULL, 0);
sep = strchr(sep + 1, ',');
}

if (user_param->connection_type == RawEth) {
for (int i = 2; i < fl_cnt + 2; i++) {
if (flow_label[i] < 0) {
fprintf(stderr," flow label must be non-negative for RawEth\n");
return -1;
}
}
}

if (user_param->flow_label) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in which scenario this will be true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sshaulnv Good catch, it seems that's dead code. I'll remove this if-condition and feedback later.

free(user_param->flow_label);
}

user_param->flow_label = flow_label;

return 0;
}

/******************************************************************************
parse_ip_from_str.
*
Expand Down Expand Up @@ -569,8 +610,8 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
printf(" Set the Traffic Class in GRH (if GRH is in use)\n");

if (connection_type != RawEth) {
printf(" --flow_label=<value> ");
printf(" Set the flow_label in GRH (if GRH is in use)\n");
printf(" --flow_label=<fl0,fl1,fl2,...> ");
printf(" Set the flow_label in GRH for each qp in roundrobin method(if GRH is in use)\n");
}

if (cuda_memory_supported()) {
Expand Down Expand Up @@ -889,7 +930,7 @@ static void init_perftest_params(struct perftest_parameters *user_param)
user_param->mr_per_qp = 0;
user_param->dlid = 0;
user_param->traffic_class = 0;
user_param->flow_label = 0;
user_param->flow_label = NULL;
user_param->flows = DEF_FLOWS;
user_param->flows_burst = 1;
user_param->perform_warm_up = 0;
Expand Down Expand Up @@ -3011,9 +3052,7 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
use_mlu_flag = 0;
}
if (flow_label_flag) {
CHECK_VALUE(user_param->flow_label,int,"flow label",not_int_ptr);
if (user_param->connection_type == RawEth && user_param->flow_label < 0) {
fprintf(stderr," flow label must be non-negative for RawEth\n");
if (parse_flow_label_from_str(user_param, optarg)) {
return FAILURE;
}
flow_label_flag = 0;
Expand Down Expand Up @@ -3427,6 +3466,7 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
return 0;
}


/******************************************************************************
*
******************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/perftest_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ struct perftest_parameters {
char *out_json_file_name;
struct cpu_util_data cpu_util_data;
int latency_gap;
int flow_label;
int* flow_label;
int retry_count;
int dont_xchg_versions;
int ipv6;
Expand Down
5 changes: 4 additions & 1 deletion src/perftest_resources.c
Original file line number Diff line number Diff line change
Expand Up @@ -2681,7 +2681,10 @@ static int ctx_modify_qp_to_rtr(struct ibv_qp *qp,
attr->ah_attr.grh.sgid_index = (attr->ah_attr.port_num == user_param->ib_port) ? user_param->gid_index : user_param->gid_index2;
attr->ah_attr.grh.hop_limit = 0xFF;
attr->ah_attr.grh.traffic_class = user_param->traffic_class;
attr->ah_attr.grh.flow_label = user_param->flow_label;
if (user_param->flow_label) {
attr->ah_attr.grh.flow_label = user_param->flow_label[user_param->flow_label[1] % user_param->flow_label[0] + 2];
user_param->flow_label[1] = user_param->flow_label[1] + 1;
}
}
if (user_param->connection_type != UD && user_param->connection_type != SRD) {
if (user_param->connection_type == DC) {
Expand Down
3 changes: 2 additions & 1 deletion src/raw_ethernet_resources.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,10 @@ static void fill_ip_common(struct ibv_flow_spec* spec_info,
}
if (user_param->flow_label) {
ipv6_spec->val.flow_label =
htonl(user_param->flow_label);
htonl(user_param->flow_label[user_param->flow_label[1] % user_param->flow_label[0] + 2]);
ipv6_spec->mask.flow_label =
htonl(0xfffff);
user_param->flow_label[1] = user_param->flow_label[1] + 1;
}
memcpy((void*)&ipv6_spec->mask.dst_ip, ipv6_mask, 16);
memcpy((void*)&ipv6_spec->mask.src_ip, ipv6_mask, 16);
Expand Down