[RFC,v4,4/4] app/testpmd: add meter pps mode cmd
Checks
Commit Message
Support meter pps mode
Signed-off-by: Li Zhang <lizh@nvidia.com>
---
app/test-pmd/cmdline.c | 4 +
app/test-pmd/cmdline_mtr.c | 105 ++++++++++++++++++++
app/test-pmd/cmdline_mtr.h | 1 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 +++
4 files changed, 125 insertions(+)
Comments
Hi
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Li Zhang
> Sent: Monday, March 1, 2021 18:36
> To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> matan@nvidia.com
> Cc: dev@dpdk.org; thomas@monjalon.net; rasland@nvidia.com;
> mb@smartsharesystems.com; ajit.khaparde@broadcom.com
> Subject: [dpdk-dev] [RFC v4 4/4] app/testpmd: add meter pps mode cmd
>
> Support meter pps mode
>
> Signed-off-by: Li Zhang <lizh@nvidia.com>
> ---
> app/test-pmd/cmdline.c | 4 +
> app/test-pmd/cmdline_mtr.c | 105 ++++++++++++++++++++
> app/test-pmd/cmdline_mtr.h | 1 +
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 +++
> 4 files changed, 125 insertions(+)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> d274a7cb8c..1a3fc644dc 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -698,6 +698,9 @@ static void cmd_help_long_parsed(void *parsed_result,
> "add port meter profile trtcm_rfc4115 (port_id)
> (profile_id) (cir) (eir) (cbs) (ebs)\n"
> " meter profile add - trtcm rfc 4115\n\n"
>
> + "add port meter profile srtcmp (port_id) (profile_id)
> (cipr) (cpbs) (epbs)\n"
> + " meter profile add - srtcmp packet per second\n\n"
> +
> "del port meter profile (port_id) (profile_id)\n"
> " meter profile delete\n\n"
>
> @@ -17006,6 +17009,7 @@ cmdline_parse_ctx_t main_ctx[] = {
> (cmdline_parse_inst_t *)&cmd_show_port_meter_cap,
> (cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm,
> (cmdline_parse_inst_t *)&cmd_add_port_meter_profile_trtcm,
> + (cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcmp,
> (cmdline_parse_inst_t *)&cmd_del_port_meter_profile,
> (cmdline_parse_inst_t *)&cmd_create_port_meter,
> (cmdline_parse_inst_t *)&cmd_enable_port_meter, diff --git
> a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c index
> 399ee56e07..3f62240a0d 100644
> --- a/app/test-pmd/cmdline_mtr.c
> +++ b/app/test-pmd/cmdline_mtr.c
> @@ -295,6 +295,8 @@ static void cmd_show_port_meter_cap_parsed(void
> *parsed_result,
> cap.meter_trtcm_rfc2698_n_max);
> printf("cap.meter_trtcm_rfc4115_n_max %" PRIu32 "\n",
> cap.meter_trtcm_rfc4115_n_max);
> + printf("cap.meter_srtcmp_n_max %" PRIu32 "\n",
> + cap.meter_srtcmp_n_max);
> printf("cap.meter_rate_max %" PRIu64 "\n", cap.meter_rate_max);
> printf("cap.color_aware_srtcm_rfc2697_supported %" PRId32 "\n",
> cap.color_aware_srtcm_rfc2697_supported);
> @@ -302,6 +304,8 @@ static void cmd_show_port_meter_cap_parsed(void
> *parsed_result,
> cap.color_aware_trtcm_rfc2698_supported);
> printf("cap.color_aware_trtcm_rfc4115_supported %" PRId32 "\n",
> cap.color_aware_trtcm_rfc4115_supported);
> + printf("cap.color_aware_srtcmp_supported %" PRId32 "\n",
> + cap.color_aware_srtcmp_supported);
> printf("cap.policer_action_recolor_supported %" PRId32 "\n",
> cap.policer_action_recolor_supported);
> printf("cap.policer_action_drop_supported %" PRId32 "\n", @@ -644,6
> +648,107 @@ cmdline_parse_inst_t
> cmd_add_port_meter_profile_trtcm_rfc4115 = {
> },
> };
>
> +/* *** Add Port Meter Profile srtcmp *** */ struct
> +cmd_add_port_meter_profile_srtcmp_result {
> + cmdline_fixed_string_t add;
> + cmdline_fixed_string_t port;
> + cmdline_fixed_string_t meter;
> + cmdline_fixed_string_t profile;
> + cmdline_fixed_string_t srtcmp;
> + uint16_t port_id;
> + uint32_t profile_id;
> + uint64_t cir;
> + uint64_t cbs;
> + uint64_t ebs;
> +};
> +
> +cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_add =
> + TOKEN_STRING_INITIALIZER(
> + struct cmd_add_port_meter_profile_srtcmp_result, add, "add");
> +cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_port =
> + TOKEN_STRING_INITIALIZER(
> + struct cmd_add_port_meter_profile_srtcmp_result,
> + port, "port");
> +cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_meter =
> + TOKEN_STRING_INITIALIZER(
> + struct cmd_add_port_meter_profile_srtcmp_result,
> + meter, "meter");
> +cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_profile =
> + TOKEN_STRING_INITIALIZER(
> + struct cmd_add_port_meter_profile_srtcmp_result,
> + profile, "profile");
> +cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_srtcmp =
> + TOKEN_STRING_INITIALIZER(
> + struct cmd_add_port_meter_profile_srtcmp_result,
> + srtcmp, "srtcmp");
> +cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_port_id =
> + TOKEN_NUM_INITIALIZER(
> + struct cmd_add_port_meter_profile_srtcmp_result,
> + port_id, RTE_UINT16);
> +cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_profile_id
> =
> + TOKEN_NUM_INITIALIZER(
> + struct cmd_add_port_meter_profile_srtcmp_result,
> + profile_id, RTE_UINT32);
> +cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_cir =
> + TOKEN_NUM_INITIALIZER(
> + struct cmd_add_port_meter_profile_srtcmp_result,
> + cir, RTE_UINT64);
> +cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_cbs =
> + TOKEN_NUM_INITIALIZER(
> + struct cmd_add_port_meter_profile_srtcmp_result,
> + cbs, RTE_UINT64);
> +cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_ebs =
> + TOKEN_NUM_INITIALIZER(
> + struct cmd_add_port_meter_profile_srtcmp_result,
> + ebs, RTE_UINT64);
> +
> +static void cmd_add_port_meter_profile_srtcmp_parsed(void *parsed_result,
> + __rte_unused struct cmdline *cl,
> + __rte_unused void *data)
> +{
> + struct cmd_add_port_meter_profile_srtcmp_result *res = parsed_result;
> + struct rte_mtr_meter_profile mp;
> + struct rte_mtr_error error;
> + uint32_t profile_id = res->profile_id;
> + uint16_t port_id = res->port_id;
> + int ret;
> +
> + if (port_id_is_invalid(port_id, ENABLED_WARN))
> + return;
> +
> + /* Private shaper profile params */
> + memset(&mp, 0, sizeof(struct rte_mtr_meter_profile));
> + mp.alg = RTE_MTR_SRTCMP;
> + mp.srtcmp.cir = res->cir;
> + mp.srtcmp.cbs = res->cbs;
> + mp.srtcmp.ebs = res->ebs;
> +
> + ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
> + if (ret != 0) {
> + print_err_msg(&error);
> + return;
> + }
> +}
> +
> +cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp = {
> + .f = cmd_add_port_meter_profile_srtcmp_parsed,
> + .data = NULL,
> + .help_str = "Add port meter profile srtcmp",
helper_str is the hint that users can follow to tap the command. Please follow other commands behavior.
You can refer to the recent commit 618f0f4ac689f9255eecbef9202e77e35a9a7ceb which fixes all wrong helper_str in meter commands.
> + .tokens = {
> + (void *)&cmd_add_port_meter_profile_srtcmp_add,
> + (void *)&cmd_add_port_meter_profile_srtcmp_port,
> + (void *)&cmd_add_port_meter_profile_srtcmp_meter,
> + (void *)&cmd_add_port_meter_profile_srtcmp_profile,
> + (void *)&cmd_add_port_meter_profile_srtcmp_srtcmp,
> + (void *)&cmd_add_port_meter_profile_srtcmp_port_id,
> + (void *)&cmd_add_port_meter_profile_srtcmp_profile_id,
> + (void *)&cmd_add_port_meter_profile_srtcmp_cir,
> + (void *)&cmd_add_port_meter_profile_srtcmp_cbs,
> + (void *)&cmd_add_port_meter_profile_srtcmp_ebs,
> + NULL,
> + },
> +};
> +
> /* *** Delete Port Meter Profile *** */ struct
> cmd_del_port_meter_profile_result {
> cmdline_fixed_string_t del;
> diff --git a/app/test-pmd/cmdline_mtr.h b/app/test-pmd/cmdline_mtr.h index
> e69d6da023..01ef85e1e7 100644
> --- a/app/test-pmd/cmdline_mtr.h
> +++ b/app/test-pmd/cmdline_mtr.h
> @@ -10,6 +10,7 @@ extern cmdline_parse_inst_t cmd_show_port_meter_cap;
> extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm; extern
> cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm; extern
> cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115;
> +extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp;
> extern cmdline_parse_inst_t cmd_del_port_meter_profile; extern
> cmdline_parse_inst_t cmd_create_port_meter; extern cmdline_parse_inst_t
> cmd_enable_port_meter; diff --git
> a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 37278d31d6..d11de05583 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -2734,6 +2734,21 @@ where:
> * ``cbs``: Committed burst size (bytes).
> * ``ebs``: Excess burst size (bytes).
>
> +add port meter profile (srTcmp)
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Add meter profile (srTcmp) to the ethernet device::
> +
> + testpmd> add port meter profile srtcmp (port_id) (profile_id) \
> + (cir) (cbs) (ebs)
> +
> +where:
> +
> +* ``profile_id``: ID for the meter profile.
> +* ``cpr``: Committed Information Rate (CIR) (packets/second).
> +* ``cbs``: Committed Burst Size (CBS) (packets).
> +* ``ebs``: Excess Burst Size (EBS) (packets).
> +
> delete port meter profile
> ~~~~~~~~~~~~~~~~~~~~~~~~~
>
> --
> 2.21.0
Hi Xiao yun,
Thanks for your comments.
We will follow other commands in our new command's helper_str.
Regards,
Li Zhang
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Li, Xiaoyun
> Sent: Tuesday, March 2, 2021 9:48 AM
> To: Li Zhang <lizh@nvidia.com>; Dekel Peled <dekelp@nvidia.com>; Ori Kam
> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
> Azrad <matan@nvidia.com>
> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> Raslan Darawsheh <rasland@nvidia.com>; mb@smartsharesystems.com;
> ajit.khaparde@broadcom.com
> Subject: Re: [dpdk-dev] [RFC v4 4/4] app/testpmd: add meter pps mode cmd
>
> Hi
>
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Li Zhang
> > Sent: Monday, March 1, 2021 18:36
> > To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> > matan@nvidia.com
> > Cc: dev@dpdk.org; thomas@monjalon.net; rasland@nvidia.com;
> > mb@smartsharesystems.com; ajit.khaparde@broadcom.com
> > Subject: [dpdk-dev] [RFC v4 4/4] app/testpmd: add meter pps mode cmd
> >
> > Support meter pps mode
> >
> > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > ---
> > app/test-pmd/cmdline.c | 4 +
> > app/test-pmd/cmdline_mtr.c | 105 ++++++++++++++++++++
> > app/test-pmd/cmdline_mtr.h | 1 +
> > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 +++
> > 4 files changed, 125 insertions(+)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > d274a7cb8c..1a3fc644dc 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -698,6 +698,9 @@ static void cmd_help_long_parsed(void
> *parsed_result,
> > "add port meter profile trtcm_rfc4115 (port_id)
> > (profile_id) (cir) (eir) (cbs) (ebs)\n"
> > " meter profile add - trtcm rfc 4115\n\n"
> >
> > + "add port meter profile srtcmp (port_id) (profile_id)
> > (cipr) (cpbs) (epbs)\n"
> > + " meter profile add - srtcmp packet per second\n\n"
> > +
> > "del port meter profile (port_id) (profile_id)\n"
> > " meter profile delete\n\n"
> >
> > @@ -17006,6 +17009,7 @@ cmdline_parse_ctx_t main_ctx[] = {
> > (cmdline_parse_inst_t *)&cmd_show_port_meter_cap,
> > (cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm,
> > (cmdline_parse_inst_t *)&cmd_add_port_meter_profile_trtcm,
> > + (cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcmp,
> > (cmdline_parse_inst_t *)&cmd_del_port_meter_profile,
> > (cmdline_parse_inst_t *)&cmd_create_port_meter,
> > (cmdline_parse_inst_t *)&cmd_enable_port_meter, diff --git
> > a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c index
> > 399ee56e07..3f62240a0d 100644
> > --- a/app/test-pmd/cmdline_mtr.c
> > +++ b/app/test-pmd/cmdline_mtr.c
> > @@ -295,6 +295,8 @@ static void cmd_show_port_meter_cap_parsed(void
> > *parsed_result,
> > cap.meter_trtcm_rfc2698_n_max);
> > printf("cap.meter_trtcm_rfc4115_n_max %" PRIu32 "\n",
> > cap.meter_trtcm_rfc4115_n_max);
> > + printf("cap.meter_srtcmp_n_max %" PRIu32 "\n",
> > + cap.meter_srtcmp_n_max);
> > printf("cap.meter_rate_max %" PRIu64 "\n", cap.meter_rate_max);
> > printf("cap.color_aware_srtcm_rfc2697_supported %" PRId32 "\n",
> > cap.color_aware_srtcm_rfc2697_supported);
> > @@ -302,6 +304,8 @@ static void cmd_show_port_meter_cap_parsed(void
> > *parsed_result,
> > cap.color_aware_trtcm_rfc2698_supported);
> > printf("cap.color_aware_trtcm_rfc4115_supported %" PRId32 "\n",
> > cap.color_aware_trtcm_rfc4115_supported);
> > + printf("cap.color_aware_srtcmp_supported %" PRId32 "\n",
> > + cap.color_aware_srtcmp_supported);
> > printf("cap.policer_action_recolor_supported %" PRId32 "\n",
> > cap.policer_action_recolor_supported);
> > printf("cap.policer_action_drop_supported %" PRId32 "\n", @@ -
> 644,6
> > +648,107 @@ cmdline_parse_inst_t
> > cmd_add_port_meter_profile_trtcm_rfc4115 = {
> > },
> > };
> >
> > +/* *** Add Port Meter Profile srtcmp *** */ struct
> > +cmd_add_port_meter_profile_srtcmp_result {
> > + cmdline_fixed_string_t add;
> > + cmdline_fixed_string_t port;
> > + cmdline_fixed_string_t meter;
> > + cmdline_fixed_string_t profile;
> > + cmdline_fixed_string_t srtcmp;
> > + uint16_t port_id;
> > + uint32_t profile_id;
> > + uint64_t cir;
> > + uint64_t cbs;
> > + uint64_t ebs;
> > +};
> > +
> > +cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_add
> =
> > + TOKEN_STRING_INITIALIZER(
> > + struct cmd_add_port_meter_profile_srtcmp_result, add,
> "add");
> > +cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_port
> =
> > + TOKEN_STRING_INITIALIZER(
> > + struct cmd_add_port_meter_profile_srtcmp_result,
> > + port, "port");
> > +cmdline_parse_token_string_t
> cmd_add_port_meter_profile_srtcmp_meter =
> > + TOKEN_STRING_INITIALIZER(
> > + struct cmd_add_port_meter_profile_srtcmp_result,
> > + meter, "meter");
> > +cmdline_parse_token_string_t
> cmd_add_port_meter_profile_srtcmp_profile =
> > + TOKEN_STRING_INITIALIZER(
> > + struct cmd_add_port_meter_profile_srtcmp_result,
> > + profile, "profile");
> > +cmdline_parse_token_string_t
> cmd_add_port_meter_profile_srtcmp_srtcmp =
> > + TOKEN_STRING_INITIALIZER(
> > + struct cmd_add_port_meter_profile_srtcmp_result,
> > + srtcmp, "srtcmp");
> > +cmdline_parse_token_num_t
> cmd_add_port_meter_profile_srtcmp_port_id =
> > + TOKEN_NUM_INITIALIZER(
> > + struct cmd_add_port_meter_profile_srtcmp_result,
> > + port_id, RTE_UINT16);
> > +cmdline_parse_token_num_t
> > +cmd_add_port_meter_profile_srtcmp_profile_id
> > =
> > + TOKEN_NUM_INITIALIZER(
> > + struct cmd_add_port_meter_profile_srtcmp_result,
> > + profile_id, RTE_UINT32);
> > +cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_cir =
> > + TOKEN_NUM_INITIALIZER(
> > + struct cmd_add_port_meter_profile_srtcmp_result,
> > + cir, RTE_UINT64);
> > +cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_cbs =
> > + TOKEN_NUM_INITIALIZER(
> > + struct cmd_add_port_meter_profile_srtcmp_result,
> > + cbs, RTE_UINT64);
> > +cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_ebs =
> > + TOKEN_NUM_INITIALIZER(
> > + struct cmd_add_port_meter_profile_srtcmp_result,
> > + ebs, RTE_UINT64);
> > +
> > +static void cmd_add_port_meter_profile_srtcmp_parsed(void
> *parsed_result,
> > + __rte_unused struct cmdline *cl,
> > + __rte_unused void *data)
> > +{
> > + struct cmd_add_port_meter_profile_srtcmp_result *res =
> parsed_result;
> > + struct rte_mtr_meter_profile mp;
> > + struct rte_mtr_error error;
> > + uint32_t profile_id = res->profile_id;
> > + uint16_t port_id = res->port_id;
> > + int ret;
> > +
> > + if (port_id_is_invalid(port_id, ENABLED_WARN))
> > + return;
> > +
> > + /* Private shaper profile params */
> > + memset(&mp, 0, sizeof(struct rte_mtr_meter_profile));
> > + mp.alg = RTE_MTR_SRTCMP;
> > + mp.srtcmp.cir = res->cir;
> > + mp.srtcmp.cbs = res->cbs;
> > + mp.srtcmp.ebs = res->ebs;
> > +
> > + ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
> > + if (ret != 0) {
> > + print_err_msg(&error);
> > + return;
> > + }
> > +}
> > +
> > +cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp = {
> > + .f = cmd_add_port_meter_profile_srtcmp_parsed,
> > + .data = NULL,
> > + .help_str = "Add port meter profile srtcmp",
>
> helper_str is the hint that users can follow to tap the command. Please follow
> other commands behavior.
> You can refer to the recent commit
> 618f0f4ac689f9255eecbef9202e77e35a9a7ceb which fixes all wrong helper_str
> in meter commands.
>
> > + .tokens = {
> > + (void *)&cmd_add_port_meter_profile_srtcmp_add,
> > + (void *)&cmd_add_port_meter_profile_srtcmp_port,
> > + (void *)&cmd_add_port_meter_profile_srtcmp_meter,
> > + (void *)&cmd_add_port_meter_profile_srtcmp_profile,
> > + (void *)&cmd_add_port_meter_profile_srtcmp_srtcmp,
> > + (void *)&cmd_add_port_meter_profile_srtcmp_port_id,
> > + (void *)&cmd_add_port_meter_profile_srtcmp_profile_id,
> > + (void *)&cmd_add_port_meter_profile_srtcmp_cir,
> > + (void *)&cmd_add_port_meter_profile_srtcmp_cbs,
> > + (void *)&cmd_add_port_meter_profile_srtcmp_ebs,
> > + NULL,
> > + },
> > +};
> > +
> > /* *** Delete Port Meter Profile *** */ struct
> > cmd_del_port_meter_profile_result {
> > cmdline_fixed_string_t del;
> > diff --git a/app/test-pmd/cmdline_mtr.h b/app/test-pmd/cmdline_mtr.h
> > index
> > e69d6da023..01ef85e1e7 100644
> > --- a/app/test-pmd/cmdline_mtr.h
> > +++ b/app/test-pmd/cmdline_mtr.h
> > @@ -10,6 +10,7 @@ extern cmdline_parse_inst_t
> cmd_show_port_meter_cap;
> > extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm; extern
> > cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm; extern
> > cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115;
> > +extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp;
> > extern cmdline_parse_inst_t cmd_del_port_meter_profile; extern
> > cmdline_parse_inst_t cmd_create_port_meter; extern
> > cmdline_parse_inst_t cmd_enable_port_meter; diff --git
> > a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > index 37278d31d6..d11de05583 100644
> > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > @@ -2734,6 +2734,21 @@ where:
> > * ``cbs``: Committed burst size (bytes).
> > * ``ebs``: Excess burst size (bytes).
> >
> > +add port meter profile (srTcmp)
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +
> > +Add meter profile (srTcmp) to the ethernet device::
> > +
> > + testpmd> add port meter profile srtcmp (port_id) (profile_id) \
> > + (cir) (cbs) (ebs)
> > +
> > +where:
> > +
> > +* ``profile_id``: ID for the meter profile.
> > +* ``cpr``: Committed Information Rate (CIR) (packets/second).
> > +* ``cbs``: Committed Burst Size (CBS) (packets).
> > +* ``ebs``: Excess Burst Size (EBS) (packets).
> > +
> > delete port meter profile
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > --
> > 2.21.0
@@ -698,6 +698,9 @@ static void cmd_help_long_parsed(void *parsed_result,
"add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs)\n"
" meter profile add - trtcm rfc 4115\n\n"
+ "add port meter profile srtcmp (port_id) (profile_id) (cipr) (cpbs) (epbs)\n"
+ " meter profile add - srtcmp packet per second\n\n"
+
"del port meter profile (port_id) (profile_id)\n"
" meter profile delete\n\n"
@@ -17006,6 +17009,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_show_port_meter_cap,
(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm,
(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_trtcm,
+ (cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcmp,
(cmdline_parse_inst_t *)&cmd_del_port_meter_profile,
(cmdline_parse_inst_t *)&cmd_create_port_meter,
(cmdline_parse_inst_t *)&cmd_enable_port_meter,
@@ -295,6 +295,8 @@ static void cmd_show_port_meter_cap_parsed(void *parsed_result,
cap.meter_trtcm_rfc2698_n_max);
printf("cap.meter_trtcm_rfc4115_n_max %" PRIu32 "\n",
cap.meter_trtcm_rfc4115_n_max);
+ printf("cap.meter_srtcmp_n_max %" PRIu32 "\n",
+ cap.meter_srtcmp_n_max);
printf("cap.meter_rate_max %" PRIu64 "\n", cap.meter_rate_max);
printf("cap.color_aware_srtcm_rfc2697_supported %" PRId32 "\n",
cap.color_aware_srtcm_rfc2697_supported);
@@ -302,6 +304,8 @@ static void cmd_show_port_meter_cap_parsed(void *parsed_result,
cap.color_aware_trtcm_rfc2698_supported);
printf("cap.color_aware_trtcm_rfc4115_supported %" PRId32 "\n",
cap.color_aware_trtcm_rfc4115_supported);
+ printf("cap.color_aware_srtcmp_supported %" PRId32 "\n",
+ cap.color_aware_srtcmp_supported);
printf("cap.policer_action_recolor_supported %" PRId32 "\n",
cap.policer_action_recolor_supported);
printf("cap.policer_action_drop_supported %" PRId32 "\n",
@@ -644,6 +648,107 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
},
};
+/* *** Add Port Meter Profile srtcmp *** */
+struct cmd_add_port_meter_profile_srtcmp_result {
+ cmdline_fixed_string_t add;
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t meter;
+ cmdline_fixed_string_t profile;
+ cmdline_fixed_string_t srtcmp;
+ uint16_t port_id;
+ uint32_t profile_id;
+ uint64_t cir;
+ uint64_t cbs;
+ uint64_t ebs;
+};
+
+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_add =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_add_port_meter_profile_srtcmp_result, add, "add");
+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_port =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_add_port_meter_profile_srtcmp_result,
+ port, "port");
+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_meter =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_add_port_meter_profile_srtcmp_result,
+ meter, "meter");
+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_profile =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_add_port_meter_profile_srtcmp_result,
+ profile, "profile");
+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_srtcmp =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_add_port_meter_profile_srtcmp_result,
+ srtcmp, "srtcmp");
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_port_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_add_port_meter_profile_srtcmp_result,
+ port_id, RTE_UINT16);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_profile_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_add_port_meter_profile_srtcmp_result,
+ profile_id, RTE_UINT32);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_cir =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_add_port_meter_profile_srtcmp_result,
+ cir, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_cbs =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_add_port_meter_profile_srtcmp_result,
+ cbs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_ebs =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_add_port_meter_profile_srtcmp_result,
+ ebs, RTE_UINT64);
+
+static void cmd_add_port_meter_profile_srtcmp_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_add_port_meter_profile_srtcmp_result *res = parsed_result;
+ struct rte_mtr_meter_profile mp;
+ struct rte_mtr_error error;
+ uint32_t profile_id = res->profile_id;
+ uint16_t port_id = res->port_id;
+ int ret;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN))
+ return;
+
+ /* Private shaper profile params */
+ memset(&mp, 0, sizeof(struct rte_mtr_meter_profile));
+ mp.alg = RTE_MTR_SRTCMP;
+ mp.srtcmp.cir = res->cir;
+ mp.srtcmp.cbs = res->cbs;
+ mp.srtcmp.ebs = res->ebs;
+
+ ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
+ if (ret != 0) {
+ print_err_msg(&error);
+ return;
+ }
+}
+
+cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp = {
+ .f = cmd_add_port_meter_profile_srtcmp_parsed,
+ .data = NULL,
+ .help_str = "Add port meter profile srtcmp",
+ .tokens = {
+ (void *)&cmd_add_port_meter_profile_srtcmp_add,
+ (void *)&cmd_add_port_meter_profile_srtcmp_port,
+ (void *)&cmd_add_port_meter_profile_srtcmp_meter,
+ (void *)&cmd_add_port_meter_profile_srtcmp_profile,
+ (void *)&cmd_add_port_meter_profile_srtcmp_srtcmp,
+ (void *)&cmd_add_port_meter_profile_srtcmp_port_id,
+ (void *)&cmd_add_port_meter_profile_srtcmp_profile_id,
+ (void *)&cmd_add_port_meter_profile_srtcmp_cir,
+ (void *)&cmd_add_port_meter_profile_srtcmp_cbs,
+ (void *)&cmd_add_port_meter_profile_srtcmp_ebs,
+ NULL,
+ },
+};
+
/* *** Delete Port Meter Profile *** */
struct cmd_del_port_meter_profile_result {
cmdline_fixed_string_t del;
@@ -10,6 +10,7 @@ extern cmdline_parse_inst_t cmd_show_port_meter_cap;
extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm;
extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm;
extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115;
+extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp;
extern cmdline_parse_inst_t cmd_del_port_meter_profile;
extern cmdline_parse_inst_t cmd_create_port_meter;
extern cmdline_parse_inst_t cmd_enable_port_meter;
@@ -2734,6 +2734,21 @@ where:
* ``cbs``: Committed burst size (bytes).
* ``ebs``: Excess burst size (bytes).
+add port meter profile (srTcmp)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add meter profile (srTcmp) to the ethernet device::
+
+ testpmd> add port meter profile srtcmp (port_id) (profile_id) \
+ (cir) (cbs) (ebs)
+
+where:
+
+* ``profile_id``: ID for the meter profile.
+* ``cpr``: Committed Information Rate (CIR) (packets/second).
+* ``cbs``: Committed Burst Size (CBS) (packets).
+* ``ebs``: Excess Burst Size (EBS) (packets).
+
delete port meter profile
~~~~~~~~~~~~~~~~~~~~~~~~~