[dpdk-dev] [PATCH v3 1/3] app/flow-perf: support meter policy API

Thomas Monjalon thomas at monjalon.net
Fri Nov 5 10:57:57 CET 2021


28/10/2021 05:25, Rongwei Liu:
> @@ -854,6 +862,46 @@ args_parse(int argc, char **argv)
>  						RTE_MAX_LCORE);
>  				}
>  			}
> +			if (strcmp(lgopts[opt_idx].name, "policy-mtr") == 0) {
> +				j = 0;
> +				k = 0;
> +				arg = optarg;
> +				policy_mtr = true;
> +				token = strsep(&arg, ":\0");
> +				while (token != NULL && j < RTE_COLORS) {
> +					actions_str[j++] = token;
> +					token = strsep(&arg, ":\0");
> +				}
> +				j = 0;
> +				token = strtok(actions_str[0], ",\0");
> +				while (token == NULL && j < RTE_COLORS - 1)
> +					token = strtok(actions_str[++j], ",\0");
> +				while (j < RTE_COLORS && token != NULL) {
> +					for (i = 0;
> +					     i < RTE_DIM(flow_options); i++) {
> +						if (!strcmp(token,
> +						    flow_options[i].str)) {
> +							all_actions[j][k++] =
> +							flow_options[i].mask;
> +							break;
> +						}
> +					}
> +					/* Reached last item with no match */
> +					if (i >= RTE_DIM(flow_options)) {
> +						fprintf(stderr,
> +							"Invalid actions "
> +							"item: %s\n", token);
> +						usage(argv[0]);
> +						rte_exit(EXIT_SUCCESS, "Invalid actions item\n");
> +					}
> +					token = strtok(NULL, ",\0");
> +					while (!token && j < RTE_COLORS - 1) {
> +						token = strtok(actions_str[++j],
> +								",\0");
> +						k = 0;
> +					}
> +				}
> +			}

Could we avoid having so many indents?
Checkpatch suggest considering a refactoring.

[...]
> +		fill_actions(actions[i], all_actions[i], 0, 0, 0,
> +			     0, 0, 0, unique_data, rx_queues_count);

error: too few arguments to function ‘fill_actions’

That's a rebase issue because I merged first the patch
"app/flow-perf: add destination ports parameter"





More information about the dev mailing list