DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] Support PPS(packet per second) on meter
@ 2021-03-31  8:54 Li Zhang
  2021-03-31  8:54 ` [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure Li Zhang
                   ` (4 more replies)
  0 siblings, 5 replies; 47+ messages in thread
From: Li Zhang @ 2021-03-31  8:54 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports rate is bytes per second(BPS).
Add packet_mode flag in meter profile parameters data structure.
So that it can meter traffic by packet per second.

When packet_mode is 0, the profile rates and bucket sizes are
specified in bytes per second and bytes
when packet_mode is not 0, the profile rates and bucket sizes are
specified in packets and packets per second.

RFC ("adds support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769-2-lizh@nvidia.com/

Depends-on: series=15998  ("Add ASO meter support in MLX5 PMD")
https://patchwork.dpdk.org/project/dpdk/list/?series=15998

Li Zhang (2):
  ethdev: add packet mode in meter profile structure
  app/testpmd: add meter profile packet mode option

 app/test-pmd/cmdline_mtr.c                  | 40 ++++++++-
 doc/guides/rel_notes/release_21_05.rst      |  7 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 +++----
 lib/librte_ethdev/rte_mtr.h                 | 89 ++++++++++++++++++---
 4 files changed, 139 insertions(+), 28 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure
  2021-03-31  8:54 [dpdk-dev] [PATCH 0/2] Support PPS(packet per second) on meter Li Zhang
@ 2021-03-31  8:54 ` Li Zhang
  2021-03-31 16:26   ` Dumitrescu, Cristian
  2021-03-31  8:54 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option Li Zhang
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 47+ messages in thread
From: Li Zhang @ 2021-03-31  8:54 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
  Cc: dev, rasland, roniba

Currently meter algorithms only supports rate is bytes per second(BPS).
Add packet_mode flag in meter profile parameters data structure.
So that it can meter traffic by packet per second.

When packet_mode is 0, the profile rates and bucket sizes are
specified in bytes per second and bytes
when packet_mode is not 0, the profile rates and bucket sizes are
specified in packets and packets per second.

The below structure will be extended:
rte_mtr_meter_profile
rte_mtr_capabilities

Signed-off-by: Li Zhang <lizh@nvidia.com>
---
 doc/guides/rel_notes/release_21_05.rst |  7 ++
 lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
 2 files changed, 85 insertions(+), 11 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 3c76148b11..c9c15794ad 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -119,6 +119,13 @@ New Features
   * Added command to display Rx queue used descriptor count.
     ``show port (port_id) rxq (queue_id) desc used count``
 
+* **Added support for meter PPS profile.**
+
+  Currently meter algorithms only supports bytes per second(BPS).
+  Add packet_mode in the meter profile parameters data structures
+  to support packet per second (PPS) mode.
+  So that it can meter traffic by packet per second.
+  Packet_mode must be 0 when it is bytes mode.
 
 Removed Items
 -------------
diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
index e1dc59eb06..52611a90f5 100644
--- a/lib/librte_ethdev/rte_mtr.h
+++ b/lib/librte_ethdev/rte_mtr.h
@@ -133,46 +133,71 @@ struct rte_mtr_meter_profile {
 	union {
 		/** Items only valid when *alg* is set to srTCM - RFC 2697. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Committed Burst Size (CBS) (bytes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Excess Burst Size (EBS) (bytes). */
+			/** Excess Burst Size (EBS) (bytes or packets). */
 			uint64_t ebs;
 		} srtcm_rfc2697;
 
 		/** Items only valid when *alg* is set to trTCM - RFC 2698. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Peak Information Rate (PIR) (bytes/second). */
+			/**
+			 * Peak Information Rate (PIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t pir;
 
-			/** Committed Burst Size (CBS) (byes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Peak Burst Size (PBS) (bytes). */
+			/** Peak Burst Size (PBS) (bytes or packets). */
 			uint64_t pbs;
 		} trtcm_rfc2698;
 
 		/** Items only valid when *alg* is set to trTCM - RFC 4115. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Excess Information Rate (EIR) (bytes/second). */
+			/**
+			 * Excess Information Rate (EIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t eir;
 
-			/** Committed Burst Size (CBS) (byes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Excess Burst Size (EBS) (bytes). */
+			/** Excess Burst Size (EBS) (bytes or packets). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
 	};
+
+	/**
+	 * When zero, the byte mode is enabled for the current profile, so the
+	 * *rate* and *size* fields are specified in bytes per second
+	 * and bytes, respectively.
+	 * When non-zero, the packet mode is enabled for the current profile,
+	 * so the *rate* and *size* fields are specified in packets per second
+	 * and packets, respectively.
+	 */
+	int packet_mode;
 };
 
 /**
@@ -333,6 +358,48 @@ struct rte_mtr_capabilities {
 	 */
 	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * srTCM rfc2697 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the srTCM RFC 2697 metering algorithm.
+	 */
+	int srtcm_rfc2697_byte_mode_supported;
+
+	/**
+	 * srTCM rfc2697 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the srTCM RFC 2697 metering algorithm.
+	 */
+	int srtcm_rfc2697_packet_mode_supported;
+
+	/**
+	 * trTCM rfc2698 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the trTCM RFC 2698 metering algorithm.
+	 */
+	int trtcm_rfc2698_byte_mode_supported;
+
+	/**
+	 * trTCM rfc2698 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the trTCM RFC 2698 metering algorithm.
+	 */
+	int trtcm_rfc2698_packet_mode_supported;
+
+	/**
+	 * trTCM rfc4115 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the trTCM RFC 4115 metering algorithm.
+	 */
+	int trtcm_rfc4115_byte_mode_supported;
+
+	/**
+	 * trTCM rfc4115 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the trTCM RFC 4115 metering algorithm.
+	 */
+	int trtcm_rfc4115_packet_mode_supported;
+
 	/** Set of supported statistics counter types.
 	 * @see enum rte_mtr_stats_type
 	 */
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option
  2021-03-31  8:54 [dpdk-dev] [PATCH 0/2] Support PPS(packet per second) on meter Li Zhang
  2021-03-31  8:54 ` [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure Li Zhang
@ 2021-03-31  8:54 ` Li Zhang
  2021-04-07 20:17   ` Dumitrescu, Cristian
  2021-04-07 20:21   ` Dumitrescu, Cristian
  2021-04-08  3:58 ` [dpdk-dev] [PATCH v2 0/4] Support PPS(packet per second) on meter Li Zhang
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 47+ messages in thread
From: Li Zhang @ 2021-03-31  8:54 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	Xiaoyun Li
  Cc: dev, thomas, rasland, roniba

add meter profile packet_mode to the ethernet device.
One example:
add port meter profile rfc2697 (port_id) (profile_id)
(cir) (cbs) (ebs) (packet_mode)

Signed-off-by: Li Zhang <lizh@nvidia.com>
---
 app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
 2 files changed, 54 insertions(+), 17 deletions(-)

diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index bdc9ae8bfe..eff2473e7b 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -263,6 +263,18 @@ 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.srtcm_rfc2697_byte_mode_supported %" PRId32 "\n",
+		cap.srtcm_rfc2697_byte_mode_supported);
+	printf("cap.srtcm_rfc2697_packet_mode_supported %" PRId32 "\n",
+		cap.srtcm_rfc2697_packet_mode_supported);
+	printf("cap.trtcm_rfc2698_byte_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc2698_byte_mode_supported);
+	printf("cap.trtcm_rfc2698_packet_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc2698_packet_mode_supported);
+	printf("cap.trtcm_rfc4115_byte_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc4115_byte_mode_supported);
+	printf("cap.trtcm_rfc4115_packet_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc4115_packet_mode_supported);
 	printf("cap.stats_mask %" PRIx64 "\n", cap.stats_mask);
 }
 
@@ -292,6 +304,7 @@ struct cmd_add_port_meter_profile_srtcm_result {
 	uint64_t cir;
 	uint64_t cbs;
 	uint64_t ebs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcm_add =
@@ -333,6 +346,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_ebs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_srtcm_result,
 			ebs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcm_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -354,6 +371,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 	mp.srtcm_rfc2697.cir = res->cir;
 	mp.srtcm_rfc2697.cbs = res->cbs;
 	mp.srtcm_rfc2697.ebs = res->ebs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -365,7 +383,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 	.f = cmd_add_port_meter_profile_srtcm_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs>",
+	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_srtcm_add,
 		(void *)&cmd_add_port_meter_profile_srtcm_port,
@@ -377,6 +395,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 		(void *)&cmd_add_port_meter_profile_srtcm_cir,
 		(void *)&cmd_add_port_meter_profile_srtcm_cbs,
 		(void *)&cmd_add_port_meter_profile_srtcm_ebs,
+		(void *)&cmd_add_port_meter_profile_srtcm_packet_mode,
 		NULL,
 	},
 };
@@ -394,6 +413,7 @@ struct cmd_add_port_meter_profile_trtcm_result {
 	uint64_t pir;
 	uint64_t cbs;
 	uint64_t pbs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_add =
@@ -439,6 +459,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_pbs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_trtcm_result,
 			pbs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_trtcm_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -461,6 +485,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 	mp.trtcm_rfc2698.pir = res->pir;
 	mp.trtcm_rfc2698.cbs = res->cbs;
 	mp.trtcm_rfc2698.pbs = res->pbs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -472,7 +497,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 	.f = cmd_add_port_meter_profile_trtcm_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs>",
+	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_port,
@@ -485,6 +510,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 		(void *)&cmd_add_port_meter_profile_trtcm_pir,
 		(void *)&cmd_add_port_meter_profile_trtcm_cbs,
 		(void *)&cmd_add_port_meter_profile_trtcm_pbs,
+		(void *)&cmd_add_port_meter_profile_trtcm_packet_mode,
 		NULL,
 	},
 };
@@ -502,6 +528,7 @@ struct cmd_add_port_meter_profile_trtcm_rfc4115_result {
 	uint64_t eir;
 	uint64_t cbs;
 	uint64_t ebs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_rfc4115_add =
@@ -549,6 +576,11 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_rfc4115_ebs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
 			ebs, RTE_UINT64);
+cmdline_parse_token_num_t
+	cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 	void *parsed_result,
@@ -573,6 +605,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 	mp.trtcm_rfc4115.eir = res->eir;
 	mp.trtcm_rfc4115.cbs = res->cbs;
 	mp.trtcm_rfc4115.ebs = res->ebs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -584,7 +617,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 	.f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs>",
+	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port,
@@ -597,6 +630,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_eir,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_cbs,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_ebs,
+		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode,
 		NULL,
 	},
 };
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f59eb8a27d..b5e52f6b1c 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2698,14 +2698,15 @@ add port meter profile (srTCM rfc2967)
 Add meter profile (srTCM rfc2697) to the ethernet device::
 
    testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
-   (cir) (cbs) (ebs)
+   (cir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed Information Rate (CIR) (bytes/second).
-* ``cbs``: Committed Burst Size (CBS) (bytes).
-* ``ebs``: Excess Burst Size (EBS) (bytes).
+* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second).
+* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
+* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc2968)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2713,15 +2714,16 @@ add port meter profile (trTCM rfc2968)
 Add meter profile (srTCM rfc2698) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
-   (cir) (pir) (cbs) (pbs)
+   (cir) (pir) (cbs) (pbs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``pir``: Peak information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``pbs``: Peak burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``pir``: Peak information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``pbs``: Peak burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc4115)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2729,15 +2731,16 @@ add port meter profile (trTCM rfc4115)
 Add meter profile (trTCM rfc4115) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
-   (cir) (eir) (cbs) (ebs)
+   (cir) (eir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``eir``: Excess information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``ebs``: Excess burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``eir``: Excess information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``ebs``: Excess burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure
  2021-03-31  8:54 ` [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure Li Zhang
@ 2021-03-31 16:26   ` Dumitrescu, Cristian
  2021-04-01  1:41     ` Li Zhang
  0 siblings, 1 reply; 47+ messages in thread
From: Dumitrescu, Cristian @ 2021-03-31 16:26 UTC (permalink / raw)
  To: Li Zhang, dekelp, orika, viacheslavo, matan, shahafs,
	Thomas Monjalon, Yigit, Ferruh, Andrew Rybchenko
  Cc: dev, rasland, roniba

Hi Li,

> -----Original Message-----
> From: Li Zhang <lizh@nvidia.com>
> Sent: Wednesday, March 31, 2021 9:54 AM
> To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Cc: dev@dpdk.org; rasland@nvidia.com; roniba@nvidia.com
> Subject: [PATCH 1/2] ethdev: add packet mode in meter profile structure
> 
> Currently meter algorithms only supports rate is bytes per second(BPS).
> Add packet_mode flag in meter profile parameters data structure.
> So that it can meter traffic by packet per second.
> 
> When packet_mode is 0, the profile rates and bucket sizes are
> specified in bytes per second and bytes
> when packet_mode is not 0, the profile rates and bucket sizes are
> specified in packets and packets per second.
> 
> The below structure will be extended:
> rte_mtr_meter_profile
> rte_mtr_capabilities
> 
> Signed-off-by: Li Zhang <lizh@nvidia.com>
> ---
>  doc/guides/rel_notes/release_21_05.rst |  7 ++
>  lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
>  2 files changed, 85 insertions(+), 11 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_21_05.rst
> b/doc/guides/rel_notes/release_21_05.rst
> index 3c76148b11..c9c15794ad 100644
> --- a/doc/guides/rel_notes/release_21_05.rst
> +++ b/doc/guides/rel_notes/release_21_05.rst
> @@ -119,6 +119,13 @@ New Features
>    * Added command to display Rx queue used descriptor count.
>      ``show port (port_id) rxq (queue_id) desc used count``
> 
> +* **Added support for meter PPS profile.**
> +
> +  Currently meter algorithms only supports bytes per second(BPS).
> +  Add packet_mode in the meter profile parameters data structures
> +  to support packet per second (PPS) mode.
> +  So that it can meter traffic by packet per second.
> +  Packet_mode must be 0 when it is bytes mode.
> 
>  Removed Items
>  -------------
> diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
> index e1dc59eb06..52611a90f5 100644
> --- a/lib/librte_ethdev/rte_mtr.h
> +++ b/lib/librte_ethdev/rte_mtr.h
> @@ -133,46 +133,71 @@ struct rte_mtr_meter_profile {
>  	union {
>  		/** Items only valid when *alg* is set to srTCM - RFC 2697. */
>  		struct {
> -			/** Committed Information Rate (CIR)
> (bytes/second). */
> +			/**
> +			 * Committed Information Rate (CIR)
> +			 * (bytes per second or packets per second).
> +			 */
>  			uint64_t cir;
> 
> -			/** Committed Burst Size (CBS) (bytes). */
> +			/** Committed Burst Size (CBS) (bytes or packets). */
>  			uint64_t cbs;
> 
> -			/** Excess Burst Size (EBS) (bytes). */
> +			/** Excess Burst Size (EBS) (bytes or packets). */
>  			uint64_t ebs;
>  		} srtcm_rfc2697;
> 
>  		/** Items only valid when *alg* is set to trTCM - RFC 2698. */
>  		struct {
> -			/** Committed Information Rate (CIR)
> (bytes/second). */
> +			/**
> +			 * Committed Information Rate (CIR)
> +			 * (bytes per second or packets per second).
> +			 */
>  			uint64_t cir;
> 
> -			/** Peak Information Rate (PIR) (bytes/second). */
> +			/**
> +			 * Peak Information Rate (PIR)
> +			 * (bytes per second or packets per second).
> +			 */
>  			uint64_t pir;
> 
> -			/** Committed Burst Size (CBS) (byes). */
> +			/** Committed Burst Size (CBS) (bytes or packets). */
>  			uint64_t cbs;
> 
> -			/** Peak Burst Size (PBS) (bytes). */
> +			/** Peak Burst Size (PBS) (bytes or packets). */
>  			uint64_t pbs;
>  		} trtcm_rfc2698;
> 
>  		/** Items only valid when *alg* is set to trTCM - RFC 4115. */
>  		struct {
> -			/** Committed Information Rate (CIR)
> (bytes/second). */
> +			/**
> +			 * Committed Information Rate (CIR)
> +			 * (bytes per second or packets per second).
> +			 */
>  			uint64_t cir;
> 
> -			/** Excess Information Rate (EIR) (bytes/second). */
> +			/**
> +			 * Excess Information Rate (EIR)
> +			 * (bytes per second or packets per second).
> +			 */
>  			uint64_t eir;
> 
> -			/** Committed Burst Size (CBS) (byes). */
> +			/** Committed Burst Size (CBS) (bytes or packets). */
>  			uint64_t cbs;
> 
> -			/** Excess Burst Size (EBS) (bytes). */
> +			/** Excess Burst Size (EBS) (bytes or packets). */
>  			uint64_t ebs;
>  		} trtcm_rfc4115;
>  	};
> +
> +	/**
> +	 * When zero, the byte mode is enabled for the current profile, so
> the
> +	 * *rate* and *size* fields are specified in bytes per second
> +	 * and bytes, respectively.
> +	 * When non-zero, the packet mode is enabled for the current
> profile,
> +	 * so the *rate* and *size* fields are specified in packets per second
> +	 * and packets, respectively.
> +	 */
> +	int packet_mode;
>  };
> 
>  /**
> @@ -333,6 +358,48 @@ struct rte_mtr_capabilities {
>  	 */
>  	int color_aware_trtcm_rfc4115_supported;
> 
> +	/**
> +	 * srTCM rfc2697 byte mode supported.
> +	 * When non-zero, it indicates that byte mode is supported for
> +	 * the srTCM RFC 2697 metering algorithm.
> +	 */
> +	int srtcm_rfc2697_byte_mode_supported;
> +
> +	/**
> +	 * srTCM rfc2697 packet mode supported.
> +	 * When non-zero, it indicates that packet mode is supported for
> +	 * the srTCM RFC 2697 metering algorithm.
> +	 */
> +	int srtcm_rfc2697_packet_mode_supported;
> +
> +	/**
> +	 * trTCM rfc2698 byte mode supported.
> +	 * When non-zero, it indicates that byte mode is supported for
> +	 * the trTCM RFC 2698 metering algorithm.
> +	 */
> +	int trtcm_rfc2698_byte_mode_supported;
> +
> +	/**
> +	 * trTCM rfc2698 packet mode supported.
> +	 * When non-zero, it indicates that packet mode is supported for
> +	 * the trTCM RFC 2698 metering algorithm.
> +	 */
> +	int trtcm_rfc2698_packet_mode_supported;
> +
> +	/**
> +	 * trTCM rfc4115 byte mode supported.
> +	 * When non-zero, it indicates that byte mode is supported for
> +	 * the trTCM RFC 4115 metering algorithm.
> +	 */
> +	int trtcm_rfc4115_byte_mode_supported;
> +
> +	/**
> +	 * trTCM rfc4115 packet mode supported.
> +	 * When non-zero, it indicates that packet mode is supported for
> +	 * the trTCM RFC 4115 metering algorithm.
> +	 */
> +	int trtcm_rfc4115_packet_mode_supported;
> +
>  	/** Set of supported statistics counter types.
>  	 * @see enum rte_mtr_stats_type
>  	 */
> --
> 2.27.0

These API updates look good to me, but please add the necessary checks to the existing drivers implementing the rte_mtr API to makes sure that profiles with packet_mode set to TRUE are rejected.

For the Soft NIC driver, this is a simple check in file drivers/net/softnic/rte_eth_softnic_meter.c, function meter_profile_check. Thanks!

Regards,
Cristian

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure
  2021-03-31 16:26   ` Dumitrescu, Cristian
@ 2021-04-01  1:41     ` Li Zhang
  2021-04-01  6:19       ` Li Zhang
  0 siblings, 1 reply; 47+ messages in thread
From: Li Zhang @ 2021-04-01  1:41 UTC (permalink / raw)
  To: Dumitrescu, Cristian, dekelp, Ori Kam, Slava Ovsiienko,
	Matan Azrad, Shahaf Shuler, NBU-Contact-Thomas Monjalon, Yigit,
	Ferruh, Andrew Rybchenko
  Cc: dev, Raslan Darawsheh, Roni Bar Yanai

Hi Dumitrescu,

Thank you for your comments.
I will add the necessary checks in V2 patches.

Regards,
Li Zhang

> -----Original Message-----
> From: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Sent: Thursday, April 1, 2021 12:27 AM
> To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; NBU-
> Contact-Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Roni Bar Yanai
> <roniba@nvidia.com>
> Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile structure
> 
> External email: Use caution opening links or attachments
> 
> 
> Hi Li,
> 
> > -----Original Message-----
> > From: Li Zhang <lizh@nvidia.com>
> > Sent: Wednesday, March 31, 2021 9:54 AM
> > To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> > matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> > <cristian.dumitrescu@intel.com>; Thomas Monjalon
> > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > Cc: dev@dpdk.org; rasland@nvidia.com; roniba@nvidia.com
> > Subject: [PATCH 1/2] ethdev: add packet mode in meter profile
> > structure
> >
> > Currently meter algorithms only supports rate is bytes per second(BPS).
> > Add packet_mode flag in meter profile parameters data structure.
> > So that it can meter traffic by packet per second.
> >
> > When packet_mode is 0, the profile rates and bucket sizes are
> > specified in bytes per second and bytes when packet_mode is not 0, the
> > profile rates and bucket sizes are specified in packets and packets
> > per second.
> >
> > The below structure will be extended:
> > rte_mtr_meter_profile
> > rte_mtr_capabilities
> >
> > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > ---
> >  doc/guides/rel_notes/release_21_05.rst |  7 ++
> >  lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
> >  2 files changed, 85 insertions(+), 11 deletions(-)
> >
> > diff --git a/doc/guides/rel_notes/release_21_05.rst
> > b/doc/guides/rel_notes/release_21_05.rst
> > index 3c76148b11..c9c15794ad 100644
> > --- a/doc/guides/rel_notes/release_21_05.rst
> > +++ b/doc/guides/rel_notes/release_21_05.rst
> > @@ -119,6 +119,13 @@ New Features
> >    * Added command to display Rx queue used descriptor count.
> >      ``show port (port_id) rxq (queue_id) desc used count``
> >
> > +* **Added support for meter PPS profile.**
> > +
> > +  Currently meter algorithms only supports bytes per second(BPS).
> > +  Add packet_mode in the meter profile parameters data structures  to
> > + support packet per second (PPS) mode.
> > +  So that it can meter traffic by packet per second.
> > +  Packet_mode must be 0 when it is bytes mode.
> >
> >  Removed Items
> >  -------------
> > diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
> > index e1dc59eb06..52611a90f5 100644
> > --- a/lib/librte_ethdev/rte_mtr.h
> > +++ b/lib/librte_ethdev/rte_mtr.h
> > @@ -133,46 +133,71 @@ struct rte_mtr_meter_profile {
> >       union {
> >               /** Items only valid when *alg* is set to srTCM - RFC 2697. */
> >               struct {
> > -                     /** Committed Information Rate (CIR)
> > (bytes/second). */
> > +                     /**
> > +                      * Committed Information Rate (CIR)
> > +                      * (bytes per second or packets per second).
> > +                      */
> >                       uint64_t cir;
> >
> > -                     /** Committed Burst Size (CBS) (bytes). */
> > +                     /** Committed Burst Size (CBS) (bytes or
> > + packets). */
> >                       uint64_t cbs;
> >
> > -                     /** Excess Burst Size (EBS) (bytes). */
> > +                     /** Excess Burst Size (EBS) (bytes or packets).
> > + */
> >                       uint64_t ebs;
> >               } srtcm_rfc2697;
> >
> >               /** Items only valid when *alg* is set to trTCM - RFC 2698. */
> >               struct {
> > -                     /** Committed Information Rate (CIR)
> > (bytes/second). */
> > +                     /**
> > +                      * Committed Information Rate (CIR)
> > +                      * (bytes per second or packets per second).
> > +                      */
> >                       uint64_t cir;
> >
> > -                     /** Peak Information Rate (PIR) (bytes/second). */
> > +                     /**
> > +                      * Peak Information Rate (PIR)
> > +                      * (bytes per second or packets per second).
> > +                      */
> >                       uint64_t pir;
> >
> > -                     /** Committed Burst Size (CBS) (byes). */
> > +                     /** Committed Burst Size (CBS) (bytes or
> > + packets). */
> >                       uint64_t cbs;
> >
> > -                     /** Peak Burst Size (PBS) (bytes). */
> > +                     /** Peak Burst Size (PBS) (bytes or packets). */
> >                       uint64_t pbs;
> >               } trtcm_rfc2698;
> >
> >               /** Items only valid when *alg* is set to trTCM - RFC 4115. */
> >               struct {
> > -                     /** Committed Information Rate (CIR)
> > (bytes/second). */
> > +                     /**
> > +                      * Committed Information Rate (CIR)
> > +                      * (bytes per second or packets per second).
> > +                      */
> >                       uint64_t cir;
> >
> > -                     /** Excess Information Rate (EIR) (bytes/second). */
> > +                     /**
> > +                      * Excess Information Rate (EIR)
> > +                      * (bytes per second or packets per second).
> > +                      */
> >                       uint64_t eir;
> >
> > -                     /** Committed Burst Size (CBS) (byes). */
> > +                     /** Committed Burst Size (CBS) (bytes or
> > + packets). */
> >                       uint64_t cbs;
> >
> > -                     /** Excess Burst Size (EBS) (bytes). */
> > +                     /** Excess Burst Size (EBS) (bytes or packets).
> > + */
> >                       uint64_t ebs;
> >               } trtcm_rfc4115;
> >       };
> > +
> > +     /**
> > +      * When zero, the byte mode is enabled for the current profile,
> > + so
> > the
> > +      * *rate* and *size* fields are specified in bytes per second
> > +      * and bytes, respectively.
> > +      * When non-zero, the packet mode is enabled for the current
> > profile,
> > +      * so the *rate* and *size* fields are specified in packets per second
> > +      * and packets, respectively.
> > +      */
> > +     int packet_mode;
> >  };
> >
> >  /**
> > @@ -333,6 +358,48 @@ struct rte_mtr_capabilities {
> >        */
> >       int color_aware_trtcm_rfc4115_supported;
> >
> > +     /**
> > +      * srTCM rfc2697 byte mode supported.
> > +      * When non-zero, it indicates that byte mode is supported for
> > +      * the srTCM RFC 2697 metering algorithm.
> > +      */
> > +     int srtcm_rfc2697_byte_mode_supported;
> > +
> > +     /**
> > +      * srTCM rfc2697 packet mode supported.
> > +      * When non-zero, it indicates that packet mode is supported for
> > +      * the srTCM RFC 2697 metering algorithm.
> > +      */
> > +     int srtcm_rfc2697_packet_mode_supported;
> > +
> > +     /**
> > +      * trTCM rfc2698 byte mode supported.
> > +      * When non-zero, it indicates that byte mode is supported for
> > +      * the trTCM RFC 2698 metering algorithm.
> > +      */
> > +     int trtcm_rfc2698_byte_mode_supported;
> > +
> > +     /**
> > +      * trTCM rfc2698 packet mode supported.
> > +      * When non-zero, it indicates that packet mode is supported for
> > +      * the trTCM RFC 2698 metering algorithm.
> > +      */
> > +     int trtcm_rfc2698_packet_mode_supported;
> > +
> > +     /**
> > +      * trTCM rfc4115 byte mode supported.
> > +      * When non-zero, it indicates that byte mode is supported for
> > +      * the trTCM RFC 4115 metering algorithm.
> > +      */
> > +     int trtcm_rfc4115_byte_mode_supported;
> > +
> > +     /**
> > +      * trTCM rfc4115 packet mode supported.
> > +      * When non-zero, it indicates that packet mode is supported for
> > +      * the trTCM RFC 4115 metering algorithm.
> > +      */
> > +     int trtcm_rfc4115_packet_mode_supported;
> > +
> >       /** Set of supported statistics counter types.
> >        * @see enum rte_mtr_stats_type
> >        */
> > --
> > 2.27.0
> 
> These API updates look good to me, but please add the necessary checks to
> the existing drivers implementing the rte_mtr API to makes sure that profiles
> with packet_mode set to TRUE are rejected.
> 
> For the Soft NIC driver, this is a simple check in file
> drivers/net/softnic/rte_eth_softnic_meter.c, function meter_profile_check.
> Thanks!
> 
> Regards,
> Cristian

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure
  2021-04-01  1:41     ` Li Zhang
@ 2021-04-01  6:19       ` Li Zhang
  2021-04-07 20:20         ` Dumitrescu, Cristian
  0 siblings, 1 reply; 47+ messages in thread
From: Li Zhang @ 2021-04-01  6:19 UTC (permalink / raw)
  To: Dumitrescu, Cristian, dekelp, Ori Kam, Slava Ovsiienko,
	Matan Azrad, Shahaf Shuler, NBU-Contact-Thomas Monjalon, Yigit,
	Ferruh, Andrew Rybchenko, Liron Himi
  Cc: dev, Raslan Darawsheh, Roni Bar Yanai

Hi Dumitrescu and Liron,

I add the check in softnet and mvpp2 drivers in the following patch.
Please help review it.
https://patchwork.dpdk.org/project/dpdk/list/?series=16036

Thanks!
Regards,
Li Zhang
> -----Original Message-----
> From: Li Zhang
> Sent: Thursday, April 1, 2021 9:42 AM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>;
> dekelp@nvidia.com; Ori Kam <orika@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Shahaf
> Shuler <shahafs@nvidia.com>; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Roni Bar Yanai
> <roniba@nvidia.com>
> Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile structure
> 
> Hi Dumitrescu,
> 
> Thank you for your comments.
> I will add the necessary checks in V2 patches.
> 
> Regards,
> Li Zhang
> 
> > -----Original Message-----
> > From: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> > Sent: Thursday, April 1, 2021 12:27 AM
> > To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
> > <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
> > Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; NBU-
> > Contact-Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
> > <ferruh.yigit@intel.com>; Andrew Rybchenko
> > <andrew.rybchenko@oktetlabs.ru>
> > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Roni Bar
> > Yanai <roniba@nvidia.com>
> > Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile
> > structure
> >
> > External email: Use caution opening links or attachments
> >
> >
> > Hi Li,
> >
> > > -----Original Message-----
> > > From: Li Zhang <lizh@nvidia.com>
> > > Sent: Wednesday, March 31, 2021 9:54 AM
> > > To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> > > matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> > > <cristian.dumitrescu@intel.com>; Thomas Monjalon
> > > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> > > Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > > Cc: dev@dpdk.org; rasland@nvidia.com; roniba@nvidia.com
> > > Subject: [PATCH 1/2] ethdev: add packet mode in meter profile
> > > structure
> > >
> > > Currently meter algorithms only supports rate is bytes per second(BPS).
> > > Add packet_mode flag in meter profile parameters data structure.
> > > So that it can meter traffic by packet per second.
> > >
> > > When packet_mode is 0, the profile rates and bucket sizes are
> > > specified in bytes per second and bytes when packet_mode is not 0,
> > > the profile rates and bucket sizes are specified in packets and
> > > packets per second.
> > >
> > > The below structure will be extended:
> > > rte_mtr_meter_profile
> > > rte_mtr_capabilities
> > >
> > > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > > ---
> > >  doc/guides/rel_notes/release_21_05.rst |  7 ++
> > >  lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
> > >  2 files changed, 85 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/doc/guides/rel_notes/release_21_05.rst
> > > b/doc/guides/rel_notes/release_21_05.rst
> > > index 3c76148b11..c9c15794ad 100644
> > > --- a/doc/guides/rel_notes/release_21_05.rst
> > > +++ b/doc/guides/rel_notes/release_21_05.rst
> > > @@ -119,6 +119,13 @@ New Features
> > >    * Added command to display Rx queue used descriptor count.
> > >      ``show port (port_id) rxq (queue_id) desc used count``
> > >
> > > +* **Added support for meter PPS profile.**
> > > +
> > > +  Currently meter algorithms only supports bytes per second(BPS).
> > > +  Add packet_mode in the meter profile parameters data structures
> > > + to support packet per second (PPS) mode.
> > > +  So that it can meter traffic by packet per second.
> > > +  Packet_mode must be 0 when it is bytes mode.
> > >
> > >  Removed Items
> > >  -------------
> > > diff --git a/lib/librte_ethdev/rte_mtr.h
> > > b/lib/librte_ethdev/rte_mtr.h index e1dc59eb06..52611a90f5 100644
> > > --- a/lib/librte_ethdev/rte_mtr.h
> > > +++ b/lib/librte_ethdev/rte_mtr.h
> > > @@ -133,46 +133,71 @@ struct rte_mtr_meter_profile {
> > >       union {
> > >               /** Items only valid when *alg* is set to srTCM - RFC 2697. */
> > >               struct {
> > > -                     /** Committed Information Rate (CIR)
> > > (bytes/second). */
> > > +                     /**
> > > +                      * Committed Information Rate (CIR)
> > > +                      * (bytes per second or packets per second).
> > > +                      */
> > >                       uint64_t cir;
> > >
> > > -                     /** Committed Burst Size (CBS) (bytes). */
> > > +                     /** Committed Burst Size (CBS) (bytes or
> > > + packets). */
> > >                       uint64_t cbs;
> > >
> > > -                     /** Excess Burst Size (EBS) (bytes). */
> > > +                     /** Excess Burst Size (EBS) (bytes or packets).
> > > + */
> > >                       uint64_t ebs;
> > >               } srtcm_rfc2697;
> > >
> > >               /** Items only valid when *alg* is set to trTCM - RFC 2698. */
> > >               struct {
> > > -                     /** Committed Information Rate (CIR)
> > > (bytes/second). */
> > > +                     /**
> > > +                      * Committed Information Rate (CIR)
> > > +                      * (bytes per second or packets per second).
> > > +                      */
> > >                       uint64_t cir;
> > >
> > > -                     /** Peak Information Rate (PIR) (bytes/second). */
> > > +                     /**
> > > +                      * Peak Information Rate (PIR)
> > > +                      * (bytes per second or packets per second).
> > > +                      */
> > >                       uint64_t pir;
> > >
> > > -                     /** Committed Burst Size (CBS) (byes). */
> > > +                     /** Committed Burst Size (CBS) (bytes or
> > > + packets). */
> > >                       uint64_t cbs;
> > >
> > > -                     /** Peak Burst Size (PBS) (bytes). */
> > > +                     /** Peak Burst Size (PBS) (bytes or packets).
> > > + */
> > >                       uint64_t pbs;
> > >               } trtcm_rfc2698;
> > >
> > >               /** Items only valid when *alg* is set to trTCM - RFC 4115. */
> > >               struct {
> > > -                     /** Committed Information Rate (CIR)
> > > (bytes/second). */
> > > +                     /**
> > > +                      * Committed Information Rate (CIR)
> > > +                      * (bytes per second or packets per second).
> > > +                      */
> > >                       uint64_t cir;
> > >
> > > -                     /** Excess Information Rate (EIR) (bytes/second). */
> > > +                     /**
> > > +                      * Excess Information Rate (EIR)
> > > +                      * (bytes per second or packets per second).
> > > +                      */
> > >                       uint64_t eir;
> > >
> > > -                     /** Committed Burst Size (CBS) (byes). */
> > > +                     /** Committed Burst Size (CBS) (bytes or
> > > + packets). */
> > >                       uint64_t cbs;
> > >
> > > -                     /** Excess Burst Size (EBS) (bytes). */
> > > +                     /** Excess Burst Size (EBS) (bytes or packets).
> > > + */
> > >                       uint64_t ebs;
> > >               } trtcm_rfc4115;
> > >       };
> > > +
> > > +     /**
> > > +      * When zero, the byte mode is enabled for the current
> > > + profile, so
> > > the
> > > +      * *rate* and *size* fields are specified in bytes per second
> > > +      * and bytes, respectively.
> > > +      * When non-zero, the packet mode is enabled for the current
> > > profile,
> > > +      * so the *rate* and *size* fields are specified in packets per second
> > > +      * and packets, respectively.
> > > +      */
> > > +     int packet_mode;
> > >  };
> > >
> > >  /**
> > > @@ -333,6 +358,48 @@ struct rte_mtr_capabilities {
> > >        */
> > >       int color_aware_trtcm_rfc4115_supported;
> > >
> > > +     /**
> > > +      * srTCM rfc2697 byte mode supported.
> > > +      * When non-zero, it indicates that byte mode is supported for
> > > +      * the srTCM RFC 2697 metering algorithm.
> > > +      */
> > > +     int srtcm_rfc2697_byte_mode_supported;
> > > +
> > > +     /**
> > > +      * srTCM rfc2697 packet mode supported.
> > > +      * When non-zero, it indicates that packet mode is supported for
> > > +      * the srTCM RFC 2697 metering algorithm.
> > > +      */
> > > +     int srtcm_rfc2697_packet_mode_supported;
> > > +
> > > +     /**
> > > +      * trTCM rfc2698 byte mode supported.
> > > +      * When non-zero, it indicates that byte mode is supported for
> > > +      * the trTCM RFC 2698 metering algorithm.
> > > +      */
> > > +     int trtcm_rfc2698_byte_mode_supported;
> > > +
> > > +     /**
> > > +      * trTCM rfc2698 packet mode supported.
> > > +      * When non-zero, it indicates that packet mode is supported for
> > > +      * the trTCM RFC 2698 metering algorithm.
> > > +      */
> > > +     int trtcm_rfc2698_packet_mode_supported;
> > > +
> > > +     /**
> > > +      * trTCM rfc4115 byte mode supported.
> > > +      * When non-zero, it indicates that byte mode is supported for
> > > +      * the trTCM RFC 4115 metering algorithm.
> > > +      */
> > > +     int trtcm_rfc4115_byte_mode_supported;
> > > +
> > > +     /**
> > > +      * trTCM rfc4115 packet mode supported.
> > > +      * When non-zero, it indicates that packet mode is supported for
> > > +      * the trTCM RFC 4115 metering algorithm.
> > > +      */
> > > +     int trtcm_rfc4115_packet_mode_supported;
> > > +
> > >       /** Set of supported statistics counter types.
> > >        * @see enum rte_mtr_stats_type
> > >        */
> > > --
> > > 2.27.0
> >
> > These API updates look good to me, but please add the necessary checks
> > to the existing drivers implementing the rte_mtr API to makes sure
> > that profiles with packet_mode set to TRUE are rejected.
> >
> > For the Soft NIC driver, this is a simple check in file
> > drivers/net/softnic/rte_eth_softnic_meter.c, function meter_profile_check.
> > Thanks!
> >
> > Regards,
> > Cristian

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option
  2021-03-31  8:54 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option Li Zhang
@ 2021-04-07 20:17   ` Dumitrescu, Cristian
  2021-04-08  2:34     ` Li Zhang
  2021-04-07 20:21   ` Dumitrescu, Cristian
  1 sibling, 1 reply; 47+ messages in thread
From: Dumitrescu, Cristian @ 2021-04-07 20:17 UTC (permalink / raw)
  To: Li Zhang, dekelp, orika, viacheslavo, matan, shahafs, Li, Xiaoyun
  Cc: dev, thomas, rasland, roniba



> -----Original Message-----
> From: Li Zhang <lizh@nvidia.com>
> Sent: Wednesday, March 31, 2021 9:54 AM
> To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>
> Cc: dev@dpdk.org; thomas@monjalon.net; rasland@nvidia.com;
> roniba@nvidia.com
> Subject: [PATCH 2/2] app/testpmd: add meter profile packet mode option
> 
> add meter profile packet_mode to the ethernet device.
> One example:
> add port meter profile rfc2697 (port_id) (profile_id)
> (cir) (cbs) (ebs) (packet_mode)
> 
> Signed-off-by: Li Zhang <lizh@nvidia.com>
> ---
>  app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
>  2 files changed, 54 insertions(+), 17 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
> index bdc9ae8bfe..eff2473e7b 100644
> --- a/app/test-pmd/cmdline_mtr.c
> +++ b/app/test-pmd/cmdline_mtr.c
> @@ -263,6 +263,18 @@ 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.srtcm_rfc2697_byte_mode_supported %" PRId32 "\n",
> +		cap.srtcm_rfc2697_byte_mode_supported);
> +	printf("cap.srtcm_rfc2697_packet_mode_supported %" PRId32 "\n",
> +		cap.srtcm_rfc2697_packet_mode_supported);
> +	printf("cap.trtcm_rfc2698_byte_mode_supported %" PRId32 "\n",
> +		cap.trtcm_rfc2698_byte_mode_supported);
> +	printf("cap.trtcm_rfc2698_packet_mode_supported %" PRId32 "\n",
> +		cap.trtcm_rfc2698_packet_mode_supported);
> +	printf("cap.trtcm_rfc4115_byte_mode_supported %" PRId32 "\n",
> +		cap.trtcm_rfc4115_byte_mode_supported);
> +	printf("cap.trtcm_rfc4115_packet_mode_supported %" PRId32 "\n",
> +		cap.trtcm_rfc4115_packet_mode_supported);
>  	printf("cap.stats_mask %" PRIx64 "\n", cap.stats_mask);
>  }
> 
> @@ -292,6 +304,7 @@ struct cmd_add_port_meter_profile_srtcm_result {
>  	uint64_t cir;
>  	uint64_t cbs;
>  	uint64_t ebs;
> +	int packet_mode;
>  };
> 
>  cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcm_add =
> @@ -333,6 +346,10 @@ cmdline_parse_token_num_t
> cmd_add_port_meter_profile_srtcm_ebs =
>  	TOKEN_NUM_INITIALIZER(
>  		struct cmd_add_port_meter_profile_srtcm_result,
>  			ebs, RTE_UINT64);
> +cmdline_parse_token_num_t
> cmd_add_port_meter_profile_srtcm_packet_mode =
> +	TOKEN_NUM_INITIALIZER(
> +		struct cmd_add_port_meter_profile_srtcm_result,
> +			packet_mode, RTE_UINT32);
> 
>  static void cmd_add_port_meter_profile_srtcm_parsed(void
> *parsed_result,
>  	__rte_unused struct cmdline *cl,
> @@ -354,6 +371,7 @@ static void
> cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
>  	mp.srtcm_rfc2697.cir = res->cir;
>  	mp.srtcm_rfc2697.cbs = res->cbs;
>  	mp.srtcm_rfc2697.ebs = res->ebs;
> +	mp.packet_mode = res->packet_mode;
> 
>  	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
>  	if (ret != 0) {
> @@ -365,7 +383,7 @@ static void
> cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
>  cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
>  	.f = cmd_add_port_meter_profile_srtcm_parsed,
>  	.data = NULL,
> -	.help_str = "add port meter profile srtcm_rfc2697 <port_id>
> <profile_id> <cir> <cbs> <ebs>",
> +	.help_str = "add port meter profile srtcm_rfc2697 <port_id>
> <profile_id> <cir> <cbs> <ebs> <packet_mode>",
>  	.tokens = {
>  		(void *)&cmd_add_port_meter_profile_srtcm_add,
>  		(void *)&cmd_add_port_meter_profile_srtcm_port,
> @@ -377,6 +395,7 @@ cmdline_parse_inst_t
> cmd_add_port_meter_profile_srtcm = {
>  		(void *)&cmd_add_port_meter_profile_srtcm_cir,
>  		(void *)&cmd_add_port_meter_profile_srtcm_cbs,
>  		(void *)&cmd_add_port_meter_profile_srtcm_ebs,
> +		(void
> *)&cmd_add_port_meter_profile_srtcm_packet_mode,
>  		NULL,
>  	},
>  };
> @@ -394,6 +413,7 @@ struct cmd_add_port_meter_profile_trtcm_result {
>  	uint64_t pir;
>  	uint64_t cbs;
>  	uint64_t pbs;
> +	int packet_mode;
>  };
> 
>  cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_add =
> @@ -439,6 +459,10 @@ cmdline_parse_token_num_t
> cmd_add_port_meter_profile_trtcm_pbs =
>  	TOKEN_NUM_INITIALIZER(
>  		struct cmd_add_port_meter_profile_trtcm_result,
>  			pbs, RTE_UINT64);
> +cmdline_parse_token_num_t
> cmd_add_port_meter_profile_trtcm_packet_mode =
> +	TOKEN_NUM_INITIALIZER(
> +		struct cmd_add_port_meter_profile_trtcm_result,
> +			packet_mode, RTE_UINT32);
> 
>  static void cmd_add_port_meter_profile_trtcm_parsed(void
> *parsed_result,
>  	__rte_unused struct cmdline *cl,
> @@ -461,6 +485,7 @@ static void
> cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
>  	mp.trtcm_rfc2698.pir = res->pir;
>  	mp.trtcm_rfc2698.cbs = res->cbs;
>  	mp.trtcm_rfc2698.pbs = res->pbs;
> +	mp.packet_mode = res->packet_mode;
> 
>  	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
>  	if (ret != 0) {
> @@ -472,7 +497,7 @@ static void
> cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
>  cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
>  	.f = cmd_add_port_meter_profile_trtcm_parsed,
>  	.data = NULL,
> -	.help_str = "add port meter profile trtcm_rfc2698 <port_id>
> <profile_id> <cir> <pir> <cbs> <pbs>",
> +	.help_str = "add port meter profile trtcm_rfc2698 <port_id>
> <profile_id> <cir> <pir> <cbs> <pbs> <packet_mode>",
>  	.tokens = {
>  		(void *)&cmd_add_port_meter_profile_trtcm_add,
>  		(void *)&cmd_add_port_meter_profile_trtcm_port,
> @@ -485,6 +510,7 @@ cmdline_parse_inst_t
> cmd_add_port_meter_profile_trtcm = {
>  		(void *)&cmd_add_port_meter_profile_trtcm_pir,
>  		(void *)&cmd_add_port_meter_profile_trtcm_cbs,
>  		(void *)&cmd_add_port_meter_profile_trtcm_pbs,
> +		(void
> *)&cmd_add_port_meter_profile_trtcm_packet_mode,
>  		NULL,
>  	},
>  };
> @@ -502,6 +528,7 @@ struct
> cmd_add_port_meter_profile_trtcm_rfc4115_result {
>  	uint64_t eir;
>  	uint64_t cbs;
>  	uint64_t ebs;
> +	int packet_mode;
>  };
> 
>  cmdline_parse_token_string_t
> cmd_add_port_meter_profile_trtcm_rfc4115_add =
> @@ -549,6 +576,11 @@ cmdline_parse_token_num_t
> cmd_add_port_meter_profile_trtcm_rfc4115_ebs =
>  	TOKEN_NUM_INITIALIZER(
>  		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
>  			ebs, RTE_UINT64);
> +cmdline_parse_token_num_t
> +	cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode =
> +	TOKEN_NUM_INITIALIZER(
> +		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
> +			packet_mode, RTE_UINT32);
> 
>  static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
>  	void *parsed_result,
> @@ -573,6 +605,7 @@ static void
> cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
>  	mp.trtcm_rfc4115.eir = res->eir;
>  	mp.trtcm_rfc4115.cbs = res->cbs;
>  	mp.trtcm_rfc4115.ebs = res->ebs;
> +	mp.packet_mode = res->packet_mode;
> 
>  	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
>  	if (ret != 0) {
> @@ -584,7 +617,7 @@ static void
> cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
>  cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
>  	.f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed,
>  	.data = NULL,
> -	.help_str = "add port meter profile trtcm_rfc4115 <port_id>
> <profile_id> <cir> <eir> <cbs> <ebs>",
> +	.help_str = "add port meter profile trtcm_rfc4115 <port_id>
> <profile_id> <cir> <eir> <cbs> <ebs> <packet_mode>",
>  	.tokens = {
>  		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add,
>  		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port,
> @@ -597,6 +630,7 @@ cmdline_parse_inst_t
> cmd_add_port_meter_profile_trtcm_rfc4115 = {
>  		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_eir,
>  		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_cbs,
>  		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_ebs,
> +		(void
> *)&cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode,
>  		NULL,
>  	},
>  };
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index f59eb8a27d..b5e52f6b1c 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -2698,14 +2698,15 @@ add port meter profile (srTCM rfc2967)
>  Add meter profile (srTCM rfc2697) to the ethernet device::
> 
>     testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
> -   (cir) (cbs) (ebs)
> +   (cir) (cbs) (ebs) (packet_mode)
> 
>  where:
> 
>  * ``profile_id``: ID for the meter profile.
> -* ``cir``: Committed Information Rate (CIR) (bytes/second).
> -* ``cbs``: Committed Burst Size (CBS) (bytes).
> -* ``ebs``: Excess Burst Size (EBS) (bytes).
> +* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per
> second).
> +* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
> +* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
> +* ``packet_mode``: Packets mode for meter profile.
> 
>  add port meter profile (trTCM rfc2968)
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> @@ -2713,15 +2714,16 @@ add port meter profile (trTCM rfc2968)
>  Add meter profile (srTCM rfc2698) to the ethernet device::
> 
>     testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
> -   (cir) (pir) (cbs) (pbs)
> +   (cir) (pir) (cbs) (pbs) (packet_mode)
> 
>  where:
> 
>  * ``profile_id``: ID for the meter profile.
> -* ``cir``: Committed information rate (bytes/second).
> -* ``pir``: Peak information rate (bytes/second).
> -* ``cbs``: Committed burst size (bytes).
> -* ``pbs``: Peak burst size (bytes).
> +* ``cir``: Committed information rate (bytes per second or packets per
> second).
> +* ``pir``: Peak information rate (bytes per second or packets per second).
> +* ``cbs``: Committed burst size (bytes or packets).
> +* ``pbs``: Peak burst size (bytes or packets).
> +* ``packet_mode``: Packets mode for meter profile.
> 
>  add port meter profile (trTCM rfc4115)
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> @@ -2729,15 +2731,16 @@ add port meter profile (trTCM rfc4115)
>  Add meter profile (trTCM rfc4115) to the ethernet device::
> 
>     testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
> -   (cir) (eir) (cbs) (ebs)
> +   (cir) (eir) (cbs) (ebs) (packet_mode)
> 
>  where:
> 
>  * ``profile_id``: ID for the meter profile.
> -* ``cir``: Committed information rate (bytes/second).
> -* ``eir``: Excess information rate (bytes/second).
> -* ``cbs``: Committed burst size (bytes).
> -* ``ebs``: Excess burst size (bytes).
> +* ``cir``: Committed information rate (bytes per second or packets per
> second).
> +* ``eir``: Excess information rate (bytes per second or packets per second).
> +* ``cbs``: Committed burst size (bytes or packets).
> +* ``ebs``: Excess burst size (bytes or packets).
> +* ``packet_mode``: Packets mode for meter profile.
> 
>  delete port meter profile
>  ~~~~~~~~~~~~~~~~~~~~~~~~~
> --
> 2.27.0

There is already a patch from this series numbered PATCH 2/2. Does this belong to the same series?

It is not easy to review this set of patches related to the packet mode addition to the API, as it is split across multiple patch series and the numbering is confusing. I am not sure I am replying to the latest version or a superseded one.

Could you please create a unified V2 that contains both the series with the API changes and the series with the necessary error checks in the drivers?

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure
  2021-04-01  6:19       ` Li Zhang
@ 2021-04-07 20:20         ` Dumitrescu, Cristian
  2021-04-08  4:06           ` Li Zhang
  0 siblings, 1 reply; 47+ messages in thread
From: Dumitrescu, Cristian @ 2021-04-07 20:20 UTC (permalink / raw)
  To: Li Zhang, dekelp, Ori Kam, Slava Ovsiienko, Matan Azrad,
	Shahaf Shuler, NBU-Contact-Thomas Monjalon, Yigit, Ferruh,
	Andrew Rybchenko, Liron Himi
  Cc: dev, Raslan Darawsheh, Roni Bar Yanai



> -----Original Message-----
> From: Li Zhang <lizh@nvidia.com>
> Sent: Thursday, April 1, 2021 7:19 AM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>;
> dekelp@nvidia.com; Ori Kam <orika@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Shahaf
> Shuler <shahafs@nvidia.com>; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> Rybchenko <andrew.rybchenko@oktetlabs.ru>; Liron Himi
> <lironh@marvell.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Roni Bar Yanai
> <roniba@nvidia.com>
> Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile structure
> 
> Hi Dumitrescu and Liron,
> 
> I add the check in softnet and mvpp2 drivers in the following patch.
> Please help review it.
> https://patchwork.dpdk.org/project/dpdk/list/?series=16036
> 

As stated in a different email, it is difficult to review this API change, as it is split across (at least) two patch sets, one with the API changes and another one with the driver error checks, also as stated before the numbering of some patches does not seem right; difficult to tell if I am reviewing the latest version or a superseded one. 

Could you please create a unified V2 that contains all patches in one place? Thank you!

> Thanks!
> Regards,
> Li Zhang
> > -----Original Message-----
> > From: Li Zhang
> > Sent: Thursday, April 1, 2021 9:42 AM
> > To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>;
> > dekelp@nvidia.com; Ori Kam <orika@nvidia.com>; Slava Ovsiienko
> > <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Shahaf
> > Shuler <shahafs@nvidia.com>; NBU-Contact-Thomas Monjalon
> > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Roni Bar
> Yanai
> > <roniba@nvidia.com>
> > Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile
> structure
> >
> > Hi Dumitrescu,
> >
> > Thank you for your comments.
> > I will add the necessary checks in V2 patches.
> >
> > Regards,
> > Li Zhang
> >
> > > -----Original Message-----
> > > From: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> > > Sent: Thursday, April 1, 2021 12:27 AM
> > > To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
> > > <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
> > > Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; NBU-
> > > Contact-Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
> > > <ferruh.yigit@intel.com>; Andrew Rybchenko
> > > <andrew.rybchenko@oktetlabs.ru>
> > > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Roni Bar
> > > Yanai <roniba@nvidia.com>
> > > Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile
> > > structure
> > >
> > > External email: Use caution opening links or attachments
> > >
> > >
> > > Hi Li,
> > >
> > > > -----Original Message-----
> > > > From: Li Zhang <lizh@nvidia.com>
> > > > Sent: Wednesday, March 31, 2021 9:54 AM
> > > > To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> > > > matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> > > > <cristian.dumitrescu@intel.com>; Thomas Monjalon
> > > > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> > > > Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > > > Cc: dev@dpdk.org; rasland@nvidia.com; roniba@nvidia.com
> > > > Subject: [PATCH 1/2] ethdev: add packet mode in meter profile
> > > > structure
> > > >
> > > > Currently meter algorithms only supports rate is bytes per second(BPS).
> > > > Add packet_mode flag in meter profile parameters data structure.
> > > > So that it can meter traffic by packet per second.
> > > >
> > > > When packet_mode is 0, the profile rates and bucket sizes are
> > > > specified in bytes per second and bytes when packet_mode is not 0,
> > > > the profile rates and bucket sizes are specified in packets and
> > > > packets per second.
> > > >
> > > > The below structure will be extended:
> > > > rte_mtr_meter_profile
> > > > rte_mtr_capabilities
> > > >
> > > > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > > > ---
> > > >  doc/guides/rel_notes/release_21_05.rst |  7 ++
> > > >  lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
> > > >  2 files changed, 85 insertions(+), 11 deletions(-)
> > > >
> > > > diff --git a/doc/guides/rel_notes/release_21_05.rst
> > > > b/doc/guides/rel_notes/release_21_05.rst
> > > > index 3c76148b11..c9c15794ad 100644
> > > > --- a/doc/guides/rel_notes/release_21_05.rst
> > > > +++ b/doc/guides/rel_notes/release_21_05.rst
> > > > @@ -119,6 +119,13 @@ New Features
> > > >    * Added command to display Rx queue used descriptor count.
> > > >      ``show port (port_id) rxq (queue_id) desc used count``
> > > >
> > > > +* **Added support for meter PPS profile.**
> > > > +
> > > > +  Currently meter algorithms only supports bytes per second(BPS).
> > > > +  Add packet_mode in the meter profile parameters data structures
> > > > + to support packet per second (PPS) mode.
> > > > +  So that it can meter traffic by packet per second.
> > > > +  Packet_mode must be 0 when it is bytes mode.
> > > >
> > > >  Removed Items
> > > >  -------------
> > > > diff --git a/lib/librte_ethdev/rte_mtr.h
> > > > b/lib/librte_ethdev/rte_mtr.h index e1dc59eb06..52611a90f5 100644
> > > > --- a/lib/librte_ethdev/rte_mtr.h
> > > > +++ b/lib/librte_ethdev/rte_mtr.h
> > > > @@ -133,46 +133,71 @@ struct rte_mtr_meter_profile {
> > > >       union {
> > > >               /** Items only valid when *alg* is set to srTCM - RFC 2697. */
> > > >               struct {
> > > > -                     /** Committed Information Rate (CIR)
> > > > (bytes/second). */
> > > > +                     /**
> > > > +                      * Committed Information Rate (CIR)
> > > > +                      * (bytes per second or packets per second).
> > > > +                      */
> > > >                       uint64_t cir;
> > > >
> > > > -                     /** Committed Burst Size (CBS) (bytes). */
> > > > +                     /** Committed Burst Size (CBS) (bytes or
> > > > + packets). */
> > > >                       uint64_t cbs;
> > > >
> > > > -                     /** Excess Burst Size (EBS) (bytes). */
> > > > +                     /** Excess Burst Size (EBS) (bytes or packets).
> > > > + */
> > > >                       uint64_t ebs;
> > > >               } srtcm_rfc2697;
> > > >
> > > >               /** Items only valid when *alg* is set to trTCM - RFC 2698. */
> > > >               struct {
> > > > -                     /** Committed Information Rate (CIR)
> > > > (bytes/second). */
> > > > +                     /**
> > > > +                      * Committed Information Rate (CIR)
> > > > +                      * (bytes per second or packets per second).
> > > > +                      */
> > > >                       uint64_t cir;
> > > >
> > > > -                     /** Peak Information Rate (PIR) (bytes/second). */
> > > > +                     /**
> > > > +                      * Peak Information Rate (PIR)
> > > > +                      * (bytes per second or packets per second).
> > > > +                      */
> > > >                       uint64_t pir;
> > > >
> > > > -                     /** Committed Burst Size (CBS) (byes). */
> > > > +                     /** Committed Burst Size (CBS) (bytes or
> > > > + packets). */
> > > >                       uint64_t cbs;
> > > >
> > > > -                     /** Peak Burst Size (PBS) (bytes). */
> > > > +                     /** Peak Burst Size (PBS) (bytes or packets).
> > > > + */
> > > >                       uint64_t pbs;
> > > >               } trtcm_rfc2698;
> > > >
> > > >               /** Items only valid when *alg* is set to trTCM - RFC 4115. */
> > > >               struct {
> > > > -                     /** Committed Information Rate (CIR)
> > > > (bytes/second). */
> > > > +                     /**
> > > > +                      * Committed Information Rate (CIR)
> > > > +                      * (bytes per second or packets per second).
> > > > +                      */
> > > >                       uint64_t cir;
> > > >
> > > > -                     /** Excess Information Rate (EIR) (bytes/second). */
> > > > +                     /**
> > > > +                      * Excess Information Rate (EIR)
> > > > +                      * (bytes per second or packets per second).
> > > > +                      */
> > > >                       uint64_t eir;
> > > >
> > > > -                     /** Committed Burst Size (CBS) (byes). */
> > > > +                     /** Committed Burst Size (CBS) (bytes or
> > > > + packets). */
> > > >                       uint64_t cbs;
> > > >
> > > > -                     /** Excess Burst Size (EBS) (bytes). */
> > > > +                     /** Excess Burst Size (EBS) (bytes or packets).
> > > > + */
> > > >                       uint64_t ebs;
> > > >               } trtcm_rfc4115;
> > > >       };
> > > > +
> > > > +     /**
> > > > +      * When zero, the byte mode is enabled for the current
> > > > + profile, so
> > > > the
> > > > +      * *rate* and *size* fields are specified in bytes per second
> > > > +      * and bytes, respectively.
> > > > +      * When non-zero, the packet mode is enabled for the current
> > > > profile,
> > > > +      * so the *rate* and *size* fields are specified in packets per
> second
> > > > +      * and packets, respectively.
> > > > +      */
> > > > +     int packet_mode;
> > > >  };
> > > >
> > > >  /**
> > > > @@ -333,6 +358,48 @@ struct rte_mtr_capabilities {
> > > >        */
> > > >       int color_aware_trtcm_rfc4115_supported;
> > > >
> > > > +     /**
> > > > +      * srTCM rfc2697 byte mode supported.
> > > > +      * When non-zero, it indicates that byte mode is supported for
> > > > +      * the srTCM RFC 2697 metering algorithm.
> > > > +      */
> > > > +     int srtcm_rfc2697_byte_mode_supported;
> > > > +
> > > > +     /**
> > > > +      * srTCM rfc2697 packet mode supported.
> > > > +      * When non-zero, it indicates that packet mode is supported for
> > > > +      * the srTCM RFC 2697 metering algorithm.
> > > > +      */
> > > > +     int srtcm_rfc2697_packet_mode_supported;
> > > > +
> > > > +     /**
> > > > +      * trTCM rfc2698 byte mode supported.
> > > > +      * When non-zero, it indicates that byte mode is supported for
> > > > +      * the trTCM RFC 2698 metering algorithm.
> > > > +      */
> > > > +     int trtcm_rfc2698_byte_mode_supported;
> > > > +
> > > > +     /**
> > > > +      * trTCM rfc2698 packet mode supported.
> > > > +      * When non-zero, it indicates that packet mode is supported for
> > > > +      * the trTCM RFC 2698 metering algorithm.
> > > > +      */
> > > > +     int trtcm_rfc2698_packet_mode_supported;
> > > > +
> > > > +     /**
> > > > +      * trTCM rfc4115 byte mode supported.
> > > > +      * When non-zero, it indicates that byte mode is supported for
> > > > +      * the trTCM RFC 4115 metering algorithm.
> > > > +      */
> > > > +     int trtcm_rfc4115_byte_mode_supported;
> > > > +
> > > > +     /**
> > > > +      * trTCM rfc4115 packet mode supported.
> > > > +      * When non-zero, it indicates that packet mode is supported for
> > > > +      * the trTCM RFC 4115 metering algorithm.
> > > > +      */
> > > > +     int trtcm_rfc4115_packet_mode_supported;
> > > > +
> > > >       /** Set of supported statistics counter types.
> > > >        * @see enum rte_mtr_stats_type
> > > >        */
> > > > --
> > > > 2.27.0
> > >
> > > These API updates look good to me, but please add the necessary checks
> > > to the existing drivers implementing the rte_mtr API to makes sure
> > > that profiles with packet_mode set to TRUE are rejected.
> > >
> > > For the Soft NIC driver, this is a simple check in file
> > > drivers/net/softnic/rte_eth_softnic_meter.c, function
> meter_profile_check.
> > > Thanks!
> > >
> > > Regards,
> > > Cristian

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option
  2021-03-31  8:54 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option Li Zhang
  2021-04-07 20:17   ` Dumitrescu, Cristian
@ 2021-04-07 20:21   ` Dumitrescu, Cristian
  1 sibling, 0 replies; 47+ messages in thread
From: Dumitrescu, Cristian @ 2021-04-07 20:21 UTC (permalink / raw)
  To: Li Zhang, dekelp, orika, viacheslavo, matan, shahafs, Li, Xiaoyun
  Cc: dev, thomas, rasland, roniba



> -----Original Message-----
> From: Li Zhang <lizh@nvidia.com>
> Sent: Wednesday, March 31, 2021 9:54 AM
> To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>
> Cc: dev@dpdk.org; thomas@monjalon.net; rasland@nvidia.com;
> roniba@nvidia.com
> Subject: [PATCH 2/2] app/testpmd: add meter profile packet mode option
> 
> add meter profile packet_mode to the ethernet device.
> One example:
> add port meter profile rfc2697 (port_id) (profile_id)
> (cir) (cbs) (ebs) (packet_mode)
> 
> Signed-off-by: Li Zhang <lizh@nvidia.com>
> ---
>  app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
>  2 files changed, 54 insertions(+), 17 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
> index bdc9ae8bfe..eff2473e7b 100644
> --- a/app/test-pmd/cmdline_mtr.c
> +++ b/app/test-pmd/cmdline_mtr.c
> @@ -263,6 +263,18 @@ 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.srtcm_rfc2697_byte_mode_supported %" PRId32 "\n",
> +		cap.srtcm_rfc2697_byte_mode_supported);
> +	printf("cap.srtcm_rfc2697_packet_mode_supported %" PRId32 "\n",
> +		cap.srtcm_rfc2697_packet_mode_supported);
> +	printf("cap.trtcm_rfc2698_byte_mode_supported %" PRId32 "\n",
> +		cap.trtcm_rfc2698_byte_mode_supported);
> +	printf("cap.trtcm_rfc2698_packet_mode_supported %" PRId32 "\n",
> +		cap.trtcm_rfc2698_packet_mode_supported);
> +	printf("cap.trtcm_rfc4115_byte_mode_supported %" PRId32 "\n",
> +		cap.trtcm_rfc4115_byte_mode_supported);
> +	printf("cap.trtcm_rfc4115_packet_mode_supported %" PRId32 "\n",
> +		cap.trtcm_rfc4115_packet_mode_supported);
>  	printf("cap.stats_mask %" PRIx64 "\n", cap.stats_mask);
>  }
> 
> @@ -292,6 +304,7 @@ struct cmd_add_port_meter_profile_srtcm_result {
>  	uint64_t cir;
>  	uint64_t cbs;
>  	uint64_t ebs;
> +	int packet_mode;
>  };
> 
>  cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcm_add =
> @@ -333,6 +346,10 @@ cmdline_parse_token_num_t
> cmd_add_port_meter_profile_srtcm_ebs =
>  	TOKEN_NUM_INITIALIZER(
>  		struct cmd_add_port_meter_profile_srtcm_result,
>  			ebs, RTE_UINT64);
> +cmdline_parse_token_num_t
> cmd_add_port_meter_profile_srtcm_packet_mode =
> +	TOKEN_NUM_INITIALIZER(
> +		struct cmd_add_port_meter_profile_srtcm_result,
> +			packet_mode, RTE_UINT32);
> 
>  static void cmd_add_port_meter_profile_srtcm_parsed(void
> *parsed_result,
>  	__rte_unused struct cmdline *cl,
> @@ -354,6 +371,7 @@ static void
> cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
>  	mp.srtcm_rfc2697.cir = res->cir;
>  	mp.srtcm_rfc2697.cbs = res->cbs;
>  	mp.srtcm_rfc2697.ebs = res->ebs;
> +	mp.packet_mode = res->packet_mode;
> 
>  	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
>  	if (ret != 0) {
> @@ -365,7 +383,7 @@ static void
> cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
>  cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
>  	.f = cmd_add_port_meter_profile_srtcm_parsed,
>  	.data = NULL,
> -	.help_str = "add port meter profile srtcm_rfc2697 <port_id>
> <profile_id> <cir> <cbs> <ebs>",
> +	.help_str = "add port meter profile srtcm_rfc2697 <port_id>
> <profile_id> <cir> <cbs> <ebs> <packet_mode>",
>  	.tokens = {
>  		(void *)&cmd_add_port_meter_profile_srtcm_add,
>  		(void *)&cmd_add_port_meter_profile_srtcm_port,
> @@ -377,6 +395,7 @@ cmdline_parse_inst_t
> cmd_add_port_meter_profile_srtcm = {
>  		(void *)&cmd_add_port_meter_profile_srtcm_cir,
>  		(void *)&cmd_add_port_meter_profile_srtcm_cbs,
>  		(void *)&cmd_add_port_meter_profile_srtcm_ebs,
> +		(void
> *)&cmd_add_port_meter_profile_srtcm_packet_mode,
>  		NULL,
>  	},
>  };
> @@ -394,6 +413,7 @@ struct cmd_add_port_meter_profile_trtcm_result {
>  	uint64_t pir;
>  	uint64_t cbs;
>  	uint64_t pbs;
> +	int packet_mode;
>  };
> 
>  cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_add =
> @@ -439,6 +459,10 @@ cmdline_parse_token_num_t
> cmd_add_port_meter_profile_trtcm_pbs =
>  	TOKEN_NUM_INITIALIZER(
>  		struct cmd_add_port_meter_profile_trtcm_result,
>  			pbs, RTE_UINT64);
> +cmdline_parse_token_num_t
> cmd_add_port_meter_profile_trtcm_packet_mode =
> +	TOKEN_NUM_INITIALIZER(
> +		struct cmd_add_port_meter_profile_trtcm_result,
> +			packet_mode, RTE_UINT32);
> 
>  static void cmd_add_port_meter_profile_trtcm_parsed(void
> *parsed_result,
>  	__rte_unused struct cmdline *cl,
> @@ -461,6 +485,7 @@ static void
> cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
>  	mp.trtcm_rfc2698.pir = res->pir;
>  	mp.trtcm_rfc2698.cbs = res->cbs;
>  	mp.trtcm_rfc2698.pbs = res->pbs;
> +	mp.packet_mode = res->packet_mode;
> 
>  	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
>  	if (ret != 0) {
> @@ -472,7 +497,7 @@ static void
> cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
>  cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
>  	.f = cmd_add_port_meter_profile_trtcm_parsed,
>  	.data = NULL,
> -	.help_str = "add port meter profile trtcm_rfc2698 <port_id>
> <profile_id> <cir> <pir> <cbs> <pbs>",
> +	.help_str = "add port meter profile trtcm_rfc2698 <port_id>
> <profile_id> <cir> <pir> <cbs> <pbs> <packet_mode>",
>  	.tokens = {
>  		(void *)&cmd_add_port_meter_profile_trtcm_add,
>  		(void *)&cmd_add_port_meter_profile_trtcm_port,
> @@ -485,6 +510,7 @@ cmdline_parse_inst_t
> cmd_add_port_meter_profile_trtcm = {
>  		(void *)&cmd_add_port_meter_profile_trtcm_pir,
>  		(void *)&cmd_add_port_meter_profile_trtcm_cbs,
>  		(void *)&cmd_add_port_meter_profile_trtcm_pbs,
> +		(void
> *)&cmd_add_port_meter_profile_trtcm_packet_mode,
>  		NULL,
>  	},
>  };
> @@ -502,6 +528,7 @@ struct
> cmd_add_port_meter_profile_trtcm_rfc4115_result {
>  	uint64_t eir;
>  	uint64_t cbs;
>  	uint64_t ebs;
> +	int packet_mode;
>  };
> 
>  cmdline_parse_token_string_t
> cmd_add_port_meter_profile_trtcm_rfc4115_add =
> @@ -549,6 +576,11 @@ cmdline_parse_token_num_t
> cmd_add_port_meter_profile_trtcm_rfc4115_ebs =
>  	TOKEN_NUM_INITIALIZER(
>  		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
>  			ebs, RTE_UINT64);
> +cmdline_parse_token_num_t
> +	cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode =
> +	TOKEN_NUM_INITIALIZER(
> +		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
> +			packet_mode, RTE_UINT32);
> 
>  static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
>  	void *parsed_result,
> @@ -573,6 +605,7 @@ static void
> cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
>  	mp.trtcm_rfc4115.eir = res->eir;
>  	mp.trtcm_rfc4115.cbs = res->cbs;
>  	mp.trtcm_rfc4115.ebs = res->ebs;
> +	mp.packet_mode = res->packet_mode;
> 
>  	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
>  	if (ret != 0) {
> @@ -584,7 +617,7 @@ static void
> cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
>  cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
>  	.f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed,
>  	.data = NULL,
> -	.help_str = "add port meter profile trtcm_rfc4115 <port_id>
> <profile_id> <cir> <eir> <cbs> <ebs>",
> +	.help_str = "add port meter profile trtcm_rfc4115 <port_id>
> <profile_id> <cir> <eir> <cbs> <ebs> <packet_mode>",
>  	.tokens = {
>  		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add,
>  		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port,
> @@ -597,6 +630,7 @@ cmdline_parse_inst_t
> cmd_add_port_meter_profile_trtcm_rfc4115 = {
>  		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_eir,
>  		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_cbs,
>  		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_ebs,
> +		(void
> *)&cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode,
>  		NULL,
>  	},
>  };
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index f59eb8a27d..b5e52f6b1c 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -2698,14 +2698,15 @@ add port meter profile (srTCM rfc2967)
>  Add meter profile (srTCM rfc2697) to the ethernet device::
> 
>     testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
> -   (cir) (cbs) (ebs)
> +   (cir) (cbs) (ebs) (packet_mode)
> 
>  where:
> 
>  * ``profile_id``: ID for the meter profile.
> -* ``cir``: Committed Information Rate (CIR) (bytes/second).
> -* ``cbs``: Committed Burst Size (CBS) (bytes).
> -* ``ebs``: Excess Burst Size (EBS) (bytes).
> +* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per
> second).
> +* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
> +* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
> +* ``packet_mode``: Packets mode for meter profile.
> 
>  add port meter profile (trTCM rfc2968)
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> @@ -2713,15 +2714,16 @@ add port meter profile (trTCM rfc2968)
>  Add meter profile (srTCM rfc2698) to the ethernet device::
> 
>     testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
> -   (cir) (pir) (cbs) (pbs)
> +   (cir) (pir) (cbs) (pbs) (packet_mode)
> 
>  where:
> 
>  * ``profile_id``: ID for the meter profile.
> -* ``cir``: Committed information rate (bytes/second).
> -* ``pir``: Peak information rate (bytes/second).
> -* ``cbs``: Committed burst size (bytes).
> -* ``pbs``: Peak burst size (bytes).
> +* ``cir``: Committed information rate (bytes per second or packets per
> second).
> +* ``pir``: Peak information rate (bytes per second or packets per second).
> +* ``cbs``: Committed burst size (bytes or packets).
> +* ``pbs``: Peak burst size (bytes or packets).
> +* ``packet_mode``: Packets mode for meter profile.
> 
>  add port meter profile (trTCM rfc4115)
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> @@ -2729,15 +2731,16 @@ add port meter profile (trTCM rfc4115)
>  Add meter profile (trTCM rfc4115) to the ethernet device::
> 
>     testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
> -   (cir) (eir) (cbs) (ebs)
> +   (cir) (eir) (cbs) (ebs) (packet_mode)
> 
>  where:
> 
>  * ``profile_id``: ID for the meter profile.
> -* ``cir``: Committed information rate (bytes/second).
> -* ``eir``: Excess information rate (bytes/second).
> -* ``cbs``: Committed burst size (bytes).
> -* ``ebs``: Excess burst size (bytes).
> +* ``cir``: Committed information rate (bytes per second or packets per
> second).
> +* ``eir``: Excess information rate (bytes per second or packets per second).
> +* ``cbs``: Committed burst size (bytes or packets).
> +* ``ebs``: Excess burst size (bytes or packets).
> +* ``packet_mode``: Packets mode for meter profile.
> 
>  delete port meter profile
>  ~~~~~~~~~~~~~~~~~~~~~~~~~
> --
> 2.27.0

This patch should also be part of the unified V2, thanks!

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option
  2021-04-07 20:17   ` Dumitrescu, Cristian
@ 2021-04-08  2:34     ` Li Zhang
  0 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-08  2:34 UTC (permalink / raw)
  To: Dumitrescu, Cristian, dekelp, Ori Kam, Slava Ovsiienko,
	Matan Azrad, Shahaf Shuler, Li, Xiaoyun
  Cc: dev, NBU-Contact-Thomas Monjalon, Raslan Darawsheh, Roni Bar Yanai

Hi Cristian

> -----Original Message-----
> From: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Sent: Thursday, April 8, 2021 4:18 AM
> To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; Li,
> Xiaoyun <xiaoyun.li@intel.com>
> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> Raslan Darawsheh <rasland@nvidia.com>; Roni Bar Yanai
> <roniba@nvidia.com>
> Subject: RE: [PATCH 2/2] app/testpmd: add meter profile packet mode option
> 
> External email: Use caution opening links or attachments
> 
> 
> > -----Original Message-----
> > From: Li Zhang <lizh@nvidia.com>
> > Sent: Wednesday, March 31, 2021 9:54 AM
> > To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> > matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> > <cristian.dumitrescu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>
> > Cc: dev@dpdk.org; thomas@monjalon.net; rasland@nvidia.com;
> > roniba@nvidia.com
> > Subject: [PATCH 2/2] app/testpmd: add meter profile packet mode option
> >
> > add meter profile packet_mode to the ethernet device.
> > One example:
> > add port meter profile rfc2697 (port_id) (profile_id)
> > (cir) (cbs) (ebs) (packet_mode)
> >
> > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > ---
> >  app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
> >  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
> >  2 files changed, 54 insertions(+), 17 deletions(-)
> >
> > diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
> > index bdc9ae8bfe..eff2473e7b 100644
> > --- a/app/test-pmd/cmdline_mtr.c
> > +++ b/app/test-pmd/cmdline_mtr.c
> > @@ -263,6 +263,18 @@ 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.srtcm_rfc2697_byte_mode_supported %" PRId32 "\n",
> > +             cap.srtcm_rfc2697_byte_mode_supported);
> > +     printf("cap.srtcm_rfc2697_packet_mode_supported %" PRId32 "\n",
> > +             cap.srtcm_rfc2697_packet_mode_supported);
> > +     printf("cap.trtcm_rfc2698_byte_mode_supported %" PRId32 "\n",
> > +             cap.trtcm_rfc2698_byte_mode_supported);
> > +     printf("cap.trtcm_rfc2698_packet_mode_supported %" PRId32 "\n",
> > +             cap.trtcm_rfc2698_packet_mode_supported);
> > +     printf("cap.trtcm_rfc4115_byte_mode_supported %" PRId32 "\n",
> > +             cap.trtcm_rfc4115_byte_mode_supported);
> > +     printf("cap.trtcm_rfc4115_packet_mode_supported %" PRId32 "\n",
> > +             cap.trtcm_rfc4115_packet_mode_supported);
> >       printf("cap.stats_mask %" PRIx64 "\n", cap.stats_mask);  }
> >
> > @@ -292,6 +304,7 @@ struct cmd_add_port_meter_profile_srtcm_result {
> >       uint64_t cir;
> >       uint64_t cbs;
> >       uint64_t ebs;
> > +     int packet_mode;
> >  };
> >
> >  cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcm_add =
> > @@ -333,6 +346,10 @@ cmdline_parse_token_num_t
> > cmd_add_port_meter_profile_srtcm_ebs =
> >       TOKEN_NUM_INITIALIZER(
> >               struct cmd_add_port_meter_profile_srtcm_result,
> >                       ebs, RTE_UINT64);
> > +cmdline_parse_token_num_t
> > cmd_add_port_meter_profile_srtcm_packet_mode =
> > +     TOKEN_NUM_INITIALIZER(
> > +             struct cmd_add_port_meter_profile_srtcm_result,
> > +                     packet_mode, RTE_UINT32);
> >
> >  static void cmd_add_port_meter_profile_srtcm_parsed(void
> > *parsed_result,
> >       __rte_unused struct cmdline *cl, @@ -354,6 +371,7 @@ static void
> > cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
> >       mp.srtcm_rfc2697.cir = res->cir;
> >       mp.srtcm_rfc2697.cbs = res->cbs;
> >       mp.srtcm_rfc2697.ebs = res->ebs;
> > +     mp.packet_mode = res->packet_mode;
> >
> >       ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
> >       if (ret != 0) {
> > @@ -365,7 +383,7 @@ static void
> > cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
> > cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
> >       .f = cmd_add_port_meter_profile_srtcm_parsed,
> >       .data = NULL,
> > -     .help_str = "add port meter profile srtcm_rfc2697 <port_id>
> > <profile_id> <cir> <cbs> <ebs>",
> > +     .help_str = "add port meter profile srtcm_rfc2697 <port_id>
> > <profile_id> <cir> <cbs> <ebs> <packet_mode>",
> >       .tokens = {
> >               (void *)&cmd_add_port_meter_profile_srtcm_add,
> >               (void *)&cmd_add_port_meter_profile_srtcm_port,
> > @@ -377,6 +395,7 @@ cmdline_parse_inst_t
> > cmd_add_port_meter_profile_srtcm = {
> >               (void *)&cmd_add_port_meter_profile_srtcm_cir,
> >               (void *)&cmd_add_port_meter_profile_srtcm_cbs,
> >               (void *)&cmd_add_port_meter_profile_srtcm_ebs,
> > +             (void
> > *)&cmd_add_port_meter_profile_srtcm_packet_mode,
> >               NULL,
> >       },
> >  };
> > @@ -394,6 +413,7 @@ struct cmd_add_port_meter_profile_trtcm_result {
> >       uint64_t pir;
> >       uint64_t cbs;
> >       uint64_t pbs;
> > +     int packet_mode;
> >  };
> >
> >  cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_add =
> > @@ -439,6 +459,10 @@ cmdline_parse_token_num_t
> > cmd_add_port_meter_profile_trtcm_pbs =
> >       TOKEN_NUM_INITIALIZER(
> >               struct cmd_add_port_meter_profile_trtcm_result,
> >                       pbs, RTE_UINT64);
> > +cmdline_parse_token_num_t
> > cmd_add_port_meter_profile_trtcm_packet_mode =
> > +     TOKEN_NUM_INITIALIZER(
> > +             struct cmd_add_port_meter_profile_trtcm_result,
> > +                     packet_mode, RTE_UINT32);
> >
> >  static void cmd_add_port_meter_profile_trtcm_parsed(void
> > *parsed_result,
> >       __rte_unused struct cmdline *cl, @@ -461,6 +485,7 @@ static void
> > cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
> >       mp.trtcm_rfc2698.pir = res->pir;
> >       mp.trtcm_rfc2698.cbs = res->cbs;
> >       mp.trtcm_rfc2698.pbs = res->pbs;
> > +     mp.packet_mode = res->packet_mode;
> >
> >       ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
> >       if (ret != 0) {
> > @@ -472,7 +497,7 @@ static void
> > cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
> > cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
> >       .f = cmd_add_port_meter_profile_trtcm_parsed,
> >       .data = NULL,
> > -     .help_str = "add port meter profile trtcm_rfc2698 <port_id>
> > <profile_id> <cir> <pir> <cbs> <pbs>",
> > +     .help_str = "add port meter profile trtcm_rfc2698 <port_id>
> > <profile_id> <cir> <pir> <cbs> <pbs> <packet_mode>",
> >       .tokens = {
> >               (void *)&cmd_add_port_meter_profile_trtcm_add,
> >               (void *)&cmd_add_port_meter_profile_trtcm_port,
> > @@ -485,6 +510,7 @@ cmdline_parse_inst_t
> > cmd_add_port_meter_profile_trtcm = {
> >               (void *)&cmd_add_port_meter_profile_trtcm_pir,
> >               (void *)&cmd_add_port_meter_profile_trtcm_cbs,
> >               (void *)&cmd_add_port_meter_profile_trtcm_pbs,
> > +             (void
> > *)&cmd_add_port_meter_profile_trtcm_packet_mode,
> >               NULL,
> >       },
> >  };
> > @@ -502,6 +528,7 @@ struct
> > cmd_add_port_meter_profile_trtcm_rfc4115_result {
> >       uint64_t eir;
> >       uint64_t cbs;
> >       uint64_t ebs;
> > +     int packet_mode;
> >  };
> >
> >  cmdline_parse_token_string_t
> > cmd_add_port_meter_profile_trtcm_rfc4115_add = @@ -549,6 +576,11 @@
> > cmdline_parse_token_num_t
> cmd_add_port_meter_profile_trtcm_rfc4115_ebs
> > =
> >       TOKEN_NUM_INITIALIZER(
> >               struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
> >                       ebs, RTE_UINT64);
> > +cmdline_parse_token_num_t
> > +     cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode =
> > +     TOKEN_NUM_INITIALIZER(
> > +             struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
> > +                     packet_mode, RTE_UINT32);
> >
> >  static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
> >       void *parsed_result,
> > @@ -573,6 +605,7 @@ static void
> > cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
> >       mp.trtcm_rfc4115.eir = res->eir;
> >       mp.trtcm_rfc4115.cbs = res->cbs;
> >       mp.trtcm_rfc4115.ebs = res->ebs;
> > +     mp.packet_mode = res->packet_mode;
> >
> >       ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
> >       if (ret != 0) {
> > @@ -584,7 +617,7 @@ static void
> > cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
> >  cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
> >       .f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed,
> >       .data = NULL,
> > -     .help_str = "add port meter profile trtcm_rfc4115 <port_id>
> > <profile_id> <cir> <eir> <cbs> <ebs>",
> > +     .help_str = "add port meter profile trtcm_rfc4115 <port_id>
> > <profile_id> <cir> <eir> <cbs> <ebs> <packet_mode>",
> >       .tokens = {
> >               (void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add,
> >               (void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port,
> > @@ -597,6 +630,7 @@ cmdline_parse_inst_t
> > cmd_add_port_meter_profile_trtcm_rfc4115 = {
> >               (void *)&cmd_add_port_meter_profile_trtcm_rfc4115_eir,
> >               (void *)&cmd_add_port_meter_profile_trtcm_rfc4115_cbs,
> >               (void *)&cmd_add_port_meter_profile_trtcm_rfc4115_ebs,
> > +             (void
> > *)&cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode,
> >               NULL,
> >       },
> >  };
> > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > index f59eb8a27d..b5e52f6b1c 100644
> > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > @@ -2698,14 +2698,15 @@ add port meter profile (srTCM rfc2967)  Add
> > meter profile (srTCM rfc2697) to the ethernet device::
> >
> >     testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
> > -   (cir) (cbs) (ebs)
> > +   (cir) (cbs) (ebs) (packet_mode)
> >
> >  where:
> >
> >  * ``profile_id``: ID for the meter profile.
> > -* ``cir``: Committed Information Rate (CIR) (bytes/second).
> > -* ``cbs``: Committed Burst Size (CBS) (bytes).
> > -* ``ebs``: Excess Burst Size (EBS) (bytes).
> > +* ``cir``: Committed Information Rate (CIR) (bytes per second or
> > +packets per
> > second).
> > +* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
> > +* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
> > +* ``packet_mode``: Packets mode for meter profile.
> >
> >  add port meter profile (trTCM rfc2968)
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > @@ -2713,15 +2714,16 @@ add port meter profile (trTCM rfc2968)  Add
> > meter profile (srTCM rfc2698) to the ethernet device::
> >
> >     testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
> > -   (cir) (pir) (cbs) (pbs)
> > +   (cir) (pir) (cbs) (pbs) (packet_mode)
> >
> >  where:
> >
> >  * ``profile_id``: ID for the meter profile.
> > -* ``cir``: Committed information rate (bytes/second).
> > -* ``pir``: Peak information rate (bytes/second).
> > -* ``cbs``: Committed burst size (bytes).
> > -* ``pbs``: Peak burst size (bytes).
> > +* ``cir``: Committed information rate (bytes per second or packets
> > +per
> > second).
> > +* ``pir``: Peak information rate (bytes per second or packets per second).
> > +* ``cbs``: Committed burst size (bytes or packets).
> > +* ``pbs``: Peak burst size (bytes or packets).
> > +* ``packet_mode``: Packets mode for meter profile.
> >
> >  add port meter profile (trTCM rfc4115)
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > @@ -2729,15 +2731,16 @@ add port meter profile (trTCM rfc4115)  Add
> > meter profile (trTCM rfc4115) to the ethernet device::
> >
> >     testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
> > -   (cir) (eir) (cbs) (ebs)
> > +   (cir) (eir) (cbs) (ebs) (packet_mode)
> >
> >  where:
> >
> >  * ``profile_id``: ID for the meter profile.
> > -* ``cir``: Committed information rate (bytes/second).
> > -* ``eir``: Excess information rate (bytes/second).
> > -* ``cbs``: Committed burst size (bytes).
> > -* ``ebs``: Excess burst size (bytes).
> > +* ``cir``: Committed information rate (bytes per second or packets
> > +per
> > second).
> > +* ``eir``: Excess information rate (bytes per second or packets per second).
> > +* ``cbs``: Committed burst size (bytes or packets).
> > +* ``ebs``: Excess burst size (bytes or packets).
> > +* ``packet_mode``: Packets mode for meter profile.
> >
> >  delete port meter profile
> >  ~~~~~~~~~~~~~~~~~~~~~~~~~
> > --
> > 2.27.0
> 
> There is already a patch from this series numbered PATCH 2/2. Does this
> belong to the same series?
> 
> It is not easy to review this set of patches related to the packet mode addition
> to the API, as it is split across multiple patch series and the numbering is
> confusing. I am not sure I am replying to the latest version or a superseded one.
> 
> Could you please create a unified V2 that contains both the series with the API
> changes and the series with the necessary error checks in the drivers?

Sure, will send V2 patch include the API and necessary error checks.

Regards,
Li Zhang

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 0/4] Support PPS(packet per second) on meter
  2021-03-31  8:54 [dpdk-dev] [PATCH 0/2] Support PPS(packet per second) on meter Li Zhang
  2021-03-31  8:54 ` [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure Li Zhang
  2021-03-31  8:54 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option Li Zhang
@ 2021-04-08  3:58 ` Li Zhang
  2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add packet mode in meter profile structure Li Zhang
                     ` (4 more replies)
  2021-04-13  3:50 ` [dpdk-dev] [PATCH v4 " Li Zhang
  2021-04-13 15:59 ` [dpdk-dev] [PATCH v5 " Li Zhang
  4 siblings, 5 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-08  3:58 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu, lironh
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports rate is bytes per second(BPS).
Add packet_mode flag in meter profile parameters data structure.
So that it can meter traffic by packet per second.

When packet_mode is 0, the profile rates and bucket sizes are
specified in bytes per second and bytes
when packet_mode is not 0, the profile rates and bucket sizes are
specified in packets and packets per second.

Add the necessary checks to the existing drivers implementing
the rte_mtr API to makes sure that profiles with
packet_mode set to TRUE are rejected.

RFC ("adds support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769-2-lizh@nvidia.com/

Depends-on: series=15998  ("Add ASO meter support in MLX5 PMD")
https://patchwork.dpdk.org/project/dpdk/list/?series=15998

Li Zhang (4):
  ethdev: add packet mode in meter profile structure
  app/testpmd: add meter profile packet mode option
  net/softnic: check meter packet mode
  net/mvpp2: check meter packet mode

 app/test-pmd/cmdline_mtr.c                  | 40 ++++++++-
 doc/guides/rel_notes/release_21_05.rst      |  7 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 +++----
 drivers/net/mvpp2/mrvl_mtr.c                |  6 ++
 drivers/net/softnic/rte_eth_softnic_meter.c |  8 ++
 lib/librte_ethdev/rte_mtr.h                 | 90 ++++++++++++++++++---
 6 files changed, 154 insertions(+), 28 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 1/4] ethdev: add packet mode in meter profile structure
  2021-04-08  3:58 ` [dpdk-dev] [PATCH v2 0/4] Support PPS(packet per second) on meter Li Zhang
@ 2021-04-08  3:58   ` Li Zhang
  2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 2/4] app/testpmd: add meter profile packet mode option Li Zhang
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-08  3:58 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
  Cc: dev, rasland, roniba

Currently meter algorithms only supports rate is bytes per second(BPS).
Add packet_mode flag in meter profile parameters data structure.
So that it can meter traffic by packet per second.

When packet_mode is 0, the profile rates and bucket sizes are
specified in bytes per second and bytes
when packet_mode is not 0, the profile rates and bucket sizes are
specified in packets and packets per second.

The below structure will be extended:
rte_mtr_meter_profile
rte_mtr_capabilities

Signed-off-by: Li Zhang <lizh@nvidia.com>
---
 doc/guides/rel_notes/release_21_05.rst |  7 ++
 lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
 2 files changed, 86 insertions(+), 11 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 3c76148b11..c9c15794ad 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -119,6 +119,13 @@ New Features
   * Added command to display Rx queue used descriptor count.
     ``show port (port_id) rxq (queue_id) desc used count``
 
+* **Added support for meter PPS profile.**
+
+  Currently meter algorithms only supports bytes per second(BPS).
+  Add packet_mode in the meter profile parameters data structures
+  to support packet per second (PPS) mode.
+  So that it can meter traffic by packet per second.
+  Packet_mode must be 0 when it is bytes mode.
 
 Removed Items
 -------------
diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
index e1dc59eb06..890b4ac344 100644
--- a/lib/librte_ethdev/rte_mtr.h
+++ b/lib/librte_ethdev/rte_mtr.h
@@ -133,46 +133,71 @@ struct rte_mtr_meter_profile {
 	union {
 		/** Items only valid when *alg* is set to srTCM - RFC 2697. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Committed Burst Size (CBS) (bytes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Excess Burst Size (EBS) (bytes). */
+			/** Excess Burst Size (EBS) (bytes or packets). */
 			uint64_t ebs;
 		} srtcm_rfc2697;
 
 		/** Items only valid when *alg* is set to trTCM - RFC 2698. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Peak Information Rate (PIR) (bytes/second). */
+			/**
+			 * Peak Information Rate (PIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t pir;
 
-			/** Committed Burst Size (CBS) (byes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Peak Burst Size (PBS) (bytes). */
+			/** Peak Burst Size (PBS) (bytes or packets). */
 			uint64_t pbs;
 		} trtcm_rfc2698;
 
 		/** Items only valid when *alg* is set to trTCM - RFC 4115. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Excess Information Rate (EIR) (bytes/second). */
+			/**
+			 * Excess Information Rate (EIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t eir;
 
-			/** Committed Burst Size (CBS) (byes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Excess Burst Size (EBS) (bytes). */
+			/** Excess Burst Size (EBS) (bytes or packets). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
 	};
+
+	/**
+	 * When zero, the byte mode is enabled for the current profile, so the
+	 * *rate* and *size* fields are specified in bytes per second
+	 * and bytes, respectively.
+	 * When non-zero, the packet mode is enabled for the current profile,
+	 * so the *rate* and *size* fields are specified in packets per second
+	 * and packets, respectively.
+	 */
+	int packet_mode;
 };
 
 /**
@@ -333,6 +358,48 @@ struct rte_mtr_capabilities {
 	 */
 	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * srTCM rfc2697 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the srTCM RFC 2697 metering algorithm.
+	 */
+	int srtcm_rfc2697_byte_mode_supported;
+
+	/**
+	 * srTCM rfc2697 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the srTCM RFC 2697 metering algorithm.
+	 */
+	int srtcm_rfc2697_packet_mode_supported;
+
+	/**
+	 * trTCM rfc2698 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the trTCM RFC 2698 metering algorithm.
+	 */
+	int trtcm_rfc2698_byte_mode_supported;
+
+	/**
+	 * trTCM rfc2698 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the trTCM RFC 2698 metering algorithm.
+	 */
+	int trtcm_rfc2698_packet_mode_supported;
+
+	/**
+	 * trTCM rfc4115 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the trTCM RFC 4115 metering algorithm.
+	 */
+	int trtcm_rfc4115_byte_mode_supported;
+
+	/**
+	 * trTCM rfc4115 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the trTCM RFC 4115 metering algorithm.
+	 */
+	int trtcm_rfc4115_packet_mode_supported;
+
 	/** Set of supported statistics counter types.
 	 * @see enum rte_mtr_stats_type
 	 */
@@ -350,6 +417,7 @@ enum rte_mtr_error_type {
 	RTE_MTR_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
 	RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
 	RTE_MTR_ERROR_TYPE_METER_PROFILE,
+	RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
 	RTE_MTR_ERROR_TYPE_MTR_ID,
 	RTE_MTR_ERROR_TYPE_MTR_PARAMS,
 	RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 2/4] app/testpmd: add meter profile packet mode option
  2021-04-08  3:58 ` [dpdk-dev] [PATCH v2 0/4] Support PPS(packet per second) on meter Li Zhang
  2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add packet mode in meter profile structure Li Zhang
@ 2021-04-08  3:58   ` Li Zhang
  2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 3/4] net/softnic: check meter packet mode Li Zhang
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-08  3:58 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, Xiaoyun Li
  Cc: dev, thomas, rasland, roniba

add meter profile packet_mode to the ethernet device.
One example:
add port meter profile rfc2697 (port_id) (profile_id)
(cir) (cbs) (ebs) (packet_mode)

Signed-off-by: Li Zhang <lizh@nvidia.com>
---
 app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
 2 files changed, 54 insertions(+), 17 deletions(-)

diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index bdc9ae8bfe..eff2473e7b 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -263,6 +263,18 @@ 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.srtcm_rfc2697_byte_mode_supported %" PRId32 "\n",
+		cap.srtcm_rfc2697_byte_mode_supported);
+	printf("cap.srtcm_rfc2697_packet_mode_supported %" PRId32 "\n",
+		cap.srtcm_rfc2697_packet_mode_supported);
+	printf("cap.trtcm_rfc2698_byte_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc2698_byte_mode_supported);
+	printf("cap.trtcm_rfc2698_packet_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc2698_packet_mode_supported);
+	printf("cap.trtcm_rfc4115_byte_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc4115_byte_mode_supported);
+	printf("cap.trtcm_rfc4115_packet_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc4115_packet_mode_supported);
 	printf("cap.stats_mask %" PRIx64 "\n", cap.stats_mask);
 }
 
@@ -292,6 +304,7 @@ struct cmd_add_port_meter_profile_srtcm_result {
 	uint64_t cir;
 	uint64_t cbs;
 	uint64_t ebs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcm_add =
@@ -333,6 +346,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_ebs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_srtcm_result,
 			ebs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcm_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -354,6 +371,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 	mp.srtcm_rfc2697.cir = res->cir;
 	mp.srtcm_rfc2697.cbs = res->cbs;
 	mp.srtcm_rfc2697.ebs = res->ebs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -365,7 +383,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 	.f = cmd_add_port_meter_profile_srtcm_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs>",
+	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_srtcm_add,
 		(void *)&cmd_add_port_meter_profile_srtcm_port,
@@ -377,6 +395,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 		(void *)&cmd_add_port_meter_profile_srtcm_cir,
 		(void *)&cmd_add_port_meter_profile_srtcm_cbs,
 		(void *)&cmd_add_port_meter_profile_srtcm_ebs,
+		(void *)&cmd_add_port_meter_profile_srtcm_packet_mode,
 		NULL,
 	},
 };
@@ -394,6 +413,7 @@ struct cmd_add_port_meter_profile_trtcm_result {
 	uint64_t pir;
 	uint64_t cbs;
 	uint64_t pbs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_add =
@@ -439,6 +459,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_pbs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_trtcm_result,
 			pbs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_trtcm_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -461,6 +485,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 	mp.trtcm_rfc2698.pir = res->pir;
 	mp.trtcm_rfc2698.cbs = res->cbs;
 	mp.trtcm_rfc2698.pbs = res->pbs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -472,7 +497,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 	.f = cmd_add_port_meter_profile_trtcm_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs>",
+	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_port,
@@ -485,6 +510,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 		(void *)&cmd_add_port_meter_profile_trtcm_pir,
 		(void *)&cmd_add_port_meter_profile_trtcm_cbs,
 		(void *)&cmd_add_port_meter_profile_trtcm_pbs,
+		(void *)&cmd_add_port_meter_profile_trtcm_packet_mode,
 		NULL,
 	},
 };
@@ -502,6 +528,7 @@ struct cmd_add_port_meter_profile_trtcm_rfc4115_result {
 	uint64_t eir;
 	uint64_t cbs;
 	uint64_t ebs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_rfc4115_add =
@@ -549,6 +576,11 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_rfc4115_ebs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
 			ebs, RTE_UINT64);
+cmdline_parse_token_num_t
+	cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 	void *parsed_result,
@@ -573,6 +605,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 	mp.trtcm_rfc4115.eir = res->eir;
 	mp.trtcm_rfc4115.cbs = res->cbs;
 	mp.trtcm_rfc4115.ebs = res->ebs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -584,7 +617,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 	.f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs>",
+	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port,
@@ -597,6 +630,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_eir,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_cbs,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_ebs,
+		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode,
 		NULL,
 	},
 };
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f59eb8a27d..b5e52f6b1c 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2698,14 +2698,15 @@ add port meter profile (srTCM rfc2967)
 Add meter profile (srTCM rfc2697) to the ethernet device::
 
    testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
-   (cir) (cbs) (ebs)
+   (cir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed Information Rate (CIR) (bytes/second).
-* ``cbs``: Committed Burst Size (CBS) (bytes).
-* ``ebs``: Excess Burst Size (EBS) (bytes).
+* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second).
+* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
+* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc2968)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2713,15 +2714,16 @@ add port meter profile (trTCM rfc2968)
 Add meter profile (srTCM rfc2698) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
-   (cir) (pir) (cbs) (pbs)
+   (cir) (pir) (cbs) (pbs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``pir``: Peak information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``pbs``: Peak burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``pir``: Peak information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``pbs``: Peak burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc4115)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2729,15 +2731,16 @@ add port meter profile (trTCM rfc4115)
 Add meter profile (trTCM rfc4115) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
-   (cir) (eir) (cbs) (ebs)
+   (cir) (eir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``eir``: Excess information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``ebs``: Excess burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``eir``: Excess information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``ebs``: Excess burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 3/4] net/softnic: check meter packet mode
  2021-04-08  3:58 ` [dpdk-dev] [PATCH v2 0/4] Support PPS(packet per second) on meter Li Zhang
  2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add packet mode in meter profile structure Li Zhang
  2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 2/4] app/testpmd: add meter profile packet mode option Li Zhang
@ 2021-04-08  3:58   ` Li Zhang
  2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 4/4] net/mvpp2: " Li Zhang
  2021-04-10  7:24   ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Li Zhang
  4 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-08  3:58 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, Jasvinder Singh
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports bytes per second(BPS).
Check packet_mode set to TRUE are rejected.

Signed-off-by: Li Zhang <lizh@nvidia.com>
---
 drivers/net/softnic/rte_eth_softnic_meter.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c b/drivers/net/softnic/rte_eth_softnic_meter.c
index 0cbf94e8b0..8c2f82d512 100644
--- a/drivers/net/softnic/rte_eth_softnic_meter.c
+++ b/drivers/net/softnic/rte_eth_softnic_meter.c
@@ -128,6 +128,14 @@ meter_profile_check(struct rte_eth_dev *dev,
 			NULL,
 			"Metering alg not supported");
 
+	/* Not support packet mode, just support byte mode. */
+	if (profile->packet_mode)
+		return -rte_mtr_error_set(error,
+			EINVAL,
+			RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
+			NULL,
+			"Meter packet mode not supported");
+
 	return 0;
 }
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 4/4] net/mvpp2: check meter packet mode
  2021-04-08  3:58 ` [dpdk-dev] [PATCH v2 0/4] Support PPS(packet per second) on meter Li Zhang
                     ` (2 preceding siblings ...)
  2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 3/4] net/softnic: check meter packet mode Li Zhang
@ 2021-04-08  3:58   ` Li Zhang
  2021-04-10  7:24   ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Li Zhang
  4 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-08  3:58 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu, lironh
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports bytes per second(BPS).
Check packet_mode set to TRUE are rejected.

Signed-off-by: Li Zhang <lizh@nvidia.com>
---
 drivers/net/mvpp2/mrvl_mtr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mvpp2/mrvl_mtr.c b/drivers/net/mvpp2/mrvl_mtr.c
index 2fa5cb43ad..c07ac95ddc 100644
--- a/drivers/net/mvpp2/mrvl_mtr.c
+++ b/drivers/net/mvpp2/mrvl_mtr.c
@@ -88,6 +88,12 @@ mrvl_meter_profile_add(struct rte_eth_dev *dev, uint32_t meter_profile_id,
 					  NULL,
 					  "Only srTCM RFC 2697 is supported\n");
 
+	if (profile->packet_mode)
+		return -rte_mtr_error_set(error, EINVAL,
+				RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
+				NULL,
+				"Packet mode is not supported\n");
+
 	prof = mrvl_mtr_profile_from_id(priv, meter_profile_id);
 	if (prof)
 		return -rte_mtr_error_set(error, EEXIST,
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure
  2021-04-07 20:20         ` Dumitrescu, Cristian
@ 2021-04-08  4:06           ` Li Zhang
  0 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-08  4:06 UTC (permalink / raw)
  To: Dumitrescu, Cristian, dekelp, Ori Kam, Slava Ovsiienko,
	Matan Azrad, Shahaf Shuler, NBU-Contact-Thomas Monjalon, Yigit,
	Ferruh, Andrew Rybchenko, Liron Himi
  Cc: dev, Raslan Darawsheh, Roni Bar Yanai

Hi Cristian,

Please help review it, which is a unified V2 that contains all patches.
https://patchwork.dpdk.org/project/dpdk/list/?series=16183

Thanks!
Regards,
Li Zhang
> -----Original Message-----
> From: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Sent: Thursday, April 8, 2021 4:20 AM
> To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; NBU-
> Contact-Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Liron Himi <lironh@marvell.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Roni Bar Yanai
> <roniba@nvidia.com>
> Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile structure
> 
> External email: Use caution opening links or attachments
> 
> 
> > -----Original Message-----
> > From: Li Zhang <lizh@nvidia.com>
> > Sent: Thursday, April 1, 2021 7:19 AM
> > To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>;
> > dekelp@nvidia.com; Ori Kam <orika@nvidia.com>; Slava Ovsiienko
> > <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Shahaf
> > Shuler <shahafs@nvidia.com>; NBU-Contact-Thomas Monjalon
> > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > Rybchenko <andrew.rybchenko@oktetlabs.ru>; Liron Himi
> > <lironh@marvell.com>
> > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Roni Bar
> > Yanai <roniba@nvidia.com>
> > Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile
> > structure
> >
> > Hi Dumitrescu and Liron,
> >
> > I add the check in softnet and mvpp2 drivers in the following patch.
> > Please help review it.
> > https://patchwork.dpdk.org/project/dpdk/list/?series=16036
> >
> 
> As stated in a different email, it is difficult to review this API change, as it is
> split across (at least) two patch sets, one with the API changes and another one
> with the driver error checks, also as stated before the numbering of some
> patches does not seem right; difficult to tell if I am reviewing the latest version
> or a superseded one.
> 
> Could you please create a unified V2 that contains all patches in one place?
> Thank you!
> 
> > Thanks!
> > Regards,
> > Li Zhang
> > > -----Original Message-----
> > > From: Li Zhang
> > > Sent: Thursday, April 1, 2021 9:42 AM
> > > To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>;
> > > dekelp@nvidia.com; Ori Kam <orika@nvidia.com>; Slava Ovsiienko
> > > <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Shahaf
> > > Shuler <shahafs@nvidia.com>; NBU-Contact-Thomas Monjalon
> > > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> > > Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Roni Bar
> > Yanai
> > > <roniba@nvidia.com>
> > > Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile
> > structure
> > >
> > > Hi Dumitrescu,
> > >
> > > Thank you for your comments.
> > > I will add the necessary checks in V2 patches.
> > >
> > > Regards,
> > > Li Zhang
> > >
> > > > -----Original Message-----
> > > > From: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> > > > Sent: Thursday, April 1, 2021 12:27 AM
> > > > To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
> > > > <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> > > > Matan Azrad <matan@nvidia.com>; Shahaf Shuler
> > > > <shahafs@nvidia.com>; NBU- Contact-Thomas Monjalon
> > > > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> > > > Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > > > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>; Roni Bar
> > > > Yanai <roniba@nvidia.com>
> > > > Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile
> > > > structure
> > > >
> > > > External email: Use caution opening links or attachments
> > > >
> > > >
> > > > Hi Li,
> > > >
> > > > > -----Original Message-----
> > > > > From: Li Zhang <lizh@nvidia.com>
> > > > > Sent: Wednesday, March 31, 2021 9:54 AM
> > > > > To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> > > > > matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> > > > > <cristian.dumitrescu@intel.com>; Thomas Monjalon
> > > > > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> > > > > Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > > > > Cc: dev@dpdk.org; rasland@nvidia.com; roniba@nvidia.com
> > > > > Subject: [PATCH 1/2] ethdev: add packet mode in meter profile
> > > > > structure
> > > > >
> > > > > Currently meter algorithms only supports rate is bytes per second(BPS).
> > > > > Add packet_mode flag in meter profile parameters data structure.
> > > > > So that it can meter traffic by packet per second.
> > > > >
> > > > > When packet_mode is 0, the profile rates and bucket sizes are
> > > > > specified in bytes per second and bytes when packet_mode is not
> > > > > 0, the profile rates and bucket sizes are specified in packets
> > > > > and packets per second.
> > > > >
> > > > > The below structure will be extended:
> > > > > rte_mtr_meter_profile
> > > > > rte_mtr_capabilities
> > > > >
> > > > > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > > > > ---
> > > > >  doc/guides/rel_notes/release_21_05.rst |  7 ++
> > > > >  lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
> > > > >  2 files changed, 85 insertions(+), 11 deletions(-)
> > > > >
> > > > > diff --git a/doc/guides/rel_notes/release_21_05.rst
> > > > > b/doc/guides/rel_notes/release_21_05.rst
> > > > > index 3c76148b11..c9c15794ad 100644
> > > > > --- a/doc/guides/rel_notes/release_21_05.rst
> > > > > +++ b/doc/guides/rel_notes/release_21_05.rst
> > > > > @@ -119,6 +119,13 @@ New Features
> > > > >    * Added command to display Rx queue used descriptor count.
> > > > >      ``show port (port_id) rxq (queue_id) desc used count``
> > > > >
> > > > > +* **Added support for meter PPS profile.**
> > > > > +
> > > > > +  Currently meter algorithms only supports bytes per second(BPS).
> > > > > +  Add packet_mode in the meter profile parameters data
> > > > > + structures to support packet per second (PPS) mode.
> > > > > +  So that it can meter traffic by packet per second.
> > > > > +  Packet_mode must be 0 when it is bytes mode.
> > > > >
> > > > >  Removed Items
> > > > >  -------------
> > > > > diff --git a/lib/librte_ethdev/rte_mtr.h
> > > > > b/lib/librte_ethdev/rte_mtr.h index e1dc59eb06..52611a90f5
> > > > > 100644
> > > > > --- a/lib/librte_ethdev/rte_mtr.h
> > > > > +++ b/lib/librte_ethdev/rte_mtr.h
> > > > > @@ -133,46 +133,71 @@ struct rte_mtr_meter_profile {
> > > > >       union {
> > > > >               /** Items only valid when *alg* is set to srTCM - RFC 2697. */
> > > > >               struct {
> > > > > -                     /** Committed Information Rate (CIR)
> > > > > (bytes/second). */
> > > > > +                     /**
> > > > > +                      * Committed Information Rate (CIR)
> > > > > +                      * (bytes per second or packets per second).
> > > > > +                      */
> > > > >                       uint64_t cir;
> > > > >
> > > > > -                     /** Committed Burst Size (CBS) (bytes). */
> > > > > +                     /** Committed Burst Size (CBS) (bytes or
> > > > > + packets). */
> > > > >                       uint64_t cbs;
> > > > >
> > > > > -                     /** Excess Burst Size (EBS) (bytes). */
> > > > > +                     /** Excess Burst Size (EBS) (bytes or packets).
> > > > > + */
> > > > >                       uint64_t ebs;
> > > > >               } srtcm_rfc2697;
> > > > >
> > > > >               /** Items only valid when *alg* is set to trTCM - RFC 2698. */
> > > > >               struct {
> > > > > -                     /** Committed Information Rate (CIR)
> > > > > (bytes/second). */
> > > > > +                     /**
> > > > > +                      * Committed Information Rate (CIR)
> > > > > +                      * (bytes per second or packets per second).
> > > > > +                      */
> > > > >                       uint64_t cir;
> > > > >
> > > > > -                     /** Peak Information Rate (PIR) (bytes/second). */
> > > > > +                     /**
> > > > > +                      * Peak Information Rate (PIR)
> > > > > +                      * (bytes per second or packets per second).
> > > > > +                      */
> > > > >                       uint64_t pir;
> > > > >
> > > > > -                     /** Committed Burst Size (CBS) (byes). */
> > > > > +                     /** Committed Burst Size (CBS) (bytes or
> > > > > + packets). */
> > > > >                       uint64_t cbs;
> > > > >
> > > > > -                     /** Peak Burst Size (PBS) (bytes). */
> > > > > +                     /** Peak Burst Size (PBS) (bytes or packets).
> > > > > + */
> > > > >                       uint64_t pbs;
> > > > >               } trtcm_rfc2698;
> > > > >
> > > > >               /** Items only valid when *alg* is set to trTCM - RFC 4115. */
> > > > >               struct {
> > > > > -                     /** Committed Information Rate (CIR)
> > > > > (bytes/second). */
> > > > > +                     /**
> > > > > +                      * Committed Information Rate (CIR)
> > > > > +                      * (bytes per second or packets per second).
> > > > > +                      */
> > > > >                       uint64_t cir;
> > > > >
> > > > > -                     /** Excess Information Rate (EIR) (bytes/second). */
> > > > > +                     /**
> > > > > +                      * Excess Information Rate (EIR)
> > > > > +                      * (bytes per second or packets per second).
> > > > > +                      */
> > > > >                       uint64_t eir;
> > > > >
> > > > > -                     /** Committed Burst Size (CBS) (byes). */
> > > > > +                     /** Committed Burst Size (CBS) (bytes or
> > > > > + packets). */
> > > > >                       uint64_t cbs;
> > > > >
> > > > > -                     /** Excess Burst Size (EBS) (bytes). */
> > > > > +                     /** Excess Burst Size (EBS) (bytes or packets).
> > > > > + */
> > > > >                       uint64_t ebs;
> > > > >               } trtcm_rfc4115;
> > > > >       };
> > > > > +
> > > > > +     /**
> > > > > +      * When zero, the byte mode is enabled for the current
> > > > > + profile, so
> > > > > the
> > > > > +      * *rate* and *size* fields are specified in bytes per second
> > > > > +      * and bytes, respectively.
> > > > > +      * When non-zero, the packet mode is enabled for the
> > > > > + current
> > > > > profile,
> > > > > +      * so the *rate* and *size* fields are specified in
> > > > > + packets per
> > second
> > > > > +      * and packets, respectively.
> > > > > +      */
> > > > > +     int packet_mode;
> > > > >  };
> > > > >
> > > > >  /**
> > > > > @@ -333,6 +358,48 @@ struct rte_mtr_capabilities {
> > > > >        */
> > > > >       int color_aware_trtcm_rfc4115_supported;
> > > > >
> > > > > +     /**
> > > > > +      * srTCM rfc2697 byte mode supported.
> > > > > +      * When non-zero, it indicates that byte mode is supported for
> > > > > +      * the srTCM RFC 2697 metering algorithm.
> > > > > +      */
> > > > > +     int srtcm_rfc2697_byte_mode_supported;
> > > > > +
> > > > > +     /**
> > > > > +      * srTCM rfc2697 packet mode supported.
> > > > > +      * When non-zero, it indicates that packet mode is supported for
> > > > > +      * the srTCM RFC 2697 metering algorithm.
> > > > > +      */
> > > > > +     int srtcm_rfc2697_packet_mode_supported;
> > > > > +
> > > > > +     /**
> > > > > +      * trTCM rfc2698 byte mode supported.
> > > > > +      * When non-zero, it indicates that byte mode is supported for
> > > > > +      * the trTCM RFC 2698 metering algorithm.
> > > > > +      */
> > > > > +     int trtcm_rfc2698_byte_mode_supported;
> > > > > +
> > > > > +     /**
> > > > > +      * trTCM rfc2698 packet mode supported.
> > > > > +      * When non-zero, it indicates that packet mode is supported for
> > > > > +      * the trTCM RFC 2698 metering algorithm.
> > > > > +      */
> > > > > +     int trtcm_rfc2698_packet_mode_supported;
> > > > > +
> > > > > +     /**
> > > > > +      * trTCM rfc4115 byte mode supported.
> > > > > +      * When non-zero, it indicates that byte mode is supported for
> > > > > +      * the trTCM RFC 4115 metering algorithm.
> > > > > +      */
> > > > > +     int trtcm_rfc4115_byte_mode_supported;
> > > > > +
> > > > > +     /**
> > > > > +      * trTCM rfc4115 packet mode supported.
> > > > > +      * When non-zero, it indicates that packet mode is supported for
> > > > > +      * the trTCM RFC 4115 metering algorithm.
> > > > > +      */
> > > > > +     int trtcm_rfc4115_packet_mode_supported;
> > > > > +
> > > > >       /** Set of supported statistics counter types.
> > > > >        * @see enum rte_mtr_stats_type
> > > > >        */
> > > > > --
> > > > > 2.27.0
> > > >
> > > > These API updates look good to me, but please add the necessary
> > > > checks to the existing drivers implementing the rte_mtr API to
> > > > makes sure that profiles with packet_mode set to TRUE are rejected.
> > > >
> > > > For the Soft NIC driver, this is a simple check in file
> > > > drivers/net/softnic/rte_eth_softnic_meter.c, function
> > meter_profile_check.
> > > > Thanks!
> > > >
> > > > Regards,
> > > > Cristian

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter
  2021-04-08  3:58 ` [dpdk-dev] [PATCH v2 0/4] Support PPS(packet per second) on meter Li Zhang
                     ` (3 preceding siblings ...)
  2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 4/4] net/mvpp2: " Li Zhang
@ 2021-04-10  7:24   ` Li Zhang
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure Li Zhang
                       ` (4 more replies)
  4 siblings, 5 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-10  7:24 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu, lironh
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports rate is bytes per second(BPS).
Add packet_mode flag in meter profile parameters data structure.
So that it can meter traffic by packet per second.

When packet_mode is 0, the profile rates and bucket sizes are
specified in bytes per second and bytes
when packet_mode is not 0, the profile rates and bucket sizes are
specified in packets and packets per second.

Add the necessary checks to the existing drivers implementing
the rte_mtr API to makes sure that profiles with
packet_mode set to TRUE are rejected.

RFC ("adds support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769-2-lizh@nvidia.com/

Depends-on: series=15998  ("Add ASO meter support in MLX5 PMD")
https://patchwork.dpdk.org/project/dpdk/list/?series=15998

V2: create a unified patch that contains both the series with
	the API changes and the series with the necessary error checks in the drivers.

V3: Fix comments from Matan and Cristian.

Li Zhang (4):
  ethdev: add packet mode in meter profile structure
  app/testpmd: add meter profile packet mode option
  net/softnic: check meter packet mode
  net/mvpp2: check meter packet mode

 app/test-pmd/cmdline_mtr.c                  | 40 ++++++++-
 doc/guides/rel_notes/release_21_05.rst      | 12 +++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 +++----
 drivers/net/mvpp2/mrvl_mtr.c                |  6 ++
 drivers/net/softnic/rte_eth_softnic_meter.c |  8 ++
 lib/librte_ethdev/rte_mtr.h                 | 90 ++++++++++++++++++---
 6 files changed, 159 insertions(+), 28 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure
  2021-04-10  7:24   ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Li Zhang
@ 2021-04-10  7:24     ` Li Zhang
  2021-04-12 19:23       ` Dumitrescu, Cristian
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 2/4] app/testpmd: add meter profile packet mode option Li Zhang
                       ` (3 subsequent siblings)
  4 siblings, 1 reply; 47+ messages in thread
From: Li Zhang @ 2021-04-10  7:24 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
  Cc: dev, rasland, roniba

Currently meter algorithms only supports rate is bytes per second(BPS).
Add packet_mode flag in meter profile parameters data structure.
So that it can meter traffic by packet per second.

When packet_mode is 0, the profile rates and bucket sizes are
specified in bytes per second and bytes
when packet_mode is not 0, the profile rates and bucket sizes are
specified in packets and packets per second.

The below structure will be extended:
rte_mtr_meter_profile
rte_mtr_capabilities

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 doc/guides/rel_notes/release_21_05.rst | 12 ++++
 lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 11 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index f199ad286d..b4653d63a1 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -152,6 +152,18 @@ New Features
   * ethdev: Added RTE_FLOW_ACTION_TYPE_METER_COLOR in enum rte_flow_action_type.
   * ethdev: Added RTE_MTR_ERROR_TYPE_METER_POLICY_ID and RTE_MTR_ERROR_TYPE_METER_POLICY_ID into rte_mtr_error_type.
 
+* **Added support for meter PPS profile.**
+
+  Currently meter algorithms only supports bytes per second(BPS).
+  Add packet_mode in the meter profile parameters data structures
+  to support packet per second (PPS) mode.
+  So that it can meter traffic by packet per second.
+  Packet_mode must be 0 when it is bytes mode.
+
+* **Updated MLX5 driver.**
+
+  * Added support for meter profile packet per second mode (packet_mode).
+
 Removed Items
 -------------
 
diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
index 4938ef065f..778fad7638 100644
--- a/lib/librte_ethdev/rte_mtr.h
+++ b/lib/librte_ethdev/rte_mtr.h
@@ -133,46 +133,71 @@ struct rte_mtr_meter_profile {
 	union {
 		/** Items only valid when *alg* is set to srTCM - RFC 2697. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Committed Burst Size (CBS) (bytes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Excess Burst Size (EBS) (bytes). */
+			/** Excess Burst Size (EBS) (bytes or packets). */
 			uint64_t ebs;
 		} srtcm_rfc2697;
 
 		/** Items only valid when *alg* is set to trTCM - RFC 2698. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Peak Information Rate (PIR) (bytes/second). */
+			/**
+			 * Peak Information Rate (PIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t pir;
 
-			/** Committed Burst Size (CBS) (byes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Peak Burst Size (PBS) (bytes). */
+			/** Peak Burst Size (PBS) (bytes or packets). */
 			uint64_t pbs;
 		} trtcm_rfc2698;
 
 		/** Items only valid when *alg* is set to trTCM - RFC 4115. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Excess Information Rate (EIR) (bytes/second). */
+			/**
+			 * Excess Information Rate (EIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t eir;
 
-			/** Committed Burst Size (CBS) (byes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Excess Burst Size (EBS) (bytes). */
+			/** Excess Burst Size (EBS) (bytes or packets). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
 	};
+
+	/**
+	 * When zero, the byte mode is enabled for the current profile, so the
+	 * *rate* and *size* fields are specified in bytes per second
+	 * and bytes, respectively.
+	 * When non-zero, the packet mode is enabled for the current profile,
+	 * so the *rate* and *size* fields are specified in packets per second
+	 * and packets, respectively.
+	 */
+	int packet_mode;
 };
 
 /**
@@ -346,6 +371,48 @@ struct rte_mtr_capabilities {
 	 */
 	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * srTCM rfc2697 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the srTCM RFC 2697 metering algorithm.
+	 */
+	int srtcm_rfc2697_byte_mode_supported;
+
+	/**
+	 * srTCM rfc2697 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the srTCM RFC 2697 metering algorithm.
+	 */
+	int srtcm_rfc2697_packet_mode_supported;
+
+	/**
+	 * trTCM rfc2698 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the trTCM RFC 2698 metering algorithm.
+	 */
+	int trtcm_rfc2698_byte_mode_supported;
+
+	/**
+	 * trTCM rfc2698 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the trTCM RFC 2698 metering algorithm.
+	 */
+	int trtcm_rfc2698_packet_mode_supported;
+
+	/**
+	 * trTCM rfc4115 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the trTCM RFC 4115 metering algorithm.
+	 */
+	int trtcm_rfc4115_byte_mode_supported;
+
+	/**
+	 * trTCM rfc4115 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the trTCM RFC 4115 metering algorithm.
+	 */
+	int trtcm_rfc4115_packet_mode_supported;
+
 	/** Set of supported statistics counter types.
 	 * @see enum rte_mtr_stats_type
 	 */
@@ -363,6 +430,7 @@ enum rte_mtr_error_type {
 	RTE_MTR_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
 	RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
 	RTE_MTR_ERROR_TYPE_METER_PROFILE,
+	RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
 	RTE_MTR_ERROR_TYPE_MTR_ID,
 	RTE_MTR_ERROR_TYPE_MTR_PARAMS,
 	RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
-- 
2.21.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 2/4] app/testpmd: add meter profile packet mode option
  2021-04-10  7:24   ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Li Zhang
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure Li Zhang
@ 2021-04-10  7:24     ` Li Zhang
  2021-04-12 23:51       ` Ferruh Yigit
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 3/4] net/softnic: check meter packet mode Li Zhang
                       ` (2 subsequent siblings)
  4 siblings, 1 reply; 47+ messages in thread
From: Li Zhang @ 2021-04-10  7:24 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, Xiaoyun Li
  Cc: dev, thomas, rasland, roniba

add meter profile packet_mode to the ethernet device.
One example:
add port meter profile rfc2697 (port_id) (profile_id)
(cir) (cbs) (ebs) (packet_mode)

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
 2 files changed, 54 insertions(+), 17 deletions(-)

diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index bdc9ae8bfe..eff2473e7b 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -263,6 +263,18 @@ 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.srtcm_rfc2697_byte_mode_supported %" PRId32 "\n",
+		cap.srtcm_rfc2697_byte_mode_supported);
+	printf("cap.srtcm_rfc2697_packet_mode_supported %" PRId32 "\n",
+		cap.srtcm_rfc2697_packet_mode_supported);
+	printf("cap.trtcm_rfc2698_byte_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc2698_byte_mode_supported);
+	printf("cap.trtcm_rfc2698_packet_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc2698_packet_mode_supported);
+	printf("cap.trtcm_rfc4115_byte_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc4115_byte_mode_supported);
+	printf("cap.trtcm_rfc4115_packet_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc4115_packet_mode_supported);
 	printf("cap.stats_mask %" PRIx64 "\n", cap.stats_mask);
 }
 
@@ -292,6 +304,7 @@ struct cmd_add_port_meter_profile_srtcm_result {
 	uint64_t cir;
 	uint64_t cbs;
 	uint64_t ebs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcm_add =
@@ -333,6 +346,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_ebs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_srtcm_result,
 			ebs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcm_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -354,6 +371,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 	mp.srtcm_rfc2697.cir = res->cir;
 	mp.srtcm_rfc2697.cbs = res->cbs;
 	mp.srtcm_rfc2697.ebs = res->ebs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -365,7 +383,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 	.f = cmd_add_port_meter_profile_srtcm_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs>",
+	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_srtcm_add,
 		(void *)&cmd_add_port_meter_profile_srtcm_port,
@@ -377,6 +395,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 		(void *)&cmd_add_port_meter_profile_srtcm_cir,
 		(void *)&cmd_add_port_meter_profile_srtcm_cbs,
 		(void *)&cmd_add_port_meter_profile_srtcm_ebs,
+		(void *)&cmd_add_port_meter_profile_srtcm_packet_mode,
 		NULL,
 	},
 };
@@ -394,6 +413,7 @@ struct cmd_add_port_meter_profile_trtcm_result {
 	uint64_t pir;
 	uint64_t cbs;
 	uint64_t pbs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_add =
@@ -439,6 +459,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_pbs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_trtcm_result,
 			pbs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_trtcm_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -461,6 +485,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 	mp.trtcm_rfc2698.pir = res->pir;
 	mp.trtcm_rfc2698.cbs = res->cbs;
 	mp.trtcm_rfc2698.pbs = res->pbs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -472,7 +497,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 	.f = cmd_add_port_meter_profile_trtcm_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs>",
+	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_port,
@@ -485,6 +510,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 		(void *)&cmd_add_port_meter_profile_trtcm_pir,
 		(void *)&cmd_add_port_meter_profile_trtcm_cbs,
 		(void *)&cmd_add_port_meter_profile_trtcm_pbs,
+		(void *)&cmd_add_port_meter_profile_trtcm_packet_mode,
 		NULL,
 	},
 };
@@ -502,6 +528,7 @@ struct cmd_add_port_meter_profile_trtcm_rfc4115_result {
 	uint64_t eir;
 	uint64_t cbs;
 	uint64_t ebs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_rfc4115_add =
@@ -549,6 +576,11 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_rfc4115_ebs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
 			ebs, RTE_UINT64);
+cmdline_parse_token_num_t
+	cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 	void *parsed_result,
@@ -573,6 +605,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 	mp.trtcm_rfc4115.eir = res->eir;
 	mp.trtcm_rfc4115.cbs = res->cbs;
 	mp.trtcm_rfc4115.ebs = res->ebs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -584,7 +617,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 	.f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs>",
+	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port,
@@ -597,6 +630,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_eir,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_cbs,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_ebs,
+		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode,
 		NULL,
 	},
 };
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 4e9089beaf..59f7b3ebd9 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2716,14 +2716,15 @@ add port meter profile (srTCM rfc2967)
 Add meter profile (srTCM rfc2697) to the ethernet device::
 
    testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
-   (cir) (cbs) (ebs)
+   (cir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed Information Rate (CIR) (bytes/second).
-* ``cbs``: Committed Burst Size (CBS) (bytes).
-* ``ebs``: Excess Burst Size (EBS) (bytes).
+* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second).
+* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
+* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc2968)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2731,15 +2732,16 @@ add port meter profile (trTCM rfc2968)
 Add meter profile (srTCM rfc2698) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
-   (cir) (pir) (cbs) (pbs)
+   (cir) (pir) (cbs) (pbs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``pir``: Peak information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``pbs``: Peak burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``pir``: Peak information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``pbs``: Peak burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc4115)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2747,15 +2749,16 @@ add port meter profile (trTCM rfc4115)
 Add meter profile (trTCM rfc4115) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
-   (cir) (eir) (cbs) (ebs)
+   (cir) (eir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``eir``: Excess information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``ebs``: Excess burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``eir``: Excess information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``ebs``: Excess burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
2.21.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 3/4] net/softnic: check meter packet mode
  2021-04-10  7:24   ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Li Zhang
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure Li Zhang
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 2/4] app/testpmd: add meter profile packet mode option Li Zhang
@ 2021-04-10  7:24     ` Li Zhang
  2021-04-12 19:24       ` Dumitrescu, Cristian
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 4/4] net/mvpp2: " Li Zhang
  2021-04-12 23:54     ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Ferruh Yigit
  4 siblings, 1 reply; 47+ messages in thread
From: Li Zhang @ 2021-04-10  7:24 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, Jasvinder Singh
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports bytes per second(BPS).
Check packet_mode set to TRUE are rejected.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/softnic/rte_eth_softnic_meter.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c b/drivers/net/softnic/rte_eth_softnic_meter.c
index 2a05a85cdb..046e629f17 100644
--- a/drivers/net/softnic/rte_eth_softnic_meter.c
+++ b/drivers/net/softnic/rte_eth_softnic_meter.c
@@ -107,6 +107,14 @@ meter_profile_check(struct rte_eth_dev *dev,
 			NULL,
 			"Metering alg not supported");
 
+	/* Not support packet mode, just support byte mode. */
+	if (profile->packet_mode)
+		return -rte_mtr_error_set(error,
+			EINVAL,
+			RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
+			NULL,
+			"Meter packet mode not supported");
+
 	return 0;
 }
 
-- 
2.21.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 4/4] net/mvpp2: check meter packet mode
  2021-04-10  7:24   ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Li Zhang
                       ` (2 preceding siblings ...)
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 3/4] net/softnic: check meter packet mode Li Zhang
@ 2021-04-10  7:24     ` Li Zhang
  2021-04-12 23:54     ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Ferruh Yigit
  4 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-10  7:24 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu, lironh
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports bytes per second(BPS).
Check packet_mode set to TRUE are rejected.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mvpp2/mrvl_mtr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mvpp2/mrvl_mtr.c b/drivers/net/mvpp2/mrvl_mtr.c
index 2fa5cb43ad..c07ac95ddc 100644
--- a/drivers/net/mvpp2/mrvl_mtr.c
+++ b/drivers/net/mvpp2/mrvl_mtr.c
@@ -88,6 +88,12 @@ mrvl_meter_profile_add(struct rte_eth_dev *dev, uint32_t meter_profile_id,
 					  NULL,
 					  "Only srTCM RFC 2697 is supported\n");
 
+	if (profile->packet_mode)
+		return -rte_mtr_error_set(error, EINVAL,
+				RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
+				NULL,
+				"Packet mode is not supported\n");
+
 	prof = mrvl_mtr_profile_from_id(priv, meter_profile_id);
 	if (prof)
 		return -rte_mtr_error_set(error, EEXIST,
-- 
2.21.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure Li Zhang
@ 2021-04-12 19:23       ` Dumitrescu, Cristian
  2021-04-12 19:28         ` Jerin Jacob
  0 siblings, 1 reply; 47+ messages in thread
From: Dumitrescu, Cristian @ 2021-04-12 19:23 UTC (permalink / raw)
  To: Li Zhang, dekelp, orika, viacheslavo, matan, shahafs, lironh,
	Thomas Monjalon, Yigit, Ferruh, Andrew Rybchenko
  Cc: dev, rasland, roniba



> -----Original Message-----
> From: Li Zhang <lizh@nvidia.com>
> Sent: Saturday, April 10, 2021 8:25 AM
> To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; lironh@marvell.com; Thomas Monjalon
> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Cc: dev@dpdk.org; rasland@nvidia.com; roniba@nvidia.com
> Subject: [PATCH v3 1/4] ethdev: add packet mode in meter profile structure
> 
> Currently meter algorithms only supports rate is bytes per second(BPS).
> Add packet_mode flag in meter profile parameters data structure.
> So that it can meter traffic by packet per second.
> 
> When packet_mode is 0, the profile rates and bucket sizes are
> specified in bytes per second and bytes
> when packet_mode is not 0, the profile rates and bucket sizes are
> specified in packets and packets per second.
> 
> The below structure will be extended:
> rte_mtr_meter_profile
> rte_mtr_capabilities
> 
> Signed-off-by: Li Zhang <lizh@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
>  doc/guides/rel_notes/release_21_05.rst | 12 ++++
>  lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
>  2 files changed, 91 insertions(+), 11 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_21_05.rst
> b/doc/guides/rel_notes/release_21_05.rst
> index f199ad286d..b4653d63a1 100644
> --- a/doc/guides/rel_notes/release_21_05.rst
> +++ b/doc/guides/rel_notes/release_21_05.rst
> @@ -152,6 +152,18 @@ New Features
>    * ethdev: Added RTE_FLOW_ACTION_TYPE_METER_COLOR in enum
> rte_flow_action_type.
>    * ethdev: Added RTE_MTR_ERROR_TYPE_METER_POLICY_ID and
> RTE_MTR_ERROR_TYPE_METER_POLICY_ID into rte_mtr_error_type.
> 
> +* **Added support for meter PPS profile.**
> +
> +  Currently meter algorithms only supports bytes per second(BPS).
> +  Add packet_mode in the meter profile parameters data structures
> +  to support packet per second (PPS) mode.
> +  So that it can meter traffic by packet per second.
> +  Packet_mode must be 0 when it is bytes mode.
> +
> +* **Updated MLX5 driver.**
> +
> +  * Added support for meter profile packet per second mode
> (packet_mode).
> +
>  Removed Items
>  -------------
> 
> diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
> index 4938ef065f..778fad7638 100644
> --- a/lib/librte_ethdev/rte_mtr.h
> +++ b/lib/librte_ethdev/rte_mtr.h
> @@ -133,46 +133,71 @@ struct rte_mtr_meter_profile {
>  	union {
>  		/** Items only valid when *alg* is set to srTCM - RFC 2697. */
>  		struct {
> -			/** Committed Information Rate (CIR)
> (bytes/second). */
> +			/**
> +			 * Committed Information Rate (CIR)
> +			 * (bytes per second or packets per second).
> +			 */
>  			uint64_t cir;
> 
> -			/** Committed Burst Size (CBS) (bytes). */
> +			/** Committed Burst Size (CBS) (bytes or packets). */
>  			uint64_t cbs;
> 
> -			/** Excess Burst Size (EBS) (bytes). */
> +			/** Excess Burst Size (EBS) (bytes or packets). */
>  			uint64_t ebs;
>  		} srtcm_rfc2697;
> 
>  		/** Items only valid when *alg* is set to trTCM - RFC 2698. */
>  		struct {
> -			/** Committed Information Rate (CIR)
> (bytes/second). */
> +			/**
> +			 * Committed Information Rate (CIR)
> +			 * (bytes per second or packets per second).
> +			 */
>  			uint64_t cir;
> 
> -			/** Peak Information Rate (PIR) (bytes/second). */
> +			/**
> +			 * Peak Information Rate (PIR)
> +			 * (bytes per second or packets per second).
> +			 */
>  			uint64_t pir;
> 
> -			/** Committed Burst Size (CBS) (byes). */
> +			/** Committed Burst Size (CBS) (bytes or packets). */
>  			uint64_t cbs;
> 
> -			/** Peak Burst Size (PBS) (bytes). */
> +			/** Peak Burst Size (PBS) (bytes or packets). */
>  			uint64_t pbs;
>  		} trtcm_rfc2698;
> 
>  		/** Items only valid when *alg* is set to trTCM - RFC 4115. */
>  		struct {
> -			/** Committed Information Rate (CIR)
> (bytes/second). */
> +			/**
> +			 * Committed Information Rate (CIR)
> +			 * (bytes per second or packets per second).
> +			 */
>  			uint64_t cir;
> 
> -			/** Excess Information Rate (EIR) (bytes/second). */
> +			/**
> +			 * Excess Information Rate (EIR)
> +			 * (bytes per second or packets per second).
> +			 */
>  			uint64_t eir;
> 
> -			/** Committed Burst Size (CBS) (byes). */
> +			/** Committed Burst Size (CBS) (bytes or packets). */
>  			uint64_t cbs;
> 
> -			/** Excess Burst Size (EBS) (bytes). */
> +			/** Excess Burst Size (EBS) (bytes or packets). */
>  			uint64_t ebs;
>  		} trtcm_rfc4115;
>  	};
> +
> +	/**
> +	 * When zero, the byte mode is enabled for the current profile, so
> the
> +	 * *rate* and *size* fields are specified in bytes per second
> +	 * and bytes, respectively.
> +	 * When non-zero, the packet mode is enabled for the current
> profile,
> +	 * so the *rate* and *size* fields are specified in packets per second
> +	 * and packets, respectively.
> +	 */
> +	int packet_mode;
>  };
> 
>  /**
> @@ -346,6 +371,48 @@ struct rte_mtr_capabilities {
>  	 */
>  	int color_aware_trtcm_rfc4115_supported;
> 
> +	/**
> +	 * srTCM rfc2697 byte mode supported.
> +	 * When non-zero, it indicates that byte mode is supported for
> +	 * the srTCM RFC 2697 metering algorithm.
> +	 */
> +	int srtcm_rfc2697_byte_mode_supported;
> +
> +	/**
> +	 * srTCM rfc2697 packet mode supported.
> +	 * When non-zero, it indicates that packet mode is supported for
> +	 * the srTCM RFC 2697 metering algorithm.
> +	 */
> +	int srtcm_rfc2697_packet_mode_supported;
> +
> +	/**
> +	 * trTCM rfc2698 byte mode supported.
> +	 * When non-zero, it indicates that byte mode is supported for
> +	 * the trTCM RFC 2698 metering algorithm.
> +	 */
> +	int trtcm_rfc2698_byte_mode_supported;
> +
> +	/**
> +	 * trTCM rfc2698 packet mode supported.
> +	 * When non-zero, it indicates that packet mode is supported for
> +	 * the trTCM RFC 2698 metering algorithm.
> +	 */
> +	int trtcm_rfc2698_packet_mode_supported;
> +
> +	/**
> +	 * trTCM rfc4115 byte mode supported.
> +	 * When non-zero, it indicates that byte mode is supported for
> +	 * the trTCM RFC 4115 metering algorithm.
> +	 */
> +	int trtcm_rfc4115_byte_mode_supported;
> +
> +	/**
> +	 * trTCM rfc4115 packet mode supported.
> +	 * When non-zero, it indicates that packet mode is supported for
> +	 * the trTCM RFC 4115 metering algorithm.
> +	 */
> +	int trtcm_rfc4115_packet_mode_supported;
> +
>  	/** Set of supported statistics counter types.
>  	 * @see enum rte_mtr_stats_type
>  	 */
> @@ -363,6 +430,7 @@ enum rte_mtr_error_type {
>  	RTE_MTR_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
>  	RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
>  	RTE_MTR_ERROR_TYPE_METER_PROFILE,
> +	RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
>  	RTE_MTR_ERROR_TYPE_MTR_ID,
>  	RTE_MTR_ERROR_TYPE_MTR_PARAMS,
>  	RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
> --
> 2.21.0

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/4] net/softnic: check meter packet mode
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 3/4] net/softnic: check meter packet mode Li Zhang
@ 2021-04-12 19:24       ` Dumitrescu, Cristian
  0 siblings, 0 replies; 47+ messages in thread
From: Dumitrescu, Cristian @ 2021-04-12 19:24 UTC (permalink / raw)
  To: Li Zhang, dekelp, orika, viacheslavo, matan, shahafs, lironh,
	Singh, Jasvinder
  Cc: dev, thomas, rasland, roniba



> -----Original Message-----
> From: Li Zhang <lizh@nvidia.com>
> Sent: Saturday, April 10, 2021 8:25 AM
> To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; lironh@marvell.com; Singh, Jasvinder
> <jasvinder.singh@intel.com>
> Cc: dev@dpdk.org; thomas@monjalon.net; rasland@nvidia.com;
> roniba@nvidia.com
> Subject: [PATCH v3 3/4] net/softnic: check meter packet mode
> 
> Currently meter algorithms only supports bytes per second(BPS).
> Check packet_mode set to TRUE are rejected.
> 
> Signed-off-by: Li Zhang <lizh@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
>  drivers/net/softnic/rte_eth_softnic_meter.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c
> b/drivers/net/softnic/rte_eth_softnic_meter.c
> index 2a05a85cdb..046e629f17 100644
> --- a/drivers/net/softnic/rte_eth_softnic_meter.c
> +++ b/drivers/net/softnic/rte_eth_softnic_meter.c
> @@ -107,6 +107,14 @@ meter_profile_check(struct rte_eth_dev *dev,
>  			NULL,
>  			"Metering alg not supported");
> 
> +	/* Not support packet mode, just support byte mode. */
> +	if (profile->packet_mode)
> +		return -rte_mtr_error_set(error,
> +			EINVAL,
> +
> 	RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
> +			NULL,
> +			"Meter packet mode not supported");
> +
>  	return 0;
>  }
> 
> --
> 2.21.0

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure
  2021-04-12 19:23       ` Dumitrescu, Cristian
@ 2021-04-12 19:28         ` Jerin Jacob
  2021-04-13  3:48           ` Ajit Khaparde
  0 siblings, 1 reply; 47+ messages in thread
From: Jerin Jacob @ 2021-04-12 19:28 UTC (permalink / raw)
  To: Dumitrescu, Cristian
  Cc: Li Zhang, dekelp, orika, viacheslavo, matan, shahafs, lironh,
	Thomas Monjalon, Yigit, Ferruh, Andrew Rybchenko, dev, rasland,
	roniba

On Tue, Apr 13, 2021 at 12:54 AM Dumitrescu, Cristian
<cristian.dumitrescu@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Li Zhang <lizh@nvidia.com>
> > Sent: Saturday, April 10, 2021 8:25 AM
> > To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> > matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> > <cristian.dumitrescu@intel.com>; lironh@marvell.com; Thomas Monjalon
> > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > Cc: dev@dpdk.org; rasland@nvidia.com; roniba@nvidia.com
> > Subject: [PATCH v3 1/4] ethdev: add packet mode in meter profile structure
> >
> > Currently meter algorithms only supports rate is bytes per second(BPS).
> > Add packet_mode flag in meter profile parameters data structure.
> > So that it can meter traffic by packet per second.
> >
> > When packet_mode is 0, the profile rates and bucket sizes are
> > specified in bytes per second and bytes
> > when packet_mode is not 0, the profile rates and bucket sizes are
> > specified in packets and packets per second.
> >
> > The below structure will be extended:
> > rte_mtr_meter_profile
> > rte_mtr_capabilities
> >
> > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > Acked-by: Matan Azrad <matan@nvidia.com>


Acked-by: Jerin Jacob <jerinj@marvell.com>


> > ---
> >  doc/guides/rel_notes/release_21_05.rst | 12 ++++
> >  lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
> >  2 files changed, 91 insertions(+), 11 deletions(-)
> >
> > diff --git a/doc/guides/rel_notes/release_21_05.rst
> > b/doc/guides/rel_notes/release_21_05.rst
> > index f199ad286d..b4653d63a1 100644
> > --- a/doc/guides/rel_notes/release_21_05.rst
> > +++ b/doc/guides/rel_notes/release_21_05.rst
> > @@ -152,6 +152,18 @@ New Features
> >    * ethdev: Added RTE_FLOW_ACTION_TYPE_METER_COLOR in enum
> > rte_flow_action_type.
> >    * ethdev: Added RTE_MTR_ERROR_TYPE_METER_POLICY_ID and
> > RTE_MTR_ERROR_TYPE_METER_POLICY_ID into rte_mtr_error_type.
> >
> > +* **Added support for meter PPS profile.**
> > +
> > +  Currently meter algorithms only supports bytes per second(BPS).
> > +  Add packet_mode in the meter profile parameters data structures
> > +  to support packet per second (PPS) mode.
> > +  So that it can meter traffic by packet per second.
> > +  Packet_mode must be 0 when it is bytes mode.
> > +
> > +* **Updated MLX5 driver.**
> > +
> > +  * Added support for meter profile packet per second mode
> > (packet_mode).
> > +
> >  Removed Items
> >  -------------
> >
> > diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
> > index 4938ef065f..778fad7638 100644
> > --- a/lib/librte_ethdev/rte_mtr.h
> > +++ b/lib/librte_ethdev/rte_mtr.h
> > @@ -133,46 +133,71 @@ struct rte_mtr_meter_profile {
> >       union {
> >               /** Items only valid when *alg* is set to srTCM - RFC 2697. */
> >               struct {
> > -                     /** Committed Information Rate (CIR)
> > (bytes/second). */
> > +                     /**
> > +                      * Committed Information Rate (CIR)
> > +                      * (bytes per second or packets per second).
> > +                      */
> >                       uint64_t cir;
> >
> > -                     /** Committed Burst Size (CBS) (bytes). */
> > +                     /** Committed Burst Size (CBS) (bytes or packets). */
> >                       uint64_t cbs;
> >
> > -                     /** Excess Burst Size (EBS) (bytes). */
> > +                     /** Excess Burst Size (EBS) (bytes or packets). */
> >                       uint64_t ebs;
> >               } srtcm_rfc2697;
> >
> >               /** Items only valid when *alg* is set to trTCM - RFC 2698. */
> >               struct {
> > -                     /** Committed Information Rate (CIR)
> > (bytes/second). */
> > +                     /**
> > +                      * Committed Information Rate (CIR)
> > +                      * (bytes per second or packets per second).
> > +                      */
> >                       uint64_t cir;
> >
> > -                     /** Peak Information Rate (PIR) (bytes/second). */
> > +                     /**
> > +                      * Peak Information Rate (PIR)
> > +                      * (bytes per second or packets per second).
> > +                      */
> >                       uint64_t pir;
> >
> > -                     /** Committed Burst Size (CBS) (byes). */
> > +                     /** Committed Burst Size (CBS) (bytes or packets). */
> >                       uint64_t cbs;
> >
> > -                     /** Peak Burst Size (PBS) (bytes). */
> > +                     /** Peak Burst Size (PBS) (bytes or packets). */
> >                       uint64_t pbs;
> >               } trtcm_rfc2698;
> >
> >               /** Items only valid when *alg* is set to trTCM - RFC 4115. */
> >               struct {
> > -                     /** Committed Information Rate (CIR)
> > (bytes/second). */
> > +                     /**
> > +                      * Committed Information Rate (CIR)
> > +                      * (bytes per second or packets per second).
> > +                      */
> >                       uint64_t cir;
> >
> > -                     /** Excess Information Rate (EIR) (bytes/second). */
> > +                     /**
> > +                      * Excess Information Rate (EIR)
> > +                      * (bytes per second or packets per second).
> > +                      */
> >                       uint64_t eir;
> >
> > -                     /** Committed Burst Size (CBS) (byes). */
> > +                     /** Committed Burst Size (CBS) (bytes or packets). */
> >                       uint64_t cbs;
> >
> > -                     /** Excess Burst Size (EBS) (bytes). */
> > +                     /** Excess Burst Size (EBS) (bytes or packets). */
> >                       uint64_t ebs;
> >               } trtcm_rfc4115;
> >       };
> > +
> > +     /**
> > +      * When zero, the byte mode is enabled for the current profile, so
> > the
> > +      * *rate* and *size* fields are specified in bytes per second
> > +      * and bytes, respectively.
> > +      * When non-zero, the packet mode is enabled for the current
> > profile,
> > +      * so the *rate* and *size* fields are specified in packets per second
> > +      * and packets, respectively.
> > +      */
> > +     int packet_mode;
> >  };
> >
> >  /**
> > @@ -346,6 +371,48 @@ struct rte_mtr_capabilities {
> >        */
> >       int color_aware_trtcm_rfc4115_supported;
> >
> > +     /**
> > +      * srTCM rfc2697 byte mode supported.
> > +      * When non-zero, it indicates that byte mode is supported for
> > +      * the srTCM RFC 2697 metering algorithm.
> > +      */
> > +     int srtcm_rfc2697_byte_mode_supported;
> > +
> > +     /**
> > +      * srTCM rfc2697 packet mode supported.
> > +      * When non-zero, it indicates that packet mode is supported for
> > +      * the srTCM RFC 2697 metering algorithm.
> > +      */
> > +     int srtcm_rfc2697_packet_mode_supported;
> > +
> > +     /**
> > +      * trTCM rfc2698 byte mode supported.
> > +      * When non-zero, it indicates that byte mode is supported for
> > +      * the trTCM RFC 2698 metering algorithm.
> > +      */
> > +     int trtcm_rfc2698_byte_mode_supported;
> > +
> > +     /**
> > +      * trTCM rfc2698 packet mode supported.
> > +      * When non-zero, it indicates that packet mode is supported for
> > +      * the trTCM RFC 2698 metering algorithm.
> > +      */
> > +     int trtcm_rfc2698_packet_mode_supported;
> > +
> > +     /**
> > +      * trTCM rfc4115 byte mode supported.
> > +      * When non-zero, it indicates that byte mode is supported for
> > +      * the trTCM RFC 4115 metering algorithm.
> > +      */
> > +     int trtcm_rfc4115_byte_mode_supported;
> > +
> > +     /**
> > +      * trTCM rfc4115 packet mode supported.
> > +      * When non-zero, it indicates that packet mode is supported for
> > +      * the trTCM RFC 4115 metering algorithm.
> > +      */
> > +     int trtcm_rfc4115_packet_mode_supported;
> > +
> >       /** Set of supported statistics counter types.
> >        * @see enum rte_mtr_stats_type
> >        */
> > @@ -363,6 +430,7 @@ enum rte_mtr_error_type {
> >       RTE_MTR_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
> >       RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
> >       RTE_MTR_ERROR_TYPE_METER_PROFILE,
> > +     RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
> >       RTE_MTR_ERROR_TYPE_MTR_ID,
> >       RTE_MTR_ERROR_TYPE_MTR_PARAMS,
> >       RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
> > --
> > 2.21.0
>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/4] app/testpmd: add meter profile packet mode option
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 2/4] app/testpmd: add meter profile packet mode option Li Zhang
@ 2021-04-12 23:51       ` Ferruh Yigit
  2021-04-13  2:57         ` Li Zhang
  0 siblings, 1 reply; 47+ messages in thread
From: Ferruh Yigit @ 2021-04-12 23:51 UTC (permalink / raw)
  To: Li Zhang, dekelp, orika, viacheslavo, matan, shahafs,
	cristian.dumitrescu, lironh, Xiaoyun Li
  Cc: dev, thomas, rasland, roniba

On 4/10/2021 8:24 AM, Li Zhang wrote:
> add meter profile packet_mode to the ethernet device.
> One example:
> add port meter profile rfc2697 (port_id) (profile_id)
> (cir) (cbs) (ebs) (packet_mode)
> 
> Signed-off-by: Li Zhang <lizh@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>

<...>

> @@ -365,7 +383,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
>   cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
>   	.f = cmd_add_port_meter_profile_srtcm_parsed,
>   	.data = NULL,
> -	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs>",
> +	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs> <packet_mode>",

Can you please update 'cmd_help_long_parsed()' in 'cmdline.c' for the command 
updates?

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter
  2021-04-10  7:24   ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Li Zhang
                       ` (3 preceding siblings ...)
  2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 4/4] net/mvpp2: " Li Zhang
@ 2021-04-12 23:54     ` Ferruh Yigit
  2021-04-13  2:53       ` Li Zhang
  4 siblings, 1 reply; 47+ messages in thread
From: Ferruh Yigit @ 2021-04-12 23:54 UTC (permalink / raw)
  To: Li Zhang, dekelp, orika, viacheslavo, matan, shahafs,
	cristian.dumitrescu, lironh
  Cc: dev, thomas, rasland, roniba

On 4/10/2021 8:24 AM, Li Zhang wrote:
> Currently meter algorithms only supports rate is bytes per second(BPS).
> Add packet_mode flag in meter profile parameters data structure.
> So that it can meter traffic by packet per second.
> 
> When packet_mode is 0, the profile rates and bucket sizes are
> specified in bytes per second and bytes
> when packet_mode is not 0, the profile rates and bucket sizes are
> specified in packets and packets per second.
> 
> Add the necessary checks to the existing drivers implementing
> the rte_mtr API to makes sure that profiles with
> packet_mode set to TRUE are rejected.
> 
> RFC ("adds support PPS(packet per second) on meter")
> https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769-2-lizh@nvidia.com/
> 
> Depends-on: series=15998  ("Add ASO meter support in MLX5 PMD")
> https://patchwork.dpdk.org/project/dpdk/list/?series=15998
> 

Above patch is mlx5 patch, but this driver doesn't update mlx5, is above 
dependency correct?

And there is apply errors in the set, that is preventing CI to run on it, can 
you please rebase on latest master to enable CI?

> V2: create a unified patch that contains both the series with
> 	the API changes and the series with the necessary error checks in the drivers.
> 
> V3: Fix comments from Matan and Cristian.
> 
> Li Zhang (4):
>    ethdev: add packet mode in meter profile structure
>    app/testpmd: add meter profile packet mode option
>    net/softnic: check meter packet mode
>    net/mvpp2: check meter packet mode
> 
>   app/test-pmd/cmdline_mtr.c                  | 40 ++++++++-
>   doc/guides/rel_notes/release_21_05.rst      | 12 +++
>   doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 +++----
>   drivers/net/mvpp2/mrvl_mtr.c                |  6 ++
>   drivers/net/softnic/rte_eth_softnic_meter.c |  8 ++
>   lib/librte_ethdev/rte_mtr.h                 | 90 ++++++++++++++++++---
>   6 files changed, 159 insertions(+), 28 deletions(-)
> 


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter
  2021-04-12 23:54     ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Ferruh Yigit
@ 2021-04-13  2:53       ` Li Zhang
  0 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-13  2:53 UTC (permalink / raw)
  To: Ferruh Yigit, dekelp, Ori Kam, Slava Ovsiienko, Matan Azrad,
	Shahaf Shuler, cristian.dumitrescu, lironh
  Cc: dev, NBU-Contact-Thomas Monjalon, Raslan Darawsheh, Roni Bar Yanai

Hi Ferruh,

You are right.
 I will delete this series=15998 and also rebase on latest master in V4 patch.

Regards,
Li Zhang

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Tuesday, April 13, 2021 7:55 AM
> To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>;
> cristian.dumitrescu@intel.com; lironh@marvell.com
> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> Raslan Darawsheh <rasland@nvidia.com>; Roni Bar Yanai
> <roniba@nvidia.com>
> Subject: Re: [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on
> meter
> 
> External email: Use caution opening links or attachments
> 
> 
> On 4/10/2021 8:24 AM, Li Zhang wrote:
> > Currently meter algorithms only supports rate is bytes per second(BPS).
> > Add packet_mode flag in meter profile parameters data structure.
> > So that it can meter traffic by packet per second.
> >
> > When packet_mode is 0, the profile rates and bucket sizes are
> > specified in bytes per second and bytes when packet_mode is not 0, the
> > profile rates and bucket sizes are specified in packets and packets
> > per second.
> >
> > Add the necessary checks to the existing drivers implementing the
> > rte_mtr API to makes sure that profiles with packet_mode set to TRUE
> > are rejected.
> >
> > RFC ("adds support PPS(packet per second) on meter")
> > https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769-
> 2
> > -lizh@nvidia.com/
> >
> > Depends-on: series=15998  ("Add ASO meter support in MLX5 PMD")
> > https://patchwork.dpdk.org/project/dpdk/list/?series=15998
> >
> 
> Above patch is mlx5 patch, but this driver doesn't update mlx5, is above
> dependency correct?
> 
> And there is apply errors in the set, that is preventing CI to run on it, can you
> please rebase on latest master to enable CI?
> 
> > V2: create a unified patch that contains both the series with
> >       the API changes and the series with the necessary error checks in the
> drivers.
> >
> > V3: Fix comments from Matan and Cristian.
> >
> > Li Zhang (4):
> >    ethdev: add packet mode in meter profile structure
> >    app/testpmd: add meter profile packet mode option
> >    net/softnic: check meter packet mode
> >    net/mvpp2: check meter packet mode
> >
> >   app/test-pmd/cmdline_mtr.c                  | 40 ++++++++-
> >   doc/guides/rel_notes/release_21_05.rst      | 12 +++
> >   doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 +++----
> >   drivers/net/mvpp2/mrvl_mtr.c                |  6 ++
> >   drivers/net/softnic/rte_eth_softnic_meter.c |  8 ++
> >   lib/librte_ethdev/rte_mtr.h                 | 90 ++++++++++++++++++---
> >   6 files changed, 159 insertions(+), 28 deletions(-)
> >


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/4] app/testpmd: add meter profile packet mode option
  2021-04-12 23:51       ` Ferruh Yigit
@ 2021-04-13  2:57         ` Li Zhang
  0 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-13  2:57 UTC (permalink / raw)
  To: Ferruh Yigit, dekelp, Ori Kam, Slava Ovsiienko, Matan Azrad,
	Shahaf Shuler, cristian.dumitrescu, lironh, Xiaoyun Li
  Cc: dev, NBU-Contact-Thomas Monjalon, Raslan Darawsheh, Roni Bar Yanai

Hi Ferruh,

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Tuesday, April 13, 2021 7:51 AM
> To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>;
> cristian.dumitrescu@intel.com; lironh@marvell.com; Xiaoyun Li
> <xiaoyun.li@intel.com>
> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> Raslan Darawsheh <rasland@nvidia.com>; Roni Bar Yanai
> <roniba@nvidia.com>
> Subject: Re: [dpdk-dev] [PATCH v3 2/4] app/testpmd: add meter profile packet
> mode option
> 
> External email: Use caution opening links or attachments
> 
> 
> On 4/10/2021 8:24 AM, Li Zhang wrote:
> > add meter profile packet_mode to the ethernet device.
> > One example:
> > add port meter profile rfc2697 (port_id) (profile_id)
> > (cir) (cbs) (ebs) (packet_mode)
> >
> > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > Acked-by: Matan Azrad <matan@nvidia.com>
> 
> <...>
> 
> > @@ -365,7 +383,7 @@ static void
> cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
> >   cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
> >       .f = cmd_add_port_meter_profile_srtcm_parsed,
> >       .data = NULL,
> > -     .help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id>
> <cir> <cbs> <ebs>",
> > +     .help_str = "add port meter profile srtcm_rfc2697 <port_id>
> > + <profile_id> <cir> <cbs> <ebs> <packet_mode>",
> 
> Can you please update 'cmd_help_long_parsed()' in 'cmdline.c' for the
> command updates?

Sure, will update it in V4 patch.

Regards,
Li Zhang

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure
  2021-04-12 19:28         ` Jerin Jacob
@ 2021-04-13  3:48           ` Ajit Khaparde
  0 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2021-04-13  3:48 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Dumitrescu, Cristian, Li Zhang, dekelp, orika, viacheslavo,
	matan, shahafs, lironh, Thomas Monjalon, Yigit, Ferruh,
	Andrew Rybchenko, dev, rasland, roniba

[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]

On Mon, Apr 12, 2021 at 12:29 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
>
> On Tue, Apr 13, 2021 at 12:54 AM Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Li Zhang <lizh@nvidia.com>
> > > Sent: Saturday, April 10, 2021 8:25 AM
> > > To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com;
> > > matan@nvidia.com; shahafs@nvidia.com; Dumitrescu, Cristian
> > > <cristian.dumitrescu@intel.com>; lironh@marvell.com; Thomas Monjalon
> > > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > > Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > > Cc: dev@dpdk.org; rasland@nvidia.com; roniba@nvidia.com
> > > Subject: [PATCH v3 1/4] ethdev: add packet mode in meter profile structure
> > >
> > > Currently meter algorithms only supports rate is bytes per second(BPS).
> > > Add packet_mode flag in meter profile parameters data structure.
> > > So that it can meter traffic by packet per second.
> > >
> > > When packet_mode is 0, the profile rates and bucket sizes are
> > > specified in bytes per second and bytes
> > > when packet_mode is not 0, the profile rates and bucket sizes are
> > > specified in packets and packets per second.
> > >
> > > The below structure will be extended:
> > > rte_mtr_meter_profile
> > > rte_mtr_capabilities
> > >
> > > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > > Acked-by: Matan Azrad <matan@nvidia.com>
>
>
> Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v4 0/4] Support PPS(packet per second) on meter
  2021-03-31  8:54 [dpdk-dev] [PATCH 0/2] Support PPS(packet per second) on meter Li Zhang
                   ` (2 preceding siblings ...)
  2021-04-08  3:58 ` [dpdk-dev] [PATCH v2 0/4] Support PPS(packet per second) on meter Li Zhang
@ 2021-04-13  3:50 ` Li Zhang
  2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 1/4] ethdev: add packet mode in meter profile structure Li Zhang
                     ` (4 more replies)
  2021-04-13 15:59 ` [dpdk-dev] [PATCH v5 " Li Zhang
  4 siblings, 5 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-13  3:50 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, jerinj, ferruh.yigit
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports rate is bytes per second(BPS).
Add packet_mode flag in meter profile parameters data structure.
So that it can meter traffic by packet per second.

When packet_mode is 0, the profile rates and bucket sizes are
specified in bytes per second and bytes
when packet_mode is not 0, the profile rates and bucket sizes are
specified in packets and packets per second.

Add the necessary checks to the existing drivers implementing
the rte_mtr API to makes sure that profiles with
packet_mode set to TRUE are rejected.

RFC ("adds support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769-2-lizh@nvidia.com/

Depends-on: series=16301  ("Support meter policy API ")
https://patchwork.dpdk.org/project/dpdk/list/?series=16301

V2: create a unified patch that contains both the series with
	the API changes and the series with the necessary error checks in the drivers.
V3: Fix comments about commit-log.
V4: Fix comments about Depends-on and rebase.

Li Zhang (4):
  ethdev: add packet mode in meter profile structure
  app/testpmd: add meter profile packet mode option
  net/softnic: check meter packet mode
  net/mvpp2: check meter packet mode

 app/test-pmd/cmdline_mtr.c                  | 40 ++++++++-
 doc/guides/rel_notes/release_21_05.rst      | 12 +++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 +++----
 drivers/net/mvpp2/mrvl_mtr.c                |  6 ++
 drivers/net/softnic/rte_eth_softnic_meter.c |  8 ++
 lib/librte_ethdev/rte_mtr.h                 | 90 ++++++++++++++++++---
 6 files changed, 159 insertions(+), 28 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v4 1/4] ethdev: add packet mode in meter profile structure
  2021-04-13  3:50 ` [dpdk-dev] [PATCH v4 " Li Zhang
@ 2021-04-13  3:50   ` Li Zhang
  2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 2/4] app/testpmd: add meter profile packet mode option Li Zhang
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-13  3:50 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, jerinj, ferruh.yigit, Thomas Monjalon, Andrew Rybchenko
  Cc: dev, rasland, roniba

Currently meter algorithms only supports rate is bytes per second(BPS).
Add packet_mode flag in meter profile parameters data structure.
So that it can meter traffic by packet per second.

When packet_mode is 0, the profile rates and bucket sizes are
specified in bytes per second and bytes
when packet_mode is not 0, the profile rates and bucket sizes are
specified in packets and packets per second.

The below structure will be extended:
rte_mtr_meter_profile
rte_mtr_capabilities

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
---
 doc/guides/rel_notes/release_21_05.rst | 12 ++++
 lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 11 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 1b1b4368f6..1f55f475e2 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -183,6 +183,18 @@ New Features
   * ethdev: Added RTE_FLOW_ACTION_TYPE_METER_COLOR in enum rte_flow_action_type.
   * ethdev: Added RTE_MTR_ERROR_TYPE_METER_POLICY_ID and RTE_MTR_ERROR_TYPE_METER_POLICY_ID into rte_mtr_error_type.
 
+* **Added support for meter PPS profile.**
+
+  Currently meter algorithms only supports bytes per second(BPS).
+  Add packet_mode in the meter profile parameters data structures
+  to support packet per second (PPS) mode.
+  So that it can meter traffic by packet per second.
+  Packet_mode must be 0 when it is bytes mode.
+
+* **Updated MLX5 driver.**
+
+  * Added support for meter profile packet per second mode (packet_mode).
+
 Removed Items
 -------------
 
diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
index 9f6f5e1a45..e71d923dda 100644
--- a/lib/librte_ethdev/rte_mtr.h
+++ b/lib/librte_ethdev/rte_mtr.h
@@ -133,46 +133,71 @@ struct rte_mtr_meter_profile {
 	union {
 		/** Items only valid when *alg* is set to srTCM - RFC 2697. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Committed Burst Size (CBS) (bytes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Excess Burst Size (EBS) (bytes). */
+			/** Excess Burst Size (EBS) (bytes or packets). */
 			uint64_t ebs;
 		} srtcm_rfc2697;
 
 		/** Items only valid when *alg* is set to trTCM - RFC 2698. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Peak Information Rate (PIR) (bytes/second). */
+			/**
+			 * Peak Information Rate (PIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t pir;
 
-			/** Committed Burst Size (CBS) (byes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Peak Burst Size (PBS) (bytes). */
+			/** Peak Burst Size (PBS) (bytes or packets). */
 			uint64_t pbs;
 		} trtcm_rfc2698;
 
 		/** Items only valid when *alg* is set to trTCM - RFC 4115. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Excess Information Rate (EIR) (bytes/second). */
+			/**
+			 * Excess Information Rate (EIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t eir;
 
-			/** Committed Burst Size (CBS) (byes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Excess Burst Size (EBS) (bytes). */
+			/** Excess Burst Size (EBS) (bytes or packets). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
 	};
+
+	/**
+	 * When zero, the byte mode is enabled for the current profile, so the
+	 * *rate* and *size* fields are specified in bytes per second
+	 * and bytes, respectively.
+	 * When non-zero, the packet mode is enabled for the current profile,
+	 * so the *rate* and *size* fields are specified in packets per second
+	 * and packets, respectively.
+	 */
+	int packet_mode;
 };
 
 /**
@@ -346,6 +371,48 @@ struct rte_mtr_capabilities {
 	 */
 	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * srTCM rfc2697 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the srTCM RFC 2697 metering algorithm.
+	 */
+	int srtcm_rfc2697_byte_mode_supported;
+
+	/**
+	 * srTCM rfc2697 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the srTCM RFC 2697 metering algorithm.
+	 */
+	int srtcm_rfc2697_packet_mode_supported;
+
+	/**
+	 * trTCM rfc2698 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the trTCM RFC 2698 metering algorithm.
+	 */
+	int trtcm_rfc2698_byte_mode_supported;
+
+	/**
+	 * trTCM rfc2698 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the trTCM RFC 2698 metering algorithm.
+	 */
+	int trtcm_rfc2698_packet_mode_supported;
+
+	/**
+	 * trTCM rfc4115 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the trTCM RFC 4115 metering algorithm.
+	 */
+	int trtcm_rfc4115_byte_mode_supported;
+
+	/**
+	 * trTCM rfc4115 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the trTCM RFC 4115 metering algorithm.
+	 */
+	int trtcm_rfc4115_packet_mode_supported;
+
 	/** Set of supported statistics counter types.
 	 * @see enum rte_mtr_stats_type
 	 */
@@ -363,6 +430,7 @@ enum rte_mtr_error_type {
 	RTE_MTR_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
 	RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
 	RTE_MTR_ERROR_TYPE_METER_PROFILE,
+	RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
 	RTE_MTR_ERROR_TYPE_MTR_ID,
 	RTE_MTR_ERROR_TYPE_MTR_PARAMS,
 	RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v4 2/4] app/testpmd: add meter profile packet mode option
  2021-04-13  3:50 ` [dpdk-dev] [PATCH v4 " Li Zhang
  2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 1/4] ethdev: add packet mode in meter profile structure Li Zhang
@ 2021-04-13  3:50   ` Li Zhang
  2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 3/4] net/softnic: check meter packet mode Li Zhang
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-13  3:50 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, jerinj, ferruh.yigit, Xiaoyun Li
  Cc: dev, thomas, rasland, roniba

add meter profile packet_mode to the ethernet device.
One example:
add port meter profile rfc2697 (port_id) (profile_id)
(cir) (cbs) (ebs) (packet_mode)

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 app/test-pmd/cmdline.c                      |  6 ++--
 app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
 3 files changed, 57 insertions(+), 20 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 6c6184a170..b5a78055dc 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -693,13 +693,13 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"show port meter cap (port_id)\n"
 			"    Show port meter capability information\n\n"
 
-			"add port meter profile srtcm_rfc2697 (port_id) (profile_id) (cir) (cbs) (ebs)\n"
+			"add port meter profile srtcm_rfc2697 (port_id) (profile_id) (cir) (cbs) (ebs) (packet_mode)\n"
 			"    meter profile add - srtcm rfc 2697\n\n"
 
-			"add port meter profile trtcm_rfc2698 (port_id) (profile_id) (cir) (pir) (cbs) (pbs)\n"
+			"add port meter profile trtcm_rfc2698 (port_id) (profile_id) (cir) (pir) (cbs) (pbs) (packet_mode)\n"
 			"    meter profile add - trtcm rfc 2698\n\n"
 
-			"add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs)\n"
+			"add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs) (packet_mode)\n"
 			"    meter profile add - trtcm rfc 4115\n\n"
 
 			"del port meter profile (port_id) (profile_id)\n"
diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index bdc9ae8bfe..eff2473e7b 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -263,6 +263,18 @@ 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.srtcm_rfc2697_byte_mode_supported %" PRId32 "\n",
+		cap.srtcm_rfc2697_byte_mode_supported);
+	printf("cap.srtcm_rfc2697_packet_mode_supported %" PRId32 "\n",
+		cap.srtcm_rfc2697_packet_mode_supported);
+	printf("cap.trtcm_rfc2698_byte_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc2698_byte_mode_supported);
+	printf("cap.trtcm_rfc2698_packet_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc2698_packet_mode_supported);
+	printf("cap.trtcm_rfc4115_byte_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc4115_byte_mode_supported);
+	printf("cap.trtcm_rfc4115_packet_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc4115_packet_mode_supported);
 	printf("cap.stats_mask %" PRIx64 "\n", cap.stats_mask);
 }
 
@@ -292,6 +304,7 @@ struct cmd_add_port_meter_profile_srtcm_result {
 	uint64_t cir;
 	uint64_t cbs;
 	uint64_t ebs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcm_add =
@@ -333,6 +346,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_ebs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_srtcm_result,
 			ebs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcm_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -354,6 +371,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 	mp.srtcm_rfc2697.cir = res->cir;
 	mp.srtcm_rfc2697.cbs = res->cbs;
 	mp.srtcm_rfc2697.ebs = res->ebs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -365,7 +383,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 	.f = cmd_add_port_meter_profile_srtcm_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs>",
+	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_srtcm_add,
 		(void *)&cmd_add_port_meter_profile_srtcm_port,
@@ -377,6 +395,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 		(void *)&cmd_add_port_meter_profile_srtcm_cir,
 		(void *)&cmd_add_port_meter_profile_srtcm_cbs,
 		(void *)&cmd_add_port_meter_profile_srtcm_ebs,
+		(void *)&cmd_add_port_meter_profile_srtcm_packet_mode,
 		NULL,
 	},
 };
@@ -394,6 +413,7 @@ struct cmd_add_port_meter_profile_trtcm_result {
 	uint64_t pir;
 	uint64_t cbs;
 	uint64_t pbs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_add =
@@ -439,6 +459,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_pbs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_trtcm_result,
 			pbs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_trtcm_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -461,6 +485,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 	mp.trtcm_rfc2698.pir = res->pir;
 	mp.trtcm_rfc2698.cbs = res->cbs;
 	mp.trtcm_rfc2698.pbs = res->pbs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -472,7 +497,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 	.f = cmd_add_port_meter_profile_trtcm_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs>",
+	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_port,
@@ -485,6 +510,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 		(void *)&cmd_add_port_meter_profile_trtcm_pir,
 		(void *)&cmd_add_port_meter_profile_trtcm_cbs,
 		(void *)&cmd_add_port_meter_profile_trtcm_pbs,
+		(void *)&cmd_add_port_meter_profile_trtcm_packet_mode,
 		NULL,
 	},
 };
@@ -502,6 +528,7 @@ struct cmd_add_port_meter_profile_trtcm_rfc4115_result {
 	uint64_t eir;
 	uint64_t cbs;
 	uint64_t ebs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_rfc4115_add =
@@ -549,6 +576,11 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_rfc4115_ebs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
 			ebs, RTE_UINT64);
+cmdline_parse_token_num_t
+	cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 	void *parsed_result,
@@ -573,6 +605,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 	mp.trtcm_rfc4115.eir = res->eir;
 	mp.trtcm_rfc4115.cbs = res->cbs;
 	mp.trtcm_rfc4115.ebs = res->ebs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -584,7 +617,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 	.f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs>",
+	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port,
@@ -597,6 +630,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_eir,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_cbs,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_ebs,
+		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode,
 		NULL,
 	},
 };
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index b596ee9a14..4e3f697935 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2716,14 +2716,15 @@ add port meter profile (srTCM rfc2967)
 Add meter profile (srTCM rfc2697) to the ethernet device::
 
    testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
-   (cir) (cbs) (ebs)
+   (cir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed Information Rate (CIR) (bytes/second).
-* ``cbs``: Committed Burst Size (CBS) (bytes).
-* ``ebs``: Excess Burst Size (EBS) (bytes).
+* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second).
+* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
+* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc2968)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2731,15 +2732,16 @@ add port meter profile (trTCM rfc2968)
 Add meter profile (srTCM rfc2698) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
-   (cir) (pir) (cbs) (pbs)
+   (cir) (pir) (cbs) (pbs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``pir``: Peak information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``pbs``: Peak burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``pir``: Peak information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``pbs``: Peak burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc4115)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2747,15 +2749,16 @@ add port meter profile (trTCM rfc4115)
 Add meter profile (trTCM rfc4115) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
-   (cir) (eir) (cbs) (ebs)
+   (cir) (eir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``eir``: Excess information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``ebs``: Excess burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``eir``: Excess information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``ebs``: Excess burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v4 3/4] net/softnic: check meter packet mode
  2021-04-13  3:50 ` [dpdk-dev] [PATCH v4 " Li Zhang
  2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 1/4] ethdev: add packet mode in meter profile structure Li Zhang
  2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 2/4] app/testpmd: add meter profile packet mode option Li Zhang
@ 2021-04-13  3:50   ` Li Zhang
  2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 4/4] net/mvpp2: " Li Zhang
  2021-04-13 10:24   ` [dpdk-dev] [PATCH v4 0/4] Support PPS(packet per second) on meter Ferruh Yigit
  4 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-13  3:50 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, jerinj, ferruh.yigit, Jasvinder Singh
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports bytes per second(BPS).
Check packet_mode set to TRUE are rejected.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 drivers/net/softnic/rte_eth_softnic_meter.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c b/drivers/net/softnic/rte_eth_softnic_meter.c
index 2a05a85cdb..046e629f17 100644
--- a/drivers/net/softnic/rte_eth_softnic_meter.c
+++ b/drivers/net/softnic/rte_eth_softnic_meter.c
@@ -107,6 +107,14 @@ meter_profile_check(struct rte_eth_dev *dev,
 			NULL,
 			"Metering alg not supported");
 
+	/* Not support packet mode, just support byte mode. */
+	if (profile->packet_mode)
+		return -rte_mtr_error_set(error,
+			EINVAL,
+			RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
+			NULL,
+			"Meter packet mode not supported");
+
 	return 0;
 }
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v4 4/4] net/mvpp2: check meter packet mode
  2021-04-13  3:50 ` [dpdk-dev] [PATCH v4 " Li Zhang
                     ` (2 preceding siblings ...)
  2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 3/4] net/softnic: check meter packet mode Li Zhang
@ 2021-04-13  3:50   ` Li Zhang
  2021-04-13  5:42     ` [dpdk-dev] [EXT] " Liron Himi
  2021-04-13 10:24   ` [dpdk-dev] [PATCH v4 0/4] Support PPS(packet per second) on meter Ferruh Yigit
  4 siblings, 1 reply; 47+ messages in thread
From: Li Zhang @ 2021-04-13  3:50 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, jerinj, ferruh.yigit
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports bytes per second(BPS).
Check packet_mode set to TRUE are rejected.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mvpp2/mrvl_mtr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mvpp2/mrvl_mtr.c b/drivers/net/mvpp2/mrvl_mtr.c
index 2fa5cb43ad..c07ac95ddc 100644
--- a/drivers/net/mvpp2/mrvl_mtr.c
+++ b/drivers/net/mvpp2/mrvl_mtr.c
@@ -88,6 +88,12 @@ mrvl_meter_profile_add(struct rte_eth_dev *dev, uint32_t meter_profile_id,
 					  NULL,
 					  "Only srTCM RFC 2697 is supported\n");
 
+	if (profile->packet_mode)
+		return -rte_mtr_error_set(error, EINVAL,
+				RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
+				NULL,
+				"Packet mode is not supported\n");
+
 	prof = mrvl_mtr_profile_from_id(priv, meter_profile_id);
 	if (prof)
 		return -rte_mtr_error_set(error, EEXIST,
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH v4 4/4] net/mvpp2: check meter packet mode
  2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 4/4] net/mvpp2: " Li Zhang
@ 2021-04-13  5:42     ` Liron Himi
  0 siblings, 0 replies; 47+ messages in thread
From: Liron Himi @ 2021-04-13  5:42 UTC (permalink / raw)
  To: Li Zhang, dekelp, orika, viacheslavo, matan, shahafs,
	cristian.dumitrescu, Jerin Jacob Kollanukkaran, ferruh.yigit
  Cc: dev, thomas, rasland, roniba, Liron Himi


Acked-by: Liron Himi <lironh@marvell.com>

-----Original Message-----
From: Li Zhang <lizh@nvidia.com> 
Sent: Tuesday, 13 April 2021 06:51
To: dekelp@nvidia.com; orika@nvidia.com; viacheslavo@nvidia.com; matan@nvidia.com; shahafs@nvidia.com; cristian.dumitrescu@intel.com; Liron Himi <lironh@marvell.com>; Jerin Jacob Kollanukkaran <jerinj@marvell.com>; ferruh.yigit@intel.com
Cc: dev@dpdk.org; thomas@monjalon.net; rasland@nvidia.com; roniba@nvidia.com
Subject: [EXT] [PATCH v4 4/4] net/mvpp2: check meter packet mode

External Email

----------------------------------------------------------------------
Currently meter algorithms only supports bytes per second(BPS).
Check packet_mode set to TRUE are rejected.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mvpp2/mrvl_mtr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mvpp2/mrvl_mtr.c b/drivers/net/mvpp2/mrvl_mtr.c index 2fa5cb43ad..c07ac95ddc 100644
--- a/drivers/net/mvpp2/mrvl_mtr.c
+++ b/drivers/net/mvpp2/mrvl_mtr.c
@@ -88,6 +88,12 @@ mrvl_meter_profile_add(struct rte_eth_dev *dev, uint32_t meter_profile_id,
 					  NULL,
 					  "Only srTCM RFC 2697 is supported\n");
 
+	if (profile->packet_mode)
+		return -rte_mtr_error_set(error, EINVAL,
+				RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
+				NULL,
+				"Packet mode is not supported\n");
+
 	prof = mrvl_mtr_profile_from_id(priv, meter_profile_id);
 	if (prof)
 		return -rte_mtr_error_set(error, EEXIST,
--
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v4 0/4] Support PPS(packet per second) on meter
  2021-04-13  3:50 ` [dpdk-dev] [PATCH v4 " Li Zhang
                     ` (3 preceding siblings ...)
  2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 4/4] net/mvpp2: " Li Zhang
@ 2021-04-13 10:24   ` Ferruh Yigit
  2021-04-13 11:02     ` Li Zhang
  4 siblings, 1 reply; 47+ messages in thread
From: Ferruh Yigit @ 2021-04-13 10:24 UTC (permalink / raw)
  To: Li Zhang, dekelp, orika, viacheslavo, matan, shahafs,
	cristian.dumitrescu, lironh, jerinj
  Cc: dev, thomas, rasland, roniba

On 4/13/2021 4:50 AM, Li Zhang wrote:
> Currently meter algorithms only supports rate is bytes per second(BPS).
> Add packet_mode flag in meter profile parameters data structure.
> So that it can meter traffic by packet per second.
> 
> When packet_mode is 0, the profile rates and bucket sizes are
> specified in bytes per second and bytes
> when packet_mode is not 0, the profile rates and bucket sizes are
> specified in packets and packets per second.
> 
> Add the necessary checks to the existing drivers implementing
> the rte_mtr API to makes sure that profiles with
> packet_mode set to TRUE are rejected.
> 
> RFC ("adds support PPS(packet per second) on meter")
> https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769-2-lizh@nvidia.com/
> 
> Depends-on: series=16301  ("Support meter policy API ")
> https://patchwork.dpdk.org/project/dpdk/list/?series=16301
> 

Hi Li,

I am not clear with the dependency chain, can you please clarify,

1) Is this set depends to series-16301? Because it compiles fine after conflict 
resolved, I can see in your repo there is an order, but if there is no 
functional/logical dependency you can set this patch exactly on top of HEAD 
(removing the series-16301 in between), so the CI will be enabled.

2) According its cover letter series-16301 depends on mlx ASO patch, this makes 
all ethdev patches dependent to mlx5 set, I guess that is wrong, can you please 
confirm?

Above (1) is more important, since series-16301 not fully acked, it is blocking 
me to proceed.

> V2: create a unified patch that contains both the series with
> 	the API changes and the series with the necessary error checks in the drivers.
> V3: Fix comments about commit-log.
> V4: Fix comments about Depends-on and rebase.
> 
> Li Zhang (4):
>    ethdev: add packet mode in meter profile structure
>    app/testpmd: add meter profile packet mode option
>    net/softnic: check meter packet mode
>    net/mvpp2: check meter packet mode
> 
>   app/test-pmd/cmdline_mtr.c                  | 40 ++++++++-
>   doc/guides/rel_notes/release_21_05.rst      | 12 +++
>   doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 +++----
>   drivers/net/mvpp2/mrvl_mtr.c                |  6 ++
>   drivers/net/softnic/rte_eth_softnic_meter.c |  8 ++
>   lib/librte_ethdev/rte_mtr.h                 | 90 ++++++++++++++++++---
>   6 files changed, 159 insertions(+), 28 deletions(-)
> 


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v4 0/4] Support PPS(packet per second) on meter
  2021-04-13 10:24   ` [dpdk-dev] [PATCH v4 0/4] Support PPS(packet per second) on meter Ferruh Yigit
@ 2021-04-13 11:02     ` Li Zhang
  2021-04-13 11:05       ` Ferruh Yigit
  0 siblings, 1 reply; 47+ messages in thread
From: Li Zhang @ 2021-04-13 11:02 UTC (permalink / raw)
  To: Ferruh Yigit, dekelp, Ori Kam, Slava Ovsiienko, Matan Azrad,
	Shahaf Shuler, cristian.dumitrescu, lironh, jerinj
  Cc: dev, NBU-Contact-Thomas Monjalon, Raslan Darawsheh, Roni Bar Yanai

Hi Ferruh,

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Tuesday, April 13, 2021 6:25 PM
> To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>;
> cristian.dumitrescu@intel.com; lironh@marvell.com; jerinj@marvell.com
> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> Raslan Darawsheh <rasland@nvidia.com>; Roni Bar Yanai
> <roniba@nvidia.com>
> Subject: Re: [PATCH v4 0/4] Support PPS(packet per second) on meter
> 
> External email: Use caution opening links or attachments
> 
> 
> On 4/13/2021 4:50 AM, Li Zhang wrote:
> > Currently meter algorithms only supports rate is bytes per second(BPS).
> > Add packet_mode flag in meter profile parameters data structure.
> > So that it can meter traffic by packet per second.
> >
> > When packet_mode is 0, the profile rates and bucket sizes are
> > specified in bytes per second and bytes when packet_mode is not 0, the
> > profile rates and bucket sizes are specified in packets and packets
> > per second.
> >
> > Add the necessary checks to the existing drivers implementing the
> > rte_mtr API to makes sure that profiles with packet_mode set to TRUE
> > are rejected.
> >
> > RFC ("adds support PPS(packet per second) on meter")
> > https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769-
> 2
> > -lizh@nvidia.com/
> >
> > Depends-on: series=16301  ("Support meter policy API ")
> > https://patchwork.dpdk.org/project/dpdk/list/?series=16301
> >
> 
> Hi Li,
> 
> I am not clear with the dependency chain, can you please clarify,
> 
> 1) Is this set depends to series-16301? Because it compiles fine after conflict
> resolved, I can see in your repo there is an order, but if there is no
> functional/logical dependency you can set this patch exactly on top of HEAD
> (removing the series-16301 in between), so the CI will be enabled.

I will delete series-16301.
But it will merge conflict when series-16301 merged after it.

> 2) According its cover letter series-16301 depends on mlx ASO patch, this
> makes all ethdev patches dependent to mlx5 set, I guess that is wrong, can you
> please confirm?
> 
> Above (1) is more important, since series-16301 not fully acked, it is blocking
> me to proceed.
> 
> > V2: create a unified patch that contains both the series with
> >       the API changes and the series with the necessary error checks in the
> drivers.
> > V3: Fix comments about commit-log.
> > V4: Fix comments about Depends-on and rebase.
> >
> > Li Zhang (4):
> >    ethdev: add packet mode in meter profile structure
> >    app/testpmd: add meter profile packet mode option
> >    net/softnic: check meter packet mode
> >    net/mvpp2: check meter packet mode
> >
> >   app/test-pmd/cmdline_mtr.c                  | 40 ++++++++-
> >   doc/guides/rel_notes/release_21_05.rst      | 12 +++
> >   doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 +++----
> >   drivers/net/mvpp2/mrvl_mtr.c                |  6 ++
> >   drivers/net/softnic/rte_eth_softnic_meter.c |  8 ++
> >   lib/librte_ethdev/rte_mtr.h                 | 90 ++++++++++++++++++---
> >   6 files changed, 159 insertions(+), 28 deletions(-)
> >


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v4 0/4] Support PPS(packet per second) on meter
  2021-04-13 11:02     ` Li Zhang
@ 2021-04-13 11:05       ` Ferruh Yigit
  2021-04-13 15:46         ` Li Zhang
  0 siblings, 1 reply; 47+ messages in thread
From: Ferruh Yigit @ 2021-04-13 11:05 UTC (permalink / raw)
  To: Li Zhang, dekelp, Ori Kam, Slava Ovsiienko, Matan Azrad,
	Shahaf Shuler, cristian.dumitrescu, lironh, jerinj
  Cc: dev, NBU-Contact-Thomas Monjalon, Raslan Darawsheh, Roni Bar Yanai

On 4/13/2021 12:02 PM, Li Zhang wrote:
> Hi Ferruh,
> 
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Tuesday, April 13, 2021 6:25 PM
>> To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
>> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
>> Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>;
>> cristian.dumitrescu@intel.com; lironh@marvell.com; jerinj@marvell.com
>> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
>> Raslan Darawsheh <rasland@nvidia.com>; Roni Bar Yanai
>> <roniba@nvidia.com>
>> Subject: Re: [PATCH v4 0/4] Support PPS(packet per second) on meter
>>
>> External email: Use caution opening links or attachments
>>
>>
>> On 4/13/2021 4:50 AM, Li Zhang wrote:
>>> Currently meter algorithms only supports rate is bytes per second(BPS).
>>> Add packet_mode flag in meter profile parameters data structure.
>>> So that it can meter traffic by packet per second.
>>>
>>> When packet_mode is 0, the profile rates and bucket sizes are
>>> specified in bytes per second and bytes when packet_mode is not 0, the
>>> profile rates and bucket sizes are specified in packets and packets
>>> per second.
>>>
>>> Add the necessary checks to the existing drivers implementing the
>>> rte_mtr API to makes sure that profiles with packet_mode set to TRUE
>>> are rejected.
>>>
>>> RFC ("adds support PPS(packet per second) on meter")
>>> https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769-
>> 2
>>> -lizh@nvidia.com/
>>>
>>> Depends-on: series=16301  ("Support meter policy API ")
>>> https://patchwork.dpdk.org/project/dpdk/list/?series=16301
>>>
>>
>> Hi Li,
>>
>> I am not clear with the dependency chain, can you please clarify,
>>
>> 1) Is this set depends to series-16301? Because it compiles fine after conflict
>> resolved, I can see in your repo there is an order, but if there is no
>> functional/logical dependency you can set this patch exactly on top of HEAD
>> (removing the series-16301 in between), so the CI will be enabled.
> 
> I will delete series-16301.
> But it will merge conflict when series-16301 merged after it.
> 

Please send both this patch, and series-16301 on top of latest head, this 
enables CI for both.

When merging them we can handle the conflict, based on which one merged first, 
or can ask you to rebase the second one but for this case it does not look too 
complex to resolve ourselves.

>> 2) According its cover letter series-16301 depends on mlx ASO patch, this
>> makes all ethdev patches dependent to mlx5 set, I guess that is wrong, can you
>> please confirm?
>>
>> Above (1) is more important, since series-16301 not fully acked, it is blocking
>> me to proceed.
>>
>>> V2: create a unified patch that contains both the series with
>>>        the API changes and the series with the necessary error checks in the
>> drivers.
>>> V3: Fix comments about commit-log.
>>> V4: Fix comments about Depends-on and rebase.
>>>
>>> Li Zhang (4):
>>>     ethdev: add packet mode in meter profile structure
>>>     app/testpmd: add meter profile packet mode option
>>>     net/softnic: check meter packet mode
>>>     net/mvpp2: check meter packet mode
>>>
>>>    app/test-pmd/cmdline_mtr.c                  | 40 ++++++++-
>>>    doc/guides/rel_notes/release_21_05.rst      | 12 +++
>>>    doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 +++----
>>>    drivers/net/mvpp2/mrvl_mtr.c                |  6 ++
>>>    drivers/net/softnic/rte_eth_softnic_meter.c |  8 ++
>>>    lib/librte_ethdev/rte_mtr.h                 | 90 ++++++++++++++++++---
>>>    6 files changed, 159 insertions(+), 28 deletions(-)
>>>
> 


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v4 0/4] Support PPS(packet per second) on meter
  2021-04-13 11:05       ` Ferruh Yigit
@ 2021-04-13 15:46         ` Li Zhang
  0 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-13 15:46 UTC (permalink / raw)
  To: Ferruh Yigit, dekelp, Ori Kam, Slava Ovsiienko, Matan Azrad,
	Shahaf Shuler, cristian.dumitrescu, lironh, jerinj
  Cc: dev, NBU-Contact-Thomas Monjalon, Raslan Darawsheh, Roni Bar Yanai


Hi Ferruh,

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Tuesday, April 13, 2021 7:06 PM
> To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>;
> cristian.dumitrescu@intel.com; lironh@marvell.com; jerinj@marvell.com
> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> Raslan Darawsheh <rasland@nvidia.com>; Roni Bar Yanai
> <roniba@nvidia.com>
> Subject: Re: [PATCH v4 0/4] Support PPS(packet per second) on meter
> 
> External email: Use caution opening links or attachments
> 
> 
> On 4/13/2021 12:02 PM, Li Zhang wrote:
> > Hi Ferruh,
> >
> >> -----Original Message-----
> >> From: Ferruh Yigit <ferruh.yigit@intel.com>
> >> Sent: Tuesday, April 13, 2021 6:25 PM
> >> To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; Ori Kam
> >> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Matan
> >> Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>;
> >> cristian.dumitrescu@intel.com; lironh@marvell.com; jerinj@marvell.com
> >> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>;
> >> Raslan Darawsheh <rasland@nvidia.com>; Roni Bar Yanai
> >> <roniba@nvidia.com>
> >> Subject: Re: [PATCH v4 0/4] Support PPS(packet per second) on meter
> >>
> >> External email: Use caution opening links or attachments
> >>
> >>
> >> On 4/13/2021 4:50 AM, Li Zhang wrote:
> >>> Currently meter algorithms only supports rate is bytes per second(BPS).
> >>> Add packet_mode flag in meter profile parameters data structure.
> >>> So that it can meter traffic by packet per second.
> >>>
> >>> When packet_mode is 0, the profile rates and bucket sizes are
> >>> specified in bytes per second and bytes when packet_mode is not 0,
> >>> the profile rates and bucket sizes are specified in packets and
> >>> packets per second.
> >>>
> >>> Add the necessary checks to the existing drivers implementing the
> >>> rte_mtr API to makes sure that profiles with packet_mode set to TRUE
> >>> are rejected.
> >>>
> >>> RFC ("adds support PPS(packet per second) on meter")
> >>>
> https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769
> >>> -
> >> 2
> >>> -lizh@nvidia.com/
> >>>
> >>> Depends-on: series=16301  ("Support meter policy API ")
> >>> https://patchwork.dpdk.org/project/dpdk/list/?series=16301
> >>>
> >>
> >> Hi Li,
> >>
> >> I am not clear with the dependency chain, can you please clarify,
> >>
> >> 1) Is this set depends to series-16301? Because it compiles fine
> >> after conflict resolved, I can see in your repo there is an order,
> >> but if there is no functional/logical dependency you can set this
> >> patch exactly on top of HEAD (removing the series-16301 in between), so
> the CI will be enabled.
> >
> > I will delete series-16301.
> > But it will merge conflict when series-16301 merged after it.
> >
> 
> Please send both this patch, and series-16301 on top of latest head, this
> enables CI for both.
> 
> When merging them we can handle the conflict, based on which one merged
> first, or can ask you to rebase the second one but for this case it does not look
> too complex to resolve ourselves.
> 

Got it and will sent it on V5 patch.

> >> 2) According its cover letter series-16301 depends on mlx ASO patch,
> >> this makes all ethdev patches dependent to mlx5 set, I guess that is
> >> wrong, can you please confirm?
> >>
> >> Above (1) is more important, since series-16301 not fully acked, it
> >> is blocking me to proceed.
> >>
> >>> V2: create a unified patch that contains both the series with
> >>>        the API changes and the series with the necessary error
> >>> checks in the
> >> drivers.
> >>> V3: Fix comments about commit-log.
> >>> V4: Fix comments about Depends-on and rebase.
> >>>
> >>> Li Zhang (4):
> >>>     ethdev: add packet mode in meter profile structure
> >>>     app/testpmd: add meter profile packet mode option
> >>>     net/softnic: check meter packet mode
> >>>     net/mvpp2: check meter packet mode
> >>>
> >>>    app/test-pmd/cmdline_mtr.c                  | 40 ++++++++-
> >>>    doc/guides/rel_notes/release_21_05.rst      | 12 +++
> >>>    doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 +++----
> >>>    drivers/net/mvpp2/mrvl_mtr.c                |  6 ++
> >>>    drivers/net/softnic/rte_eth_softnic_meter.c |  8 ++
> >>>    lib/librte_ethdev/rte_mtr.h                 | 90 ++++++++++++++++++---
> >>>    6 files changed, 159 insertions(+), 28 deletions(-)
> >>>
> >


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v5 0/4] Support PPS(packet per second) on meter
  2021-03-31  8:54 [dpdk-dev] [PATCH 0/2] Support PPS(packet per second) on meter Li Zhang
                   ` (3 preceding siblings ...)
  2021-04-13  3:50 ` [dpdk-dev] [PATCH v4 " Li Zhang
@ 2021-04-13 15:59 ` Li Zhang
  2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 1/4] ethdev: add packet mode in meter profile structure Li Zhang
                     ` (4 more replies)
  4 siblings, 5 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-13 15:59 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, jerinj, ferruh.yigit, ajit.khaparde
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports rate is bytes per second(BPS).
Add packet_mode flag in meter profile parameters data structure.
So that it can meter traffic by packet per second.

When packet_mode is 0, the profile rates and bucket sizes are
specified in bytes per second and bytes
when packet_mode is not 0, the profile rates and bucket sizes are
specified in packets and packets per second.

Add the necessary checks to the existing drivers implementing
the rte_mtr API to makes sure that profiles with
packet_mode set to TRUE are rejected.

RFC ("adds support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769-2-lizh@nvidia.com/

V2: create a unified patch that contains both the series with
	the API changes and the series with the necessary error checks in the drivers.
V3: Fix comments about commit-log.
V4: Fix comments about Depends-on and rebase.
V5: Fix comments about Depends-on and add acked.

Li Zhang (4):
  ethdev: add packet mode in meter profile structure
  app/testpmd: add meter profile packet mode option
  net/softnic: check meter packet mode
  net/mvpp2: check meter packet mode

 app/test-pmd/cmdline.c                      |  6 +-
 app/test-pmd/cmdline_mtr.c                  | 40 ++++++++-
 doc/guides/rel_notes/release_21_05.rst      | 12 +++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 +++----
 drivers/net/mvpp2/mrvl_mtr.c                |  6 ++
 drivers/net/softnic/rte_eth_softnic_meter.c |  8 ++
 lib/librte_ethdev/rte_mtr.h                 | 90 ++++++++++++++++++---
 7 files changed, 162 insertions(+), 31 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v5 1/4] ethdev: add packet mode in meter profile structure
  2021-04-13 15:59 ` [dpdk-dev] [PATCH v5 " Li Zhang
@ 2021-04-13 15:59   ` Li Zhang
  2021-04-17 22:35     ` Thomas Monjalon
  2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 2/4] app/testpmd: add meter profile packet mode option Li Zhang
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 47+ messages in thread
From: Li Zhang @ 2021-04-13 15:59 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, jerinj, ferruh.yigit, ajit.khaparde, Thomas Monjalon,
	Andrew Rybchenko
  Cc: dev, rasland, roniba

Currently meter algorithms only supports rate is bytes per second(BPS).
Add packet_mode flag in meter profile parameters data structure.
So that it can meter traffic by packet per second.

When packet_mode is 0, the profile rates and bucket sizes are
specified in bytes per second and bytes
when packet_mode is not 0, the profile rates and bucket sizes are
specified in packets and packets per second.

The below structure will be extended:
rte_mtr_meter_profile
rte_mtr_capabilities

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 doc/guides/rel_notes/release_21_05.rst | 12 ++++
 lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 11 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 113b37cddc..b0b82380f7 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -163,6 +163,18 @@ New Features
     ``show port (port_id) rxq (queue_id) desc used count``
 
 
+* **Added support for meter PPS profile.**
+
+  Currently meter algorithms only supports bytes per second(BPS).
+  Add packet_mode in the meter profile parameters data structures
+  to support packet per second (PPS) mode.
+  So that it can meter traffic by packet per second.
+  Packet_mode must be 0 when it is bytes mode.
+
+* **Updated MLX5 driver.**
+
+  * Added support for meter profile packet per second mode (packet_mode).
+
 Removed Items
 -------------
 
diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
index 916a09c5c3..ceb5dcbef1 100644
--- a/lib/librte_ethdev/rte_mtr.h
+++ b/lib/librte_ethdev/rte_mtr.h
@@ -132,46 +132,71 @@ struct rte_mtr_meter_profile {
 	union {
 		/** Items only valid when *alg* is set to srTCM - RFC 2697. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Committed Burst Size (CBS) (bytes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Excess Burst Size (EBS) (bytes). */
+			/** Excess Burst Size (EBS) (bytes or packets). */
 			uint64_t ebs;
 		} srtcm_rfc2697;
 
 		/** Items only valid when *alg* is set to trTCM - RFC 2698. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Peak Information Rate (PIR) (bytes/second). */
+			/**
+			 * Peak Information Rate (PIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t pir;
 
-			/** Committed Burst Size (CBS) (byes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Peak Burst Size (PBS) (bytes). */
+			/** Peak Burst Size (PBS) (bytes or packets). */
 			uint64_t pbs;
 		} trtcm_rfc2698;
 
 		/** Items only valid when *alg* is set to trTCM - RFC 4115. */
 		struct {
-			/** Committed Information Rate (CIR) (bytes/second). */
+			/**
+			 * Committed Information Rate (CIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t cir;
 
-			/** Excess Information Rate (EIR) (bytes/second). */
+			/**
+			 * Excess Information Rate (EIR)
+			 * (bytes per second or packets per second).
+			 */
 			uint64_t eir;
 
-			/** Committed Burst Size (CBS) (byes). */
+			/** Committed Burst Size (CBS) (bytes or packets). */
 			uint64_t cbs;
 
-			/** Excess Burst Size (EBS) (bytes). */
+			/** Excess Burst Size (EBS) (bytes or packets). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
 	};
+
+	/**
+	 * When zero, the byte mode is enabled for the current profile, so the
+	 * *rate* and *size* fields are specified in bytes per second
+	 * and bytes, respectively.
+	 * When non-zero, the packet mode is enabled for the current profile,
+	 * so the *rate* and *size* fields are specified in packets per second
+	 * and packets, respectively.
+	 */
+	int packet_mode;
 };
 
 /**
@@ -354,6 +379,48 @@ struct rte_mtr_capabilities {
 	 */
 	int policer_action_drop_supported;
 
+	/**
+	 * srTCM rfc2697 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the srTCM RFC 2697 metering algorithm.
+	 */
+	int srtcm_rfc2697_byte_mode_supported;
+
+	/**
+	 * srTCM rfc2697 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the srTCM RFC 2697 metering algorithm.
+	 */
+	int srtcm_rfc2697_packet_mode_supported;
+
+	/**
+	 * trTCM rfc2698 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the trTCM RFC 2698 metering algorithm.
+	 */
+	int trtcm_rfc2698_byte_mode_supported;
+
+	/**
+	 * trTCM rfc2698 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the trTCM RFC 2698 metering algorithm.
+	 */
+	int trtcm_rfc2698_packet_mode_supported;
+
+	/**
+	 * trTCM rfc4115 byte mode supported.
+	 * When non-zero, it indicates that byte mode is supported for
+	 * the trTCM RFC 4115 metering algorithm.
+	 */
+	int trtcm_rfc4115_byte_mode_supported;
+
+	/**
+	 * trTCM rfc4115 packet mode supported.
+	 * When non-zero, it indicates that packet mode is supported for
+	 * the trTCM RFC 4115 metering algorithm.
+	 */
+	int trtcm_rfc4115_packet_mode_supported;
+
 	/** Set of supported statistics counter types.
 	 * @see enum rte_mtr_stats_type
 	 */
@@ -371,6 +438,7 @@ enum rte_mtr_error_type {
 	RTE_MTR_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
 	RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
 	RTE_MTR_ERROR_TYPE_METER_PROFILE,
+	RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
 	RTE_MTR_ERROR_TYPE_MTR_ID,
 	RTE_MTR_ERROR_TYPE_MTR_PARAMS,
 	RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v5 2/4] app/testpmd: add meter profile packet mode option
  2021-04-13 15:59 ` [dpdk-dev] [PATCH v5 " Li Zhang
  2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 1/4] ethdev: add packet mode in meter profile structure Li Zhang
@ 2021-04-13 15:59   ` Li Zhang
  2021-04-13 16:09     ` Ajit Khaparde
  2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 3/4] net/softnic: check meter packet mode Li Zhang
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 47+ messages in thread
From: Li Zhang @ 2021-04-13 15:59 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, jerinj, ferruh.yigit, ajit.khaparde, Xiaoyun Li
  Cc: dev, thomas, rasland, roniba

add meter profile packet_mode to the ethernet device.
One example:
add port meter profile rfc2697 (port_id) (profile_id)
(cir) (cbs) (ebs) (packet_mode)

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 app/test-pmd/cmdline.c                      |  6 ++--
 app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
 3 files changed, 57 insertions(+), 20 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 56cf0bf405..ec98ccc652 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -693,13 +693,13 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"show port meter cap (port_id)\n"
 			"    Show port meter capability information\n\n"
 
-			"add port meter profile srtcm_rfc2697 (port_id) (profile_id) (cir) (cbs) (ebs)\n"
+			"add port meter profile srtcm_rfc2697 (port_id) (profile_id) (cir) (cbs) (ebs) (packet_mode)\n"
 			"    meter profile add - srtcm rfc 2697\n\n"
 
-			"add port meter profile trtcm_rfc2698 (port_id) (profile_id) (cir) (pir) (cbs) (pbs)\n"
+			"add port meter profile trtcm_rfc2698 (port_id) (profile_id) (cir) (pir) (cbs) (pbs) (packet_mode)\n"
 			"    meter profile add - trtcm rfc 2698\n\n"
 
-			"add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs)\n"
+			"add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs) (packet_mode)\n"
 			"    meter profile add - trtcm rfc 4115\n\n"
 
 			"del port meter profile (port_id) (profile_id)\n"
diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index 3982787d20..4d9bfde78d 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -306,6 +306,18 @@ static void cmd_show_port_meter_cap_parsed(void *parsed_result,
 		cap.policer_action_recolor_supported);
 	printf("cap.policer_action_drop_supported %" PRId32 "\n",
 		cap.policer_action_drop_supported);
+	printf("cap.srtcm_rfc2697_byte_mode_supported %" PRId32 "\n",
+		cap.srtcm_rfc2697_byte_mode_supported);
+	printf("cap.srtcm_rfc2697_packet_mode_supported %" PRId32 "\n",
+		cap.srtcm_rfc2697_packet_mode_supported);
+	printf("cap.trtcm_rfc2698_byte_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc2698_byte_mode_supported);
+	printf("cap.trtcm_rfc2698_packet_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc2698_packet_mode_supported);
+	printf("cap.trtcm_rfc4115_byte_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc4115_byte_mode_supported);
+	printf("cap.trtcm_rfc4115_packet_mode_supported %" PRId32 "\n",
+		cap.trtcm_rfc4115_packet_mode_supported);
 	printf("cap.stats_mask %" PRIx64 "\n", cap.stats_mask);
 }
 
@@ -335,6 +347,7 @@ struct cmd_add_port_meter_profile_srtcm_result {
 	uint64_t cir;
 	uint64_t cbs;
 	uint64_t ebs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcm_add =
@@ -376,6 +389,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_ebs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_srtcm_result,
 			ebs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcm_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcm_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -397,6 +414,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 	mp.srtcm_rfc2697.cir = res->cir;
 	mp.srtcm_rfc2697.cbs = res->cbs;
 	mp.srtcm_rfc2697.ebs = res->ebs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -408,7 +426,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 	.f = cmd_add_port_meter_profile_srtcm_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs>",
+	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_srtcm_add,
 		(void *)&cmd_add_port_meter_profile_srtcm_port,
@@ -420,6 +438,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 		(void *)&cmd_add_port_meter_profile_srtcm_cir,
 		(void *)&cmd_add_port_meter_profile_srtcm_cbs,
 		(void *)&cmd_add_port_meter_profile_srtcm_ebs,
+		(void *)&cmd_add_port_meter_profile_srtcm_packet_mode,
 		NULL,
 	},
 };
@@ -437,6 +456,7 @@ struct cmd_add_port_meter_profile_trtcm_result {
 	uint64_t pir;
 	uint64_t cbs;
 	uint64_t pbs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_add =
@@ -482,6 +502,10 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_pbs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_trtcm_result,
 			pbs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_trtcm_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -504,6 +528,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 	mp.trtcm_rfc2698.pir = res->pir;
 	mp.trtcm_rfc2698.cbs = res->cbs;
 	mp.trtcm_rfc2698.pbs = res->pbs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -515,7 +540,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 	.f = cmd_add_port_meter_profile_trtcm_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs>",
+	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_port,
@@ -528,6 +553,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 		(void *)&cmd_add_port_meter_profile_trtcm_pir,
 		(void *)&cmd_add_port_meter_profile_trtcm_cbs,
 		(void *)&cmd_add_port_meter_profile_trtcm_pbs,
+		(void *)&cmd_add_port_meter_profile_trtcm_packet_mode,
 		NULL,
 	},
 };
@@ -545,6 +571,7 @@ struct cmd_add_port_meter_profile_trtcm_rfc4115_result {
 	uint64_t eir;
 	uint64_t cbs;
 	uint64_t ebs;
+	int packet_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_meter_profile_trtcm_rfc4115_add =
@@ -592,6 +619,11 @@ cmdline_parse_token_num_t cmd_add_port_meter_profile_trtcm_rfc4115_ebs =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
 			ebs, RTE_UINT64);
+cmdline_parse_token_num_t
+	cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
+			packet_mode, RTE_UINT32);
 
 static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 	void *parsed_result,
@@ -616,6 +648,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 	mp.trtcm_rfc4115.eir = res->eir;
 	mp.trtcm_rfc4115.cbs = res->cbs;
 	mp.trtcm_rfc4115.ebs = res->ebs;
+	mp.packet_mode = res->packet_mode;
 
 	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);
 	if (ret != 0) {
@@ -627,7 +660,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 	.f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed,
 	.data = NULL,
-	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs>",
+	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs> <packet_mode>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port,
@@ -640,6 +673,7 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_eir,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_cbs,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_ebs,
+		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_packet_mode,
 		NULL,
 	},
 };
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 36f0a328a5..5785e94aeb 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2716,14 +2716,15 @@ add port meter profile (srTCM rfc2967)
 Add meter profile (srTCM rfc2697) to the ethernet device::
 
    testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
-   (cir) (cbs) (ebs)
+   (cir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed Information Rate (CIR) (bytes/second).
-* ``cbs``: Committed Burst Size (CBS) (bytes).
-* ``ebs``: Excess Burst Size (EBS) (bytes).
+* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second).
+* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
+* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc2968)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2731,15 +2732,16 @@ add port meter profile (trTCM rfc2968)
 Add meter profile (srTCM rfc2698) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
-   (cir) (pir) (cbs) (pbs)
+   (cir) (pir) (cbs) (pbs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``pir``: Peak information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``pbs``: Peak burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``pir``: Peak information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``pbs``: Peak burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc4115)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2747,15 +2749,16 @@ add port meter profile (trTCM rfc4115)
 Add meter profile (trTCM rfc4115) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
-   (cir) (eir) (cbs) (ebs)
+   (cir) (eir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``eir``: Excess information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``ebs``: Excess burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``eir``: Excess information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``ebs``: Excess burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v5 3/4] net/softnic: check meter packet mode
  2021-04-13 15:59 ` [dpdk-dev] [PATCH v5 " Li Zhang
  2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 1/4] ethdev: add packet mode in meter profile structure Li Zhang
  2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 2/4] app/testpmd: add meter profile packet mode option Li Zhang
@ 2021-04-13 15:59   ` Li Zhang
  2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 4/4] net/mvpp2: " Li Zhang
  2021-04-13 18:39   ` [dpdk-dev] [PATCH v5 0/4] Support PPS(packet per second) on meter Ferruh Yigit
  4 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-13 15:59 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, jerinj, ferruh.yigit, ajit.khaparde, Jasvinder Singh
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports bytes per second(BPS).
Check packet_mode set to TRUE are rejected.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 drivers/net/softnic/rte_eth_softnic_meter.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c b/drivers/net/softnic/rte_eth_softnic_meter.c
index 31a2a0e6d9..b27b1285e9 100644
--- a/drivers/net/softnic/rte_eth_softnic_meter.c
+++ b/drivers/net/softnic/rte_eth_softnic_meter.c
@@ -128,6 +128,14 @@ meter_profile_check(struct rte_eth_dev *dev,
 			NULL,
 			"Metering alg not supported");
 
+	/* Not support packet mode, just support byte mode. */
+	if (profile->packet_mode)
+		return -rte_mtr_error_set(error,
+			EINVAL,
+			RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
+			NULL,
+			"Meter packet mode not supported");
+
 	return 0;
 }
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v5 4/4] net/mvpp2: check meter packet mode
  2021-04-13 15:59 ` [dpdk-dev] [PATCH v5 " Li Zhang
                     ` (2 preceding siblings ...)
  2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 3/4] net/softnic: check meter packet mode Li Zhang
@ 2021-04-13 15:59   ` Li Zhang
  2021-04-13 18:39   ` [dpdk-dev] [PATCH v5 0/4] Support PPS(packet per second) on meter Ferruh Yigit
  4 siblings, 0 replies; 47+ messages in thread
From: Li Zhang @ 2021-04-13 15:59 UTC (permalink / raw)
  To: dekelp, orika, viacheslavo, matan, shahafs, cristian.dumitrescu,
	lironh, jerinj, ferruh.yigit, ajit.khaparde
  Cc: dev, thomas, rasland, roniba

Currently meter algorithms only supports bytes per second(BPS).
Check packet_mode set to TRUE are rejected.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/mvpp2/mrvl_mtr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mvpp2/mrvl_mtr.c b/drivers/net/mvpp2/mrvl_mtr.c
index 2fa5cb43ad..c07ac95ddc 100644
--- a/drivers/net/mvpp2/mrvl_mtr.c
+++ b/drivers/net/mvpp2/mrvl_mtr.c
@@ -88,6 +88,12 @@ mrvl_meter_profile_add(struct rte_eth_dev *dev, uint32_t meter_profile_id,
 					  NULL,
 					  "Only srTCM RFC 2697 is supported\n");
 
+	if (profile->packet_mode)
+		return -rte_mtr_error_set(error, EINVAL,
+				RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
+				NULL,
+				"Packet mode is not supported\n");
+
 	prof = mrvl_mtr_profile_from_id(priv, meter_profile_id);
 	if (prof)
 		return -rte_mtr_error_set(error, EEXIST,
-- 
2.27.0


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v5 2/4] app/testpmd: add meter profile packet mode option
  2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 2/4] app/testpmd: add meter profile packet mode option Li Zhang
@ 2021-04-13 16:09     ` Ajit Khaparde
  0 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2021-04-13 16:09 UTC (permalink / raw)
  To: Li Zhang
  Cc: Dekel Peled, Ori Kam, Slava Ovsiienko, Matan Azrad,
	Shahaf Shuler, Dumitrescu, Cristian, Liron Himi,
	Jerin Jacob Kollanukkaran, Ferruh Yigit, Xiaoyun Li, dpdk-dev,
	Thomas Monjalon, Raslan Darawsheh, Roni Bar Yanai

[-- Attachment #1: Type: text/plain, Size: 371 bytes --]

On Tue, Apr 13, 2021 at 9:00 AM Li Zhang <lizh@nvidia.com> wrote:
>
> add meter profile packet_mode to the ethernet device.
> One example:
> add port meter profile rfc2697 (port_id) (profile_id)
> (cir) (cbs) (ebs) (packet_mode)
>
> Signed-off-by: Li Zhang <lizh@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v5 0/4] Support PPS(packet per second) on meter
  2021-04-13 15:59 ` [dpdk-dev] [PATCH v5 " Li Zhang
                     ` (3 preceding siblings ...)
  2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 4/4] net/mvpp2: " Li Zhang
@ 2021-04-13 18:39   ` Ferruh Yigit
  4 siblings, 0 replies; 47+ messages in thread
From: Ferruh Yigit @ 2021-04-13 18:39 UTC (permalink / raw)
  To: Li Zhang, dekelp, orika, viacheslavo, matan, shahafs,
	cristian.dumitrescu, lironh, jerinj, ajit.khaparde
  Cc: dev, thomas, rasland, roniba

On 4/13/2021 4:59 PM, Li Zhang wrote:
> Currently meter algorithms only supports rate is bytes per second(BPS).
> Add packet_mode flag in meter profile parameters data structure.
> So that it can meter traffic by packet per second.
> 
> When packet_mode is 0, the profile rates and bucket sizes are
> specified in bytes per second and bytes
> when packet_mode is not 0, the profile rates and bucket sizes are
> specified in packets and packets per second.
> 
> Add the necessary checks to the existing drivers implementing
> the rte_mtr API to makes sure that profiles with
> packet_mode set to TRUE are rejected.
> 
> RFC ("adds support PPS(packet per second) on meter")
> https://patchwork.dpdk.org/project/dpdk/patch/20210125012023.1769769-2-lizh@nvidia.com/
> 
> V2: create a unified patch that contains both the series with
> 	the API changes and the series with the necessary error checks in the drivers.
> V3: Fix comments about commit-log.
> V4: Fix comments about Depends-on and rebase.
> V5: Fix comments about Depends-on and add acked.
> 
> Li Zhang (4):
>    ethdev: add packet mode in meter profile structure
>    app/testpmd: add meter profile packet mode option
>    net/softnic: check meter packet mode
>    net/mvpp2: check meter packet mode
> 

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v5 1/4] ethdev: add packet mode in meter profile structure
  2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 1/4] ethdev: add packet mode in meter profile structure Li Zhang
@ 2021-04-17 22:35     ` Thomas Monjalon
  0 siblings, 0 replies; 47+ messages in thread
From: Thomas Monjalon @ 2021-04-17 22:35 UTC (permalink / raw)
  To: rasland, Li Zhang
  Cc: orika, viacheslavo, matan, shahafs, cristian.dumitrescu, lironh,
	jerinj, ferruh.yigit, ajit.khaparde, Andrew Rybchenko, dev,
	roniba, asafp

13/04/2021 17:59, Li Zhang:
> Currently meter algorithms only supports rate is bytes per second(BPS).
> Add packet_mode flag in meter profile parameters data structure.
> So that it can meter traffic by packet per second.
> 
> When packet_mode is 0, the profile rates and bucket sizes are
> specified in bytes per second and bytes
> when packet_mode is not 0, the profile rates and bucket sizes are
> specified in packets and packets per second.
> 
> The below structure will be extended:
> rte_mtr_meter_profile
> rte_mtr_capabilities
> 
> Signed-off-by: Li Zhang <lizh@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> Acked-by: Jerin Jacob <jerinj@marvell.com>
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
> --- a/doc/guides/rel_notes/release_21_05.rst
> +++ b/doc/guides/rel_notes/release_21_05.rst
> @@ -163,6 +163,18 @@ New Features
>      ``show port (port_id) rxq (queue_id) desc used count``
>  
>  
> +* **Added support for meter PPS profile.**
> +
> +  Currently meter algorithms only supports bytes per second(BPS).
> +  Add packet_mode in the meter profile parameters data structures
> +  to support packet per second (PPS) mode.
> +  So that it can meter traffic by packet per second.
> +  Packet_mode must be 0 when it is bytes mode.

It is supposed to be in past tense. Reworded as follow:
+  Added packet mode in the meter profile parameters data structures
+  to support metering traffic by packet per second (PPS),
+  in addition to the initial bytes per second (BPS) mode (value 0).

> +
> +* **Updated MLX5 driver.**
> +
> +  * Added support for meter profile packet per second mode (packet_mode).

The mlx5 implementation is not part of this patch.
This sentence will be removed.
Please add a similar line in the mlx5 patch.



^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2021-04-17 22:35 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  8:54 [dpdk-dev] [PATCH 0/2] Support PPS(packet per second) on meter Li Zhang
2021-03-31  8:54 ` [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure Li Zhang
2021-03-31 16:26   ` Dumitrescu, Cristian
2021-04-01  1:41     ` Li Zhang
2021-04-01  6:19       ` Li Zhang
2021-04-07 20:20         ` Dumitrescu, Cristian
2021-04-08  4:06           ` Li Zhang
2021-03-31  8:54 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option Li Zhang
2021-04-07 20:17   ` Dumitrescu, Cristian
2021-04-08  2:34     ` Li Zhang
2021-04-07 20:21   ` Dumitrescu, Cristian
2021-04-08  3:58 ` [dpdk-dev] [PATCH v2 0/4] Support PPS(packet per second) on meter Li Zhang
2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add packet mode in meter profile structure Li Zhang
2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 2/4] app/testpmd: add meter profile packet mode option Li Zhang
2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 3/4] net/softnic: check meter packet mode Li Zhang
2021-04-08  3:58   ` [dpdk-dev] [PATCH v2 4/4] net/mvpp2: " Li Zhang
2021-04-10  7:24   ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Li Zhang
2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure Li Zhang
2021-04-12 19:23       ` Dumitrescu, Cristian
2021-04-12 19:28         ` Jerin Jacob
2021-04-13  3:48           ` Ajit Khaparde
2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 2/4] app/testpmd: add meter profile packet mode option Li Zhang
2021-04-12 23:51       ` Ferruh Yigit
2021-04-13  2:57         ` Li Zhang
2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 3/4] net/softnic: check meter packet mode Li Zhang
2021-04-12 19:24       ` Dumitrescu, Cristian
2021-04-10  7:24     ` [dpdk-dev] [PATCH v3 4/4] net/mvpp2: " Li Zhang
2021-04-12 23:54     ` [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter Ferruh Yigit
2021-04-13  2:53       ` Li Zhang
2021-04-13  3:50 ` [dpdk-dev] [PATCH v4 " Li Zhang
2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 1/4] ethdev: add packet mode in meter profile structure Li Zhang
2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 2/4] app/testpmd: add meter profile packet mode option Li Zhang
2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 3/4] net/softnic: check meter packet mode Li Zhang
2021-04-13  3:50   ` [dpdk-dev] [PATCH v4 4/4] net/mvpp2: " Li Zhang
2021-04-13  5:42     ` [dpdk-dev] [EXT] " Liron Himi
2021-04-13 10:24   ` [dpdk-dev] [PATCH v4 0/4] Support PPS(packet per second) on meter Ferruh Yigit
2021-04-13 11:02     ` Li Zhang
2021-04-13 11:05       ` Ferruh Yigit
2021-04-13 15:46         ` Li Zhang
2021-04-13 15:59 ` [dpdk-dev] [PATCH v5 " Li Zhang
2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 1/4] ethdev: add packet mode in meter profile structure Li Zhang
2021-04-17 22:35     ` Thomas Monjalon
2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 2/4] app/testpmd: add meter profile packet mode option Li Zhang
2021-04-13 16:09     ` Ajit Khaparde
2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 3/4] net/softnic: check meter packet mode Li Zhang
2021-04-13 15:59   ` [dpdk-dev] [PATCH v5 4/4] net/mvpp2: " Li Zhang
2021-04-13 18:39   ` [dpdk-dev] [PATCH v5 0/4] Support PPS(packet per second) on meter Ferruh Yigit

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).