Skip to contentSkip to conversation

lib/librte_ethdev: Meter algorithms support packet per second.

RFC New Li Zhang 8 participants 49 messages Jan 25, 2021 – Mar 5, 2021 Network drivers

lore
Share & tools
lore

Li Zhang

author
#0 lore raw

cover lib/librte_ethdev: Meter algorithms support packet per second.

Li Zhang (1):
lib/librte_ethdev: add definitions for packet per second.

 lib/librte_ethdev/rte_mtr.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
Signature · 1 line
2.27.0
author
#1 lore raw

RFC PATCH 1/1 : adds support PPS(packet per second) on meter

Currently the flow Meter algorithms in rte_flow only supports bytes per second(BPS). Such as Single Rate Three Color Marker (srTCM rfc2697)
This RFC adds the packet per second definition in Meter algorithms structure, to support the rte_mtr APIs with type srTCM pps mode.
The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

---
 lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
lib/librte_ethdev/rte_mtr.h +28 -0
index 916a09c5c3..6413892aec 100644
@@ -119,6 +119,9 @@ enum rte_mtr_algorithm {
 
 	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
 	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker (srTCM) in Packet per second mode */
+	RTE_MTR_SRTCM_PPS,
 };
 
 /**
@@ -171,6 +174,18 @@ struct rte_mtr_meter_profile {
 			/** Excess Burst Size (EBS) (bytes). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCM - PPS. */
+		struct {
+			/** Committed Information Rate (CIR)(packets/second). */
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (bytes). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (bytes). */
+			uint64_t ebs;
+		} srtcm_pps;
 	};
 };
 
@@ -317,6 +332,13 @@ struct rte_mtr_capabilities {
 	 */
 	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter configured
+	 * to run the srTCM packet per second algorithm. The value of 0 
+	 * indicates this metering algorithm is not supported. 
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcm_pps_n_max;
+
 	/** Maximum traffic rate that can be metered by a single MTR object. For
 	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
 	 * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
@@ -342,6 +364,12 @@ struct rte_mtr_capabilities {
 	 */
 	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	* When non-zero, it indicates that color aware mode is supported for
+	* the srTCM packet per second  metering algorithm.
+	*/
+	int color_aware_srtcm_pps_supported;
+
 	/** When non-zero, it indicates that the policer packet recolor actions
 	 * are supported.
 	 * @see enum rte_mtr_policer_action
Signature · 1 line
2.21.0
author
#2 lore raw

cover lib/librte_ethdev: Meter algorithms support packet per second.

Li Zhang (1):
lib/librte_ethdev: add definitions for packet per second.

 lib/librte_ethdev/rte_mtr.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
Signature · 1 line
2.27.0
author
#3 lore raw

RFC PATCH v2 1/1 : adds support PPS(packet per second) on meter

Currently the flow Meter algorithms in rte_flow only supports bytes per second(BPS).
Such as Single Rate Three Color Marker (srTCM rfc2697) This RFC adds the packet per second definition in Meter algorithms structure,
to support the rte_mtr APIs with type srTCM pps mode. The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

---
 lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
lib/librte_ethdev/rte_mtr.h +28 -0
index 916a09c5c3..3e88904faf 100644
@@ -119,6 +119,9 @@ enum rte_mtr_algorithm {
 
 	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
 	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker (srTCM) in Packet per second mode */
+	RTE_MTR_SRTCM_PPS,
 };
 
 /**
@@ -171,6 +174,18 @@ struct rte_mtr_meter_profile {
 			/** Excess Burst Size (EBS) (bytes). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCM - PPS. */
+		struct {
+			/** Committed Information Rate (CIR)(packets/second). */
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (bytes). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (bytes). */
+			uint64_t ebs;
+		} srtcm_pps;
 	};
 };
 
@@ -317,6 +332,13 @@ struct rte_mtr_capabilities {
 	 */
 	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter configured
+	 * to run the srTCM packet per second algorithm. The value of 0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcm_pps_n_max;
+
 	/** Maximum traffic rate that can be metered by a single MTR object. For
 	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
 	 * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
@@ -342,6 +364,12 @@ struct rte_mtr_capabilities {
 	 */
 	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is supported for
+	 * the srTCM packet per second  metering algorithm.
+	 */
+	int color_aware_srtcm_pps_supported;
+
 	/** When non-zero, it indicates that the policer packet recolor actions
 	 * are supported.
 	 * @see enum rte_mtr_policer_action
Signature · 1 line
2.21.0
#4 lore raw

Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter

Quoted 10 lines · Li Zhang

Currently the flow Meter algorithms in rte_flow only supports bytes per second(BPS).
Such as Single Rate Three Color Marker (srTCM rfc2697) This RFC adds the packet per second definition in Meter algorithms structure,
to support the rte_mtr APIs with type srTCM pps mode. The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

cc'ed Cristian for review/comment.

Quoted 65 lines
---
  lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
  1 file changed, 28 insertions(+)
lib/librte_ethdev/rte_mtr.h +28 -0
index 916a09c5c3..3e88904faf 100644
@@ -119,6 +119,9 @@ enum rte_mtr_algorithm {
 
  	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
  	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker (srTCM) in Packet per second mode */
+	RTE_MTR_SRTCM_PPS,
  };
 
  /**
@@ -171,6 +174,18 @@ struct rte_mtr_meter_profile {
  			/** Excess Burst Size (EBS) (bytes). */
  			uint64_t ebs;
  		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCM - PPS. */
+		struct {
+			/** Committed Information Rate (CIR)(packets/second). */
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (bytes). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (bytes). */
+			uint64_t ebs;
+		} srtcm_pps;
  	};
  };
 
@@ -317,6 +332,13 @@ struct rte_mtr_capabilities {
  	 */
  	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter configured
+	 * to run the srTCM packet per second algorithm. The value of 0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcm_pps_n_max;
+
  	/** Maximum traffic rate that can be metered by a single MTR object. For
  	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
  	 * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
@@ -342,6 +364,12 @@ struct rte_mtr_capabilities {
  	 */
  	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is supported for
+	 * the srTCM packet per second  metering algorithm.
+	 */
+	int color_aware_srtcm_pps_supported;
+
  	/** When non-zero, it indicates that the policer packet recolor actions
  	 * are supported.
  	 * @see enum rte_mtr_policer_action
#5 lore raw

Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter

Quoted 46 lines

From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Thursday, January 28, 2021 7:28 PM

Quoted 10 lines · Li Zhang

Currently the flow Meter algorithms in rte_flow only supports bytes per second(BPS).
Such as Single Rate Three Color Marker (srTCM rfc2697) This RFC adds the packet per second definition in Meter algorithms structure,
to support the rte_mtr APIs with type srTCM pps mode. The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

cc'ed Cristian for review/comment.

Review

Quoted 5 lines
---
  lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
  1 file changed, 28 insertions(+)
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_mtr.h

lib/librte_ethdev/rte_mtr.h enum rte_mtr_algorithm { · line 123

Quoted 9 lines

index 916a09c5c3..3e88904faf 100644

lib/librte_ethdev/rte_mtr.h +2 -0
@@ -119,6 +119,9 @@ enum rte_mtr_algorithm {
 
  	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
  	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker (srTCM) in Packet per second

mode */

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 180

Quoted 12 lines
lib/librte_ethdev/rte_mtr.h +5 -0
+	RTE_MTR_SRTCM_PPS,
  };
 
  /**
@@ -171,6 +174,18 @@ struct rte_mtr_meter_profile {
  			/** Excess Burst Size (EBS) (bytes). */
  			uint64_t ebs;
  		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCM - PPS. */
+		struct {
+			/** Committed Information Rate (CIR)(packets/second).

*/

Quoted 8 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 188

Quoted 8 lines
lib/librte_ethdev/rte_mtr.h +8 -0
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (bytes). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (bytes). */
+			uint64_t ebs;
+		} srtcm_pps;

In PPS mode, the burst sizes (ebs, ebs) must be packets, not bytes.

Quoted 21 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 335

Quoted 8 lines
lib/librte_ethdev/rte_mtr.h +1 -0
  	};
  };
 
@@ -317,6 +332,13 @@ struct rte_mtr_capabilities {
  	 */
  	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter

configured

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 7 lines
lib/librte_ethdev/rte_mtr.h +6 -0
+	 * to run the srTCM packet per second algorithm. The value of 0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcm_pps_n_max;
+
  	/** Maximum traffic rate that can be metered by a single MTR

object. For

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 343

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC

2698,

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 344

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * this is the maximum PIR rate. For trTCM RFC 4115, this is the

maximum

Quoted 8 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 368

Quoted 6 lines
lib/librte_ethdev/rte_mtr.h +2 -0
@@ -342,6 +364,12 @@ struct rte_mtr_capabilities {
  	 */
  	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is supported

for

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 369

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +1 -0
+	 * the srTCM packet per second  metering algorithm.

No need for two spaces between the words second and metering.

Quoted 9 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 4 lines
lib/librte_ethdev/rte_mtr.h +3 -0
+	 */
+	int color_aware_srtcm_pps_supported;
+
  	/** When non-zero, it indicates that the policer packet recolor

actions

Quoted 3 lines
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * are supported.
  	 * @see enum rte_mtr_policer_action
author
#6 lore raw

Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter

Thanks for your comments.
We changed the struct as below:
struct rte_mtr_meter_profile {
......

		/** Items only valid when alg is set to sprTCM. */
		struct {
			/** Committed Information Packet Rate (CIPR). */
			uint64_t cipr;

			/** Committed Packet Burst Size (CPBS). */
			uint64_t cpbs;

			/** Excess Packet Burst Size (EPBS). */
			uint64_t epbs;
		} sprtcm;
}

Regards,
Li Zhang

Quoted 110 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Morten Br?rup
Sent: Friday, February 12, 2021 3:41 PM
To: Ferruh Yigit <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Dumitrescu, Cristian <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter

Quoted 35 lines

From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Thursday, January 28, 2021 7:28 PM

Quoted 9 lines · Li Zhang

Currently the flow Meter algorithms in rte_flow only supports bytes per second(BPS).
Such as Single Rate Three Color Marker (srTCM rfc2697) This RFC adds the packet per second definition in Meter algorithms structure, to support the rte_mtr APIs with type srTCM pps mode.
The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

cc'ed Cristian for review/comment.

Review

Quoted 5 lines
---
  lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
  1 file changed, 28 insertions(+)
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_mtr.h

lib/librte_ethdev/rte_mtr.h enum rte_mtr_algorithm { · line 123

Quoted 9 lines

index 916a09c5c3..3e88904faf 100644

lib/librte_ethdev/rte_mtr.h +2 -0
@@ -119,6 +119,9 @@ enum rte_mtr_algorithm {
 
  	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
  	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker (srTCM) in Packet per second

mode */

Quoted 3 lines
lib/librte_ethdev/rte_mtr.h +1 -0
+	RTE_MTR_SRTCM_PPS,
  };
 
Quoted 9 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 180

Quoted 9 lines
lib/librte_ethdev/rte_mtr.h +4 -0
  /**
@@ -171,6 +174,18 @@ struct rte_mtr_meter_profile {
  			/** Excess Burst Size (EBS) (bytes). */
  			uint64_t ebs;
  		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCM - PPS. */
+		struct {
+			/** Committed Information Rate

(CIR)(packets/second).

Quoted 9 lines

*/

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 188

Quoted 8 lines
lib/librte_ethdev/rte_mtr.h +8 -0
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (bytes). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (bytes). */
+			uint64_t ebs;
+		} srtcm_pps;

In PPS mode, the burst sizes (ebs, ebs) must be packets, not bytes.

Quoted 21 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 335

Quoted 8 lines
lib/librte_ethdev/rte_mtr.h +1 -0
  	};
  };
 
@@ -317,6 +332,13 @@ struct rte_mtr_capabilities {
  	 */
  	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter

configured

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 7 lines
lib/librte_ethdev/rte_mtr.h +6 -0
+	 * to run the srTCM packet per second algorithm. The value of 0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcm_pps_n_max;
+
  	/** Maximum traffic rate that can be metered by a single MTR

object. For

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 343

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC

2698,

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 344

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * this is the maximum PIR rate. For trTCM RFC 4115, this is the

maximum

Quoted 8 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 368

Quoted 6 lines
lib/librte_ethdev/rte_mtr.h +2 -0
@@ -342,6 +364,12 @@ struct rte_mtr_capabilities {
  	 */
  	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is supported

for

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 369

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +1 -0
+	 * the srTCM packet per second  metering algorithm.

No need for two spaces between the words second and metering.

Quoted 9 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 4 lines
lib/librte_ethdev/rte_mtr.h +3 -0
+	 */
+	int color_aware_srtcm_pps_supported;
+
  	/** When non-zero, it indicates that the policer packet recolor

actions

Quoted 3 lines
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * are supported.
  	 * @see enum rte_mtr_policer_action
#7 lore raw

Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter

Quoted 7 lines

From: dev [mailto:[email protected]] On Behalf Of Li Zhang
Sent: Tuesday, February 23, 2021 3:07 AM

Thanks for your comments.
We changed the struct as below:
struct rte_mtr_meter_profile {
......

Quoted 12 lines
		/** Items only valid when alg is set to sprTCM. */
		struct {
			/** Committed Information Packet Rate (CIPR). */
			uint64_t cipr;

			/** Committed Packet Burst Size (CPBS). */
			uint64_t cpbs;

			/** Excess Packet Burst Size (EPBS). */
			uint64_t epbs;
		} sprtcm;
}

That is certainly not an improvement! Please stick with the broadly accepted industry standard names (CIR, CBS, EBS, etc.). Newly invented names like CIPR will only cause confusion. Please note that CIR, CBS, EBS don't say anything about their units; it could be bytes, packets, cells, frames, messages or anything else. So it is perfectly natural using the same names for packets instead of bytes.

I propose the following modifications instead.

For the algorithm, keep the "Single Rate Three Color Marker" name mentioned in the RFCs, but indicate that the variant is packet based:

	/** Single Rate Three Color Marker, Packet based (srTCMp). */
	RTE_MTR_SRTCMP,

Or if you prefer the packet based indicator at the front instead:

	/** Packet based Single Rate Three Color Marker (psrTCM). */
	RTE_MTR_PSRTCM,

And for the meter profile, keep the industry standard names, but update the descriptions:

/** Items only valid when *alg* is set to srTCMp. */ struct {
/** Committed Information Rate (CIR) (packets/second). */ uint64_t cir;

/** Committed Burst Size (CBS) (packets). */ uint64_t cbs;

/** Excess Burst Size (EBS) (packets). */ uint64_t ebs;
} srtcmp;

Come to think of it: Is the unit packets, or is it actually Ethernet frames? In other words: Does a 4 KB TCP packet that the NIC's offload function chops up into three Ethernet frames count as one or three in this algorithm?

Med venlig hilsen / kind regards
- Morten Brørup

Quoted 127 lines

Regards,
Li Zhang

Quoted 4 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Morten Br?rup
Sent: Friday, February 12, 2021 3:41 PM
To: Ferruh Yigit <[email protected]>; Li Zhang

<[email protected]>; Dekel

Quoted 1 line

Peled <[email protected]>; Ori Kam <[email protected]>; Slava

Ovsiienko

Quoted 5 lines

<[email protected]>; Matan Azrad <[email protected]>; Dumitrescu, Cristian <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet

per second)

Quoted 7 lines

on meter

Quoted 5 lines

From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Thursday, January 28, 2021 7:28 PM

Quoted 1 line · Li Zhang

Currently the flow Meter algorithms in rte_flow only supports

bytes

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

per second(BPS).
Such as Single Rate Three Color Marker (srTCM rfc2697) This RFC

adds

Quoted 1 line
Quoted 1 line
Quoted 1 line

the packet per second definition in Meter algorithms structure,

to

Quoted 19 lines
Quoted 19 lines
Quoted 5 lines

support the rte_mtr APIs with type srTCM pps mode. The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

cc'ed Cristian for review/comment.

Review

Quoted 5 lines
---
  lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
  1 file changed, 28 insertions(+)
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_mtr.h

Quoted 5 lines

index 916a09c5c3..3e88904faf 100644

lib/librte_ethdev/rte_mtr.h +0 -0
@@ -119,6 +119,9 @@ enum rte_mtr_algorithm {
 
Quoted 4 lines
Quoted 4 lines

lib/librte_ethdev/rte_mtr.h enum rte_mtr_algorithm {

Quoted 4 lines
lib/librte_ethdev/rte_mtr.h +2 -0
  	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
  	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker (srTCM) in Packet per

second

Quoted 11 lines
Quoted 11 lines

mode */

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 178

Quoted 10 lines
lib/librte_ethdev/rte_mtr.h +3 -0
+	RTE_MTR_SRTCM_PPS,
  };
 
  /**
@@ -171,6 +174,18 @@ struct rte_mtr_meter_profile {
  			/** Excess Burst Size (EBS) (bytes). */
  			uint64_t ebs;
  		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCM -

PPS. */

Quoted 18 lines
Quoted 2 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 180

Quoted 2 lines
lib/librte_ethdev/rte_mtr.h +2 -0
+		struct {
+			/** Committed Information Rate

(CIR)(packets/second).

Quoted 9 lines

*/

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 188

Quoted 8 lines
lib/librte_ethdev/rte_mtr.h +8 -0
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (bytes). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (bytes). */
+			uint64_t ebs;
+		} srtcm_pps;

In PPS mode, the burst sizes (ebs, ebs) must be packets, not bytes.

Quoted 3 lines
Quoted 3 lines
lib/librte_ethdev/rte_mtr.h +0 -0
  	};
  };
 
Quoted 7 lines
Quoted 7 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 335

Quoted 5 lines
lib/librte_ethdev/rte_mtr.h +1 -0
@@ -317,6 +332,13 @@ struct rte_mtr_capabilities {
  	 */
  	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter

configured

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 336

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +1 -0
+	 * to run the srTCM packet per second algorithm. The value

of 0

Quoted 6 lines
Quoted 6 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 6 lines
lib/librte_ethdev/rte_mtr.h +5 -0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcm_pps_n_max;
+
  	/** Maximum traffic rate that can be metered by a single

MTR

Quoted 2 lines
Quoted 2 lines

object. For

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM

RFC

Quoted 2 lines
Quoted 2 lines

2698,

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * this is the maximum PIR rate. For trTCM RFC 4115, this

is the

Quoted 7 lines
Quoted 7 lines

maximum

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 368

Quoted 6 lines
lib/librte_ethdev/rte_mtr.h +2 -0
@@ -342,6 +364,12 @@ struct rte_mtr_capabilities {
  	 */
  	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is

supported

Quoted 9 lines
Quoted 2 lines

for

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 369

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +1 -0
+	 * the srTCM packet per second  metering algorithm.

No need for two spaces between the words second and metering.

Quoted 4 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 4 lines
lib/librte_ethdev/rte_mtr.h +3 -0
+	 */
+	int color_aware_srtcm_pps_supported;
+
  	/** When non-zero, it indicates that the policer packet

recolor

Quoted 5 lines
Quoted 5 lines

actions

Quoted 3 lines
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * are supported.
  	 * @see enum rte_mtr_policer_action
author
#8 lore raw

Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter

Hi Morten,

Thank you for your comments.
It is packet count instead of frames count.
So 4K TCP packet should be handle as one instead of 3 Ethernet Frames.

We will update the struct as below:
enum rte_mtr_algorithm {
......

	/** Single Rate Three Color Marker, Packet based (srTCMp).
	 * - - similar to IETF RFC 2697 but rate is packet per second.
	 */
	RTE_MTR_SRTCMP,
}

struct rte_mtr_meter_profile {
......

		/** Items only valid when *alg* is set to srTCMp. */
		struct {
			/** Committed Information Rate (CIR)
			 * (packets/second).
			 */
			uint64_t cir;

			/** Committed Burst Size (CBS) (packets). */
			uint64_t cbs;

			/** Excess Burst Size (EBS) (packets). */
			uint64_t ebs;
		} srtcmp;
}

Regards,
Li Zhang

Quoted 206 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Morten Br?rup
Sent: Tuesday, February 23, 2021 4:25 PM
To: Li Zhang <[email protected]>; Ferruh Yigit <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Dumitrescu, Cristian <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter

Quoted 7 lines

From: dev [mailto:[email protected]] On Behalf Of Li Zhang
Sent: Tuesday, February 23, 2021 3:07 AM

Thanks for your comments.
We changed the struct as below:
struct rte_mtr_meter_profile {
......

Quoted 12 lines
		/** Items only valid when alg is set to sprTCM. */
		struct {
			/** Committed Information Packet Rate (CIPR). */
			uint64_t cipr;

			/** Committed Packet Burst Size (CPBS). */
			uint64_t cpbs;

			/** Excess Packet Burst Size (EPBS). */
			uint64_t epbs;
		} sprtcm;
}

That is certainly not an improvement! Please stick with the broadly accepted industry standard names (CIR, CBS, EBS, etc.). Newly invented names like CIPR will only cause confusion. Please note that CIR, CBS, EBS don't say anything about their units; it could be bytes, packets, cells, frames, messages or anything else. So it is perfectly natural using the same names for packets instead of bytes.

I propose the following modifications instead.

For the algorithm, keep the "Single Rate Three Color Marker" name mentioned in the RFCs, but indicate that the variant is packet based:

	/** Single Rate Three Color Marker, Packet based (srTCMp). */
	RTE_MTR_SRTCMP,

Or if you prefer the packet based indicator at the front instead:

	/** Packet based Single Rate Three Color Marker (psrTCM). */
	RTE_MTR_PSRTCM,

And for the meter profile, keep the industry standard names, but update the descriptions:

(quoted diff) +0 -0
 		/** Items only valid when *alg* is set to srTCMp. */
 		struct {
 			/** Committed Information Rate (CIR)

(packets/second). */

(quoted diff) +0 -0
 			uint64_t cir;
 
 			/** Committed Burst Size (CBS) (packets). */
 			uint64_t cbs;
 
 			/** Excess Burst Size (EBS) (packets). */
 			uint64_t ebs;
 		} srtcmp;

Come to think of it: Is the unit packets, or is it actually Ethernet frames? In other words: Does a 4 KB TCP packet that the NIC's offload function chops up into three Ethernet frames count as one or three in this algorithm?

Med venlig hilsen / kind regards
- Morten Brørup

Quoted 13 lines

Regards,
Li Zhang

Quoted 4 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Morten Br?rup
Sent: Friday, February 12, 2021 3:41 PM
To: Ferruh Yigit <[email protected]>; Li Zhang

<[email protected]>; Dekel

Quoted 1 line

Peled <[email protected]>; Ori Kam <[email protected]>; Slava

Ovsiienko

Quoted 3 lines

<[email protected]>; Matan Azrad <[email protected]>; Dumitrescu, Cristian <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon

<[email protected]>;

Quoted 67 lines
Quoted 2 lines

Raslan Darawsheh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet

per second)

Quoted 7 lines

on meter

Quoted 5 lines

From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Thursday, January 28, 2021 7:28 PM

Quoted 1 line · Li Zhang

Currently the flow Meter algorithms in rte_flow only supports

bytes

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

per second(BPS).
Such as Single Rate Three Color Marker (srTCM rfc2697) This RFC

adds

Quoted 1 line
Quoted 1 line
Quoted 1 line

the packet per second definition in Meter algorithms structure,

to

Quoted 19 lines
Quoted 19 lines
Quoted 5 lines

support the rte_mtr APIs with type srTCM pps mode. The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

cc'ed Cristian for review/comment.

Review

Quoted 5 lines
---
  lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
  1 file changed, 28 insertions(+)
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_mtr.h

Quoted 5 lines

index 916a09c5c3..3e88904faf 100644

lib/librte_ethdev/rte_mtr.h +0 -0
@@ -119,6 +119,9 @@ enum rte_mtr_algorithm {
 
Quoted 4 lines
Quoted 4 lines

lib/librte_ethdev/rte_mtr.h enum rte_mtr_algorithm {

Quoted 4 lines
lib/librte_ethdev/rte_mtr.h +2 -0
  	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
  	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker (srTCM) in Packet per

second

Quoted 11 lines
Quoted 11 lines

mode */

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 178

Quoted 10 lines
lib/librte_ethdev/rte_mtr.h +3 -0
+	RTE_MTR_SRTCM_PPS,
  };
 
  /**
@@ -171,6 +174,18 @@ struct rte_mtr_meter_profile {
  			/** Excess Burst Size (EBS) (bytes). */
  			uint64_t ebs;
  		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCM -

PPS. */

Quoted 15 lines
Quoted 2 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 180

Quoted 2 lines
lib/librte_ethdev/rte_mtr.h +2 -0
+		struct {
+			/** Committed Information Rate

(CIR)(packets/second).

Quoted 9 lines

*/

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 188

Quoted 8 lines
lib/librte_ethdev/rte_mtr.h +8 -0
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (bytes). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (bytes). */
+			uint64_t ebs;
+		} srtcm_pps;

In PPS mode, the burst sizes (ebs, ebs) must be packets, not bytes.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 335

Quoted 8 lines
lib/librte_ethdev/rte_mtr.h +1 -0
  	};
  };
 
@@ -317,6 +332,13 @@ struct rte_mtr_capabilities {
  	 */
  	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their

meter

Quoted 39 lines
Quoted 2 lines
Quoted 2 lines

configured

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 336

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +1 -0
+	 * to run the srTCM packet per second algorithm. The value

of 0

Quoted 6 lines
Quoted 6 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 6 lines
lib/librte_ethdev/rte_mtr.h +5 -0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcm_pps_n_max;
+
  	/** Maximum traffic rate that can be metered by a single

MTR

Quoted 2 lines
Quoted 2 lines

object. For

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM

RFC

Quoted 2 lines
Quoted 2 lines

2698,

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * this is the maximum PIR rate. For trTCM RFC 4115, this

is the

Quoted 7 lines
Quoted 7 lines

maximum

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 368

Quoted 6 lines
lib/librte_ethdev/rte_mtr.h +2 -0
@@ -342,6 +364,12 @@ struct rte_mtr_capabilities {
  	 */
  	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is

supported

Quoted 9 lines
Quoted 2 lines

for

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 369

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +1 -0
+	 * the srTCM packet per second  metering algorithm.

No need for two spaces between the words second and metering.

Quoted 4 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 4 lines
lib/librte_ethdev/rte_mtr.h +3 -0
+	 */
+	int color_aware_srtcm_pps_supported;
+
  	/** When non-zero, it indicates that the policer packet

recolor

Quoted 5 lines
Quoted 5 lines

actions

Quoted 3 lines
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * are supported.
  	 * @see enum rte_mtr_policer_action
#9 lore raw

Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter

Quoted 6 lines · Li Zhang

Hi Morten,

Thank you for your comments.
It is packet count instead of frames count.
So 4K TCP packet should be handle as one instead of 3 Ethernet Frames.

So it is not dependent on the MTU?

Quoted 5 lines

We will update the struct as below:
enum rte_mtr_algorithm {
......

        /** Single Rate Three Color Marker, Packet based (srTCMp).

+1

Quoted 1 line

* - - similar to IETF RFC 2697 but rate is packet per second.

s/rate is/measured in

Quoted 6 lines
         */
        RTE_MTR_SRTCMP,
}

struct rte_mtr_meter_profile {
......

Quoted 15 lines
                /** Items only valid when *alg* is set to srTCMp. */
                struct {
                        /** Committed Information Rate (CIR)
                         * (packets/second).
                         */
                        uint64_t cir;

                        /** Committed Burst Size (CBS) (packets). */
                        uint64_t cbs;

                        /** Excess Burst Size (EBS) (packets). */
                        uint64_t ebs;
                } srtcmp;
}

::::[snip]::::

#10 lore raw

Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter

In reply to Li Zhang
Quoted 35 lines

From: dev [mailto:[email protected]] On Behalf Of Li Zhang
Sent: Monday, March 1, 2021 4:16 AM

Hi Morten,

Thank you for your comments.
It is packet count instead of frames count.
So 4K TCP packet should be handle as one instead of 3 Ethernet Frames.

We will update the struct as below:
enum rte_mtr_algorithm {
......

	/** Single Rate Three Color Marker, Packet based (srTCMp).
	 * - - similar to IETF RFC 2697 but rate is packet per second.
	 */
	RTE_MTR_SRTCMP,
}

struct rte_mtr_meter_profile {
......

		/** Items only valid when *alg* is set to srTCMp. */
		struct {
			/** Committed Information Rate (CIR)
			 * (packets/second).
			 */
			uint64_t cir;

			/** Committed Burst Size (CBS) (packets). */
			uint64_t cbs;

			/** Excess Burst Size (EBS) (packets). */
			uint64_t ebs;
		} srtcmp;
}
Quoted 2 lines

Regards,
Li Zhang

Looks good.

Quoted 229 lines
Quoted 4 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Morten Br?rup
Sent: Tuesday, February 23, 2021 4:25 PM
To: Li Zhang <[email protected]>; Ferruh Yigit

<[email protected]>; Dekel

Quoted 1 line

Peled <[email protected]>; Ori Kam <[email protected]>; Slava

Ovsiienko

Quoted 5 lines

<[email protected]>; Matan Azrad <[email protected]>; Dumitrescu, Cristian <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet

per second)

Quoted 17 lines

on meter

Quoted 15 lines

From: dev [mailto:[email protected]] On Behalf Of Li Zhang
Sent: Tuesday, February 23, 2021 3:07 AM

Thanks for your comments.
We changed the struct as below:
struct rte_mtr_meter_profile {
......

		/** Items only valid when alg is set to sprTCM. */
		struct {
			/** Committed Information Packet Rate (CIPR). */
			uint64_t cipr;

			/** Committed Packet Burst Size (CPBS). */
			uint64_t cpbs;
Quoted 6 lines
Quoted 4 lines
			/** Excess Packet Burst Size (EPBS). */
			uint64_t epbs;
		} sprtcm;
}

That is certainly not an improvement! Please stick with the broadly

accepted

Quoted 1 line

industry standard names (CIR, CBS, EBS, etc.). Newly invented names

like CIPR

Quoted 1 line

will only cause confusion. Please note that CIR, CBS, EBS don't say

anything

Quoted 1 line

about their units; it could be bytes, packets, cells, frames,

messages or

Quoted 1 line

anything else. So it is perfectly natural using the same names for

packets

Quoted 5 lines

instead of bytes.

I propose the following modifications instead.

For the algorithm, keep the "Single Rate Three Color Marker" name

mentioned

Quoted 11 lines

in the RFCs, but indicate that the variant is packet based:

	/** Single Rate Three Color Marker, Packet based (srTCMp). */
	RTE_MTR_SRTCMP,

Or if you prefer the packet based indicator at the front instead:

	/** Packet based Single Rate Three Color Marker (psrTCM). */
	RTE_MTR_PSRTCM,

And for the meter profile, keep the industry standard names, but

update the

Quoted 16 lines

descriptions:

(quoted diff) +0 -0
 		/** Items only valid when *alg* is set to srTCMp. */
 		struct {
 			/** Committed Information Rate (CIR)

(packets/second). */

(quoted diff) +0 -0
 			uint64_t cir;
 
 			/** Committed Burst Size (CBS) (packets). */
 			uint64_t cbs;
 
 			/** Excess Burst Size (EBS) (packets). */
 			uint64_t ebs;
 		} srtcmp;
Quoted 1 line

Come to think of it: Is the unit packets, or is it actually Ethernet

frames? In

Quoted 1 line

other words: Does a 4 KB TCP packet that the NIC's offload function

chops up

Quoted 13 lines

into three Ethernet frames count as one or three in this algorithm?

Med venlig hilsen / kind regards
- Morten Brørup

Quoted 7 lines

Regards,
Li Zhang

Quoted 4 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Morten Br?rup
Sent: Friday, February 12, 2021 3:41 PM
To: Ferruh Yigit <[email protected]>; Li Zhang

Quoted 9 lines
Quoted 6 lines

<[email protected]>; Dekel

Quoted 1 line

Peled <[email protected]>; Ori Kam <[email protected]>; Slava

Ovsiienko

Quoted 3 lines

<[email protected]>; Matan Azrad <[email protected]>; Dumitrescu, Cristian <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon

<[email protected]>;

Quoted 2 lines
Quoted 2 lines

Raslan Darawsheh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support

PPS(packet

Quoted 4 lines
Quoted 4 lines

per second)

Quoted 3 lines

on meter

Quoted 1 line

From: dev [mailto:[email protected]] On Behalf Of Ferruh

Yigit

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Sent: Thursday, January 28, 2021 7:28 PM

Quoted 1 line · Li Zhang

Currently the flow Meter algorithms in rte_flow only supports

bytes

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

per second(BPS).
Such as Single Rate Three Color Marker (srTCM rfc2697) This

RFC

Quoted 2 lines
Quoted 2 lines

adds

Quoted 1 line
Quoted 1 line
Quoted 1 line

the packet per second definition in Meter algorithms

structure,

Quoted 11 lines
Quoted 11 lines

to

Quoted 10 lines
Quoted 10 lines
Quoted 5 lines

support the rte_mtr APIs with type srTCM pps mode. The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

cc'ed Cristian for review/comment.

Quoted 2 lines
---
  lib/librte_ethdev/rte_mtr.h | 28

++++++++++++++++++++++++++++

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Review

Quoted 3 lines
  1 file changed, 28 insertions(+)
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_mtr.h

lib/librte_ethdev/rte_mtr.h enum rte_mtr_algorithm { · line 120

Quoted 6 lines

index 916a09c5c3..3e88904faf 100644

lib/librte_ethdev/rte_mtr.h +0 -0
@@ -119,6 +119,9 @@ enum rte_mtr_algorithm {
 
  	/** Two Rate Three Color Marker (trTCM) - IETF RFC

4115. */

Quoted 20 lines
Quoted 20 lines
Quoted 3 lines
Quoted 3 lines

lib/librte_ethdev/rte_mtr.h enum rte_mtr_algorithm {

Quoted 3 lines
lib/librte_ethdev/rte_mtr.h +2 -0
  	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker (srTCM) in Packet per

second

Quoted 11 lines
Quoted 11 lines

mode */

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 178

Quoted 10 lines
lib/librte_ethdev/rte_mtr.h +3 -0
+	RTE_MTR_SRTCM_PPS,
  };
 
  /**
@@ -171,6 +174,18 @@ struct rte_mtr_meter_profile {
  			/** Excess Burst Size (EBS) (bytes). */
  			uint64_t ebs;
  		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCM -

PPS. */

Quoted 4 lines
Quoted 2 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 180

Quoted 2 lines
lib/librte_ethdev/rte_mtr.h +2 -0
+		struct {
+			/** Committed Information Rate

(CIR)(packets/second).

Quoted 1 line

*/

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 188

Quoted 8 lines
lib/librte_ethdev/rte_mtr.h +8 -0
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (bytes). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (bytes). */
+			uint64_t ebs;
+		} srtcm_pps;

In PPS mode, the burst sizes (ebs, ebs) must be packets, not

bytes.

Quoted 11 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 335

Quoted 9 lines
lib/librte_ethdev/rte_mtr.h +1 -0
  	};
  };
 
@@ -317,6 +332,13 @@ struct rte_mtr_capabilities {
  	 */
  	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their

meter

Quoted 1 line
Quoted 1 line
Quoted 1 line

configured

Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 336

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +1 -0
+	 * to run the srTCM packet per second algorithm. The value

of 0

Quoted 6 lines
Quoted 6 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 6 lines
lib/librte_ethdev/rte_mtr.h +5 -0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcm_pps_n_max;
+
  	/** Maximum traffic rate that can be metered by a

single

Quoted 3 lines
Quoted 3 lines

MTR

Quoted 2 lines
Quoted 2 lines

object. For

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * srTCM RFC 2697, this is the maximum CIR rate. For

trTCM

Quoted 3 lines
Quoted 3 lines

RFC

Quoted 2 lines
Quoted 2 lines

2698,

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * this is the maximum PIR rate. For trTCM RFC 4115,

this

Quoted 10 lines
Quoted 10 lines

is the

Quoted 7 lines
Quoted 7 lines

maximum

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 368

Quoted 6 lines
lib/librte_ethdev/rte_mtr.h +2 -0
@@ -342,6 +364,12 @@ struct rte_mtr_capabilities {
  	 */
  	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is

supported

Quoted 1 line
Quoted 1 line

for

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 369

Quoted 1 line
lib/librte_ethdev/rte_mtr.h +1 -0
+	 * the srTCM packet per second  metering algorithm.

No need for two spaces between the words second and metering.

Quoted 4 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 4 lines
lib/librte_ethdev/rte_mtr.h +3 -0
+	 */
+	int color_aware_srtcm_pps_supported;
+
  	/** When non-zero, it indicates that the policer

packet

Quoted 6 lines
Quoted 6 lines

recolor

Quoted 5 lines
Quoted 5 lines

actions

Quoted 3 lines
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * are supported.
  	 * @see enum rte_mtr_policer_action
#11 lore raw

Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter

In reply to Ferruh Yigit
Quoted 89 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, January 28, 2021 6:28 PM
To: Li Zhang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second) on meter

Quoted 10 lines · Li Zhang

Currently the flow Meter algorithms in rte_flow only supports bytes per second(BPS).
Such as Single Rate Three Color Marker (srTCM rfc2697) This RFC adds the packet per second definition in Meter algorithms structure,
to support the rte_mtr APIs with type srTCM pps mode. The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

cc'ed Cristian for review/comment.

Quoted 9 lines
---
  lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
  1 file changed, 28 insertions(+)
lib/librte_ethdev/rte_mtr.h +0 -0
index 916a09c5c3..3e88904faf 100644

lib/librte_ethdev/rte_mtr.h enum rte_mtr_algorithm { · line 123

Quoted 5 lines
lib/librte_ethdev/rte_mtr.h +2 -0
@@ -119,6 +119,9 @@ enum rte_mtr_algorithm {
 
  	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
  	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker (srTCM) in Packet per second

mode */

lib/librte_ethdev/rte_mtr.h struct rte_mtr_meter_profile { · line 180

Quoted 12 lines
lib/librte_ethdev/rte_mtr.h +5 -0
+	RTE_MTR_SRTCM_PPS,
  };
 
  /**
@@ -171,6 +174,18 @@ struct rte_mtr_meter_profile {
  			/** Excess Burst Size (EBS) (bytes). */
  			uint64_t ebs;
  		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCM - PPS. */
+		struct {
+			/** Committed Information Rate

(CIR)(packets/second). */

Quoted 12 lines
lib/librte_ethdev/rte_mtr.h +8 -0
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (bytes). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (bytes). */
+			uint64_t ebs;
+		} srtcm_pps;
  	};
  };
 

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 335

Quoted 4 lines
lib/librte_ethdev/rte_mtr.h +1 -0
@@ -317,6 +332,13 @@ struct rte_mtr_capabilities {
  	 */
  	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter

configured

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 7 lines
lib/librte_ethdev/rte_mtr.h +6 -0
+	 * to run the srTCM packet per second algorithm. The value of 0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcm_pps_n_max;
+
  	/** Maximum traffic rate that can be metered by a single MTR

object. For

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 344

Quoted 2 lines
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
  	 * this is the maximum PIR rate. For trTCM RFC 4115, this is the

maximum

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities { · line 368

Quoted 6 lines
lib/librte_ethdev/rte_mtr.h +2 -0
@@ -342,6 +364,12 @@ struct rte_mtr_capabilities {
  	 */
  	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is supported

for

Quoted 9 lines

lib/librte_ethdev/rte_mtr.h struct rte_mtr_capabilities {

Quoted 5 lines
lib/librte_ethdev/rte_mtr.h +4 -0
+	 * the srTCM packet per second  metering algorithm.
+	 */
+	int color_aware_srtcm_pps_supported;
+
  	/** When non-zero, it indicates that the policer packet recolor

actions

Quoted 3 lines
lib/librte_ethdev/rte_mtr.h +0 -0
  	 * are supported.
  	 * @see enum rte_mtr_policer_action

Hi Li,

Sorry for my delay.

We had this same problem earlier for the rte_tm.h API, where people asked to add support for WRED and shaper rates specified in packets to the existing byte rate support. I am more than happy to support adding the same here, but please let's adopt the same solution here rather than invent a different approach.

Please refer to struct rte_tm_wred_params and struct rte_tm_shaper_params from rte_tm.h: the packets vs. bytes mode is explicitly specified through the use of a flag called packet_mode that is added to the WRED and shaper profile. When packet_mode is 0, the profile rates and bucket sizes are specified in bytes per second and bytes, respectivelly; when packet_mode is not 0, the profile rates and bucket sizes are specified in packets and packets per second, respectivelly. The same profile parameters are used, no need to invent additional algorithms (such as srTCM - packet mode) or profile data structures. Can we do the same here, please?

This is a quick summary of the required API changes to add support for the packet mode, they are minimal:
a) Introduce the packet_mode flag in the profile parameters data structure.
b) Change the description (comment) of the rate and bucket size parameters in the meter profile parameters data structures to reflect that their values represents either bytes or packets, depending on the value of the new flag packet_mode from the same structure.
c) Add the relevant capabilities: just search for "packet" in the rte_tm.h capabilities data structures and apply the same to the rte_mtr.h capabilities, when applicable.

Regards,
Cristian

author
#12 lore raw

v3 cover adds support PPS(packet per second) on meter

In reply to Li Zhang

v2:
* Rebase

Li Zhang (4):
ethdev: add meter PPS profile
common/mlx5: add meter mode definition in PRM file net/mlx5: support meter PPS profile app/testpmd: add meter pps mode cmd

 app/test-pmd/cmdline.c                        |   4 +
 app/test-pmd/cmdline_mtr.c                    | 105 ++++++++++++++++++
 app/test-pmd/cmdline_mtr.h                    |   1 +
 doc/guides/nics/mlx5.rst                      |   1 +
 .../traffic_metering_and_policing.rst         |   3 +-
 doc/guides/rel_notes/release_20_11.rst        |   5 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  15 +++
 drivers/common/mlx5/mlx5_prm.h                |   8 ++
 drivers/net/mlx5/mlx5.h                       |  13 ++-
 drivers/net/mlx5/mlx5_flow_aso.c              |  17 ++-
 drivers/net/mlx5/mlx5_flow_meter.c            |  71 +++++++++---
 lib/librte_ethdev/rte_mtr.h                   |  32 ++++++
 12 files changed, 251 insertions(+), 24 deletions(-)
Signature · 1 line
2.21.0
author
#13 lore raw

RFC v3 1/4 ethdev: add meter PPS profile

Currently meter algorithms only supports rate is bytes per second(BPS). Add this new meter srTCMp algorithm to support rate is packet per second. So that it can meter traffic by packet per second.
The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

---
 .../traffic_metering_and_policing.rst         |  3 +-
 doc/guides/rel_notes/release_20_11.rst        |  5 +++
 lib/librte_ethdev/rte_mtr.h                   | 32 +++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)
doc/guides/prog_guide/traffic_metering_and_policing.rst +2 -1
index 90c781eb1d..4d2405d44a 100644
@@ -17,7 +17,8 @@ The main features are:
 * Part of DPDK rte_ethdev API
 * Capability query API
 * Metering algorithms: RFC 2697 Single Rate Three Color Marker (srTCM), RFC 2698
-  and RFC 4115 Two Rate Three Color Marker (trTCM)
+  and RFC 4115 Two Rate Three Color Marker (trTCM),
+  Single Rate Three Color Marker, Packet based (srTCMp).
 * Policer actions (per meter output color): recolor, drop
 * Statistics (per policer output color)
 
doc/guides/rel_notes/release_20_11.rst +5 -0
index 7405a9864f..de04886cc9 100644
@@ -429,6 +429,11 @@ New Features
   can leverage IOAT DMA channels with vhost asynchronous APIs.
   See the :doc:`../sample_app_ug/vhost` for more details.
 
+* **Added support for meter PPS profile.**
+
+  Currently meter algorithms only supports bytes per second(BPS).
+  Add this new meter algorithm to support packet per second (PPS) mode.
+  So that it can meter traffic by packet per second.
 
 Removed Items
 -------------
lib/librte_ethdev/rte_mtr.h +32 -0
index 916a09c5c3..f27a4b5354 100644
@@ -119,6 +119,11 @@ enum rte_mtr_algorithm {
 
 	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
 	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker, Packet based (srTCMp).
+	 * - - similar to IETF RFC 2697 but rate is packet per second.
+	 */
+	RTE_MTR_SRTCMP,
 };
 
 /**
@@ -171,6 +176,20 @@ struct rte_mtr_meter_profile {
 			/** Excess Burst Size (EBS) (bytes). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCMp. */
+		struct {
+			/** Committed Information Rate (CIR)
+			 * (packets/second).
+			 */
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (packets). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (packets). */
+			uint64_t ebs;
+		} srtcmp;
 	};
 };
 
@@ -317,6 +336,13 @@ struct rte_mtr_capabilities {
 	 */
 	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter configured
+	 * to run the srTCMp algorithm. The value of 0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcmp_n_max;
+
 	/** Maximum traffic rate that can be metered by a single MTR object. For
 	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
 	 * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
@@ -342,6 +368,12 @@ struct rte_mtr_capabilities {
 	 */
 	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is supported for
+	 * the srTCMp metering algorithm.
+	 */
+	int color_aware_srtcmp_supported;
+
 	/** When non-zero, it indicates that the policer packet recolor actions
 	 * are supported.
 	 * @see enum rte_mtr_policer_action
Signature · 1 line
2.21.0
author
#14 lore raw

RFC v3 2/4 common/mlx5: add meter mode definition in PRM file

In reply to Li Zhang

Add meter mode definition in PRM file

---
 drivers/common/mlx5/mlx5_prm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/common/mlx5/mlx5_prm.h +8 -0
index e3d4120849..609b1c3951 100644
@@ -2177,6 +2177,13 @@ struct mlx5_ifc_flow_meter_parameters_bits {
 #define MLX5_IFC_FLOW_METER_PARAM_MASK UINT64_C(0x80FFFFFF)
 #define MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL 0x14BF00C8
 
+enum {
+	MLX5_METER_MODE_IP_LEN = 0x0,
+	MLX5_METER_MODE_L2_LEN = 0x1,
+	MLX5_METER_MODE_L2_IPG_LEN = 0x2,
+	MLX5_METER_MODE_PKT = 0x3,
+};
+
 enum {
 	MLX5_CQE_SIZE_64B = 0x0,
 	MLX5_CQE_SIZE_128B = 0x1,
@@ -2508,6 +2515,7 @@ struct mlx5_aso_mtr_dseg {
 #define ASO_DSEG_VALID_OFFSET 31
 #define ASO_DSEG_BO_OFFSET 30
 #define ASO_DSEG_SC_OFFSET 28
+#define ASO_DSEG_MTR_MODE 24
 #define ASO_DSEG_CBS_EXP_OFFSET 24
 #define ASO_DSEG_CBS_MAN_OFFSET 16
 #define ASO_DSEG_CIR_EXP_MASK 0x1F
Signature · 1 line
2.21.0
author
#15 lore raw

RFC v3 3/4 net/mlx5: support meter PPS profile

In reply to Li Zhang

Currently meter algorithms only supports bytes per second(BPS). Such as Single Rate Three Color Marker (srTCM rfc2697)
Add this new meter srTCMp algorithm to support rate is packet per second. So that it can meter traffic by packet per second (PPS).

---
 doc/guides/nics/mlx5.rst           |  1 +
 drivers/net/mlx5/mlx5.h            | 13 ++++--
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 71 ++++++++++++++++++++++++------
 4 files changed, 79 insertions(+), 23 deletions(-)
doc/guides/nics/mlx5.rst +1 -0
index a390a4b53c..93f5c0e4d4 100644
@@ -362,6 +362,7 @@ Limitations
   - Green color is not supported with drop action.
   - Yellow detection is not supported.
   - Red color must be with drop action.
+  - meter srTCMp algorithm is supported.
 
 Statistics
 ----------
drivers/net/mlx5/mlx5.h +9 -4
index 2790995dcc..16fa1b6c4d 100644
@@ -742,8 +742,13 @@ struct mlx5_flow_meter_info {
 	/**< Flow meter action. */
 };
 
-/* RFC2697 parameter structure. */
-struct mlx5_flow_meter_srtcm_rfc2697_prm {
+/* PPS(packets per second) map to BPS(Bytes per second).
+ * HW treat packet as 128bytes in PPS mode
+ */
+#define MLX5_MTRS_PPS_MAP_BPS_SHIFT 7
+
+/* RFC2697/PPS parameter structure. */
+struct mlx5_flow_meter_srtcm_prm {
 	rte_be32_t cbs_cir;
 	/*
 	 * bit 24-28: cbs_exponent, bit 16-23 cbs_mantissa,
@@ -763,8 +768,8 @@ struct mlx5_flow_meter_profile {
 	uint32_t id; /**< Profile id. */
 	struct rte_mtr_meter_profile profile; /**< Profile detail. */
 	union {
-		struct mlx5_flow_meter_srtcm_rfc2697_prm srtcm_prm;
-		/**< srtcm_rfc2697 struct. */
+		struct mlx5_flow_meter_srtcm_prm srtcm_prm;
+		/**< srtcm_rfc2697/srtcm_pps struct. */
 	};
 	uint32_t ref_cnt; /**< Use count. */
 };
drivers/net/mlx5/mlx5_flow_aso.c +11 -6
index c9280b1f9d..3f3ba7e8fa 100644
@@ -244,7 +244,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 	volatile struct mlx5_aso_wqe *restrict wqe;
 	int i;
 	int size = 1 << sq->log_desc_n;
-	uint32_t idx;
 
 	/* All the next fields state should stay constant. */
 	for (i = 0, wqe = &sq->wqes[0]; i < size; ++i, ++wqe) {
@@ -257,11 +256,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 			 (BYTEWISE_64BYTE << ASO_CSEG_DATA_MASK_MODE_OFFSET));
 		wqe->general_cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS <<
 							 MLX5_COMP_MODE_OFFSET);
-		for (idx = 0; idx < MLX5_ASO_METERS_PER_WQE;
-			idx++)
-			wqe->aso_dseg.mtrs[idx].v_bo_sc_bbog_mm =
-				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
-				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	}
 }
 
@@ -744,6 +738,7 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 {
 	volatile struct mlx5_aso_wqe *wqe = NULL;
 	struct mlx5_flow_meter_info *fm = NULL;
+	struct mlx5_flow_meter_profile *fmp;
 	uint16_t size = 1 << sq->log_desc_n;
 	uint16_t mask = size - 1;
 	uint16_t res = size - (uint16_t)(sq->head - sq->tail);
@@ -781,6 +776,16 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 			RTE_BE32(MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL);
 		wqe->aso_dseg.mtrs[dseg_idx].ebs_eir = 0;
 	}
+	fmp = fm->profile;
+	if (fmp->profile.alg == RTE_MTR_SRTCMP)
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET) |
+				(MLX5_METER_MODE_PKT << ASO_DSEG_MTR_MODE));
+	else
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	sq->head++;
 	sq->pi += 2;/* Each WQE contains 2 WQEBB's. */
 	rte_io_wmb();
drivers/net/mlx5/mlx5_flow_meter.c +58 -13

136 lines not on this page · raw message

Signature · 1 line
2.21.0
author
#16 lore raw

RFC v3 4/4 app/testpmd: add meter pps mode cmd

In reply to Li Zhang

Support meter pps mode

---
 app/test-pmd/cmdline.c                      |   4 +
 app/test-pmd/cmdline_mtr.c                  | 105 ++++++++++++++++++++
 app/test-pmd/cmdline_mtr.h                  |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  15 +++
 4 files changed, 125 insertions(+)
app/test-pmd/cmdline.c +4 -0
index d274a7cb8c..1a3fc644dc 100644
@@ -698,6 +698,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs)\n"
 			"    meter profile add - trtcm rfc 4115\n\n"
 
+			"add port meter profile srtcmp (port_id) (profile_id) (cipr) (cpbs) (epbs)\n"
+			"    meter profile add - srtcmp packet per second\n\n"
+
 			"del port meter profile (port_id) (profile_id)\n"
 			"    meter profile delete\n\n"
 
@@ -17006,6 +17009,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_show_port_meter_cap,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_trtcm,
+	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcmp,
 	(cmdline_parse_inst_t *)&cmd_del_port_meter_profile,
 	(cmdline_parse_inst_t *)&cmd_create_port_meter,
 	(cmdline_parse_inst_t *)&cmd_enable_port_meter,
app/test-pmd/cmdline_mtr.c +105 -0

123 lines not on this page · raw message

app/test-pmd/cmdline_mtr.h +1 -0
index e69d6da023..01ef85e1e7 100644
@@ -10,6 +10,7 @@ extern cmdline_parse_inst_t cmd_show_port_meter_cap;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115;
+extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp;
 extern cmdline_parse_inst_t cmd_del_port_meter_profile;
 extern cmdline_parse_inst_t cmd_create_port_meter;
 extern cmdline_parse_inst_t cmd_enable_port_meter;
doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -0
index 37278d31d6..d11de05583 100644
@@ -2734,6 +2734,21 @@ where:
 * ``cbs``: Committed burst size (bytes).
 * ``ebs``: Excess burst size (bytes).
 
+add port meter profile (srTcmp)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add meter profile (srTcmp) to the ethernet device::
+
+   testpmd> add port meter profile srtcmp (port_id) (profile_id) \
+   (cir) (cbs) (ebs)
+
+where:
+
+* ``profile_id``: ID for the meter profile.
+* ``cpr``: Committed Information Rate (CIR) (packets/second).
+* ``cbs``: Committed Burst Size (CBS) (packets).
+* ``ebs``: Excess Burst Size (EBS) (packets).
+
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
Signature · 1 line
2.21.0
author
#17 lore raw

v3 cover adds support PPS(packet per second) on meter

In reply to Li Zhang

v2:
* Rebase

Li Zhang (4):
ethdev: add meter PPS profile
common/mlx5: add meter mode definition in PRM file net/mlx5: support meter PPS profile app/testpmd: add meter pps mode cmd

 app/test-pmd/cmdline.c                        |   4 +
 app/test-pmd/cmdline_mtr.c                    | 105 ++++++++++++++++++
 app/test-pmd/cmdline_mtr.h                    |   1 +
 doc/guides/nics/mlx5.rst                      |   1 +
 .../traffic_metering_and_policing.rst         |   3 +-
 doc/guides/rel_notes/release_20_11.rst        |   5 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  15 +++
 drivers/common/mlx5/mlx5_prm.h                |   8 ++
 drivers/net/mlx5/mlx5.h                       |  13 ++-
 drivers/net/mlx5/mlx5_flow_aso.c              |  17 ++-
 drivers/net/mlx5/mlx5_flow_meter.c            |  71 +++++++++---
 lib/librte_ethdev/rte_mtr.h                   |  32 ++++++
 12 files changed, 251 insertions(+), 24 deletions(-)
Signature · 1 line
2.21.0
author
#18 lore raw

RFC v3 1/4 ethdev: add meter PPS profile

Currently meter algorithms only supports rate is bytes per second(BPS). Add this new meter srTCMp algorithm to support rate is packet per second. So that it can meter traffic by packet per second.
The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

---
 .../traffic_metering_and_policing.rst         |  3 +-
 doc/guides/rel_notes/release_20_11.rst        |  5 +++
 lib/librte_ethdev/rte_mtr.h                   | 32 +++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)
doc/guides/prog_guide/traffic_metering_and_policing.rst +2 -1
index 90c781eb1d..4d2405d44a 100644
@@ -17,7 +17,8 @@ The main features are:
 * Part of DPDK rte_ethdev API
 * Capability query API
 * Metering algorithms: RFC 2697 Single Rate Three Color Marker (srTCM), RFC 2698
-  and RFC 4115 Two Rate Three Color Marker (trTCM)
+  and RFC 4115 Two Rate Three Color Marker (trTCM),
+  Single Rate Three Color Marker, Packet based (srTCMp).
 * Policer actions (per meter output color): recolor, drop
 * Statistics (per policer output color)
 
doc/guides/rel_notes/release_20_11.rst +5 -0
index 7405a9864f..de04886cc9 100644
@@ -429,6 +429,11 @@ New Features
   can leverage IOAT DMA channels with vhost asynchronous APIs.
   See the :doc:`../sample_app_ug/vhost` for more details.
 
+* **Added support for meter PPS profile.**
+
+  Currently meter algorithms only supports bytes per second(BPS).
+  Add this new meter algorithm to support packet per second (PPS) mode.
+  So that it can meter traffic by packet per second.
 
 Removed Items
 -------------
lib/librte_ethdev/rte_mtr.h +32 -0
index 916a09c5c3..f27a4b5354 100644
@@ -119,6 +119,11 @@ enum rte_mtr_algorithm {
 
 	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
 	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker, Packet based (srTCMp).
+	 * - - similar to IETF RFC 2697 but rate is packet per second.
+	 */
+	RTE_MTR_SRTCMP,
 };
 
 /**
@@ -171,6 +176,20 @@ struct rte_mtr_meter_profile {
 			/** Excess Burst Size (EBS) (bytes). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCMp. */
+		struct {
+			/** Committed Information Rate (CIR)
+			 * (packets/second).
+			 */
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (packets). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (packets). */
+			uint64_t ebs;
+		} srtcmp;
 	};
 };
 
@@ -317,6 +336,13 @@ struct rte_mtr_capabilities {
 	 */
 	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter configured
+	 * to run the srTCMp algorithm. The value of 0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcmp_n_max;
+
 	/** Maximum traffic rate that can be metered by a single MTR object. For
 	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
 	 * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
@@ -342,6 +368,12 @@ struct rte_mtr_capabilities {
 	 */
 	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is supported for
+	 * the srTCMp metering algorithm.
+	 */
+	int color_aware_srtcmp_supported;
+
 	/** When non-zero, it indicates that the policer packet recolor actions
 	 * are supported.
 	 * @see enum rte_mtr_policer_action
Signature · 1 line
2.21.0
author
#19 lore raw

RFC v3 2/4 common/mlx5: add meter mode definition in PRM file

In reply to Li Zhang

Add meter mode definition in PRM file

---
 drivers/common/mlx5/mlx5_prm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/common/mlx5/mlx5_prm.h +8 -0
index e3d4120849..609b1c3951 100644
@@ -2177,6 +2177,13 @@ struct mlx5_ifc_flow_meter_parameters_bits {
 #define MLX5_IFC_FLOW_METER_PARAM_MASK UINT64_C(0x80FFFFFF)
 #define MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL 0x14BF00C8
 
+enum {
+	MLX5_METER_MODE_IP_LEN = 0x0,
+	MLX5_METER_MODE_L2_LEN = 0x1,
+	MLX5_METER_MODE_L2_IPG_LEN = 0x2,
+	MLX5_METER_MODE_PKT = 0x3,
+};
+
 enum {
 	MLX5_CQE_SIZE_64B = 0x0,
 	MLX5_CQE_SIZE_128B = 0x1,
@@ -2508,6 +2515,7 @@ struct mlx5_aso_mtr_dseg {
 #define ASO_DSEG_VALID_OFFSET 31
 #define ASO_DSEG_BO_OFFSET 30
 #define ASO_DSEG_SC_OFFSET 28
+#define ASO_DSEG_MTR_MODE 24
 #define ASO_DSEG_CBS_EXP_OFFSET 24
 #define ASO_DSEG_CBS_MAN_OFFSET 16
 #define ASO_DSEG_CIR_EXP_MASK 0x1F
Signature · 1 line
2.21.0
author
#20 lore raw

RFC v3 3/4 net/mlx5: support meter PPS profile

In reply to Li Zhang

Currently meter algorithms only supports bytes per second(BPS). Such as Single Rate Three Color Marker (srTCM rfc2697)
Add this new meter srTCMp algorithm to support rate is packet per second. So that it can meter traffic by packet per second (PPS).

---
 doc/guides/nics/mlx5.rst           |  1 +
 drivers/net/mlx5/mlx5.h            | 13 ++++--
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 71 ++++++++++++++++++++++++------
 4 files changed, 79 insertions(+), 23 deletions(-)
doc/guides/nics/mlx5.rst +1 -0
index a390a4b53c..93f5c0e4d4 100644
@@ -362,6 +362,7 @@ Limitations
   - Green color is not supported with drop action.
   - Yellow detection is not supported.
   - Red color must be with drop action.
+  - meter srTCMp algorithm is supported.
 
 Statistics
 ----------
drivers/net/mlx5/mlx5.h +9 -4
index 2790995dcc..16fa1b6c4d 100644
@@ -742,8 +742,13 @@ struct mlx5_flow_meter_info {
 	/**< Flow meter action. */
 };
 
-/* RFC2697 parameter structure. */
-struct mlx5_flow_meter_srtcm_rfc2697_prm {
+/* PPS(packets per second) map to BPS(Bytes per second).
+ * HW treat packet as 128bytes in PPS mode
+ */
+#define MLX5_MTRS_PPS_MAP_BPS_SHIFT 7
+
+/* RFC2697/PPS parameter structure. */
+struct mlx5_flow_meter_srtcm_prm {
 	rte_be32_t cbs_cir;
 	/*
 	 * bit 24-28: cbs_exponent, bit 16-23 cbs_mantissa,
@@ -763,8 +768,8 @@ struct mlx5_flow_meter_profile {
 	uint32_t id; /**< Profile id. */
 	struct rte_mtr_meter_profile profile; /**< Profile detail. */
 	union {
-		struct mlx5_flow_meter_srtcm_rfc2697_prm srtcm_prm;
-		/**< srtcm_rfc2697 struct. */
+		struct mlx5_flow_meter_srtcm_prm srtcm_prm;
+		/**< srtcm_rfc2697/srtcm_pps struct. */
 	};
 	uint32_t ref_cnt; /**< Use count. */
 };
drivers/net/mlx5/mlx5_flow_aso.c +11 -6
index c9280b1f9d..3f3ba7e8fa 100644
@@ -244,7 +244,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 	volatile struct mlx5_aso_wqe *restrict wqe;
 	int i;
 	int size = 1 << sq->log_desc_n;
-	uint32_t idx;
 
 	/* All the next fields state should stay constant. */
 	for (i = 0, wqe = &sq->wqes[0]; i < size; ++i, ++wqe) {
@@ -257,11 +256,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 			 (BYTEWISE_64BYTE << ASO_CSEG_DATA_MASK_MODE_OFFSET));
 		wqe->general_cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS <<
 							 MLX5_COMP_MODE_OFFSET);
-		for (idx = 0; idx < MLX5_ASO_METERS_PER_WQE;
-			idx++)
-			wqe->aso_dseg.mtrs[idx].v_bo_sc_bbog_mm =
-				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
-				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	}
 }
 
@@ -744,6 +738,7 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 {
 	volatile struct mlx5_aso_wqe *wqe = NULL;
 	struct mlx5_flow_meter_info *fm = NULL;
+	struct mlx5_flow_meter_profile *fmp;
 	uint16_t size = 1 << sq->log_desc_n;
 	uint16_t mask = size - 1;
 	uint16_t res = size - (uint16_t)(sq->head - sq->tail);
@@ -781,6 +776,16 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 			RTE_BE32(MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL);
 		wqe->aso_dseg.mtrs[dseg_idx].ebs_eir = 0;
 	}
+	fmp = fm->profile;
+	if (fmp->profile.alg == RTE_MTR_SRTCMP)
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET) |
+				(MLX5_METER_MODE_PKT << ASO_DSEG_MTR_MODE));
+	else
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	sq->head++;
 	sq->pi += 2;/* Each WQE contains 2 WQEBB's. */
 	rte_io_wmb();
drivers/net/mlx5/mlx5_flow_meter.c +58 -13

136 lines not on this page · raw message

Signature · 1 line
2.21.0
author
#21 lore raw

RFC v3 4/4 app/testpmd: add meter pps mode cmd

In reply to Li Zhang

Support meter pps mode

---
 app/test-pmd/cmdline.c                      |   4 +
 app/test-pmd/cmdline_mtr.c                  | 105 ++++++++++++++++++++
 app/test-pmd/cmdline_mtr.h                  |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  15 +++
 4 files changed, 125 insertions(+)
app/test-pmd/cmdline.c +4 -0
index d274a7cb8c..1a3fc644dc 100644
@@ -698,6 +698,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs)\n"
 			"    meter profile add - trtcm rfc 4115\n\n"
 
+			"add port meter profile srtcmp (port_id) (profile_id) (cipr) (cpbs) (epbs)\n"
+			"    meter profile add - srtcmp packet per second\n\n"
+
 			"del port meter profile (port_id) (profile_id)\n"
 			"    meter profile delete\n\n"
 
@@ -17006,6 +17009,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_show_port_meter_cap,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_trtcm,
+	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcmp,
 	(cmdline_parse_inst_t *)&cmd_del_port_meter_profile,
 	(cmdline_parse_inst_t *)&cmd_create_port_meter,
 	(cmdline_parse_inst_t *)&cmd_enable_port_meter,
app/test-pmd/cmdline_mtr.c +105 -0

123 lines not on this page · raw message

app/test-pmd/cmdline_mtr.h +1 -0
index e69d6da023..01ef85e1e7 100644
@@ -10,6 +10,7 @@ extern cmdline_parse_inst_t cmd_show_port_meter_cap;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115;
+extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp;
 extern cmdline_parse_inst_t cmd_del_port_meter_profile;
 extern cmdline_parse_inst_t cmd_create_port_meter;
 extern cmdline_parse_inst_t cmd_enable_port_meter;
doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -0
index 37278d31d6..d11de05583 100644
@@ -2734,6 +2734,21 @@ where:
 * ``cbs``: Committed burst size (bytes).
 * ``ebs``: Excess burst size (bytes).
 
+add port meter profile (srTcmp)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add meter profile (srTcmp) to the ethernet device::
+
+   testpmd> add port meter profile srtcmp (port_id) (profile_id) \
+   (cir) (cbs) (ebs)
+
+where:
+
+* ``profile_id``: ID for the meter profile.
+* ``cpr``: Committed Information Rate (CIR) (packets/second).
+* ``cbs``: Committed Burst Size (CBS) (packets).
+* ``ebs``: Excess Burst Size (EBS) (packets).
+
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
Signature · 1 line
2.21.0
author
#22 lore raw

v3 cover adds support PPS(packet per second) on meter

In reply to Li Zhang

v3:
* Redefine the struct name for PPS mode.

v2:
* Rebase

Li Zhang (4):
ethdev: add meter PPS profile
common/mlx5: add meter mode definition in PRM file net/mlx5: support meter PPS profile app/testpmd: add meter pps mode cmd

 app/test-pmd/cmdline.c                        |   4 +
 app/test-pmd/cmdline_mtr.c                    | 105 ++++++++++++++++++
 app/test-pmd/cmdline_mtr.h                    |   1 +
 doc/guides/nics/mlx5.rst                      |   1 +
 .../traffic_metering_and_policing.rst         |   3 +-
 doc/guides/rel_notes/release_20_11.rst        |   5 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  15 +++
 drivers/common/mlx5/mlx5_prm.h                |   8 ++
 drivers/net/mlx5/mlx5.h                       |  13 ++-
 drivers/net/mlx5/mlx5_flow_aso.c              |  17 ++-
 drivers/net/mlx5/mlx5_flow_meter.c            |  71 +++++++++---
 lib/librte_ethdev/rte_mtr.h                   |  32 ++++++
 12 files changed, 251 insertions(+), 24 deletions(-)
Signature · 1 line
2.21.0
author
#23 lore raw

RFC v3 1/4 ethdev: add meter PPS profile

Currently meter algorithms only supports rate is bytes per second(BPS). Add this new meter srTCMp algorithm to support rate is packet per second. So that it can meter traffic by packet per second.
The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

---
 .../traffic_metering_and_policing.rst         |  3 +-
 doc/guides/rel_notes/release_20_11.rst        |  5 +++
 lib/librte_ethdev/rte_mtr.h                   | 32 +++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)
doc/guides/prog_guide/traffic_metering_and_policing.rst +2 -1
index 90c781eb1d..4d2405d44a 100644
@@ -17,7 +17,8 @@ The main features are:
 * Part of DPDK rte_ethdev API
 * Capability query API
 * Metering algorithms: RFC 2697 Single Rate Three Color Marker (srTCM), RFC 2698
-  and RFC 4115 Two Rate Three Color Marker (trTCM)
+  and RFC 4115 Two Rate Three Color Marker (trTCM),
+  Single Rate Three Color Marker, Packet based (srTCMp).
 * Policer actions (per meter output color): recolor, drop
 * Statistics (per policer output color)
 
doc/guides/rel_notes/release_20_11.rst +5 -0
index 7405a9864f..de04886cc9 100644
@@ -429,6 +429,11 @@ New Features
   can leverage IOAT DMA channels with vhost asynchronous APIs.
   See the :doc:`../sample_app_ug/vhost` for more details.
 
+* **Added support for meter PPS profile.**
+
+  Currently meter algorithms only supports bytes per second(BPS).
+  Add this new meter algorithm to support packet per second (PPS) mode.
+  So that it can meter traffic by packet per second.
 
 Removed Items
 -------------
lib/librte_ethdev/rte_mtr.h +32 -0
index 916a09c5c3..f27a4b5354 100644
@@ -119,6 +119,11 @@ enum rte_mtr_algorithm {
 
 	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
 	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker, Packet based (srTCMp).
+	 * - - similar to IETF RFC 2697 but rate is packet per second.
+	 */
+	RTE_MTR_SRTCMP,
 };
 
 /**
@@ -171,6 +176,20 @@ struct rte_mtr_meter_profile {
 			/** Excess Burst Size (EBS) (bytes). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCMp. */
+		struct {
+			/** Committed Information Rate (CIR)
+			 * (packets/second).
+			 */
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (packets). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (packets). */
+			uint64_t ebs;
+		} srtcmp;
 	};
 };
 
@@ -317,6 +336,13 @@ struct rte_mtr_capabilities {
 	 */
 	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter configured
+	 * to run the srTCMp algorithm. The value of 0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcmp_n_max;
+
 	/** Maximum traffic rate that can be metered by a single MTR object. For
 	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
 	 * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
@@ -342,6 +368,12 @@ struct rte_mtr_capabilities {
 	 */
 	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is supported for
+	 * the srTCMp metering algorithm.
+	 */
+	int color_aware_srtcmp_supported;
+
 	/** When non-zero, it indicates that the policer packet recolor actions
 	 * are supported.
 	 * @see enum rte_mtr_policer_action
Signature · 1 line
2.21.0
author
#24 lore raw

RFC v3 2/4 common/mlx5: add meter mode definition in PRM file

In reply to Li Zhang

Add meter mode definition in PRM file

---
 drivers/common/mlx5/mlx5_prm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/common/mlx5/mlx5_prm.h +8 -0
index e3d4120849..609b1c3951 100644
@@ -2177,6 +2177,13 @@ struct mlx5_ifc_flow_meter_parameters_bits {
 #define MLX5_IFC_FLOW_METER_PARAM_MASK UINT64_C(0x80FFFFFF)
 #define MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL 0x14BF00C8
 
+enum {
+	MLX5_METER_MODE_IP_LEN = 0x0,
+	MLX5_METER_MODE_L2_LEN = 0x1,
+	MLX5_METER_MODE_L2_IPG_LEN = 0x2,
+	MLX5_METER_MODE_PKT = 0x3,
+};
+
 enum {
 	MLX5_CQE_SIZE_64B = 0x0,
 	MLX5_CQE_SIZE_128B = 0x1,
@@ -2508,6 +2515,7 @@ struct mlx5_aso_mtr_dseg {
 #define ASO_DSEG_VALID_OFFSET 31
 #define ASO_DSEG_BO_OFFSET 30
 #define ASO_DSEG_SC_OFFSET 28
+#define ASO_DSEG_MTR_MODE 24
 #define ASO_DSEG_CBS_EXP_OFFSET 24
 #define ASO_DSEG_CBS_MAN_OFFSET 16
 #define ASO_DSEG_CIR_EXP_MASK 0x1F
Signature · 1 line
2.21.0
author
#25 lore raw

RFC v3 3/4 net/mlx5: support meter PPS profile

In reply to Li Zhang

Currently meter algorithms only supports bytes per second(BPS). Such as Single Rate Three Color Marker (srTCM rfc2697)
Add this new meter srTCMp algorithm to support rate is packet per second. So that it can meter traffic by packet per second (PPS).

---
 doc/guides/nics/mlx5.rst           |  1 +
 drivers/net/mlx5/mlx5.h            | 13 ++++--
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 71 ++++++++++++++++++++++++------
 4 files changed, 79 insertions(+), 23 deletions(-)
doc/guides/nics/mlx5.rst +1 -0
index a390a4b53c..93f5c0e4d4 100644
@@ -362,6 +362,7 @@ Limitations
   - Green color is not supported with drop action.
   - Yellow detection is not supported.
   - Red color must be with drop action.
+  - meter srTCMp algorithm is supported.
 
 Statistics
 ----------
drivers/net/mlx5/mlx5.h +9 -4
index 2790995dcc..16fa1b6c4d 100644
@@ -742,8 +742,13 @@ struct mlx5_flow_meter_info {
 	/**< Flow meter action. */
 };
 
-/* RFC2697 parameter structure. */
-struct mlx5_flow_meter_srtcm_rfc2697_prm {
+/* PPS(packets per second) map to BPS(Bytes per second).
+ * HW treat packet as 128bytes in PPS mode
+ */
+#define MLX5_MTRS_PPS_MAP_BPS_SHIFT 7
+
+/* RFC2697/PPS parameter structure. */
+struct mlx5_flow_meter_srtcm_prm {
 	rte_be32_t cbs_cir;
 	/*
 	 * bit 24-28: cbs_exponent, bit 16-23 cbs_mantissa,
@@ -763,8 +768,8 @@ struct mlx5_flow_meter_profile {
 	uint32_t id; /**< Profile id. */
 	struct rte_mtr_meter_profile profile; /**< Profile detail. */
 	union {
-		struct mlx5_flow_meter_srtcm_rfc2697_prm srtcm_prm;
-		/**< srtcm_rfc2697 struct. */
+		struct mlx5_flow_meter_srtcm_prm srtcm_prm;
+		/**< srtcm_rfc2697/srtcm_pps struct. */
 	};
 	uint32_t ref_cnt; /**< Use count. */
 };
drivers/net/mlx5/mlx5_flow_aso.c +11 -6
index c9280b1f9d..3f3ba7e8fa 100644
@@ -244,7 +244,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 	volatile struct mlx5_aso_wqe *restrict wqe;
 	int i;
 	int size = 1 << sq->log_desc_n;
-	uint32_t idx;
 
 	/* All the next fields state should stay constant. */
 	for (i = 0, wqe = &sq->wqes[0]; i < size; ++i, ++wqe) {
@@ -257,11 +256,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 			 (BYTEWISE_64BYTE << ASO_CSEG_DATA_MASK_MODE_OFFSET));
 		wqe->general_cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS <<
 							 MLX5_COMP_MODE_OFFSET);
-		for (idx = 0; idx < MLX5_ASO_METERS_PER_WQE;
-			idx++)
-			wqe->aso_dseg.mtrs[idx].v_bo_sc_bbog_mm =
-				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
-				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	}
 }
 
@@ -744,6 +738,7 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 {
 	volatile struct mlx5_aso_wqe *wqe = NULL;
 	struct mlx5_flow_meter_info *fm = NULL;
+	struct mlx5_flow_meter_profile *fmp;
 	uint16_t size = 1 << sq->log_desc_n;
 	uint16_t mask = size - 1;
 	uint16_t res = size - (uint16_t)(sq->head - sq->tail);
@@ -781,6 +776,16 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 			RTE_BE32(MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL);
 		wqe->aso_dseg.mtrs[dseg_idx].ebs_eir = 0;
 	}
+	fmp = fm->profile;
+	if (fmp->profile.alg == RTE_MTR_SRTCMP)
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET) |
+				(MLX5_METER_MODE_PKT << ASO_DSEG_MTR_MODE));
+	else
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	sq->head++;
 	sq->pi += 2;/* Each WQE contains 2 WQEBB's. */
 	rte_io_wmb();
drivers/net/mlx5/mlx5_flow_meter.c +58 -13

136 lines not on this page · raw message

Signature · 1 line
2.21.0
author
#26 lore raw

RFC v3 4/4 app/testpmd: add meter pps mode cmd

In reply to Li Zhang

Support meter pps mode

---
 app/test-pmd/cmdline.c                      |   4 +
 app/test-pmd/cmdline_mtr.c                  | 105 ++++++++++++++++++++
 app/test-pmd/cmdline_mtr.h                  |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  15 +++
 4 files changed, 125 insertions(+)
app/test-pmd/cmdline.c +4 -0
index d274a7cb8c..1a3fc644dc 100644
@@ -698,6 +698,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs)\n"
 			"    meter profile add - trtcm rfc 4115\n\n"
 
+			"add port meter profile srtcmp (port_id) (profile_id) (cipr) (cpbs) (epbs)\n"
+			"    meter profile add - srtcmp packet per second\n\n"
+
 			"del port meter profile (port_id) (profile_id)\n"
 			"    meter profile delete\n\n"
 
@@ -17006,6 +17009,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_show_port_meter_cap,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_trtcm,
+	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcmp,
 	(cmdline_parse_inst_t *)&cmd_del_port_meter_profile,
 	(cmdline_parse_inst_t *)&cmd_create_port_meter,
 	(cmdline_parse_inst_t *)&cmd_enable_port_meter,
app/test-pmd/cmdline_mtr.c +105 -0

123 lines not on this page · raw message

app/test-pmd/cmdline_mtr.h +1 -0
index e69d6da023..01ef85e1e7 100644
@@ -10,6 +10,7 @@ extern cmdline_parse_inst_t cmd_show_port_meter_cap;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115;
+extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp;
 extern cmdline_parse_inst_t cmd_del_port_meter_profile;
 extern cmdline_parse_inst_t cmd_create_port_meter;
 extern cmdline_parse_inst_t cmd_enable_port_meter;
doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -0
index 37278d31d6..d11de05583 100644
@@ -2734,6 +2734,21 @@ where:
 * ``cbs``: Committed burst size (bytes).
 * ``ebs``: Excess burst size (bytes).
 
+add port meter profile (srTcmp)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add meter profile (srTcmp) to the ethernet device::
+
+   testpmd> add port meter profile srtcmp (port_id) (profile_id) \
+   (cir) (cbs) (ebs)
+
+where:
+
+* ``profile_id``: ID for the meter profile.
+* ``cpr``: Committed Information Rate (CIR) (packets/second).
+* ``cbs``: Committed Burst Size (CBS) (packets).
+* ``ebs``: Excess Burst Size (EBS) (packets).
+
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
Signature · 1 line
2.21.0
#27 lore raw

Re: [dpdk-dev] [PATCH] [RFC]: adds support PPS(packet per second) on meter

In reply to Li Zhang
Quoted 7 lines · Li Zhang

Currently the flow Meter algorithms in rte_flow only supports bytes per second(BPS).
Such as Single Rate Three Color Marker (srTCM rfc2697)
This RFC adds the packet per second definition in Meter algorithms structure,
to support the rte_mtr APIs with type srTCM pps mode.

I thought rfc2697 specified metering using BPS only. The CIR was measured in bytes per second for IP packets. Is there a draft or link to the new srTCM mode?

Quoted 80 lines

The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

---
 lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
lib/librte_ethdev/rte_mtr.h +2 -0
index 916a09c5c3..6413892aec 100644
@@ -119,6 +119,9 @@ enum rte_mtr_algorithm {
 
        /** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
        RTE_MTR_TRTCM_RFC4115,
+
+       /** Single Rate Three Color Marker (srTCM) in Packet per second

mode */

lib/librte_ethdev/rte_mtr.h +5 -0
+       RTE_MTR_SRTCM_PPS,
 };
 
 /**
@@ -171,6 +174,18 @@ struct rte_mtr_meter_profile {
                        /** Excess Burst Size (EBS) (bytes). */
                        uint64_t ebs;
                } trtcm_rfc4115;
+
+               /** Items only valid when *alg* is set to srTCM - PPS. */
+               struct {
+                       /** Committed Information Rate

(CIR)(packets/second). */

lib/librte_ethdev/rte_mtr.h +9 -0
+                       uint64_t cir;
+
+                       /** Committed Burst Size (CBS) (bytes). */
+                       uint64_t cbs;
+
+                       /** Excess Burst Size (EBS) (bytes). */
+                       uint64_t ebs;
+               } srtcm_pps;
        };
 };
@@ -317,6 +332,13 @@ struct rte_mtr_capabilities {
         */
        uint32_t meter_trtcm_rfc4115_n_max;
 
+       /** Maximum number of MTR objects that can have their meter

configured

lib/librte_ethdev/rte_mtr.h +6 -0
+        * to run the srTCM packet per second algorithm. The value of 0
+        * indicates this metering algorithm is not supported.
+        * The maximum value is *n_max*.
+        */
+       uint32_t meter_srtcm_pps_n_max;
+
        /** Maximum traffic rate that can be metered by a single MTR

object. For
* srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC
2698,
* this is the maximum PIR rate. For trTCM RFC 4115, this is the
maximum

lib/librte_ethdev/rte_mtr.h +2 -0
@@ -342,6 +364,12 @@ struct rte_mtr_capabilities {
         */
        int color_aware_trtcm_rfc4115_supported;
 
+       /**
+       * When non-zero, it indicates that color aware mode is supported

for

lib/librte_ethdev/rte_mtr.h +4 -0
+       * the srTCM packet per second  metering algorithm.
+       */
+       int color_aware_srtcm_pps_supported;
+
        /** When non-zero, it indicates that the policer packet recolor

actions
* are supported.
* @see enum rte_mtr_policer_action
--
2.21.0

author
#28 lore raw

Re: [dpdk-dev] [PATCH] [RFC]: adds support PPS(packet per second) on meter

Yes, RFC2697 is using BPS only.
We change srTCM_PPS mode name to sprTCM.
Single Packet Rate Three Color Marker (sprTCM) - - similar to IETF RFC 2697 but rate is packet per second. There is no draft or link to this new mode (sprTCM)

Regards,
Li Zhang

Quoted 106 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Ajit Khaparde
Sent: Saturday, February 13, 2021 5:36 AM
To: Li Zhang <[email protected]>
Cc: Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; dpdk-dev <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] [RFC]: adds support PPS(packet per second) on meter

Quoted 6 lines · Li Zhang

Currently the flow Meter algorithms in rte_flow only supports bytes per second(BPS).
Such as Single Rate Three Color Marker (srTCM rfc2697) This RFC adds the packet per second definition in Meter algorithms structure, to support the rte_mtr APIs with type srTCM pps mode.

I thought rfc2697 specified metering using BPS only. The CIR was measured in bytes per second for IP packets. Is there a draft or link to the new srTCM mode?

Quoted 81 lines

The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

---
 lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
lib/librte_ethdev/rte_mtr.h +3 -0
index 916a09c5c3..6413892aec 100644
@@ -119,6 +119,9 @@ enum rte_mtr_algorithm {
 
        /** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
        RTE_MTR_TRTCM_RFC4115,
+
+       /** Single Rate Three Color Marker (srTCM) in Packet per
+ second

mode */

lib/librte_ethdev/rte_mtr.h +5 -0
+       RTE_MTR_SRTCM_PPS,
 };
 
 /**
@@ -171,6 +174,18 @@ struct rte_mtr_meter_profile {
                        /** Excess Burst Size (EBS) (bytes). */
                        uint64_t ebs;
                } trtcm_rfc4115;
+
+               /** Items only valid when *alg* is set to srTCM - PPS. */
+               struct {
+                       /** Committed Information Rate

(CIR)(packets/second). */

lib/librte_ethdev/rte_mtr.h +9 -0
+                       uint64_t cir;
+
+                       /** Committed Burst Size (CBS) (bytes). */
+                       uint64_t cbs;
+
+                       /** Excess Burst Size (EBS) (bytes). */
+                       uint64_t ebs;
+               } srtcm_pps;
        };
 };
@@ -317,6 +332,13 @@ struct rte_mtr_capabilities {
         */
        uint32_t meter_trtcm_rfc4115_n_max;
 
+       /** Maximum number of MTR objects that can have their meter

configured

lib/librte_ethdev/rte_mtr.h +6 -0
+        * to run the srTCM packet per second algorithm. The value of 0
+        * indicates this metering algorithm is not supported.
+        * The maximum value is *n_max*.
+        */
+       uint32_t meter_srtcm_pps_n_max;
+
        /** Maximum traffic rate that can be metered by a single MTR

object. For
* srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC
2698,
* this is the maximum PIR rate. For trTCM RFC 4115, this is

the maximum @@ -342,6 +364,12 @@ struct rte_mtr_capabilities {
         */
        int color_aware_trtcm_rfc4115_supported;
lib/librte_ethdev/rte_mtr.h +3 -0
+       /**
+       * When non-zero, it indicates that color aware mode is
+ supported

for

lib/librte_ethdev/rte_mtr.h +4 -0
+       * the srTCM packet per second  metering algorithm.
+       */
+       int color_aware_srtcm_pps_supported;
+
        /** When non-zero, it indicates that the policer packet

recolor actions
* are supported.
* @see enum rte_mtr_policer_action
--
2.21.0

author
#29 lore raw

v4 cover adds support PPS(packet per second) on meter

In reply to Li Zhang

Currently the flow Meter algorithms in rte_flow only supports bytes per second(BPS).
Such as Single Rate Three Color Marker (srTCM rfc2697) This RFC adds the packet per second definition in Meter algorithms structure,
to support the rte_mtr APIs with type srTCM pps mode. The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

v4:
* Fix the wrong commit log.

v3:
* Redefine the struct name for PPS mode.

v2:
* Rebase

Li Zhang (4):
ethdev: add meter PPS profile
common/mlx5: add meter mode definition in PRM file net/mlx5: support meter PPS profile app/testpmd: add meter pps mode cmd

 app/test-pmd/cmdline.c                        |   4 +
 app/test-pmd/cmdline_mtr.c                    | 105 ++++++++++++++++++
 app/test-pmd/cmdline_mtr.h                    |   1 +
 doc/guides/nics/mlx5.rst                      |   1 +
 .../traffic_metering_and_policing.rst         |   3 +-
 doc/guides/rel_notes/release_20_11.rst        |   5 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst   |  15 +++
 drivers/common/mlx5/mlx5_prm.h                |   8 ++
 drivers/net/mlx5/mlx5.h                       |  13 ++-
 drivers/net/mlx5/mlx5_flow_aso.c              |  17 ++-
 drivers/net/mlx5/mlx5_flow_meter.c            |  71 +++++++++---
 lib/librte_ethdev/rte_mtr.h                   |  32 ++++++
 12 files changed, 251 insertions(+), 24 deletions(-)
Signature · 1 line
2.21.0
author
#30 lore raw

RFC v4 1/4 ethdev: add meter PPS profile

Currently meter algorithms only supports rate is bytes per second(BPS). Add this new meter srTCMp algorithm to support rate is packet per second. So that it can meter traffic by packet per second.
The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

---
 .../traffic_metering_and_policing.rst         |  3 +-
 doc/guides/rel_notes/release_20_11.rst        |  5 +++
 lib/librte_ethdev/rte_mtr.h                   | 32 +++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)
doc/guides/prog_guide/traffic_metering_and_policing.rst +2 -1
index 90c781eb1d..4d2405d44a 100644
@@ -17,7 +17,8 @@ The main features are:
 * Part of DPDK rte_ethdev API
 * Capability query API
 * Metering algorithms: RFC 2697 Single Rate Three Color Marker (srTCM), RFC 2698
-  and RFC 4115 Two Rate Three Color Marker (trTCM)
+  and RFC 4115 Two Rate Three Color Marker (trTCM),
+  Single Rate Three Color Marker, Packet based (srTCMp).
 * Policer actions (per meter output color): recolor, drop
 * Statistics (per policer output color)
 
doc/guides/rel_notes/release_20_11.rst +5 -0
index 7405a9864f..de04886cc9 100644
@@ -429,6 +429,11 @@ New Features
   can leverage IOAT DMA channels with vhost asynchronous APIs.
   See the :doc:`../sample_app_ug/vhost` for more details.
 
+* **Added support for meter PPS profile.**
+
+  Currently meter algorithms only supports bytes per second(BPS).
+  Add this new meter algorithm to support packet per second (PPS) mode.
+  So that it can meter traffic by packet per second.
 
 Removed Items
 -------------
lib/librte_ethdev/rte_mtr.h +32 -0
index 916a09c5c3..f27a4b5354 100644
@@ -119,6 +119,11 @@ enum rte_mtr_algorithm {
 
 	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
 	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker, Packet based (srTCMp).
+	 * - - similar to IETF RFC 2697 but rate is packet per second.
+	 */
+	RTE_MTR_SRTCMP,
 };
 
 /**
@@ -171,6 +176,20 @@ struct rte_mtr_meter_profile {
 			/** Excess Burst Size (EBS) (bytes). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCMp. */
+		struct {
+			/** Committed Information Rate (CIR)
+			 * (packets/second).
+			 */
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (packets). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (packets). */
+			uint64_t ebs;
+		} srtcmp;
 	};
 };
 
@@ -317,6 +336,13 @@ struct rte_mtr_capabilities {
 	 */
 	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter configured
+	 * to run the srTCMp algorithm. The value of 0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcmp_n_max;
+
 	/** Maximum traffic rate that can be metered by a single MTR object. For
 	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
 	 * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
@@ -342,6 +368,12 @@ struct rte_mtr_capabilities {
 	 */
 	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is supported for
+	 * the srTCMp metering algorithm.
+	 */
+	int color_aware_srtcmp_supported;
+
 	/** When non-zero, it indicates that the policer packet recolor actions
 	 * are supported.
 	 * @see enum rte_mtr_policer_action
Signature · 1 line
2.21.0
#31 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Quoted 125 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Li Zhang
Sent: Monday, March 1, 2021 10:35 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Currently meter algorithms only supports rate is bytes per second(BPS). Add this new meter srTCMp algorithm to support rate is packet per second. So that it can meter traffic by packet per second.
The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

---
 .../traffic_metering_and_policing.rst         |  3 +-
 doc/guides/rel_notes/release_20_11.rst        |  5 +++
 lib/librte_ethdev/rte_mtr.h                   | 32 +++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)
doc/guides/prog_guide/traffic_metering_and_policing.rst +0 -0
index 90c781eb1d..4d2405d44a 100644
@@ -17,7 +17,8 @@ The main features are:
 * Part of DPDK rte_ethdev API
 * Capability query API
 * Metering algorithms: RFC 2697 Single Rate Three Color Marker (srTCM),

RFC 2698

doc/guides/prog_guide/traffic_metering_and_policing.rst +2 -1
-  and RFC 4115 Two Rate Three Color Marker (trTCM)
+  and RFC 4115 Two Rate Three Color Marker (trTCM),
+  Single Rate Three Color Marker, Packet based (srTCMp).
 * Policer actions (per meter output color): recolor, drop
 * Statistics (per policer output color)
doc/guides/rel_notes/release_20_11.rst +5 -0
index 7405a9864f..de04886cc9 100644
@@ -429,6 +429,11 @@ New Features
   can leverage IOAT DMA channels with vhost asynchronous APIs.
   See the :doc:`../sample_app_ug/vhost` for more details.
 
+* **Added support for meter PPS profile.**
+
+  Currently meter algorithms only supports bytes per second(BPS).
+  Add this new meter algorithm to support packet per second (PPS) mode.
+  So that it can meter traffic by packet per second.
 
 Removed Items
 -------------
lib/librte_ethdev/rte_mtr.h +20 -0
index 916a09c5c3..f27a4b5354 100644
@@ -119,6 +119,11 @@ enum rte_mtr_algorithm {
 
 	/** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
 	RTE_MTR_TRTCM_RFC4115,
+
+	/** Single Rate Three Color Marker, Packet based (srTCMp).
+	 * - - similar to IETF RFC 2697 but rate is packet per second.
+	 */
+	RTE_MTR_SRTCMP,
 };
 
 /**
@@ -171,6 +176,20 @@ struct rte_mtr_meter_profile {
 			/** Excess Burst Size (EBS) (bytes). */
 			uint64_t ebs;
 		} trtcm_rfc4115;
+
+		/** Items only valid when *alg* is set to srTCMp. */
+		struct {
+			/** Committed Information Rate (CIR)
+			 * (packets/second).
+			 */
+			uint64_t cir;
+
+			/** Committed Burst Size (CBS) (packets). */
+			uint64_t cbs;
+
+			/** Excess Burst Size (EBS) (packets). */
+			uint64_t ebs;
+		} srtcmp;
 	};
 };
 
@@ -317,6 +336,13 @@ struct rte_mtr_capabilities {
 	 */
 	uint32_t meter_trtcm_rfc4115_n_max;
 
+	/** Maximum number of MTR objects that can have their meter

configured

lib/librte_ethdev/rte_mtr.h +6 -0
+	 * to run the srTCMp algorithm. The value of 0
+	 * indicates this metering algorithm is not supported.
+	 * The maximum value is *n_max*.
+	 */
+	uint32_t meter_srtcmp_n_max;
+
 	/** Maximum traffic rate that can be metered by a single MTR

object. For

lib/librte_ethdev/rte_mtr.h +0 -0
 	 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
 	 * this is the maximum PIR rate. For trTCM RFC 4115, this is the

maximum

lib/librte_ethdev/rte_mtr.h +2 -0
@@ -342,6 +368,12 @@ struct rte_mtr_capabilities {
 	 */
 	int color_aware_trtcm_rfc4115_supported;
 
+	/**
+	 * When non-zero, it indicates that color aware mode is supported

for

lib/librte_ethdev/rte_mtr.h +4 -0
+	 * the srTCMp metering algorithm.
+	 */
+	int color_aware_srtcmp_supported;
+
 	/** When non-zero, it indicates that the policer packet recolor

actions

lib/librte_ethdev/rte_mtr.h +0 -1
 	 * are supported.
 	 * @see enum rte_mtr_policer_action
--
Quoted 1 line

2.21.0

Hi Li,

As specified in the MAINTEINERS file of DPDK, I am the maintainer of this API, so please make sure you add my email in the To: list of future revisions of this patch set.

Isn't this a duplicate of this other patchset that you authored as well: http://patchwork.dpdk.org/project/dpdk/patch/[email protected]/ ? Which one do you want to keep? I am pasting below my reply to this other patchset.

We had this same problem earlier for the rte_tm.h API, where people asked to add support for WRED and shaper rates specified in packets to the existing byte rate support. I am more than happy to support adding the same here, but please let's adopt the same solution here rather than invent a different approach.

Please refer to struct rte_tm_wred_params and struct rte_tm_shaper_params from rte_tm.h: the packets vs. bytes mode is explicitly specified through the use of a flag called packet_mode that is added to the WRED and shaper profile. When packet_mode is 0, the profile rates and bucket sizes are specified in bytes per second and bytes, respectively; when packet_mode is not 0, the profile rates and bucket sizes are specified in packets and packets per second, respectively. The same profile parameters are used, no need to invent additional algorithms (such as srTCM - packet mode) or profile data structures. Can we do the same here, please?

This is a quick summary of the required API changes to add support for the packet mode, they are minimal:
a) Introduce the packet_mode flag in the profile parameters data structure.
b) Change the description (comment) of the rate and bucket size parameters in the meter profile parameters data structures to reflect that their values represents either bytes or packets, depending on the value of the new flag packet_mode from the same structure.
c) Add the relevant capabilities: just search for "packet" in the rte_tm.h capabilities data structures and apply the same to the rte_mtr.h capabilities, when applicable.

Regards,
Cristian

#32 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

01/03/2021 14:20, Dumitrescu, Cristian:

Quoted 2 lines

From: Li Zhang

Quoted 1 line

As specified in the MAINTEINERS file of DPDK, I am the maintainer of this API, so please make sure you add my email in the To: list of future revisions of this patch set.

This kind of miss should be solved by using
--cc-cmd devtools/get-maintainer.sh when sending.

author
#33 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Thanks Thomas.
I will use it next time.

Regards,
Li Zhang

Quoted 22 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Monday, March 1, 2021 11:54 PM
To: Li Zhang <[email protected]>
Cc: Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Dumitrescu, Cristian <[email protected]>; [email protected]; Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

01/03/2021 14:20, Dumitrescu, Cristian:

Quoted 2 lines

From: Li Zhang

Quoted 1 line

As specified in the MAINTEINERS file of DPDK, I am the maintainer of this

API, so please make sure you add my email in the To: list of future revisions of this patch set.

This kind of miss should be solved by using --cc-cmd devtools/get- maintainer.sh when sending.

#34 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

In reply to Dumitrescu, Cristian
Quoted 134 lines · Cristian
Quoted 122 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Li Zhang
Sent: Monday, March 1, 2021 10:35 AM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Currently meter algorithms only supports rate is bytes per second(BPS). Add this new meter srTCMp algorithm to support rate is packet per second. So that it can meter traffic by packet per second.
The below structure will be extended:
rte_mtr_algorithm
rte_mtr_meter_profile

---
 .../traffic_metering_and_policing.rst         |  3 +-
 doc/guides/rel_notes/release_20_11.rst        |  5 +++
 lib/librte_ethdev/rte_mtr.h                   | 32 +++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)
doc/guides/prog_guide/traffic_metering_and_policing.rst +0 -0
index 90c781eb1d..4d2405d44a 100644
@@ -17,7 +17,8 @@ The main features are:
 * Part of DPDK rte_ethdev API
 * Capability query API
 * Metering algorithms: RFC 2697 Single Rate Three Color Marker (srTCM),

RFC 2698

doc/guides/prog_guide/traffic_metering_and_policing.rst +2 -1
-  and RFC 4115 Two Rate Three Color Marker (trTCM)
+  and RFC 4115 Two Rate Three Color Marker (trTCM),
+  Single Rate Three Color Marker, Packet based (srTCMp).
 * Policer actions (per meter output color): recolor, drop
 * Statistics (per policer output color)
doc/guides/rel_notes/release_20_11.rst +5 -0
index 7405a9864f..de04886cc9 100644
@@ -429,6 +429,11 @@ New Features
   can leverage IOAT DMA channels with vhost asynchronous APIs.
   See the :doc:`../sample_app_ug/vhost` for more details.
 
+* **Added support for meter PPS profile.**
+
+  Currently meter algorithms only supports bytes per second(BPS).
+  Add this new meter algorithm to support packet per second (PPS) mode.
+  So that it can meter traffic by packet per second.
 
 Removed Items
 -------------
lib/librte_ethdev/rte_mtr.h +20 -0
index 916a09c5c3..f27a4b5354 100644
@@ -119,6 +119,11 @@ enum rte_mtr_algorithm {
 
      /** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
      RTE_MTR_TRTCM_RFC4115,
+
+     /** Single Rate Three Color Marker, Packet based (srTCMp).
+      * - - similar to IETF RFC 2697 but rate is packet per second.
+      */
+     RTE_MTR_SRTCMP,
 };
 
 /**
@@ -171,6 +176,20 @@ struct rte_mtr_meter_profile {
                      /** Excess Burst Size (EBS) (bytes). */
                      uint64_t ebs;
              } trtcm_rfc4115;
+
+             /** Items only valid when *alg* is set to srTCMp. */
+             struct {
+                     /** Committed Information Rate (CIR)
+                      * (packets/second).
+                      */
+                     uint64_t cir;
+
+                     /** Committed Burst Size (CBS) (packets). */
+                     uint64_t cbs;
+
+                     /** Excess Burst Size (EBS) (packets). */
+                     uint64_t ebs;
+             } srtcmp;
      };
 };
 
@@ -317,6 +336,13 @@ struct rte_mtr_capabilities {
       */
      uint32_t meter_trtcm_rfc4115_n_max;
 
+     /** Maximum number of MTR objects that can have their meter

configured

lib/librte_ethdev/rte_mtr.h +6 -0
+      * to run the srTCMp algorithm. The value of 0
+      * indicates this metering algorithm is not supported.
+      * The maximum value is *n_max*.
+      */
+     uint32_t meter_srtcmp_n_max;
+
      /** Maximum traffic rate that can be metered by a single MTR

object. For
* srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
* this is the maximum PIR rate. For trTCM RFC 4115, this is the
maximum

lib/librte_ethdev/rte_mtr.h +2 -0
@@ -342,6 +368,12 @@ struct rte_mtr_capabilities {
       */
      int color_aware_trtcm_rfc4115_supported;
 
+     /**
+      * When non-zero, it indicates that color aware mode is supported

for

lib/librte_ethdev/rte_mtr.h +4 -0
+      * the srTCMp metering algorithm.
+      */
+     int color_aware_srtcmp_supported;
+
      /** When non-zero, it indicates that the policer packet recolor
Quoted 5 lines

actions
* are supported.
* @see enum rte_mtr_policer_action
--
2.21.0

Hi Li,

As specified in the MAINTEINERS file of DPDK, I am the maintainer of this API, so please make sure you add my email in the To: list of future revisions of this patch set.

Isn't this a duplicate of this other patchset that you authored as well: http://patchwork.dpdk.org/project/dpdk/patch/[email protected]/ ? Which one do you want to keep? I am pasting below my reply to this other patchset.

Quoted 8 lines

We had this same problem earlier for the rte_tm.h API, where people asked to add support for WRED and shaper rates specified in packets to the existing byte rate support. I am more than happy to support adding the same here, but please let's adopt the same solution here rather than invent a different approach.

Please refer to struct rte_tm_wred_params and struct rte_tm_shaper_params from rte_tm.h: the packets vs. bytes mode is explicitly specified through the use of a flag called packet_mode that is added to the WRED and shaper profile. When packet_mode is 0, the profile rates and bucket sizes are specified in bytes per second and bytes, respectively; when packet_mode is not 0, the profile rates and bucket sizes are specified in packets and packets per second, respectively. The same profile parameters are used, no need to invent additional algorithms (such as srTCM - packet mode) or profile data structures. Can we do the same here, please?

This is a quick summary of the required API changes to add support for the packet mode, they are minimal:
a) Introduce the packet_mode flag in the profile parameters data structure.
b) Change the description (comment) of the rate and bucket size parameters in the meter profile parameters data structures to reflect that their values represents either bytes or packets, depending on the value of the new flag packet_mode from the same structure.
c) Add the relevant capabilities: just search for "packet" in the rte_tm.h capabilities data structures and apply the same to the rte_mtr.h capabilities, when applicable.

Overall I think this is a better approach. And default packet_mode will be bytes.

Quoted 3 lines

Regards,
Cristian

#35 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

<snip>...

Quoted 3 lines

Overall I think this is a better approach. And default packet_mode will be bytes.

Yes, agreed.

#36 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

In reply to Dumitrescu, Cristian

Hi Cristian

Thank you for review, please see inline.

From: Dumitrescu, Cristian

Quoted 1 line
Quoted 1 line

From: dev <[email protected]> On Behalf Of Li Zhang

<snip>

Quoted 6 lines

We had this same problem earlier for the rte_tm.h API, where people asked to add support for WRED and shaper rates specified in packets to the existing byte rate support. I am more than happy to support adding the same here, but please let's adopt the same solution here rather than invent a different approach.

Quoted 9 lines

Please refer to struct rte_tm_wred_params and struct rte_tm_shaper_params from rte_tm.h: the packets vs. bytes mode is explicitly specified through the use of a flag called packet_mode that is added to the WRED and shaper profile. When packet_mode is 0, the profile rates and bucket sizes are specified in bytes per second and bytes, respectively; when packet_mode is not 0, the profile rates and bucket sizes are specified in packets and packets per second, respectively. The same profile parameters are used, no need to invent additional algorithms (such as srTCM - packet mode) or profile data structures. Can we do the same here, please?

This flag approach is very intuitive suggestion and it has advantages.

The main problem with the flag approach is that it breaks ABI and API. The profile structure size is changed due to a new field - ABI breakage. The user must initialize the flag with zero to get old behavior - API breakage.

I don't see issues with Li suggestion, Do you think Li suggestion has critical issues?

Quoted 13 lines

This is a quick summary of the required API changes to add support for the packet mode, they are minimal:
a) Introduce the packet_mode flag in the profile parameters data structure.
b) Change the description (comment) of the rate and bucket size parameters in the meter profile parameters data structures to reflect that their values represents either bytes or packets, depending on the value of the new flag packet_mode from the same structure.
c) Add the relevant capabilities: just search for "packet" in the rte_tm.h capabilities data structures and apply the same to the rte_mtr.h capabilities, when applicable.

Regards,
Cristian

#37 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Matan,

Quoted 40 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 7:02 AM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

Thank you for review, please see inline.

From: Dumitrescu, Cristian

Quoted 1 line
Quoted 1 line

From: dev <[email protected]> On Behalf Of Li Zhang

<snip>

Quoted 1 line

We had this same problem earlier for the rte_tm.h API, where people

asked to

Quoted 1 line

add support for WRED and shaper rates specified in packets to the existing

byte

Quoted 5 lines

rate support. I am more than happy to support adding the same here, but please let's adopt the same solution here rather than invent a different approach.

Please refer to struct rte_tm_wred_params and struct

rte_tm_shaper_params

Quoted 1 line

from rte_tm.h: the packets vs. bytes mode is explicitly specified through

the use

Quoted 4 lines

of a flag called packet_mode that is added to the WRED and shaper profile. When packet_mode is 0, the profile rates and bucket sizes are specified in bytes per second and bytes, respectively; when packet_mode is not 0, the profile rates and bucket sizes are specified in packets and packets per

second,

Quoted 2 lines

respectively. The same profile parameters are used, no need to invent additional algorithms (such as srTCM - packet mode) or profile data

Quoted 9 lines

structures.

Quoted 1 line

Can we do the same here, please?

This flag approach is very intuitive suggestion and it has advantages.

The main problem with the flag approach is that it breaks ABI and API. The profile structure size is changed due to a new field - ABI breakage. The user must initialize the flag with zero to get old behavior - API breakage.

The rte_mtr API is experimental, all the API functions are correctly marked with __rte_experimental in rte_mtr.h file, so we can safely change the API and the ABI breakage is not applicable here. Therefore, this problem does not exist, correct?

Quoted 2 lines

I don't see issues with Li suggestion, Do you think Li suggestion has critical issues?

It is probably better to keep the rte_mtr and the rte_tm APIs aligned, it simplifies the code maintenance and improves the user experience, which always pays off in the long run. Both APIs configure token buckets in either packet mode or byte mode, and it is desirable to have them work in the same way. Also, I think we should avoid duplicating configuration data structures for to support essentially the same algorithms (such as srTCM or trTCM) if we can.

The flag proposal is actually reducing the amount of work that you guys need to do to implement your proposal. There is no negative impact to your proposal and no big change, right?

Quoted 5 lines
Quoted 4 lines

This is a quick summary of the required API changes to add support for the packet mode, they are minimal:
a) Introduce the packet_mode flag in the profile parameters data

structure.

Quoted 12 lines
Quoted 1 line

b) Change the description (comment) of the rate and bucket size

parameters in

Quoted 5 lines

the meter profile parameters data structures to reflect that their values represents either bytes or packets, depending on the value of the new flag packet_mode from the same structure.
c) Add the relevant capabilities: just search for "packet" in the rte_tm.h capabilities data structures and apply the same to the rte_mtr.h

capabilities,

Quoted 4 lines

when applicable.

Regards,
Cristian

Regards,
Cristian

#38 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

HI Cristian

From: Dumitrescu, Cristian

Quoted 56 lines

Hi Matan,

Quoted 44 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 7:02 AM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

Thank you for review, please see inline.

From: Dumitrescu, Cristian

Quoted 1 line
Quoted 1 line

From: dev <[email protected]> On Behalf Of Li Zhang

<snip>

Quoted 1 line

We had this same problem earlier for the rte_tm.h API, where people

asked to

Quoted 2 lines

add support for WRED and shaper rates specified in packets to the existing

byte

Quoted 5 lines

rate support. I am more than happy to support adding the same here, but please let's adopt the same solution here rather than invent a different approach.

Please refer to struct rte_tm_wred_params and struct

rte_tm_shaper_params

Quoted 2 lines

from rte_tm.h: the packets vs. bytes mode is explicitly specified through

the use

Quoted 5 lines

of a flag called packet_mode that is added to the WRED and shaper profile. When packet_mode is 0, the profile rates and bucket sizes are specified in bytes per second and bytes, respectively; when packet_mode is not 0, the profile rates and bucket sizes are specified in packets and packets per

second,

Quoted 3 lines

respectively. The same profile parameters are used, no need to invent additional algorithms (such as srTCM - packet mode) or profile data

Quoted 9 lines

structures.

Quoted 1 line

Can we do the same here, please?

This flag approach is very intuitive suggestion and it has advantages.

The main problem with the flag approach is that it breaks ABI and API. The profile structure size is changed due to a new field - ABI breakage. The user must initialize the flag with zero to get old behavior - API breakage.

Quoted 4 lines

The rte_mtr API is experimental, all the API functions are correctly marked with __rte_experimental in rte_mtr.h file, so we can safely change the API and the ABI breakage is not applicable here. Therefore, this problem does not exist, correct?

Yes, but still meter is not new API and I know that a lot of user uses it for a long time. Forcing them to change while we have good solution that don't force it, looks me problematic.

Quoted 10 lines
Quoted 2 lines

I don't see issues with Li suggestion, Do you think Li suggestion has critical issues?

It is probably better to keep the rte_mtr and the rte_tm APIs aligned, it simplifies the code maintenance and improves the user experience, which always pays off in the long run. Both APIs configure token buckets in either packet mode or byte mode, and it is desirable to have them work in the same way. Also, I think we should avoid duplicating configuration data structures for to support essentially the same algorithms (such as srTCM or trTCM) if we can.

Yes, but I don't think this motivation is critical.

Quoted 3 lines

The flag proposal is actually reducing the amount of work that you guys need to do to implement your proposal. There is no negative impact to your proposal and no big change, right?

Yes you right, but the implementation effect is not our concern.

Quoted 20 lines
Quoted 5 lines
Quoted 3 lines

This is a quick summary of the required API changes to add support for the packet mode, they are minimal:
a) Introduce the packet_mode flag in the profile parameters data

structure.

Quoted 1 line

b) Change the description (comment) of the rate and bucket size

Quoted 12 lines

parameters in

Quoted 6 lines

the meter profile parameters data structures to reflect that their values represents either bytes or packets, depending on the value of the new flag packet_mode from the same structure.
c) Add the relevant capabilities: just search for "packet" in the rte_tm.h capabilities data structures and apply the same to the rte_mtr.h

capabilities,

Quoted 4 lines

when applicable.

Regards,
Cristian

Regards,
Cristian

#39 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Matan,

Quoted 77 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 12:37 PM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

HI Cristian

From: Dumitrescu, Cristian

Quoted 9 lines

Hi Matan,

Quoted 7 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 7:02 AM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon

<[email protected]>;

Quoted 23 lines
Quoted 23 lines

Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

Thank you for review, please see inline.

From: Dumitrescu, Cristian

Quoted 1 line
Quoted 1 line

From: dev <[email protected]> On Behalf Of Li Zhang

<snip>

Quoted 1 line

We had this same problem earlier for the rte_tm.h API, where people

asked to

Quoted 2 lines

add support for WRED and shaper rates specified in packets to the existing

byte

Quoted 4 lines

rate support. I am more than happy to support adding the same here, but please let's adopt the same solution here rather than invent a different approach.

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Please refer to struct rte_tm_wred_params and struct

rte_tm_shaper_params

Quoted 2 lines

from rte_tm.h: the packets vs. bytes mode is explicitly specified through

the use

Quoted 1 line

of a flag called packet_mode that is added to the WRED and shaper

profile.

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

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

second,

Quoted 3 lines

respectively. The same profile parameters are used, no need to invent additional algorithms (such as srTCM - packet mode) or profile data

Quoted 8 lines
Quoted 8 lines

structures.

Quoted 1 line

Can we do the same here, please?

This flag approach is very intuitive suggestion and it has advantages.

The main problem with the flag approach is that it breaks ABI and API. The profile structure size is changed due to a new field - ABI breakage. The user must initialize the flag with zero to get old behavior - API

breakage.

Quoted 4 lines
Quoted 1 line

The rte_mtr API is experimental, all the API functions are correctly marked with __rte_experimental in rte_mtr.h file, so we can safely change the API

and

Quoted 9 lines
Quoted 1 line

the ABI breakage is not applicable here. Therefore, this problem does not

exist,

Quoted 1 line

correct?

Yes, but still meter is not new API and I know that a lot of user uses it for a long time.
Forcing them to change while we have good solution that don't force it, looks me problematic.

Not really, only 3 drivers are currently implementing this API.

Even to these drivers, the required changes are none or extremely small: as Ajit was also noting, as the default value of 0 continues to represent the existing byte mode, all you have to do is make sure the new flag is set to zero in the profile params structure, which is already done implicitly in most places as this structure is initialized to all-zeros.

A simple search exercise for struct rte_mtr_meter_profile is all that is needed. You also agreed the flag approach is very intuitive, hence better and nicer, with no additional work needed for you, so why not do it?

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

I don't see issues with Li suggestion, Do you think Li suggestion has critical issues?

It is probably better to keep the rte_mtr and the rte_tm APIs aligned, it simplifies the code maintenance and improves the user experience, which always pays off in the long run. Both APIs configure token buckets in either packet mode or byte mode, and it is desirable to have them work in the

Quoted 8 lines

same

Quoted 1 line

way. Also, I think we should avoid duplicating configuration data structures

for

Quoted 1 line

to support essentially the same algorithms (such as srTCM or trTCM) if we

can.

Quoted 1 line

Yes, but I don't think this motivation is critical.

I really disagree. As API maintainer, making every effort to keep the APIs clear and consistent is a critical task for me. We don't want to proliferate the API data structures and parameters if there is a good way to avoid it. Especially in cases like this, when the drivers are just beginning to pick up this (still experimental) API, we have the rare chance to make things right and therefore we should do it. Please also keep in mind that, as more feature are added to the API, small corner cuts like this one that might not look like a big deal now, eventually come back as unnecessary complexity in the drivers themselves.

So, please, let's try to keep the quality of the APIs high.

Quoted 30 lines
Quoted 2 lines

The flag proposal is actually reducing the amount of work that you guys

need to

Quoted 1 line

do to implement your proposal. There is no negative impact to your

proposal

Quoted 1 line

and no big change, right?

Yes you right, but the implementation effect is not our concern.

Quoted 20 lines
Quoted 5 lines
Quoted 3 lines

This is a quick summary of the required API changes to add support for the packet mode, they are minimal:
a) Introduce the packet_mode flag in the profile parameters data

structure.

Quoted 1 line

b) Change the description (comment) of the rate and bucket size

Quoted 12 lines

parameters in

Quoted 6 lines

the meter profile parameters data structures to reflect that their values represents either bytes or packets, depending on the value of the new flag packet_mode from the same structure.
c) Add the relevant capabilities: just search for "packet" in the rte_tm.h capabilities data structures and apply the same to the rte_mtr.h

capabilities,

Quoted 4 lines

when applicable.

Regards,
Cristian

Regards,
Cristian

Regards,
Cristian

#40 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

Good discussion, thank you for that!

From: Dumitrescu, Cristian

Quoted 89 lines

Hi Matan,

Quoted 87 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 12:37 PM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

HI Cristian

From: Dumitrescu, Cristian

Quoted 9 lines

Hi Matan,

Quoted 7 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 7:02 AM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon

<[email protected]>;

Quoted 25 lines
Quoted 25 lines

Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

Thank you for review, please see inline.

From: Dumitrescu, Cristian

Quoted 1 line
Quoted 1 line

From: dev <[email protected]> On Behalf Of Li Zhang

<snip>

Quoted 2 lines

We had this same problem earlier for the rte_tm.h API, where people

asked to

Quoted 2 lines

add support for WRED and shaper rates specified in packets to the existing

byte

Quoted 4 lines

rate support. I am more than happy to support adding the same here, but please let's adopt the same solution here rather than invent a different approach.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Please refer to struct rte_tm_wred_params and struct

rte_tm_shaper_params

Quoted 2 lines

from rte_tm.h: the packets vs. bytes mode is explicitly specified through

the use

Quoted 2 lines

of a flag called packet_mode that is added to the WRED and shaper

profile.

Quoted 9 lines
Quoted 9 lines
Quoted 4 lines

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

second,

Quoted 3 lines

respectively. The same profile parameters are used, no need to invent additional algorithms (such as srTCM - packet mode) or profile data

structures.

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

Can we do the same here, please?

This flag approach is very intuitive suggestion and it has advantages.

The main problem with the flag approach is that it breaks ABI and API. The profile structure size is changed due to a new field - ABI breakage. The user must initialize the flag with zero to get old behavior - API

breakage.

Quoted 5 lines
Quoted 1 line

The rte_mtr API is experimental, all the API functions are correctly marked with __rte_experimental in rte_mtr.h file, so we can safely change the API

and

Quoted 2 lines

the ABI breakage is not applicable here. Therefore, this problem does not

exist,

Quoted 1 line

correct?

Quoted 7 lines
Quoted 5 lines

Yes, but still meter is not new API and I know that a lot of user uses it for a long time.
Forcing them to change while we have good solution that don't force it, looks me problematic.

Not really, only 3 drivers are currently implementing this API.

The user is not the PMD, the PMDs are the providers.
I'm talking about all our customers, all the current DPDK based applications like OVS and others (I familiar with at least 4 ConnectX customer applications) which use the meter API and I'm sure there are more around the world.

Quoted 5 lines

Even to these drivers, the required changes are none or extremely small: as Ajit was also noting, as the default value of 0 continues to represent the existing byte mode, all you have to do is make sure the new flag is set to zero in the profile params structure, which is already done implicitly in most places as this structure is initialized to all-zeros.

Are you sure all the world initialize the struct to 0? and also in this case, without new compilation, not all the struct will be zeroes(the old size is smaller).

Quoted 3 lines

A simple search exercise for struct rte_mtr_meter_profile is all that is needed. You also agreed the flag approach is very intuitive, hence better and nicer, with no additional work needed for you, so why not do it?

Do you understand that any current application that use the meter API must recompile the code of the application? Part of them also probably need to set the flag to 0.... Do you understand also the potential issues for the applications which are not aware to the change? Debug time, etc....

Quoted 14 lines
Quoted 14 lines
Quoted 8 lines
Quoted 2 lines

I don't see issues with Li suggestion, Do you think Li suggestion has critical issues?

It is probably better to keep the rte_mtr and the rte_tm APIs aligned, it simplifies the code maintenance and improves the user experience, which always pays off in the long run. Both APIs configure token buckets in either packet mode or byte mode, and it is desirable to have them work in the

same

Quoted 2 lines

way. Also, I think we should avoid duplicating configuration data structures

for

Quoted 2 lines

to support essentially the same algorithms (such as srTCM or trTCM) if we

Quoted 7 lines
Quoted 4 lines

can.

Quoted 1 line

Yes, but I don't think this motivation is critical.

I really disagree. As API maintainer, making every effort to keep the APIs clear and consistent is a critical task for me.

New pps profile is also clear and simple.

Quoted 7 lines

We don't want to proliferate the API
data structures and parameters if there is a good way to avoid it. Especially in cases like this, when the drivers are just beginning to pick up this (still experimental) API, we have the rare chance to make things right and therefore we should do it. Please also keep in mind that, as more feature are added to the API, small corner cuts like this one that might not look like a big deal now, eventually come back as unnecessary complexity in the drivers themselves.

I don't see a complexity in the current suggestion.

Quoted 1 line

So, please, let's try to keep the quality of the APIs high.

Also by this way is high.

Look, the flag approach is also good and makes the job.
The two approaches are clear, simple and in high quality.
I don't care which one from the 2 to take but I want to be sure we are all understand the pros and cons.

If you understand my concern on flag approach and still insist to take the flag approach we will align.

And if we so, and we are going to break the API\ABI, we are going to introduce new meter policy API soon and there, breaking API can help, lets see in other discussion later.

One more point:
Currently, the meter_id is managed by the user, I think it is better to let the PMDs to manage the meter_id.

Searching the PMD meter handler inside the PMD is very expensive for the API call rate when the meter_id is managed by the user.

Same for profile_id.

Also all the rte_flow API including the shared action API taking the PMD management approach.

What do you think?

Quoted 33 lines
Quoted 30 lines
Quoted 2 lines

The flag proposal is actually reducing the amount of work that you guys

need to

Quoted 1 line

do to implement your proposal. There is no negative impact to your

proposal

Quoted 1 line

and no big change, right?

Yes you right, but the implementation effect is not our concern.

Quoted 20 lines
Quoted 5 lines
Quoted 3 lines

This is a quick summary of the required API changes to add support for the packet mode, they are minimal:
a) Introduce the packet_mode flag in the profile parameters data

structure.

Quoted 1 line

b) Change the description (comment) of the rate and bucket size

Quoted 12 lines

parameters in

Quoted 6 lines

the meter profile parameters data structures to reflect that their values represents either bytes or packets, depending on the value of the new flag packet_mode from the same structure.
c) Add the relevant capabilities: just search for "packet" in the rte_tm.h capabilities data structures and apply the same to the rte_mtr.h

capabilities,

Quoted 4 lines

when applicable.

Regards,
Cristian

Regards,
Cristian

Regards,
Cristian

#41 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Matan,

Quoted 191 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 6:10 PM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

Good discussion, thank you for that!

From: Dumitrescu, Cristian

Quoted 9 lines

Hi Matan,

Quoted 7 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 12:37 PM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon

<[email protected]>;

Quoted 17 lines
Quoted 17 lines

Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

HI Cristian

From: Dumitrescu, Cristian

Quoted 9 lines

Hi Matan,

Quoted 7 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 7:02 AM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon

Quoted 2 lines
Quoted 2 lines

<[email protected]>;

Quoted 1 line
Quoted 1 line

Raslan Darawsheh <[email protected]>;

[email protected];

Quoted 40 lines
Quoted 40 lines
Quoted 24 lines
Quoted 24 lines

[email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

Thank you for review, please see inline.

From: Dumitrescu, Cristian

Quoted 1 line
Quoted 1 line

From: dev <[email protected]> On Behalf Of Li Zhang

<snip>

Quoted 2 lines

We had this same problem earlier for the rte_tm.h API, where people

asked to

Quoted 2 lines

add support for WRED and shaper rates specified in packets to the existing

byte

Quoted 4 lines

rate support. I am more than happy to support adding the same here, but please let's adopt the same solution here rather than invent a different approach.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Please refer to struct rte_tm_wred_params and struct

rte_tm_shaper_params

Quoted 2 lines

from rte_tm.h: the packets vs. bytes mode is explicitly specified through

the use

Quoted 2 lines

of a flag called packet_mode that is added to the WRED and shaper

profile.

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

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

second,

Quoted 3 lines

respectively. The same profile parameters are used, no need to invent additional algorithms (such as srTCM - packet mode) or profile data

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

structures.

Quoted 1 line

Can we do the same here, please?

This flag approach is very intuitive suggestion and it has advantages.

The main problem with the flag approach is that it breaks ABI and API. The profile structure size is changed due to a new field - ABI

breakage.

Quoted 14 lines
Quoted 14 lines
Quoted 2 lines
Quoted 2 lines

The user must initialize the flag with zero to get old behavior - API

breakage.

Quoted 5 lines
Quoted 1 line

The rte_mtr API is experimental, all the API functions are correctly marked with __rte_experimental in rte_mtr.h file, so we can safely change the API

and

Quoted 2 lines

the ABI breakage is not applicable here. Therefore, this problem does not

exist,

Quoted 1 line

correct?

Quoted 7 lines
Quoted 5 lines

Yes, but still meter is not new API and I know that a lot of user uses it for a long time.
Forcing them to change while we have good solution that don't force it, looks me problematic.

Not really, only 3 drivers are currently implementing this API.

The user is not the PMD, the PMDs are the providers.
I'm talking about all our customers, all the current DPDK based applications like OVS and others (I familiar with at least 4 ConnectX customer applications) which use the meter API and I'm sure there are more around the world.

Quoted 1 line

Even to these drivers, the required changes are none or extremely small:

as Ajit

Quoted 1 line

was also noting, as the default value of 0 continues to represent the

existing

Quoted 2 lines

byte mode, all you have to do is make sure the new flag is set to zero in the profile params structure, which is already done implicitly in most places as

this

Quoted 1 line

structure is initialized to all-zeros.

Are you sure all the world initialize the struct to 0? and also in this case, without new compilation, not all the struct will be zeroes(the old size is smaller).

Quoted 1 line

A simple search exercise for struct rte_mtr_meter_profile is all that is

needed.

Quoted 1 line

You also agreed the flag approach is very intuitive, hence better and nicer,

with

Quoted 1 line

no additional work needed for you, so why not do it?

Do you understand that any current application that use the meter API must recompile the code of the application? Part of them also probably need to set the flag to 0....
Do you understand also the potential issues for the applications which are not aware to the change? Debug time, etc....

Quoted 12 lines
Quoted 12 lines
Quoted 8 lines
Quoted 2 lines

I don't see issues with Li suggestion, Do you think Li suggestion has critical issues?

It is probably better to keep the rte_mtr and the rte_tm APIs aligned, it simplifies the code maintenance and improves the user experience, which always pays off in the long run. Both APIs configure token buckets in either packet mode or byte mode, and it is desirable to have them work in the

same

Quoted 2 lines

way. Also, I think we should avoid duplicating configuration data structures

for

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

to support essentially the same algorithms (such as srTCM or trTCM) if we

can.

Quoted 1 line

Yes, but I don't think this motivation is critical.

I really disagree. As API maintainer, making every effort to keep the APIs

clear

Quoted 1 line

and consistent is a critical task for me.

New pps profile is also clear and simple.

Quoted 2 lines

We don't want to proliferate the API
data structures and parameters if there is a good way to avoid it. Especially

in

Quoted 2 lines

cases like this, when the drivers are just beginning to pick up this (still experimental) API, we have the rare chance to make things right and

therefore

Quoted 1 line

we should do it. Please also keep in mind that, as more feature are added

to

Quoted 1 line

the API, small corner cuts like this one that might not look like a big deal

now,

Quoted 1 line

eventually come back as unnecessary complexity in the drivers themselves.

I don't see a complexity in the current suggestion.

Quoted 1 line

So, please, let's try to keep the quality of the APIs high.

Also by this way is high.

Quoted 7 lines

Look, the flag approach is also good and makes the job.
The two approaches are clear, simple and in high quality.
I don't care which one from the 2 to take but I want to be sure we are all understand the pros and cons.

If you understand my concern on flag approach and still insist to take the flag approach we will align.

Yes, thanks for summarizing the pros and cons, I confirm that I do understand your concerns.

Yes, sorry to disappoint you, I still think the packet_mode based approach is better for the long run, as it keeps the APIs clean and consistent. We are not adding new algorithms here, we're just adding a new mode to an existing algorithm, so IMO we should not duplicate configuration data structures and proliferate the number of algorithms artificially.

Yes, I do realize that in some limited cases the users will have to explicitly set the new packet_mode flag to zero or one, in case they need to enable the packet mode, but I think this is an acceptable cost because: (A) This API is clearly marked as experimental; (B) It is better to take a small incremental hit now to keep the APIs in good order rather than taking a bit hit in a few years as more features are added in the wrong way and the APIs become unmanageable.

Quoted 5 lines

And if we so, and we are going to break the API\ABI, we are going to introduce new meter policy API soon and there, breaking API can help, lets see in other discussion later.

Yes, as you point out API changes are unavoidable as new features are added, we have to manage the API evolution correctly.

Quoted 7 lines

One more point:
Currently, the meter_id is managed by the user, I think it is better to let the PMDs to manage the meter_id.

Searching the PMD meter handler inside the PMD is very expensive for the API call rate when the meter_id is managed by the user.

Quoted 7 lines

Same for profile_id.

Also all the rte_flow API including the shared action API taking the PMD management approach.

What do you think?

Yes, we have carefully considered and discussed both approaches a few years back when the API was introduced, this is not done by accident :), there are pros and cons for each of them.

If the object IDs are generated by the driver (outputs of the API), then it is the user application that needs to keep track of them, which can be very painful. Basically, for each API object the user application needs to create its own wrapper to store this ID. We basically transfer this problem to the user app.

If the object IDs are generated by the user application (inputs into the API), then we simplify the application by removing and indirection layer. Yes, it is true that this indirection layer now moves into the driver, but we should try to make the life easier for the appl developers as opposed to us, the driver developers. This indirection layer in the driver can be made a bit smarter than just a slow "for" loop; the search operation can be made faster with a small bit of effort, such as keeping this list sorted based on the object ID, splitting this list into buckets (similar to a hash table), etc, right?

Having the user app provide the object ID is especially important in the case of rte_tm API, where we have to deal with a tree of nodes, with thousands of nodes for each level. Having the app to store and manages this tree of IDs is a really bad idea, as the user app needs to mirror the tree of nodes on its side for no real benefit. As an added benefit, the user can generate these IDs using a rule, such as: given the specific path through the tree, the value of the ID can be computed.

But again, as you also mention above, there is a list of pros and cons for every approach, no approach is perfect. We took this approach for the good reasons listed above.

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 2 lines

The flag proposal is actually reducing the amount of work that you guys

need to

Quoted 1 line

do to implement your proposal. There is no negative impact to your

proposal

Quoted 1 line

and no big change, right?

Yes you right, but the implementation effect is not our concern.

Quoted 15 lines
Quoted 15 lines
Quoted 3 lines

This is a quick summary of the required API changes to add support for the packet mode, they are minimal:
a) Introduce the packet_mode flag in the profile parameters data

structure.

Quoted 1 line

b) Change the description (comment) of the rate and bucket size

parameters in

Quoted 6 lines

the meter profile parameters data structures to reflect that their values represents either bytes or packets, depending on the value of the new flag packet_mode from the same structure.
c) Add the relevant capabilities: just search for "packet" in the rte_tm.h capabilities data structures and apply the same to the rte_mtr.h

capabilities,

Quoted 1 line

when applicable.

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Regards,
Cristian

Regards,
Cristian

Regards,
Cristian

Regards,
Cristian

#42 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

From: Dumitrescu, Cristian

Quoted 213 lines

Hi Matan,

Quoted 118 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 6:10 PM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

Good discussion, thank you for that!

From: Dumitrescu, Cristian

Quoted 9 lines

Hi Matan,

Quoted 7 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 12:37 PM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon

<[email protected]>;

Quoted 19 lines
Quoted 19 lines

Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

HI Cristian

From: Dumitrescu, Cristian

Quoted 10 lines

Hi Matan,

Quoted 8 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 7:02 AM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon

Quoted 2 lines
Quoted 2 lines

<[email protected]>;

Quoted 1 line
Quoted 1 line

Raslan Darawsheh <[email protected]>;

[email protected];

Quoted 41 lines
Quoted 41 lines
Quoted 25 lines
Quoted 25 lines

[email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

Thank you for review, please see inline.

From: Dumitrescu, Cristian

Quoted 1 line
Quoted 1 line

From: dev <[email protected]> On Behalf Of Li Zhang

<snip>

Quoted 2 lines

We had this same problem earlier for the rte_tm.h API, where people

asked to

Quoted 2 lines

add support for WRED and shaper rates specified in packets to the existing

byte

Quoted 4 lines

rate support. I am more than happy to support adding the same here, but please let's adopt the same solution here rather than invent a different approach.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Please refer to struct rte_tm_wred_params and struct

rte_tm_shaper_params

Quoted 2 lines

from rte_tm.h: the packets vs. bytes mode is explicitly specified through

the use

Quoted 2 lines

of a flag called packet_mode that is added to the WRED and shaper

profile.

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

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

second,

Quoted 3 lines

respectively. The same profile parameters are used, no need to invent additional algorithms (such as srTCM - packet mode) or profile data

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

structures.

Quoted 1 line

Can we do the same here, please?

This flag approach is very intuitive suggestion and it has advantages.

The main problem with the flag approach is that it breaks ABI and API. The profile structure size is changed due to a new field - ABI

breakage.

Quoted 20 lines
Quoted 19 lines
Quoted 2 lines
Quoted 2 lines

The user must initialize the flag with zero to get old behavior - API

breakage.

Quoted 5 lines
Quoted 1 line

The rte_mtr API is experimental, all the API functions are correctly marked with __rte_experimental in rte_mtr.h file, so we can safely change the API

and

Quoted 2 lines

the ABI breakage is not applicable here. Therefore, this problem does not

exist,

Quoted 1 line

correct?

Yes, but still meter is not new API and I know that a lot of user uses it for a long time.
Forcing them to change while we have good solution that don't force it, looks me problematic.

Quoted 6 lines
Quoted 1 line

Not really, only 3 drivers are currently implementing this API.

The user is not the PMD, the PMDs are the providers.
I'm talking about all our customers, all the current DPDK based applications like OVS and others (I familiar with at least 4 ConnectX customer applications) which use the meter API and I'm sure there are more

around the world.

Quoted 78 lines
Quoted 2 lines

Even to these drivers, the required changes are none or extremely small:

as Ajit

Quoted 2 lines

was also noting, as the default value of 0 continues to represent the

existing

Quoted 3 lines

byte mode, all you have to do is make sure the new flag is set to zero in the profile params structure, which is already done implicitly in most places as

this

Quoted 1 line

structure is initialized to all-zeros.

Are you sure all the world initialize the struct to 0? and also in this case, without new compilation, not all the struct will be zeroes(the old size is smaller).

Quoted 2 lines

A simple search exercise for struct rte_mtr_meter_profile is all that is

needed.

Quoted 2 lines

You also agreed the flag approach is very intuitive, hence better and nicer,

with

Quoted 1 line

no additional work needed for you, so why not do it?

Do you understand that any current application that use the meter API must recompile the code of the application? Part of them also probably need to set the flag to 0....
Do you understand also the potential issues for the applications which are not aware to the change? Debug time, etc....

Quoted 14 lines
Quoted 14 lines
Quoted 8 lines
Quoted 2 lines

I don't see issues with Li suggestion, Do you think Li suggestion has critical issues?

It is probably better to keep the rte_mtr and the rte_tm APIs aligned, it simplifies the code maintenance and improves the user experience, which always pays off in the long run. Both APIs configure token buckets in either packet mode or byte mode, and it is desirable to have them work in the

same

Quoted 2 lines

way. Also, I think we should avoid duplicating configuration data structures

for

Quoted 2 lines

to support essentially the same algorithms (such as srTCM or trTCM) if we

Quoted 7 lines
Quoted 4 lines

can.

Quoted 1 line

Yes, but I don't think this motivation is critical.

I really disagree. As API maintainer, making every effort to keep the APIs

clear

Quoted 1 line

and consistent is a critical task for me.

New pps profile is also clear and simple.

Quoted 2 lines

We don't want to proliferate the API data structures and parameters if there is a good way to avoid it. Especially

in

Quoted 3 lines

cases like this, when the drivers are just beginning to pick up this (still
experimental) API, we have the rare chance to make things right and

therefore

Quoted 2 lines

we should do it. Please also keep in mind that, as more feature are added

to

Quoted 2 lines

the API, small corner cuts like this one that might not look like a big deal

now,

Quoted 1 line

eventually come back as unnecessary complexity in the drivers themselves.

I don't see a complexity in the current suggestion.

Quoted 1 line

So, please, let's try to keep the quality of the APIs high.

Also by this way is high.

Quoted 7 lines

Look, the flag approach is also good and makes the job.
The two approaches are clear, simple and in high quality.
I don't care which one from the 2 to take but I want to be sure we are all understand the pros and cons.

If you understand my concern on flag approach and still insist to take the flag approach we will align.

Quoted 8 lines

Yes, thanks for summarizing the pros and cons, I confirm that I do understand your concerns.

Yes, sorry to disappoint you, I still think the packet_mode based approach is better for the long run, as it keeps the APIs clean and consistent. We are not adding new algorithms here, we're just adding a new mode to an existing algorithm, so IMO we should not duplicate configuration data structures and proliferate the number of algorithms artificially.

Actually, PPS meter is a new algorithm - you can see that current algorithms RFCs don't talk about PPS.

Quoted 7 lines

Yes, I do realize that in some limited cases the users will have to explicitly set the new packet_mode flag to zero or one, in case they need to enable the packet mode, but I think this is an acceptable cost because: (A) This API is clearly marked as experimental; (B) It is better to take a small incremental hit now to keep the APIs in good order rather than taking a bit hit in a few years as more features are added in the wrong way and the APIs become unmanageable.

I don't think that the current suggestion is in wrong way. In any case, you insist, we will align.

Quoted 23 lines
Quoted 4 lines

And if we so, and we are going to break the API\ABI, we are going to introduce new meter policy API soon and there, breaking API can help, lets see in other discussion later.

Yes, as you point out API changes are unavoidable as new features are added, we have to manage the API evolution correctly.

Quoted 7 lines

One more point:
Currently, the meter_id is managed by the user, I think it is better to let the PMDs to manage the meter_id.

Searching the PMD meter handler inside the PMD is very expensive for the API call rate when the meter_id is managed by the user.

Quoted 7 lines

Same for profile_id.

Also all the rte_flow API including the shared action API taking the PMD management approach.

What do you think?

Quoted 8 lines

Yes, we have carefully considered and discussed both approaches a few years back when the API was introduced, this is not done by accident :), there are pros and cons for each of them.

If the object IDs are generated by the driver (outputs of the API), then it is the user application that needs to keep track of them, which can be very painful. Basically, for each API object the user application needs to create its own wrapper to store this ID. We basically transfer this problem to the user app.

No exactly\not for all, the app gets the meter_id in the same time it decides it now.

Quoted 8 lines

If the object IDs are generated by the user application (inputs into the API), then we simplify the application by removing and indirection layer. Yes, it is true that this indirection layer now moves into the driver, but we should try to make the life easier for the appl developers as opposed to us, the driver developers. This indirection layer in the driver can be made a bit smarter than just a slow "for" loop; the search operation can be made faster with a small bit of effort, such as keeping this list sorted based on the object ID, splitting this list into buckets (similar to a hash table), etc, right?

Yes, there are even better solution than hash table from "rate" perspective.

But any solution costs a lot of memory just for this mapping...
When we talked about 4M meters supported(in mlx5 next release) it becomes an issue.

Quoted 7 lines

Having the user app provide the object ID is especially important in the case of rte_tm API, where we have to deal with a tree of nodes, with thousands of nodes for each level. Having the app to store and manages this tree of IDs is a really bad idea, as the user app needs to mirror the tree of nodes on its side for no real benefit. As an added benefit, the user can generate these IDs using a rule, such as: given the specific path through the tree, the value of the ID can be computed.

rte_tm is not rte_mtr - I think meter is different and used differently.
For example, as I know, no one from our dpdk meter customers(at least 5) use TREEs for meter management. OVS, for example, just randomize some meter_id and don't care about it.

Also, all the rte_flow API basics works with PMD ID\handle management approach.

Quoted 3 lines

But again, as you also mention above, there is a list of pros and cons for every approach, no approach is perfect. We took this approach for the good reasons listed above.

If you familiar with TREE usage with meter, maybe we can combined easily the two approaches in this topic,

meter_id argument can be by reference, if it 0 - PMD set it, if not PMD use it.

Quoted 39 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 2 lines

The flag proposal is actually reducing the amount of work that you guys

need to

Quoted 2 lines

do to implement your proposal. There is no negative impact to your

proposal

Quoted 1 line

and no big change, right?

Yes you right, but the implementation effect is not our concern.

Quoted 17 lines
Quoted 17 lines
Quoted 4 lines

This is a quick summary of the required API changes to add support for the packet mode, they are minimal:
a) Introduce the packet_mode flag in the profile parameters data

structure.

Quoted 2 lines

b) Change the description (comment) of the rate and bucket size

parameters in

Quoted 6 lines

the meter profile parameters data structures to reflect that their values represents either bytes or packets, depending on the value of the new flag packet_mode from the same structure.
c) Add the relevant capabilities: just search for "packet" in the rte_tm.h capabilities data structures and apply the same to the rte_mtr.h

capabilities,

Quoted 1 line

when applicable.

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Regards,
Cristian

Regards,
Cristian

Regards,
Cristian

Regards,
Cristian

#43 lore raw

Re: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Quoted 244 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Thursday, March 4, 2021 6:34 AM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

From: Dumitrescu, Cristian

Quoted 9 lines

Hi Matan,

Quoted 7 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 6:10 PM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon

<[email protected]>;

Quoted 19 lines
Quoted 19 lines

Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

Good discussion, thank you for that!

From: Dumitrescu, Cristian

Quoted 9 lines

Hi Matan,

Quoted 7 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 12:37 PM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon

Quoted 2 lines
Quoted 2 lines

<[email protected]>;

Quoted 1 line
Quoted 1 line

Raslan Darawsheh <[email protected]>;

[email protected];

Quoted 58 lines
Quoted 58 lines
Quoted 18 lines
Quoted 18 lines

[email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

HI Cristian

From: Dumitrescu, Cristian

Quoted 10 lines

Hi Matan,

Quoted 8 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, March 2, 2021 7:02 AM
To: Dumitrescu, Cristian <[email protected]>; Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon

Quoted 2 lines
Quoted 2 lines

<[email protected]>;

Quoted 1 line
Quoted 1 line

Raslan Darawsheh <[email protected]>;

[email protected];

Quoted 37 lines
Quoted 37 lines
Quoted 25 lines
Quoted 25 lines

[email protected]; Yigit, Ferruh <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [dpdk-dev] [RFC v4 1/4] ethdev: add meter PPS profile

Hi Cristian

Thank you for review, please see inline.

From: Dumitrescu, Cristian

Quoted 1 line
Quoted 1 line

From: dev <[email protected]> On Behalf Of Li Zhang

<snip>

Quoted 2 lines

We had this same problem earlier for the rte_tm.h API, where people

asked to

Quoted 2 lines

add support for WRED and shaper rates specified in packets to the existing

byte

Quoted 4 lines

rate support. I am more than happy to support adding the same here, but please let's adopt the same solution here rather than invent a different approach.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Please refer to struct rte_tm_wred_params and struct

rte_tm_shaper_params

Quoted 2 lines

from rte_tm.h: the packets vs. bytes mode is explicitly specified through

the use

Quoted 2 lines

of a flag called packet_mode that is added to the WRED and shaper

profile.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

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

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

second,

Quoted 3 lines

respectively. The same profile parameters are used, no need to invent additional algorithms (such as srTCM - packet mode) or profile data

structures.

Quoted 1 line

Can we do the same here, please?

This flag approach is very intuitive suggestion and it has

advantages.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The main problem with the flag approach is that it breaks ABI and

API.

Quoted 22 lines
Quoted 22 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

The profile structure size is changed due to a new field - ABI

breakage.

Quoted 20 lines
Quoted 19 lines
Quoted 2 lines
Quoted 2 lines

The user must initialize the flag with zero to get old behavior - API

breakage.

Quoted 5 lines
Quoted 1 line

The rte_mtr API is experimental, all the API functions are correctly marked with __rte_experimental in rte_mtr.h file, so we can safely change the API

and

Quoted 2 lines

the ABI breakage is not applicable here. Therefore, this problem does not

exist,

Quoted 1 line

correct?

Yes, but still meter is not new API and I know that a lot of user uses it for a long time.
Forcing them to change while we have good solution that don't force it, looks me problematic.

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Not really, only 3 drivers are currently implementing this API.

The user is not the PMD, the PMDs are the providers.
I'm talking about all our customers, all the current DPDK based applications like OVS and others (I familiar with at least 4 ConnectX customer applications) which use the meter API and I'm sure there are

more

Quoted 3 lines

around the world.

Quoted 2 lines
Quoted 2 lines

Even to these drivers, the required changes are none or extremely

small:

Quoted 60 lines
Quoted 60 lines

as Ajit

Quoted 2 lines

was also noting, as the default value of 0 continues to represent the

existing

Quoted 3 lines

byte mode, all you have to do is make sure the new flag is set to zero in the profile params structure, which is already done implicitly in most places as

this

Quoted 1 line

structure is initialized to all-zeros.

Are you sure all the world initialize the struct to 0? and also in this case, without new compilation, not all the struct will be zeroes(the old size is smaller).

Quoted 2 lines

A simple search exercise for struct rte_mtr_meter_profile is all that is

needed.

Quoted 2 lines

You also agreed the flag approach is very intuitive, hence better and nicer,

with

Quoted 1 line

no additional work needed for you, so why not do it?

Do you understand that any current application that use the meter API must recompile the code of the application? Part of them also probably need to set the flag to 0....
Do you understand also the potential issues for the applications which are not aware to the change? Debug time, etc....

Quoted 14 lines
Quoted 14 lines
Quoted 8 lines
Quoted 2 lines

I don't see issues with Li suggestion, Do you think Li suggestion has critical issues?

It is probably better to keep the rte_mtr and the rte_tm APIs aligned, it simplifies the code maintenance and improves the user experience, which always pays off in the long run. Both APIs configure token buckets in either packet mode or byte mode, and it is desirable to have them work in the

same

Quoted 2 lines

way. Also, I think we should avoid duplicating configuration data structures

for

Quoted 2 lines

to support essentially the same algorithms (such as srTCM or trTCM) if we

Quoted 7 lines
Quoted 4 lines

can.

Quoted 1 line

Yes, but I don't think this motivation is critical.

I really disagree. As API maintainer, making every effort to keep the APIs

clear

Quoted 1 line

and consistent is a critical task for me.

New pps profile is also clear and simple.

Quoted 2 lines

We don't want to proliferate the API data structures and parameters if there is a good way to avoid it. Especially

in

Quoted 3 lines

cases like this, when the drivers are just beginning to pick up this (still
experimental) API, we have the rare chance to make things right and

Quoted 8 lines
Quoted 8 lines

therefore

Quoted 2 lines

we should do it. Please also keep in mind that, as more feature are added

to

Quoted 2 lines

the API, small corner cuts like this one that might not look like a big deal

now,

Quoted 1 line

eventually come back as unnecessary complexity in the drivers

themselves.

Quoted 13 lines
Quoted 13 lines

I don't see a complexity in the current suggestion.

Quoted 1 line

So, please, let's try to keep the quality of the APIs high.

Also by this way is high.

Look, the flag approach is also good and makes the job.
The two approaches are clear, simple and in high quality.
I don't care which one from the 2 to take but I want to be sure we are all understand the pros and cons.

Quoted 4 lines
Quoted 2 lines

If you understand my concern on flag approach and still insist to take the flag approach we will align.

Yes, thanks for summarizing the pros and cons, I confirm that I do

understand

Quoted 3 lines

your concerns.

Yes, sorry to disappoint you, I still think the packet_mode based approach

is

Quoted 1 line

better for the long run, as it keeps the APIs clean and consistent. We are

Quoted 9 lines

not

Quoted 2 lines

adding new algorithms here, we're just adding a new mode to an existing algorithm, so IMO we should not duplicate configuration data structures

and

Quoted 1 line

proliferate the number of algorithms artificially.

Actually, PPS meter is a new algorithm - you can see that current algorithms RFCs don't talk about PPS.

Yes, I know, I implemented it in librte_meter, but still, it is the same algorithm with just a different measurement unit (packet instead of byte), that's why many people (and you included :) ) still refer to it as srTCM - RFC 2697.

Quoted 5 lines
Quoted 1 line

Yes, I do realize that in some limited cases the users will have to explicitly

set

Quoted 3 lines

the new packet_mode flag to zero or one, in case they need to enable the packet mode, but I think this is an acceptable cost because: (A) This API is clearly marked as experimental; (B) It is better to take a small incremental

Quoted 9 lines

hit

Quoted 1 line

now to keep the APIs in good order rather than taking a bit hit in a few

years as

Quoted 2 lines

more features are added in the wrong way and the APIs become unmanageable.

I don't think that the current suggestion is in wrong way. In any case, you insist, we will align.

Thank you.

Quoted 45 lines
Quoted 6 lines
Quoted 4 lines

And if we so, and we are going to break the API\ABI, we are going to introduce new meter policy API soon and there, breaking API can help, lets see in other discussion later.

Yes, as you point out API changes are unavoidable as new features are

added,

Quoted 11 lines

we have to manage the API evolution correctly.

Quoted 9 lines

One more point:
Currently, the meter_id is managed by the user, I think it is better to let the PMDs to manage the meter_id.

Searching the PMD meter handler inside the PMD is very expensive for the API call rate when the meter_id is managed by the user.

Same for profile_id.

Quoted 7 lines
Quoted 5 lines

Also all the rte_flow API including the shared action API taking the PMD management approach.

What do you think?

Yes, we have carefully considered and discussed both approaches a few

years

Quoted 4 lines

back when the API was introduced, this is not done by accident :), there are pros and cons for each of them.

If the object IDs are generated by the driver (outputs of the API), then it is

the

Quoted 1 line

user application that needs to keep track of them, which can be very

painful.

Quoted 2 lines

Basically, for each API object the user application needs to create its own wrapper to store this ID. We basically transfer this problem to the user app.

No exactly\not for all, the app gets the meter_id in the same time it decides it now.

Quoted 3 lines

If the object IDs are generated by the user application (inputs into the API), then we simplify the application by removing and indirection layer. Yes, it is true that this indirection layer now moves into the driver, but we should try

to

Quoted 2 lines

make the life easier for the appl developers as opposed to us, the driver developers. This indirection layer in the driver can be made a bit smarter

Quoted 9 lines

than

Quoted 1 line

just a slow "for" loop; the search operation can be made faster with a small

bit

Quoted 1 line

of effort, such as keeping this list sorted based on the object ID, splitting

this list

Quoted 1 line

into buckets (similar to a hash table), etc, right?

Yes, there are even better solution than hash table from "rate" perspective.

I'd be very interested to hear your proposals here.

Quoted 4 lines

But any solution costs a lot of memory just for this mapping... When we talked about 4M meters supported(in mlx5 next release) it becomes an issue.

I thought your concern was about the speed/rate of API calls, you are saying it is not speed but memory footprint??

I would imagine that a system that enables all the 4M meters is a big beast with the most powerful CPU on the planet and many dozens of gigabytes of RAM, so a few extra megabytes for some API layers is not a concern?

Quoted 9 lines
Quoted 1 line

Having the user app provide the object ID is especially important in the case

of

Quoted 2 lines

rte_tm API, where we have to deal with a tree of nodes, with thousands of nodes for each level. Having the app to store and manages this tree of IDs

is a

Quoted 1 line

really bad idea, as the user app needs to mirror the tree of nodes on its

side for

Quoted 1 line

no real benefit. As an added benefit, the user can generate these IDs using

a

Quoted 9 lines
Quoted 1 line

rule, such as: given the specific path through the tree, the value of the ID

can

Quoted 1 line

be computed.

rte_tm is not rte_mtr - I think meter is different and used differently. For example, as I know, no one from our dpdk meter customers(at least 5) use TREEs for meter management. OVS, for example, just randomize some meter_id and don't care about it.

What kinds of trees? I'd be very interested to hear some proposals to make this handle mapping faster.

Quoted 3 lines

Also, all the rte_flow API basics works with PMD ID\handle management approach.

Yes, I am not saying it is wrong, none of the approaches is wrong IMO.

Quoted 11 lines
Quoted 1 line

But again, as you also mention above, there is a list of pros and cons for

every

Quoted 1 line

approach, no approach is perfect. We took this approach for the good

reasons

Quoted 1 line

listed above.

If you familiar with TREE usage with meter, maybe we can combined easily the two approaches in this topic,

meter_id argument can be by reference, if it 0 - PMD set it, if not PMD use it.

It would be good if you could elaborate here a bit, just to make sure we are on the same page.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 2 lines

The flag proposal is actually reducing the amount of work that you guys

need to

Quoted 2 lines

do to implement your proposal. There is no negative impact to your

proposal

Quoted 1 line

and no big change, right?

Yes you right, but the implementation effect is not our concern.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

This is a quick summary of the required API changes to add support for the packet mode, they are minimal:
a) Introduce the packet_mode flag in the profile parameters data

Quoted 25 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

structure.

Quoted 2 lines

b) Change the description (comment) of the rate and bucket size

parameters in

Quoted 3 lines

the meter profile parameters data structures to reflect that their values represents either bytes or packets, depending on the value of the new flag packet_mode from the same

structure.

Quoted 17 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

c) Add the relevant capabilities: just search for "packet" in the rte_tm.h capabilities data structures and apply the same to the rte_mtr.h

capabilities,

Quoted 1 line

when applicable.

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Regards,
Cristian

Regards,
Cristian

Regards,
Cristian

Regards,
Cristian

Regards,
Cristian

author
#44 lore raw

RFC v4 2/4 common/mlx5: add meter mode definition in PRM file

In reply to Li Zhang

Add meter mode definition in PRM file

---
 drivers/common/mlx5/mlx5_prm.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/common/mlx5/mlx5_prm.h +8 -0
index e3d4120849..609b1c3951 100644
@@ -2177,6 +2177,13 @@ struct mlx5_ifc_flow_meter_parameters_bits {
 #define MLX5_IFC_FLOW_METER_PARAM_MASK UINT64_C(0x80FFFFFF)
 #define MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL 0x14BF00C8
 
+enum {
+	MLX5_METER_MODE_IP_LEN = 0x0,
+	MLX5_METER_MODE_L2_LEN = 0x1,
+	MLX5_METER_MODE_L2_IPG_LEN = 0x2,
+	MLX5_METER_MODE_PKT = 0x3,
+};
+
 enum {
 	MLX5_CQE_SIZE_64B = 0x0,
 	MLX5_CQE_SIZE_128B = 0x1,
@@ -2508,6 +2515,7 @@ struct mlx5_aso_mtr_dseg {
 #define ASO_DSEG_VALID_OFFSET 31
 #define ASO_DSEG_BO_OFFSET 30
 #define ASO_DSEG_SC_OFFSET 28
+#define ASO_DSEG_MTR_MODE 24
 #define ASO_DSEG_CBS_EXP_OFFSET 24
 #define ASO_DSEG_CBS_MAN_OFFSET 16
 #define ASO_DSEG_CIR_EXP_MASK 0x1F
Signature · 1 line
2.21.0
author
#45 lore raw

RFC v4 3/4 net/mlx5: support meter PPS profile

In reply to Li Zhang

Currently meter algorithms only supports bytes per second(BPS). Such as Single Rate Three Color Marker (srTCM rfc2697)
Add this new meter srTCMp algorithm to support rate is packet per second. So that it can meter traffic by packet per second (PPS).

---
 doc/guides/nics/mlx5.rst           |  1 +
 drivers/net/mlx5/mlx5.h            | 13 ++++--
 drivers/net/mlx5/mlx5_flow_aso.c   | 17 ++++---
 drivers/net/mlx5/mlx5_flow_meter.c | 71 ++++++++++++++++++++++++------
 4 files changed, 79 insertions(+), 23 deletions(-)
doc/guides/nics/mlx5.rst +1 -0
index a390a4b53c..93f5c0e4d4 100644
@@ -362,6 +362,7 @@ Limitations
   - Green color is not supported with drop action.
   - Yellow detection is not supported.
   - Red color must be with drop action.
+  - meter srTCMp algorithm is supported.
 
 Statistics
 ----------
drivers/net/mlx5/mlx5.h +9 -4
index 2790995dcc..16fa1b6c4d 100644
@@ -742,8 +742,13 @@ struct mlx5_flow_meter_info {
 	/**< Flow meter action. */
 };
 
-/* RFC2697 parameter structure. */
-struct mlx5_flow_meter_srtcm_rfc2697_prm {
+/* PPS(packets per second) map to BPS(Bytes per second).
+ * HW treat packet as 128bytes in PPS mode
+ */
+#define MLX5_MTRS_PPS_MAP_BPS_SHIFT 7
+
+/* RFC2697/PPS parameter structure. */
+struct mlx5_flow_meter_srtcm_prm {
 	rte_be32_t cbs_cir;
 	/*
 	 * bit 24-28: cbs_exponent, bit 16-23 cbs_mantissa,
@@ -763,8 +768,8 @@ struct mlx5_flow_meter_profile {
 	uint32_t id; /**< Profile id. */
 	struct rte_mtr_meter_profile profile; /**< Profile detail. */
 	union {
-		struct mlx5_flow_meter_srtcm_rfc2697_prm srtcm_prm;
-		/**< srtcm_rfc2697 struct. */
+		struct mlx5_flow_meter_srtcm_prm srtcm_prm;
+		/**< srtcm_rfc2697/srtcm_pps struct. */
 	};
 	uint32_t ref_cnt; /**< Use count. */
 };
drivers/net/mlx5/mlx5_flow_aso.c +11 -6
index c9280b1f9d..3f3ba7e8fa 100644
@@ -244,7 +244,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 	volatile struct mlx5_aso_wqe *restrict wqe;
 	int i;
 	int size = 1 << sq->log_desc_n;
-	uint32_t idx;
 
 	/* All the next fields state should stay constant. */
 	for (i = 0, wqe = &sq->wqes[0]; i < size; ++i, ++wqe) {
@@ -257,11 +256,6 @@ mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq)
 			 (BYTEWISE_64BYTE << ASO_CSEG_DATA_MASK_MODE_OFFSET));
 		wqe->general_cseg.flags = RTE_BE32(MLX5_COMP_ALWAYS <<
 							 MLX5_COMP_MODE_OFFSET);
-		for (idx = 0; idx < MLX5_ASO_METERS_PER_WQE;
-			idx++)
-			wqe->aso_dseg.mtrs[idx].v_bo_sc_bbog_mm =
-				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
-				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	}
 }
 
@@ -744,6 +738,7 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 {
 	volatile struct mlx5_aso_wqe *wqe = NULL;
 	struct mlx5_flow_meter_info *fm = NULL;
+	struct mlx5_flow_meter_profile *fmp;
 	uint16_t size = 1 << sq->log_desc_n;
 	uint16_t mask = size - 1;
 	uint16_t res = size - (uint16_t)(sq->head - sq->tail);
@@ -781,6 +776,16 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_aso_sq *sq,
 			RTE_BE32(MLX5_IFC_FLOW_METER_DISABLE_CBS_CIR_VAL);
 		wqe->aso_dseg.mtrs[dseg_idx].ebs_eir = 0;
 	}
+	fmp = fm->profile;
+	if (fmp->profile.alg == RTE_MTR_SRTCMP)
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET) |
+				(MLX5_METER_MODE_PKT << ASO_DSEG_MTR_MODE));
+	else
+		wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm =
+				RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) |
+				(MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET));
 	sq->head++;
 	sq->pi += 2;/* Each WQE contains 2 WQEBB's. */
 	rte_io_wmb();
drivers/net/mlx5/mlx5_flow_meter.c +58 -13

136 lines not on this page · raw message

Signature · 1 line
2.21.0
author
#46 lore raw

RFC v4 4/4 app/testpmd: add meter pps mode cmd

In reply to Li Zhang

Support meter pps mode

---
 app/test-pmd/cmdline.c                      |   4 +
 app/test-pmd/cmdline_mtr.c                  | 105 ++++++++++++++++++++
 app/test-pmd/cmdline_mtr.h                  |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  15 +++
 4 files changed, 125 insertions(+)
app/test-pmd/cmdline.c +4 -0
index d274a7cb8c..1a3fc644dc 100644
@@ -698,6 +698,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"add port meter profile trtcm_rfc4115 (port_id) (profile_id) (cir) (eir) (cbs) (ebs)\n"
 			"    meter profile add - trtcm rfc 4115\n\n"
 
+			"add port meter profile srtcmp (port_id) (profile_id) (cipr) (cpbs) (epbs)\n"
+			"    meter profile add - srtcmp packet per second\n\n"
+
 			"del port meter profile (port_id) (profile_id)\n"
 			"    meter profile delete\n\n"
 
@@ -17006,6 +17009,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_show_port_meter_cap,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_trtcm,
+	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcmp,
 	(cmdline_parse_inst_t *)&cmd_del_port_meter_profile,
 	(cmdline_parse_inst_t *)&cmd_create_port_meter,
 	(cmdline_parse_inst_t *)&cmd_enable_port_meter,
app/test-pmd/cmdline_mtr.c +105 -0

123 lines not on this page · raw message

app/test-pmd/cmdline_mtr.h +1 -0
index e69d6da023..01ef85e1e7 100644
@@ -10,6 +10,7 @@ extern cmdline_parse_inst_t cmd_show_port_meter_cap;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm;
 extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115;
+extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp;
 extern cmdline_parse_inst_t cmd_del_port_meter_profile;
 extern cmdline_parse_inst_t cmd_create_port_meter;
 extern cmdline_parse_inst_t cmd_enable_port_meter;
doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -0
index 37278d31d6..d11de05583 100644
@@ -2734,6 +2734,21 @@ where:
 * ``cbs``: Committed burst size (bytes).
 * ``ebs``: Excess burst size (bytes).
 
+add port meter profile (srTcmp)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add meter profile (srTcmp) to the ethernet device::
+
+   testpmd> add port meter profile srtcmp (port_id) (profile_id) \
+   (cir) (cbs) (ebs)
+
+where:
+
+* ``profile_id``: ID for the meter profile.
+* ``cpr``: Committed Information Rate (CIR) (packets/second).
+* ``cbs``: Committed Burst Size (CBS) (packets).
+* ``ebs``: Excess Burst Size (EBS) (packets).
+
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
Signature · 1 line
2.21.0
#47 lore raw

Re: [dpdk-dev] [RFC v4 4/4] app/testpmd: add meter pps mode cmd

Hi

Quoted 149 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Li Zhang
Sent: Monday, March 1, 2021 18:36
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [RFC v4 4/4] app/testpmd: add meter pps mode cmd

Support meter pps mode

---
 app/test-pmd/cmdline.c                      |   4 +
 app/test-pmd/cmdline_mtr.c                  | 105 ++++++++++++++++++++
 app/test-pmd/cmdline_mtr.h                  |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  15 +++
 4 files changed, 125 insertions(+)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

d274a7cb8c..1a3fc644dc 100644

app/test-pmd/cmdline.c +0 -0
@@ -698,6 +698,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"add port meter profile trtcm_rfc4115 (port_id)

(profile_id) (cir) (eir) (cbs) (ebs)\n"

app/test-pmd/cmdline.c +1 -0
 			"    meter profile add - trtcm rfc 4115\n\n"
 
+			"add port meter profile srtcmp (port_id) (profile_id)

(cipr) (cpbs) (epbs)\n"

app/test-pmd/cmdline.c +3 -0
+			"    meter profile add - srtcmp packet per second\n\n"
+
 			"del port meter profile (port_id) (profile_id)\n"
 			"    meter profile delete\n\n"
@@ -17006,6 +17009,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_show_port_meter_cap,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_trtcm,
+	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcmp,
 	(cmdline_parse_inst_t *)&cmd_del_port_meter_profile,
 	(cmdline_parse_inst_t *)&cmd_create_port_meter,
 	(cmdline_parse_inst_t *)&cmd_enable_port_meter, diff --git

a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c index 399ee56e07..3f62240a0d 100644

app/test-pmd/cmdline_mtr.c +2 -0
@@ -295,6 +295,8 @@ static void cmd_show_port_meter_cap_parsed(void
 *parsed_result,
 		cap.meter_trtcm_rfc2698_n_max);
 	printf("cap.meter_trtcm_rfc4115_n_max %" PRIu32 "\n",
 		cap.meter_trtcm_rfc4115_n_max);
+	printf("cap.meter_srtcmp_n_max %" PRIu32 "\n",
+		cap.meter_srtcmp_n_max);
 	printf("cap.meter_rate_max %" PRIu64 "\n", cap.meter_rate_max);
 	printf("cap.color_aware_srtcm_rfc2697_supported %" PRId32 "\n",
app/test-pmd/cmdline_mtr.c +2 -0
 		cap.color_aware_srtcm_rfc2697_supported);
@@ -302,6 +304,8 @@ static void cmd_show_port_meter_cap_parsed(void
 *parsed_result,
 		cap.color_aware_trtcm_rfc2698_supported);
 	printf("cap.color_aware_trtcm_rfc4115_supported %" PRId32 "\n",
 		cap.color_aware_trtcm_rfc4115_supported);
+	printf("cap.color_aware_srtcmp_supported %" PRId32 "\n",
+		cap.color_aware_srtcmp_supported);
 	printf("cap.policer_action_recolor_supported %" PRId32 "\n",
 		cap.policer_action_recolor_supported);

printf("cap.policer_action_drop_supported %" PRId32 "\n", @@ -644,6
+648,107 @@ cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {

app/test-pmd/cmdline_mtr.c +38 -0
 	},
 };
 
+/* *** Add Port Meter Profile srtcmp *** */ struct
+cmd_add_port_meter_profile_srtcmp_result {
+	cmdline_fixed_string_t add;
+	cmdline_fixed_string_t port;
+	cmdline_fixed_string_t meter;
+	cmdline_fixed_string_t profile;
+	cmdline_fixed_string_t srtcmp;
+	uint16_t port_id;
+	uint32_t profile_id;
+	uint64_t cir;
+	uint64_t cbs;
+	uint64_t ebs;
+};
+
+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_add =
+	TOKEN_STRING_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result, add, "add");
+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_port =
+	TOKEN_STRING_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			port, "port");
+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_meter =
+	TOKEN_STRING_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			meter, "meter");
+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_profile =
+	TOKEN_STRING_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			profile, "profile");
+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_srtcmp =
+	TOKEN_STRING_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			srtcmp, "srtcmp");
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_port_id =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			port_id, RTE_UINT16);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_profile_id

=

app/test-pmd/cmdline_mtr.c +38 -0
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			profile_id, RTE_UINT32);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_cir =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			cir, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_cbs =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			cbs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_ebs =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			ebs, RTE_UINT64);
+
+static void cmd_add_port_meter_profile_srtcmp_parsed(void *parsed_result,
+	__rte_unused struct cmdline *cl,
+	__rte_unused void *data)
+{
+	struct cmd_add_port_meter_profile_srtcmp_result *res = parsed_result;
+	struct rte_mtr_meter_profile mp;
+	struct rte_mtr_error error;
+	uint32_t profile_id = res->profile_id;
+	uint16_t port_id = res->port_id;
+	int ret;
+
+	if (port_id_is_invalid(port_id, ENABLED_WARN))
+		return;
+
+	/* Private shaper profile params */
+	memset(&mp, 0, sizeof(struct rte_mtr_meter_profile));
+	mp.alg = RTE_MTR_SRTCMP;
+	mp.srtcmp.cir = res->cir;
+	mp.srtcmp.cbs = res->cbs;
+	mp.srtcmp.ebs = res->ebs;
+
+	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);

app/test-pmd/cmdline_mtr.c cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = { · line 736

Quoted 10 lines
app/test-pmd/cmdline_mtr.c +10 -0
+	if (ret != 0) {
+		print_err_msg(&error);
+		return;
+	}
+}
+
+cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp = {
+	.f = cmd_add_port_meter_profile_srtcmp_parsed,
+	.data = NULL,
+	.help_str = "Add port meter profile srtcmp",

helper_str is the hint that users can follow to tap the command. Please follow other commands behavior. You can refer to the recent commit 618f0f4ac689f9255eecbef9202e77e35a9a7ceb which fixes all wrong helper_str in meter commands.

Quoted 59 lines
app/test-pmd/cmdline_mtr.c +15 -0
+	.tokens = {
+		(void *)&cmd_add_port_meter_profile_srtcmp_add,
+		(void *)&cmd_add_port_meter_profile_srtcmp_port,
+		(void *)&cmd_add_port_meter_profile_srtcmp_meter,
+		(void *)&cmd_add_port_meter_profile_srtcmp_profile,
+		(void *)&cmd_add_port_meter_profile_srtcmp_srtcmp,
+		(void *)&cmd_add_port_meter_profile_srtcmp_port_id,
+		(void *)&cmd_add_port_meter_profile_srtcmp_profile_id,
+		(void *)&cmd_add_port_meter_profile_srtcmp_cir,
+		(void *)&cmd_add_port_meter_profile_srtcmp_cbs,
+		(void *)&cmd_add_port_meter_profile_srtcmp_ebs,
+		NULL,
+	},
+};
+
 /* *** Delete Port Meter Profile *** */  struct

cmd_del_port_meter_profile_result {

app/test-pmd/cmdline_mtr.c +0 -0
 	cmdline_fixed_string_t del;
app/test-pmd/cmdline_mtr.h index renamed from app/test-pmd/cmdline_mtr.h +0 -0

e69d6da023..01ef85e1e7 100644

app/test-pmd/cmdline_mtr.h +0 -0
@@ -10,6 +10,7 @@ extern cmdline_parse_inst_t cmd_show_port_meter_cap;

extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm; extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm; extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115; +extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp;
extern cmdline_parse_inst_t cmd_del_port_meter_profile; extern
cmdline_parse_inst_t cmd_create_port_meter; extern cmdline_parse_inst_t cmd_enable_port_meter; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 37278d31d6..d11de05583 100644

doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -1
@@ -2734,6 +2734,21 @@ where:
 * ``cbs``: Committed burst size (bytes).
 * ``ebs``: Excess burst size (bytes).
 
+add port meter profile (srTcmp)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add meter profile (srTcmp) to the ethernet device::
+
+   testpmd> add port meter profile srtcmp (port_id) (profile_id) \
+   (cir) (cbs) (ebs)
+
+where:
+
+* ``profile_id``: ID for the meter profile.
+* ``cpr``: Committed Information Rate (CIR) (packets/second).
+* ``cbs``: Committed Burst Size (CBS) (packets).
+* ``ebs``: Excess Burst Size (EBS) (packets).
+
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
--

2.21.0

author
#48 lore raw

Re: [dpdk-dev] [RFC v4 4/4] app/testpmd: add meter pps mode cmd

Hi Xiao yun,

Thanks for your comments.
We will follow other commands in our new command's helper_str.

Regards,
Li Zhang

Quoted 252 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Li, Xiaoyun
Sent: Tuesday, March 2, 2021 9:48 AM
To: Li Zhang <[email protected]>; Dekel Peled <[email protected]>; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [RFC v4 4/4] app/testpmd: add meter pps mode cmd

Hi

app/test-pmd/cmdline.c static void cmd_help_long_parsed(void

Quoted 24 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Li Zhang
Sent: Monday, March 1, 2021 18:36
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [RFC v4 4/4] app/testpmd: add meter pps mode cmd

Support meter pps mode

---
 app/test-pmd/cmdline.c                      |   4 +
 app/test-pmd/cmdline_mtr.c                  | 105 ++++++++++++++++++++
 app/test-pmd/cmdline_mtr.h                  |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  15 +++
 4 files changed, 125 insertions(+)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

d274a7cb8c..1a3fc644dc 100644

app/test-pmd/cmdline.c +0 -0
@@ -698,6 +698,9 @@ static void cmd_help_long_parsed(void

*parsed_result,

Quoted 42 lines
app/test-pmd/cmdline.c +0 -0
 			"add port meter profile trtcm_rfc4115 (port_id)

(profile_id) (cir) (eir) (cbs) (ebs)\n"

app/test-pmd/cmdline.c +1 -0
 			"    meter profile add - trtcm rfc 4115\n\n"
 
+			"add port meter profile srtcmp (port_id) (profile_id)

(cipr) (cpbs) (epbs)\n"

app/test-pmd/cmdline.c +3 -0
+			"    meter profile add - srtcmp packet per second\n\n"
+
 			"del port meter profile (port_id) (profile_id)\n"
 			"    meter profile delete\n\n"
@@ -17006,6 +17009,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_show_port_meter_cap,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcm,
 	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_trtcm,
+	(cmdline_parse_inst_t *)&cmd_add_port_meter_profile_srtcmp,
 	(cmdline_parse_inst_t *)&cmd_del_port_meter_profile,
 	(cmdline_parse_inst_t *)&cmd_create_port_meter,
 	(cmdline_parse_inst_t *)&cmd_enable_port_meter, diff --git

a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c index 399ee56e07..3f62240a0d 100644

app/test-pmd/cmdline_mtr.c +2 -0
@@ -295,6 +295,8 @@ static void cmd_show_port_meter_cap_parsed(void
 *parsed_result,
 		cap.meter_trtcm_rfc2698_n_max);
 	printf("cap.meter_trtcm_rfc4115_n_max %" PRIu32 "\n",
 		cap.meter_trtcm_rfc4115_n_max);
+	printf("cap.meter_srtcmp_n_max %" PRIu32 "\n",
+		cap.meter_srtcmp_n_max);
 	printf("cap.meter_rate_max %" PRIu64 "\n", cap.meter_rate_max);
 	printf("cap.color_aware_srtcm_rfc2697_supported %" PRId32 "\n",
app/test-pmd/cmdline_mtr.c +2 -0
 		cap.color_aware_srtcm_rfc2697_supported);
@@ -302,6 +304,8 @@ static void cmd_show_port_meter_cap_parsed(void
 *parsed_result,
 		cap.color_aware_trtcm_rfc2698_supported);
 	printf("cap.color_aware_trtcm_rfc4115_supported %" PRId32 "\n",
 		cap.color_aware_trtcm_rfc4115_supported);
+	printf("cap.color_aware_srtcmp_supported %" PRId32 "\n",
+		cap.color_aware_srtcmp_supported);
 	printf("cap.policer_action_recolor_supported %" PRId32 "\n",
 		cap.policer_action_recolor_supported);
Quoted 1 line

printf("cap.policer_action_drop_supported %" PRId32 "\n", @@ -

644,6

Quoted 10 lines

+648,107 @@ cmdline_parse_inst_t
cmd_add_port_meter_profile_trtcm_rfc4115 = {

app/test-pmd/cmdline_mtr.c +5 -0
 	},
 };
 
+/* *** Add Port Meter Profile srtcmp *** */ struct
+cmd_add_port_meter_profile_srtcmp_result {
+	cmdline_fixed_string_t add;
+	cmdline_fixed_string_t port;
+	cmdline_fixed_string_t meter;

app/test-pmd/cmdline_mtr.c cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {

Quoted 10 lines
app/test-pmd/cmdline_mtr.c +10 -0
+	cmdline_fixed_string_t profile;
+	cmdline_fixed_string_t srtcmp;
+	uint16_t port_id;
+	uint32_t profile_id;
+	uint64_t cir;
+	uint64_t cbs;
+	uint64_t ebs;
+};
+
+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_add

=

app/test-pmd/cmdline_mtr.c

Quoted 2 lines
app/test-pmd/cmdline_mtr.c +2 -0
+	TOKEN_STRING_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result, add,

"add");

Quoted 1 line

+cmdline_parse_token_string_t cmd_add_port_meter_profile_srtcmp_port

=

app/test-pmd/cmdline_mtr.c cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {

Quoted 4 lines
app/test-pmd/cmdline_mtr.c +4 -0
+	TOKEN_STRING_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			port, "port");
+cmdline_parse_token_string_t

cmd_add_port_meter_profile_srtcmp_meter =

app/test-pmd/cmdline_mtr.c cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {

Quoted 4 lines
app/test-pmd/cmdline_mtr.c +4 -0
+	TOKEN_STRING_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			meter, "meter");
+cmdline_parse_token_string_t

cmd_add_port_meter_profile_srtcmp_profile =

app/test-pmd/cmdline_mtr.c cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {

Quoted 4 lines
app/test-pmd/cmdline_mtr.c +4 -0
+	TOKEN_STRING_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			profile, "profile");
+cmdline_parse_token_string_t

cmd_add_port_meter_profile_srtcmp_srtcmp =

app/test-pmd/cmdline_mtr.c cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {

Quoted 4 lines
app/test-pmd/cmdline_mtr.c +4 -0
+	TOKEN_STRING_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			srtcmp, "srtcmp");
+cmdline_parse_token_num_t

cmd_add_port_meter_profile_srtcmp_port_id =

Quoted 13 lines
app/test-pmd/cmdline_mtr.c +5 -0
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			port_id, RTE_UINT16);
+cmdline_parse_token_num_t
+cmd_add_port_meter_profile_srtcmp_profile_id

=

app/test-pmd/cmdline_mtr.c +7 -0
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			profile_id, RTE_UINT32);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_cir =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			cir, RTE_UINT64);

app/test-pmd/cmdline_mtr.c cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {

Quoted 10 lines
app/test-pmd/cmdline_mtr.c +10 -0
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_cbs =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			cbs, RTE_UINT64);
+cmdline_parse_token_num_t cmd_add_port_meter_profile_srtcmp_ebs =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_meter_profile_srtcmp_result,
+			ebs, RTE_UINT64);
+
+static void cmd_add_port_meter_profile_srtcmp_parsed(void

*parsed_result,

app/test-pmd/cmdline_mtr.c cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {

Quoted 4 lines
app/test-pmd/cmdline_mtr.c +4 -0
+	__rte_unused struct cmdline *cl,
+	__rte_unused void *data)
+{
+	struct cmd_add_port_meter_profile_srtcmp_result *res =

parsed_result;

Quoted 17 lines
app/test-pmd/cmdline_mtr.c +17 -0
+	struct rte_mtr_meter_profile mp;
+	struct rte_mtr_error error;
+	uint32_t profile_id = res->profile_id;
+	uint16_t port_id = res->port_id;
+	int ret;
+
+	if (port_id_is_invalid(port_id, ENABLED_WARN))
+		return;
+
+	/* Private shaper profile params */
+	memset(&mp, 0, sizeof(struct rte_mtr_meter_profile));
+	mp.alg = RTE_MTR_SRTCMP;
+	mp.srtcmp.cir = res->cir;
+	mp.srtcmp.cbs = res->cbs;
+	mp.srtcmp.ebs = res->ebs;
+
+	ret = rte_mtr_meter_profile_add(port_id, profile_id, &mp, &error);

app/test-pmd/cmdline_mtr.c cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = { · line 736

Quoted 10 lines
app/test-pmd/cmdline_mtr.c +10 -0
+	if (ret != 0) {
+		print_err_msg(&error);
+		return;
+	}
+}
+
+cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp = {
+	.f = cmd_add_port_meter_profile_srtcmp_parsed,
+	.data = NULL,
+	.help_str = "Add port meter profile srtcmp",

helper_str is the hint that users can follow to tap the command. Please follow other commands behavior.
You can refer to the recent commit 618f0f4ac689f9255eecbef9202e77e35a9a7ceb which fixes all wrong helper_str in meter commands.

app/test-pmd/cmdline_mtr.h extern cmdline_parse_inst_t

Quoted 24 lines
app/test-pmd/cmdline_mtr.c +15 -0
+	.tokens = {
+		(void *)&cmd_add_port_meter_profile_srtcmp_add,
+		(void *)&cmd_add_port_meter_profile_srtcmp_port,
+		(void *)&cmd_add_port_meter_profile_srtcmp_meter,
+		(void *)&cmd_add_port_meter_profile_srtcmp_profile,
+		(void *)&cmd_add_port_meter_profile_srtcmp_srtcmp,
+		(void *)&cmd_add_port_meter_profile_srtcmp_port_id,
+		(void *)&cmd_add_port_meter_profile_srtcmp_profile_id,
+		(void *)&cmd_add_port_meter_profile_srtcmp_cir,
+		(void *)&cmd_add_port_meter_profile_srtcmp_cbs,
+		(void *)&cmd_add_port_meter_profile_srtcmp_ebs,
+		NULL,
+	},
+};
+
 /* *** Delete Port Meter Profile *** */  struct

cmd_del_port_meter_profile_result {

app/test-pmd/cmdline_mtr.c +0 -0
 	cmdline_fixed_string_t del;
app/test-pmd/cmdline_mtr.h +0 -0

index
e69d6da023..01ef85e1e7 100644

app/test-pmd/cmdline_mtr.h +0 -0
@@ -10,6 +10,7 @@ extern cmdline_parse_inst_t

cmd_show_port_meter_cap;

Quoted 36 lines

extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm; extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm; extern cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115; +extern cmdline_parse_inst_t cmd_add_port_meter_profile_srtcmp;
extern cmdline_parse_inst_t cmd_del_port_meter_profile; extern
cmdline_parse_inst_t cmd_create_port_meter; extern cmdline_parse_inst_t cmd_enable_port_meter; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 37278d31d6..d11de05583 100644

doc/guides/testpmd_app_ug/testpmd_funcs.rst +15 -1
@@ -2734,6 +2734,21 @@ where:
 * ``cbs``: Committed burst size (bytes).
 * ``ebs``: Excess burst size (bytes).
 
+add port meter profile (srTcmp)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add meter profile (srTcmp) to the ethernet device::
+
+   testpmd> add port meter profile srtcmp (port_id) (profile_id) \
+   (cir) (cbs) (ebs)
+
+where:
+
+* ``profile_id``: ID for the meter profile.
+* ``cpr``: Committed Information Rate (CIR) (packets/second).
+* ``cbs``: Committed Burst Size (CBS) (packets).
+* ``ebs``: Excess Burst Size (EBS) (packets).
+
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
--

2.21.0