DPDK patches and discussions
 help / color / mirror / Atom feed
From: Li Zhang <lizh@nvidia.com>
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 v3 4/4] app/testpmd: add meter pps mode cmd
Date: Mon,  1 Mar 2021 11:43:08 +0200	[thread overview]
Message-ID: <20210301094308.183161-5-lizh@nvidia.com> (raw)
In-Reply-To: <20210301094308.183161-1-lizh@nvidia.com>

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",
+	.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


  parent reply	other threads:[~2021-03-01  9:43 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25  1:02 [dpdk-dev] [RFC 0/1] lib/librte_ethdev: Meter algorithms support packet per second Li Zhang
2021-01-25  1:02 ` [dpdk-dev] [PATCH] [RFC]: adds support PPS(packet per second) on meter Li Zhang
2021-01-25  1:20   ` [dpdk-dev] [RFC 0/1] lib/librte_ethdev: Meter algorithms support packet per second Li Zhang
2021-01-25  1:20     ` [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter Li Zhang
2021-01-28 18:27       ` Ferruh Yigit
2021-02-12  7:40         ` Morten Brørup
2021-02-23  2:07           ` Li Zhang
2021-02-23  8:24             ` Morten Brørup
2021-03-01  3:16               ` Li Zhang
2021-03-01  3:31                 ` Ajit Khaparde
2021-03-01  7:20                 ` Morten Brørup
2021-03-01 13:08         ` Dumitrescu, Cristian
2021-03-01  9:39       ` [dpdk-dev] [RFC v3 0/4] " Li Zhang
2021-03-01  9:39         ` [dpdk-dev] [RFC v3 1/4] ethdev: add meter PPS profile Li Zhang
2021-03-01  9:39         ` [dpdk-dev] [RFC v3 2/4] common/mlx5: add meter mode definition in PRM file Li Zhang
2021-03-01  9:39         ` [dpdk-dev] [RFC v3 3/4] net/mlx5: support meter PPS profile Li Zhang
2021-03-01  9:40         ` [dpdk-dev] [RFC v3 4/4] app/testpmd: add meter pps mode cmd Li Zhang
2021-03-01  9:43       ` [dpdk-dev] [RFC v3 0/4] adds support PPS(packet per second) on meter Li Zhang
2021-03-01  9:43         ` [dpdk-dev] [RFC v3 1/4] ethdev: add meter PPS profile Li Zhang
2021-03-01  9:43         ` [dpdk-dev] [RFC v3 2/4] common/mlx5: add meter mode definition in PRM file Li Zhang
2021-03-01  9:43         ` [dpdk-dev] [RFC v3 3/4] net/mlx5: support meter PPS profile Li Zhang
2021-03-01  9:43         ` Li Zhang [this message]
2021-03-01  9:53       ` [dpdk-dev] [RFC v3 0/4] adds support PPS(packet per second) on meter Li Zhang
2021-03-01  9:53         ` [dpdk-dev] [RFC v3 1/4] ethdev: add meter PPS profile Li Zhang
2021-03-01  9:53         ` [dpdk-dev] [RFC v3 2/4] common/mlx5: add meter mode definition in PRM file Li Zhang
2021-03-01  9:53         ` [dpdk-dev] [RFC v3 3/4] net/mlx5: support meter PPS profile Li Zhang
2021-03-01  9:53         ` [dpdk-dev] [RFC v3 4/4] app/testpmd: add meter pps mode cmd Li Zhang
2021-02-12 21:35   ` [dpdk-dev] [PATCH] [RFC]: adds support PPS(packet per second) on meter Ajit Khaparde
2021-02-23  2:11     ` Li Zhang
2021-03-01 10:35 ` [dpdk-dev] [RFC v4 0/4] " Li Zhang
2021-03-01 10:35   ` [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile Li Zhang
2021-03-01 13:20     ` Dumitrescu, Cristian
2021-03-01 15:53       ` Thomas Monjalon
2021-03-02  1:27         ` Li Zhang
2021-03-02  1:46       ` Ajit Khaparde
2021-03-02 12:13         ` Dumitrescu, Cristian
2021-03-02  7:02       ` Matan Azrad
2021-03-02 12:29         ` Dumitrescu, Cristian
2021-03-02 12:37           ` Matan Azrad
2021-03-02 14:33             ` Dumitrescu, Cristian
2021-03-02 18:10               ` Matan Azrad
2021-03-03 20:35                 ` Dumitrescu, Cristian
2021-03-04  6:34                   ` Matan Azrad
2021-03-05 18:44                     ` Dumitrescu, Cristian
2021-03-01 10:35   ` [dpdk-dev] [RFC v4 2/4] common/mlx5: add meter mode definition in PRM file Li Zhang
2021-03-01 10:35   ` [dpdk-dev] [RFC v4 3/4] net/mlx5: support meter PPS profile Li Zhang
2021-03-01 10:35   ` [dpdk-dev] [RFC v4 4/4] app/testpmd: add meter pps mode cmd Li Zhang
2021-03-02  1:48     ` Li, Xiaoyun
2021-03-02  3:04       ` Li Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210301094308.183161-5-lizh@nvidia.com \
    --to=lizh@nvidia.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dekelp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=mb@smartsharesystems.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).