Skip to contentSkip to conversation

Support PPS(packet per second) on meter

PATCH In review Li Zhang 7 participants 47 messages Mar 31, 2021 – Apr 17, 2021 Network drivers

lore
Share & tools
lore

Li Zhang

author
#0 lore raw

cover Support PPS(packet per second) on meter

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/[email protected]/

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(-)
Signature · 1 line
2.27.0
author
#1 lore raw

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

---
 doc/guides/rel_notes/release_21_05.rst |  7 ++
 lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
 2 files changed, 85 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +7 -0
index 3c76148b11..c9c15794ad 100644
@@ -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
 -------------
lib/librte_ethdev/rte_mtr.h +78 -11

130 lines not on this page · raw message

Signature · 1 line
2.27.0
#2 lore raw

Re: [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure

Hi Li,

Quoted 191 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Wednesday, March 31, 2021 9:54 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
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

---
 doc/guides/rel_notes/release_21_05.rst |  7 ++
 lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
 2 files changed, 85 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +7 -0
index 3c76148b11..c9c15794ad 100644
@@ -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
 -------------
lib/librte_ethdev/rte_mtr.h +0 -1
index e1dc59eb06..52611a90f5 100644
@@ -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). */

lib/librte_ethdev/rte_mtr.h +6 -3
+			/**
+			 * 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). */

lib/librte_ethdev/rte_mtr.h +10 -4
+			/**
+			 * 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). */

lib/librte_ethdev/rte_mtr.h +13 -3
+			/**
+			 * 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

lib/librte_ethdev/rte_mtr.h +3 -0
+	 * *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,

lib/librte_ethdev/rte_mtr.h +46 -1
+	 * 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
 	 */
--
Quoted 1 line

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

author
#3 lore raw

Re: [dpdk-dev] [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

Quoted 228 lines

-----Original Message-----
From: Dumitrescu, Cristian <[email protected]>
Sent: Thursday, April 1, 2021 12:27 AM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile structure

External email: Use caution opening links or attachments

Hi Li,

Quoted 198 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Wednesday, March 31, 2021 9:54 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
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

---
 doc/guides/rel_notes/release_21_05.rst |  7 ++
 lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
 2 files changed, 85 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +7 -0
index 3c76148b11..c9c15794ad 100644
@@ -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
 -------------
lib/librte_ethdev/rte_mtr.h +0 -1
index e1dc59eb06..52611a90f5 100644
@@ -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). */

lib/librte_ethdev/rte_mtr.h +8 -3
+                     /**
+                      * 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). */

lib/librte_ethdev/rte_mtr.h +11 -4
+                     /**
+                      * 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). */

lib/librte_ethdev/rte_mtr.h +16 -3
+                     /**
+                      * 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

lib/librte_ethdev/rte_mtr.h +3 -0
+      * *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,

lib/librte_ethdev/rte_mtr.h +46 -1
+      * 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
       */
--
Quoted 1 line

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

author
#4 lore raw

Re: [dpdk-dev] [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

Thanks!
Regards,
Li Zhang

Quoted 251 lines

-----Original Message-----
From: Li Zhang
Sent: Thursday, April 1, 2021 9:42 AM
To: Dumitrescu, Cristian <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
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

Quoted 230 lines

-----Original Message-----
From: Dumitrescu, Cristian <[email protected]>
Sent: Thursday, April 1, 2021 12:27 AM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile structure

External email: Use caution opening links or attachments

Hi Li,

Quoted 199 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Wednesday, March 31, 2021 9:54 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
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

---
 doc/guides/rel_notes/release_21_05.rst |  7 ++
 lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
 2 files changed, 85 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +7 -0
index 3c76148b11..c9c15794ad 100644
@@ -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
 -------------
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_mtr.h index e1dc59eb06..52611a90f5 100644

lib/librte_ethdev/rte_mtr.h +0 -1
@@ -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). */

lib/librte_ethdev/rte_mtr.h +8 -3
+                     /**
+                      * 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). */

lib/librte_ethdev/rte_mtr.h +12 -4
+                     /**
+                      * 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). */

lib/librte_ethdev/rte_mtr.h +16 -3
+                     /**
+                      * 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

lib/librte_ethdev/rte_mtr.h +3 -0
+      * *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,

lib/librte_ethdev/rte_mtr.h +46 -1
+      * 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
       */
--
Quoted 1 line

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

#5 lore raw

Re: [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure

Quoted 16 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Thursday, April 1, 2021 7:19 AM
To: Dumitrescu, Cristian <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Liron Himi <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile structure

Quoted 6 lines

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!

Quoted 258 lines

Thanks!
Regards,
Li Zhang

Quoted 10 lines

-----Original Message-----
From: Li Zhang
Sent: Thursday, April 1, 2021 9:42 AM
To: Dumitrescu, Cristian <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Roni Bar

Yanai

Quoted 2 lines

<[email protected]>
Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile

structure

Quoted 155 lines

Hi Dumitrescu,

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

Regards,
Li Zhang

Quoted 146 lines

-----Original Message-----
From: Dumitrescu, Cristian <[email protected]>
Sent: Thursday, April 1, 2021 12:27 AM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile structure

External email: Use caution opening links or attachments

Hi Li,

Quoted 127 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Wednesday, March 31, 2021 9:54 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
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

---
 doc/guides/rel_notes/release_21_05.rst |  7 ++
 lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
 2 files changed, 85 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +7 -0
index 3c76148b11..c9c15794ad 100644
@@ -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
 -------------
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_mtr.h index e1dc59eb06..52611a90f5 100644

lib/librte_ethdev/rte_mtr.h +0 -1
@@ -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). */

lib/librte_ethdev/rte_mtr.h +8 -3
+                     /**
+                      * 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). */

lib/librte_ethdev/rte_mtr.h +12 -4
+                     /**
+                      * 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). */

lib/librte_ethdev/rte_mtr.h +10 -2
+                     /**
+                      * 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;
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
lib/librte_ethdev/rte_mtr.h +4 -1
-                     /** Excess Burst Size (EBS) (bytes). */
+                     /** Excess Burst Size (EBS) (bytes or packets).
+ */
                      uint64_t ebs;
              } trtcm_rfc4115;
      };
+
+     /**
Quoted 8 lines
Quoted 8 lines

+ * When zero, the byte mode is enabled for the current
+ profile, so
the

lib/librte_ethdev/rte_mtr.h +3 -0
+      * *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

Quoted 62 lines
Quoted 62 lines
Quoted 56 lines
lib/librte_ethdev/rte_mtr.h +45 -1
+      * 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
       */
--
Quoted 1 line

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.

Quoted 2 lines
Quoted 2 lines

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

meter_profile_check.

Quoted 4 lines
Quoted 4 lines

Thanks!

Regards,
Cristian

author
#6 lore raw

Re: [dpdk-dev] [PATCH 1/2] ethdev: add packet mode in meter profile structure

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

Quoted 308 lines

-----Original Message-----
From: Dumitrescu, Cristian <[email protected]>
Sent: Thursday, April 8, 2021 4:20 AM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Liron Himi <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile structure

External email: Use caution opening links or attachments

Quoted 15 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Thursday, April 1, 2021 7:19 AM
To: Dumitrescu, Cristian <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Liron Himi <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile structure

Quoted 6 lines

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!

Quoted 261 lines

Thanks!
Regards,
Li Zhang

Quoted 10 lines

-----Original Message-----
From: Li Zhang
Sent: Thursday, April 1, 2021 9:42 AM
To: Dumitrescu, Cristian <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Roni Bar

Yanai

Quoted 2 lines

<[email protected]>
Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile

structure

Quoted 166 lines

Hi Dumitrescu,

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

Regards,
Li Zhang

Quoted 157 lines

-----Original Message-----
From: Dumitrescu, Cristian <[email protected]>
Sent: Thursday, April 1, 2021 12:27 AM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: RE: [PATCH 1/2] ethdev: add packet mode in meter profile structure

External email: Use caution opening links or attachments

Hi Li,

Quoted 138 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Wednesday, March 31, 2021 9:54 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
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

---
 doc/guides/rel_notes/release_21_05.rst |  7 ++
 lib/librte_ethdev/rte_mtr.h            | 89 ++++++++++++++++++++++----
 2 files changed, 85 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +7 -0
index 3c76148b11..c9c15794ad 100644
@@ -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
 -------------
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_mtr.h index e1dc59eb06..52611a90f5 100644

lib/librte_ethdev/rte_mtr.h +0 -1
@@ -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). */

lib/librte_ethdev/rte_mtr.h +8 -3
+                     /**
+                      * 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). */

lib/librte_ethdev/rte_mtr.h +12 -4
+                     /**
+                      * 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). */

lib/librte_ethdev/rte_mtr.h +16 -3
+                     /**
+                      * 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
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

the

lib/librte_ethdev/rte_mtr.h +4 -0
+      * *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

Quoted 62 lines
Quoted 62 lines
Quoted 56 lines
lib/librte_ethdev/rte_mtr.h +45 -1
+      * 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
       */
--
Quoted 1 line

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.

Quoted 2 lines
Quoted 2 lines

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

meter_profile_check.

Quoted 4 lines
Quoted 4 lines

Thanks!

Regards,
Cristian

author
#7 lore raw

PATCH 2/2 app/testpmd: add meter profile packet mode option

In reply to Li Zhang

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)

---
 app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
 2 files changed, 54 insertions(+), 17 deletions(-)
app/test-pmd/cmdline_mtr.c +37 -3
index bdc9ae8bfe..eff2473e7b 100644
@@ -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,
 	},
 };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +17 -14
index f59eb8a27d..b5e52f6b1c 100644
@@ -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
 ~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.27.0
#8 lore raw

Re: [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option

Quoted 280 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Wednesday, March 31, 2021 9:54 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; Li, Xiaoyun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
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)

---
 app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
 2 files changed, 54 insertions(+), 17 deletions(-)
app/test-pmd/cmdline_mtr.c +13 -0
index bdc9ae8bfe..eff2473e7b 100644
@@ -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 =

app/test-pmd/cmdline_mtr.c +1 -0
 	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 =

app/test-pmd/cmdline_mtr.c +3 -0
+	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,

app/test-pmd/cmdline_mtr.c +1 -0
 	__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);
app/test-pmd/cmdline_mtr.c +1 -1
 	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>",
app/test-pmd/cmdline_mtr.c +1 -0
 	.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,
app/test-pmd/cmdline_mtr.c +1 -0
 	},
 };
@@ -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 =

app/test-pmd/cmdline_mtr.c +1 -0
 	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 =

app/test-pmd/cmdline_mtr.c +3 -0
+	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,

app/test-pmd/cmdline_mtr.c +1 -0
 	__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);
app/test-pmd/cmdline_mtr.c +1 -1
 	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>",
app/test-pmd/cmdline_mtr.c +1 -0
 	.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,
app/test-pmd/cmdline_mtr.c +1 -0
 	},
 };
@@ -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 =

app/test-pmd/cmdline_mtr.c +0 -0
@@ -549,6 +576,11 @@ cmdline_parse_token_num_t

cmd_add_port_meter_profile_trtcm_rfc4115_ebs =

app/test-pmd/cmdline_mtr.c +5 -0
 	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(

app/test-pmd/cmdline_mtr.c +1 -0
 	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 = {

app/test-pmd/cmdline_mtr.c +0 -1
 	.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>",

app/test-pmd/cmdline_mtr.c +1 -0
+	.help_str = "add port meter profile trtcm_rfc4115 <port_id>

<profile_id> <cir> <eir> <cbs> <ebs> <packet_mode>",

app/test-pmd/cmdline_mtr.c +1 -0
 	.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,
app/test-pmd/cmdline_mtr.c +0 -0
 	},
 };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +2 -4
index f59eb8a27d..b5e52f6b1c 100644
@@ -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).

doc/guides/testpmd_app_ug/testpmd_funcs.rst +5 -5
+* ``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).

doc/guides/testpmd_app_ug/testpmd_funcs.rst +6 -5
+* ``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).

doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -1
+* ``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
 ~~~~~~~~~~~~~~~~~~~~~~~~~
--
Quoted 1 line

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?

author
#9 lore raw

Re: [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option

Hi Cristian

Quoted 299 lines

-----Original Message-----
From: Dumitrescu, Cristian <[email protected]>
Sent: Thursday, April 8, 2021 4:18 AM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Li, Xiaoyun <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: RE: [PATCH 2/2] app/testpmd: add meter profile packet mode option

External email: Use caution opening links or attachments

Quoted 156 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Wednesday, March 31, 2021 9:54 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; Li, Xiaoyun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
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)

---
 app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
 2 files changed, 54 insertions(+), 17 deletions(-)
app/test-pmd/cmdline_mtr.c +13 -0
index bdc9ae8bfe..eff2473e7b 100644
@@ -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 =

app/test-pmd/cmdline_mtr.c +3 -0
+     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;
app/test-pmd/cmdline_mtr.c +2 -1
+     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,
app/test-pmd/cmdline_mtr.c +1 -0
@@ -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,
      },

};

app/test-pmd/cmdline_mtr.c +1 -0
@@ -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 =

app/test-pmd/cmdline_mtr.c +3 -0
+     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;
app/test-pmd/cmdline_mtr.c +2 -1
+     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,
app/test-pmd/cmdline_mtr.c +1 -0
@@ -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,
      },

};

app/test-pmd/cmdline_mtr.c +1 -0
@@ -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;
 };
 
Quoted 3 lines

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

Quoted 119 lines

=

      TOKEN_NUM_INITIALIZER(
              struct cmd_add_port_meter_profile_trtcm_rfc4115_result,
                      ebs, RTE_UINT64);
app/test-pmd/cmdline_mtr.c +5 -0
+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;
app/test-pmd/cmdline_mtr.c +1 -0
+     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,
app/test-pmd/cmdline_mtr.c +1 -0
@@ -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,
      },

};

doc/guides/testpmd_app_ug/testpmd_funcs.rst +0 -0
index f59eb8a27d..b5e52f6b1c 100644
@@ -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) \
doc/guides/testpmd_app_ug/testpmd_funcs.rst +3 -4
-   (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).

doc/guides/testpmd_app_ug/testpmd_funcs.rst +3 -0
+* ``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)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

doc/guides/testpmd_app_ug/testpmd_funcs.rst +0 -0
@@ -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) \
doc/guides/testpmd_app_ug/testpmd_funcs.rst +3 -5
-   (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).

doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -0
+* ``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)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

doc/guides/testpmd_app_ug/testpmd_funcs.rst +0 -0
@@ -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) \
doc/guides/testpmd_app_ug/testpmd_funcs.rst +3 -5
-   (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).

doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -1
+* ``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
 ~~~~~~~~~~~~~~~~~~~~~~~~~
--
Quoted 1 line

2.27.0

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

Quoted 6 lines

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

#10 lore raw

Re: [dpdk-dev] [PATCH 2/2] app/testpmd: add meter profile packet mode option

In reply to Li Zhang
Quoted 280 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Wednesday, March 31, 2021 9:54 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; Li, Xiaoyun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
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)

---
 app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
 2 files changed, 54 insertions(+), 17 deletions(-)
app/test-pmd/cmdline_mtr.c +13 -0
index bdc9ae8bfe..eff2473e7b 100644
@@ -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 =

app/test-pmd/cmdline_mtr.c +1 -0
 	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 =

app/test-pmd/cmdline_mtr.c +3 -0
+	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,

app/test-pmd/cmdline_mtr.c +1 -0
 	__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);
app/test-pmd/cmdline_mtr.c +1 -1
 	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>",
app/test-pmd/cmdline_mtr.c +1 -0
 	.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,
app/test-pmd/cmdline_mtr.c +1 -0
 	},
 };
@@ -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 =

app/test-pmd/cmdline_mtr.c +1 -0
 	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 =

app/test-pmd/cmdline_mtr.c +3 -0
+	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,

app/test-pmd/cmdline_mtr.c +1 -0
 	__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);
app/test-pmd/cmdline_mtr.c +1 -1
 	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>",
app/test-pmd/cmdline_mtr.c +1 -0
 	.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,
app/test-pmd/cmdline_mtr.c +1 -0
 	},
 };
@@ -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 =

app/test-pmd/cmdline_mtr.c +0 -0
@@ -549,6 +576,11 @@ cmdline_parse_token_num_t

cmd_add_port_meter_profile_trtcm_rfc4115_ebs =

app/test-pmd/cmdline_mtr.c +5 -0
 	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(

app/test-pmd/cmdline_mtr.c +1 -0
 	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 = {

app/test-pmd/cmdline_mtr.c +0 -1
 	.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>",

app/test-pmd/cmdline_mtr.c +1 -0
+	.help_str = "add port meter profile trtcm_rfc4115 <port_id>

<profile_id> <cir> <eir> <cbs> <ebs> <packet_mode>",

app/test-pmd/cmdline_mtr.c +1 -0
 	.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,
app/test-pmd/cmdline_mtr.c +0 -0
 	},
 };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +2 -4
index f59eb8a27d..b5e52f6b1c 100644
@@ -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).

doc/guides/testpmd_app_ug/testpmd_funcs.rst +5 -5
+* ``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).

doc/guides/testpmd_app_ug/testpmd_funcs.rst +6 -5
+* ``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).

doc/guides/testpmd_app_ug/testpmd_funcs.rst +4 -1
+* ``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
 ~~~~~~~~~~~~~~~~~~~~~~~~~
--
Quoted 1 line

2.27.0

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

author
#11 lore raw

v2 cover Support PPS(packet per second) on meter

In reply to 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.

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/[email protected]/

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(-)
Signature · 1 line
2.27.0
author
#12 lore raw

PATCH v2 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

---
 doc/guides/rel_notes/release_21_05.rst |  7 ++
 lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
 2 files changed, 86 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +7 -0
index 3c76148b11..c9c15794ad 100644
@@ -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
 -------------
lib/librte_ethdev/rte_mtr.h +79 -11

137 lines not on this page · raw message

Signature · 1 line
2.27.0
author
#13 lore raw

PATCH v2 2/4 app/testpmd: add meter profile packet mode option

In reply to Li Zhang

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)

---
 app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
 2 files changed, 54 insertions(+), 17 deletions(-)
app/test-pmd/cmdline_mtr.c +37 -3
index bdc9ae8bfe..eff2473e7b 100644
@@ -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,
 	},
 };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +17 -14
index f59eb8a27d..b5e52f6b1c 100644
@@ -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
 ~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.27.0
author
#14 lore raw

PATCH v2 3/4 net/softnic: check meter packet mode

In reply to Li Zhang

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

---
 drivers/net/softnic/rte_eth_softnic_meter.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/softnic/rte_eth_softnic_meter.c +8 -0
index 0cbf94e8b0..8c2f82d512 100644
@@ -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;
 }
 
Signature · 1 line
2.27.0
author
#15 lore raw

PATCH v2 4/4 net/mvpp2: check meter packet mode

In reply to Li Zhang

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

---
 drivers/net/mvpp2/mrvl_mtr.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/mvpp2/mrvl_mtr.c +6 -0
index 2fa5cb43ad..c07ac95ddc 100644
@@ -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,
Signature · 1 line
2.27.0
author
#16 lore raw

v3 cover Support PPS(packet per second) on meter

In reply to 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.

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/[email protected]/

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(-)
Signature · 1 line
2.21.0
author
#17 lore raw

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

---
 doc/guides/rel_notes/release_21_05.rst | 12 ++++
 lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +12 -0
index f199ad286d..b4653d63a1 100644
@@ -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
 -------------
 
lib/librte_ethdev/rte_mtr.h +79 -11

137 lines not on this page · raw message

Signature · 1 line
2.21.0
Acked-by on v3 1/4
#18 lore raw

Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure

Quoted 210 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Saturday, April 10, 2021 8:25 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; [email protected]; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
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

---
 doc/guides/rel_notes/release_21_05.rst | 12 ++++
 lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +0 -0
index f199ad286d..b4653d63a1 100644
@@ -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.

doc/guides/rel_notes/release_21_05.rst +11 -0
+* **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).

doc/guides/rel_notes/release_21_05.rst +1 -0
+
 Removed Items
 -------------
lib/librte_ethdev/rte_mtr.h +0 -1
index 4938ef065f..778fad7638 100644
@@ -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). */

lib/librte_ethdev/rte_mtr.h +6 -3
+			/**
+			 * 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). */

lib/librte_ethdev/rte_mtr.h +10 -4
+			/**
+			 * 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). */

lib/librte_ethdev/rte_mtr.h +13 -3
+			/**
+			 * 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

lib/librte_ethdev/rte_mtr.h +3 -0
+	 * *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,

lib/librte_ethdev/rte_mtr.h +47 -1
+	 * 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,
--
Quoted 1 line

2.21.0

Acked-by
#19 lore raw

Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure

Quoted 23 lines · Cristian
Quoted 23 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Saturday, April 10, 2021 8:25 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; [email protected]; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
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.

Quoted 6 lines
Quoted 6 lines

The below structure will be extended:
rte_mtr_meter_profile
rte_mtr_capabilities

Quoted 186 lines
Quoted 182 lines
---
 doc/guides/rel_notes/release_21_05.rst | 12 ++++
 lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +0 -0
index f199ad286d..b4653d63a1 100644
@@ -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.

doc/guides/rel_notes/release_21_05.rst +11 -0
+* **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).

doc/guides/rel_notes/release_21_05.rst +1 -0
+
 Removed Items
 -------------
lib/librte_ethdev/rte_mtr.h +0 -1
index 4938ef065f..778fad7638 100644
@@ -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). */

lib/librte_ethdev/rte_mtr.h +6 -3
+                     /**
+                      * 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). */

lib/librte_ethdev/rte_mtr.h +10 -4
+                     /**
+                      * 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). */

lib/librte_ethdev/rte_mtr.h +13 -3
+                     /**
+                      * 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

lib/librte_ethdev/rte_mtr.h +3 -0
+      * *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,

lib/librte_ethdev/rte_mtr.h +47 -1
+      * 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,
--
Quoted 1 line

2.21.0

Acked-by
#20 lore raw

Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add packet mode in meter profile structure

Quoted 30 lines · Jerin Jacob
Quoted 27 lines · Cristian
Quoted 27 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Saturday, April 10, 2021 8:25 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; [email protected]; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
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

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
author
#21 lore raw

PATCH v3 2/4 app/testpmd: add meter profile packet mode option

In reply to Li Zhang

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)

---
 app/test-pmd/cmdline_mtr.c                  | 40 +++++++++++++++++++--
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 31 ++++++++--------
 2 files changed, 54 insertions(+), 17 deletions(-)
app/test-pmd/cmdline_mtr.c +37 -3
index bdc9ae8bfe..eff2473e7b 100644
@@ -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,
 	},
 };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +17 -14
index 4e9089beaf..59f7b3ebd9 100644
@@ -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
 ~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.21.0
#22 lore raw

Re: [dpdk-dev] [PATCH v3 2/4] app/testpmd: add meter profile packet mode option

Quoted 7 lines · Li Zhang

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)

<...>

app/test-pmd/cmdline_mtr.c static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result, · line 386

Quoted 6 lines
app/test-pmd/cmdline_mtr.c +1 -1
@@ -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?

author
#23 lore raw

Re: [dpdk-dev] [PATCH v3 2/4] app/testpmd: add meter profile packet mode option

Hi Ferruh,

Quoted 34 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, April 13, 2021 7:51 AM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; [email protected]; [email protected]; Xiaoyun Li <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 2/4] app/testpmd: add meter profile packet mode option

External email: Use caution opening links or attachments

Quoted 7 lines · Li Zhang

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)

<...>

Review static void

Quoted 1 line
(quoted diff) +0 -0
@@ -365,7 +383,7 @@ static void

cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,

app/test-pmd/cmdline_mtr.c static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,

Quoted 4 lines
app/test-pmd/cmdline_mtr.c +0 -1
  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>
Quoted 6 lines

<cir> <cbs> <ebs>",

Review static void · line 387

Quoted 2 lines
(quoted diff) +2 -0
+     .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

author
#24 lore raw

PATCH v3 3/4 net/softnic: check meter packet mode

In reply to Li Zhang

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

---
 drivers/net/softnic/rte_eth_softnic_meter.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/softnic/rte_eth_softnic_meter.c +8 -0
index 2a05a85cdb..046e629f17 100644
@@ -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;
 }
 
Signature · 1 line
2.21.0
Acked-by on v3 3/4
#25 lore raw

Re: [dpdk-dev] [PATCH v3 3/4] net/softnic: check meter packet mode

Quoted 44 lines

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Saturday, April 10, 2021 8:25 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>; [email protected]; Singh, Jasvinder <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
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.

---
 drivers/net/softnic/rte_eth_softnic_meter.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/softnic/rte_eth_softnic_meter.c +8 -1
index 2a05a85cdb..046e629f17 100644
@@ -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;
 }
 
--
Quoted 1 line

2.21.0

author
#26 lore raw

PATCH v3 4/4 net/mvpp2: check meter packet mode

In reply to Li Zhang

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

---
 drivers/net/mvpp2/mrvl_mtr.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/mvpp2/mrvl_mtr.c +6 -0
index 2fa5cb43ad..c07ac95ddc 100644
@@ -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,
Signature · 1 line
2.21.0
#27 lore raw
In reply to Li Zhang
Quoted 13 lines · 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.

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.

Quoted 6 lines

RFC ("adds support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

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?

Quoted 19 lines

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(-)
author
#28 lore raw

Hi Ferruh,

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

Regards,
Li Zhang

Quoted 65 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, April 13, 2021 7:55 AM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 0/4] Support PPS(packet per second) on meter

External email: Use caution opening links or attachments

Quoted 9 lines · 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.

Quoted 6 lines

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

Quoted 5 lines

[email protected]/

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?

Quoted 2 lines

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.

Quoted 17 lines

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(-)
author
#29 lore raw

v4 cover Support PPS(packet per second) on meter

In reply to 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.

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/[email protected]/

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(-)
Signature · 1 line
2.27.0
author
#30 lore raw

PATCH v4 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

---
 doc/guides/rel_notes/release_21_05.rst | 12 ++++
 lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +12 -0
index 1b1b4368f6..1f55f475e2 100644
@@ -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
 -------------
 
lib/librte_ethdev/rte_mtr.h +79 -11

137 lines not on this page · raw message

Signature · 1 line
2.27.0
author
#31 lore raw

PATCH v4 2/4 app/testpmd: add meter profile packet mode option

In reply to Li Zhang

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)

---
 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(-)
app/test-pmd/cmdline.c +3 -3
index 6c6184a170..b5a78055dc 100644
@@ -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"
app/test-pmd/cmdline_mtr.c +37 -3
index bdc9ae8bfe..eff2473e7b 100644
@@ -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,
 	},
 };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +17 -14
index b596ee9a14..4e3f697935 100644
@@ -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
 ~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.27.0
author
#32 lore raw

PATCH v4 3/4 net/softnic: check meter packet mode

In reply to Li Zhang

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

---
 drivers/net/softnic/rte_eth_softnic_meter.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/softnic/rte_eth_softnic_meter.c +8 -0
index 2a05a85cdb..046e629f17 100644
@@ -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;
 }
 
Signature · 1 line
2.27.0
author
#33 lore raw

PATCH v4 4/4 net/mvpp2: check meter packet mode

In reply to Li Zhang

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

---
 drivers/net/mvpp2/mrvl_mtr.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/mvpp2/mrvl_mtr.c +6 -0
index 2fa5cb43ad..c07ac95ddc 100644
@@ -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,
Signature · 1 line
2.27.0
Acked-by Acked-by Matan Azrad on v4 4/4
#34 lore raw

Re: [dpdk-dev] [EXT] [PATCH v4 4/4] net/mvpp2: check meter packet mode

-----Original Message-----
From: Li Zhang <[email protected]>
Sent: Tuesday, 13 April 2021 06:51
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Liron Himi <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]
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.

---
 drivers/net/mvpp2/mrvl_mtr.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/mvpp2/mrvl_mtr.c +6 -0
@@ -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

#35 lore raw
In reply to Li Zhang
Quoted 13 lines · 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.

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.

Quoted 6 lines

RFC ("adds support PPS(packet per second) on meter")
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

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.

Quoted 19 lines

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(-)
author
#36 lore raw

Hi Ferruh,

Quoted 38 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, April 13, 2021 6:25 PM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: Re: [PATCH v4 0/4] Support PPS(packet per second) on meter

External email: Use caution opening links or attachments

Quoted 9 lines · 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.

Quoted 6 lines

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

Quoted 5 lines

[email protected]/

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

Quoted 8 lines

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.

Quoted 27 lines

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.

Quoted 2 lines

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.

Quoted 17 lines

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(-)
#37 lore raw
Quoted 44 lines · Li Zhang

Hi Ferruh,

Quoted 42 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, April 13, 2021 6:25 PM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: Re: [PATCH v4 0/4] Support PPS(packet per second) on meter

External email: Use caution opening links or attachments

Quoted 9 lines · 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.

Quoted 6 lines

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

Quoted 5 lines

[email protected]/

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,

Quoted 8 lines
Quoted 4 lines

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.

Quoted 28 lines
Quoted 27 lines

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.

Quoted 2 lines

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.

Quoted 17 lines

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(-)
author
#38 lore raw

Hi Ferruh,

Quoted 73 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, April 13, 2021 7:06 PM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: Re: [PATCH v4 0/4] Support PPS(packet per second) on meter

External email: Use caution opening links or attachments

Quoted 10 lines · Li Zhang

Hi Ferruh,

Quoted 8 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, April 13, 2021 6:25 PM
To: Li Zhang <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; NBU-Contact-Thomas Monjalon

<[email protected]>;

Quoted 17 lines
Quoted 17 lines

Raslan Darawsheh <[email protected]>; Roni Bar Yanai <[email protected]>
Subject: Re: [PATCH v4 0/4] Support PPS(packet per second) on meter

External email: Use caution opening links or attachments

Quoted 9 lines · 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.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

-

2

Quoted 5 lines

[email protected]/

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

Quoted 8 lines
Quoted 8 lines

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.

Quoted 4 lines

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

Quoted 7 lines

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.

Quoted 29 lines
Quoted 29 lines
Quoted 28 lines

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.

Quoted 3 lines

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.

Quoted 17 lines

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(-)
author
#39 lore raw

v5 cover Support PPS(packet per second) on meter

In reply to 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.

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/[email protected]/

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(-)
Signature · 1 line
2.27.0
author
#40 lore raw

PATCH v5 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

---
 doc/guides/rel_notes/release_21_05.rst | 12 ++++
 lib/librte_ethdev/rte_mtr.h            | 90 ++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_21_05.rst +12 -0
index 113b37cddc..b0b82380f7 100644
@@ -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
 -------------
 
lib/librte_ethdev/rte_mtr.h +79 -11

137 lines not on this page · raw message

Signature · 1 line
2.27.0
#41 lore raw

Re: [dpdk-dev] [PATCH v5 1/4] ethdev: add packet mode in meter profile structure

13/04/2021 17:59, Li Zhang:

Quoted 22 lines

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

---

doc/guides/rel_notes/release_21_05.rst New Features · line 172

Quoted 10 lines
doc/guides/rel_notes/release_21_05.rst +7 -0
@@ -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).

doc/guides/rel_notes/release_21_05.rst New Features · line 176

Quoted 4 lines
doc/guides/rel_notes/release_21_05.rst +4 -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.

author
#42 lore raw

PATCH v5 2/4 app/testpmd: add meter profile packet mode option

In reply to Li Zhang

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)

---
 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(-)
app/test-pmd/cmdline.c +3 -3
index 56cf0bf405..ec98ccc652 100644
@@ -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"
app/test-pmd/cmdline_mtr.c +37 -3
index 3982787d20..4d9bfde78d 100644
@@ -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,
 	},
 };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +17 -14
index 36f0a328a5..5785e94aeb 100644
@@ -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
 ~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.27.0
author
#44 lore raw

PATCH v5 3/4 net/softnic: check meter packet mode

In reply to Li Zhang

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

---
 drivers/net/softnic/rte_eth_softnic_meter.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/softnic/rte_eth_softnic_meter.c +8 -0
index 31a2a0e6d9..b27b1285e9 100644
@@ -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;
 }
 
Signature · 1 line
2.27.0
author
#45 lore raw

PATCH v5 4/4 net/mvpp2: check meter packet mode

In reply to Li Zhang

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

---
 drivers/net/mvpp2/mrvl_mtr.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/mvpp2/mrvl_mtr.c +6 -0
index 2fa5cb43ad..c07ac95ddc 100644
@@ -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,
Signature · 1 line
2.27.0
#46 lore raw
In reply to Li Zhang
Quoted 22 lines · 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.

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/[email protected]/

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.

Quoted 6 lines

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.