The flow perf application used the srtcm_rfc2697 as meter profile while do the meter testing. This patch adds the support new configuration parameter '--packet-mode' to generate the meter flows with the packet mode.
Signed-off-by: Jiawei Wang <jiaw...@nvidia.com> Acked-by: Wisam Jaddo <wis...@nvidia.com> --- app/test-flow-perf/main.c | 8 +++++++- doc/guides/tools/flow-perf.rst | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 1836becbc8..5178f219d0 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -64,6 +64,7 @@ static bool dump_socket_mem_flag; static bool enable_fwd; static bool unique_data; static bool policy_mtr; +static bool packet_mode; static struct rte_mempool *mbuf_mp; static uint32_t nb_lcores; @@ -147,6 +148,7 @@ usage(char *progname) printf(" --policy-mtr: To create meter with policy\n"); printf(" --meter-cir=N: to set committed information rate(CIR)" " parameter in meter profile, default is %d\n", METER_CIR); + printf(" --packet-mode: To enable packet mode for meter profile\n"); printf("To set flow attributes:\n"); printf(" --ingress: set ingress attribute in flows\n"); @@ -588,6 +590,7 @@ args_parse(int argc, char **argv) { "cores", 1, 0, 0 }, { "policy-mtr", 0, 0, 0 }, { "meter-cir", 1, 0, 0 }, + { "packet-mode", 0, 0, 0 }, /* Attributes */ { "ingress", 0, 0, 0 }, { "egress", 0, 0, 0 }, @@ -823,6 +826,8 @@ args_parse(int argc, char **argv) n = atoi(optarg); meter_cir = (uint64_t) n; } + if (strcmp(lgopts[opt_idx].name, "packet-mode") == 0) + packet_mode = true; break; default: usage(argv[0]); @@ -990,7 +995,7 @@ create_meter_rule(int port_id, uint32_t counter) { int ret; struct rte_mtr_params params; - uint32_t default_prof_id = 100; + uint32_t default_prof_id = DEFAULT_METER_PROF_ID; struct rte_mtr_error error; memset(¶ms, 0, sizeof(struct rte_mtr_params)); @@ -1141,6 +1146,7 @@ create_meter_profile(void) mp.srtcm_rfc2697.cir = meter_cir; mp.srtcm_rfc2697.cbs = meter_cir / 8; mp.srtcm_rfc2697.ebs = 0; + mp.packet_mode = packet_mode; ret = rte_mtr_meter_profile_add (port_id, DEFAULT_METER_PROF_ID, &mp, &error); diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index c3e0e8e3ad..c6d7f15ace 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -108,6 +108,9 @@ The command line options are: * ``--meter-cir=N`` Set the committed information rate(CIR) parameter, default count is 1250000. +* ``--packet-mode`` + Enable packets mode for meter profile. + Attributes: * ``--ingress`` -- 2.18.1