diff mbox series

[RFC,v2] : adds support PPS(packet per second) on meter

Message ID 20210125012023.1769769-2-lizh@nvidia.com (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers show
Series [RFC,v2] : adds support PPS(packet per second) on meter | expand

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Li Zhang Jan. 25, 2021, 1:20 a.m. UTC
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
Signed-off-by: Li Zhang <lizh@nvidia.com>
---
 lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Ferruh Yigit Jan. 28, 2021, 6:27 p.m. UTC | #1
On 1/25/2021 1:20 AM, Li Zhang wrote:
> 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
> Signed-off-by: Li Zhang <lizh@nvidia.com>

cc'ed Cristian for review/comment.

> ---
>   lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
>   1 file changed, 28 insertions(+)
> 
> diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
> index 916a09c5c3..3e88904faf 100644
> --- a/lib/librte_ethdev/rte_mtr.h
> +++ b/lib/librte_ethdev/rte_mtr.h
> @@ -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
>
Morten Brørup Feb. 12, 2021, 7:40 a.m. UTC | #2
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Thursday, January 28, 2021 7:28 PM
> 
> On 1/25/2021 1:20 AM, Li Zhang wrote:
> > 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
> > Signed-off-by: Li Zhang <lizh@nvidia.com>
> 
> cc'ed Cristian for review/comment.
> 
> > ---
> >   lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
> >   1 file changed, 28 insertions(+)
> >
> > diff --git a/lib/librte_ethdev/rte_mtr.h
> b/lib/librte_ethdev/rte_mtr.h
> > index 916a09c5c3..3e88904faf 100644
> > --- a/lib/librte_ethdev/rte_mtr.h
> > +++ b/lib/librte_ethdev/rte_mtr.h
> > @@ -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;

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

> >   	};
> >   };
> >
> > @@ -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.

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

> > +	 */
> > +	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
> >
>
Li Zhang Feb. 23, 2021, 2:07 a.m. UTC | #3
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
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Morten Br?rup
> Sent: Friday, February 12, 2021 3:41 PM
> To: Ferruh Yigit <ferruh.yigit@intel.com>; Li Zhang <lizh@nvidia.com>; Dekel
> Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Dumitrescu,
> Cristian <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> Raslan Darawsheh <rasland@nvidia.com>
> Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second)
> on meter
> 
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> > Sent: Thursday, January 28, 2021 7:28 PM
> >
> > On 1/25/2021 1:20 AM, Li Zhang wrote:
> > > 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
> > > Signed-off-by: Li Zhang <lizh@nvidia.com>
> >
> > cc'ed Cristian for review/comment.
> >
> > > ---
> > >   lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
> > >   1 file changed, 28 insertions(+)
> > >
> > > diff --git a/lib/librte_ethdev/rte_mtr.h
> > b/lib/librte_ethdev/rte_mtr.h
> > > index 916a09c5c3..3e88904faf 100644
> > > --- a/lib/librte_ethdev/rte_mtr.h
> > > +++ b/lib/librte_ethdev/rte_mtr.h
> > > @@ -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;
> 
> In PPS mode, the burst sizes (ebs, ebs) must be packets, not bytes.
> 
> > >   	};
> > >   };
> > >
> > > @@ -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.
> 
> No need for two spaces between the words second and metering.
> 
> > > +	 */
> > > +	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
> > >
> >
Morten Brørup Feb. 23, 2021, 8:24 a.m. UTC | #4
> From: dev [mailto:dev-bounces@dpdk.org] 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;
> 
> 			/** 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

> 
> Regards,
> Li Zhang
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Morten Br?rup
> > Sent: Friday, February 12, 2021 3:41 PM
> > To: Ferruh Yigit <ferruh.yigit@intel.com>; Li Zhang
> <lizh@nvidia.com>; Dekel
> > Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Slava
> Ovsiienko
> > <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Dumitrescu,
> > Cristian <cristian.dumitrescu@intel.com>
> > Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> > Raslan Darawsheh <rasland@nvidia.com>
> > Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet
> per second)
> > on meter
> >
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> > > Sent: Thursday, January 28, 2021 7:28 PM
> > >
> > > On 1/25/2021 1:20 AM, Li Zhang wrote:
> > > > 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
> > > > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > >
> > > cc'ed Cristian for review/comment.
> > >
> > > > ---
> > > >   lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
> > > >   1 file changed, 28 insertions(+)
> > > >
> > > > diff --git a/lib/librte_ethdev/rte_mtr.h
> > > b/lib/librte_ethdev/rte_mtr.h
> > > > index 916a09c5c3..3e88904faf 100644
> > > > --- a/lib/librte_ethdev/rte_mtr.h
> > > > +++ b/lib/librte_ethdev/rte_mtr.h
> > > > @@ -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;
> >
> > In PPS mode, the burst sizes (ebs, ebs) must be packets, not bytes.
> >
> > > >   	};
> > > >   };
> > > >
> > > > @@ -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.
> >
> > No need for two spaces between the words second and metering.
> >
> > > > +	 */
> > > > +	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
> > > >
> > >
Li Zhang March 1, 2021, 3:16 a.m. UTC | #5
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
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Morten Br?rup
> Sent: Tuesday, February 23, 2021 4:25 PM
> To: Li Zhang <lizh@nvidia.com>; Ferruh Yigit <ferruh.yigit@intel.com>; Dekel
> Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Dumitrescu,
> Cristian <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> Raslan Darawsheh <rasland@nvidia.com>
> Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per second)
> on meter
> 
> > From: dev [mailto:dev-bounces@dpdk.org] 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;
> >
> > 			/** 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
> 
> >
> > Regards,
> > Li Zhang
> > > -----Original Message-----
> > > From: dev <dev-bounces@dpdk.org> On Behalf Of Morten Br?rup
> > > Sent: Friday, February 12, 2021 3:41 PM
> > > To: Ferruh Yigit <ferruh.yigit@intel.com>; Li Zhang
> > <lizh@nvidia.com>; Dekel
> > > Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Slava
> > Ovsiienko
> > > <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>;
> > > Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> > > Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>;
> > > Raslan Darawsheh <rasland@nvidia.com>
> > > Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet
> > per second)
> > > on meter
> > >
> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> > > > Sent: Thursday, January 28, 2021 7:28 PM
> > > >
> > > > On 1/25/2021 1:20 AM, Li Zhang wrote:
> > > > > 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
> > > > > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > > >
> > > > cc'ed Cristian for review/comment.
> > > >
> > > > > ---
> > > > >   lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
> > > > >   1 file changed, 28 insertions(+)
> > > > >
> > > > > diff --git a/lib/librte_ethdev/rte_mtr.h
> > > > b/lib/librte_ethdev/rte_mtr.h
> > > > > index 916a09c5c3..3e88904faf 100644
> > > > > --- a/lib/librte_ethdev/rte_mtr.h
> > > > > +++ b/lib/librte_ethdev/rte_mtr.h
> > > > > @@ -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;
> > >
> > > In PPS mode, the burst sizes (ebs, ebs) must be packets, not bytes.
> > >
> > > > >   	};
> > > > >   };
> > > > >
> > > > > @@ -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.
> > >
> > > No need for two spaces between the words second and metering.
> > >
> > > > > +	 */
> > > > > +	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
> > > > >
> > > >
Ajit Khaparde March 1, 2021, 3:31 a.m. UTC | #6
On Sun, Feb 28, 2021 at 7:16 PM Li Zhang <lizh@nvidia.com> wrote:
>
> 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?

>
> We will update the struct as below:
> enum rte_mtr_algorithm {
> ......
>         /** Single Rate Three Color Marker, Packet based (srTCMp).
+1

>          * - - similar to IETF RFC 2697 but rate is packet per second.
s/rate is/measured in

>          */
>         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;
> }
>
::::[snip]::::
Morten Brørup March 1, 2021, 7:20 a.m. UTC | #7
> From: dev [mailto:dev-bounces@dpdk.org] 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;
> }
> 
> Regards,
> Li Zhang

Looks good.

Acked-By: Morten Brørup <mb@smartsharesystems.com>


> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Morten Br?rup
> > Sent: Tuesday, February 23, 2021 4:25 PM
> > To: Li Zhang <lizh@nvidia.com>; Ferruh Yigit
> <ferruh.yigit@intel.com>; Dekel
> > Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Slava
> Ovsiienko
> > <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Dumitrescu,
> > Cristian <cristian.dumitrescu@intel.com>
> > Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> > Raslan Darawsheh <rasland@nvidia.com>
> > Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet
> per second)
> > on meter
> >
> > > From: dev [mailto:dev-bounces@dpdk.org] 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;
> > >
> > > 			/** 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
> >
> > >
> > > Regards,
> > > Li Zhang
> > > > -----Original Message-----
> > > > From: dev <dev-bounces@dpdk.org> On Behalf Of Morten Br?rup
> > > > Sent: Friday, February 12, 2021 3:41 PM
> > > > To: Ferruh Yigit <ferruh.yigit@intel.com>; Li Zhang
> > > <lizh@nvidia.com>; Dekel
> > > > Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Slava
> > > Ovsiienko
> > > > <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>;
> > > > Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> > > > Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon
> > <thomas@monjalon.net>;
> > > > Raslan Darawsheh <rasland@nvidia.com>
> > > > Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support
> PPS(packet
> > > per second)
> > > > on meter
> > > >
> > > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh
> Yigit
> > > > > Sent: Thursday, January 28, 2021 7:28 PM
> > > > >
> > > > > On 1/25/2021 1:20 AM, Li Zhang wrote:
> > > > > > 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
> > > > > > Signed-off-by: Li Zhang <lizh@nvidia.com>
> > > > >
> > > > > cc'ed Cristian for review/comment.
> > > > >
> > > > > > ---
> > > > > >   lib/librte_ethdev/rte_mtr.h | 28
> ++++++++++++++++++++++++++++
> > > > > >   1 file changed, 28 insertions(+)
> > > > > >
> > > > > > diff --git a/lib/librte_ethdev/rte_mtr.h
> > > > > b/lib/librte_ethdev/rte_mtr.h
> > > > > > index 916a09c5c3..3e88904faf 100644
> > > > > > --- a/lib/librte_ethdev/rte_mtr.h
> > > > > > +++ b/lib/librte_ethdev/rte_mtr.h
> > > > > > @@ -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;
> > > >
> > > > In PPS mode, the burst sizes (ebs, ebs) must be packets, not
> bytes.
> > > >
> > > > > >   	};
> > > > > >   };
> > > > > >
> > > > > > @@ -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.
> > > >
> > > > No need for two spaces between the words second and metering.
> > > >
> > > > > > +	 */
> > > > > > +	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
> > > > > >
> > > > >
Li Zhang March 1, 2021, 9:43 a.m. UTC | #8
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(-)
Li Zhang March 1, 2021, 9:53 a.m. UTC | #9
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(-)
Dumitrescu, Cristian March 1, 2021, 1:08 p.m. UTC | #10
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Thursday, January 28, 2021 6:28 PM
> To: Li Zhang <lizh@nvidia.com>; dekelp@nvidia.com; orika@nvidia.com;
> viacheslavo@nvidia.com; matan@nvidia.com; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org; thomas@monjalon.net; rasland@nvidia.com
> Subject: Re: [dpdk-dev] [PATCH] [RFC, v2]: adds support PPS(packet per
> second) on meter
> 
> On 1/25/2021 1:20 AM, Li Zhang wrote:
> > 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
> > Signed-off-by: Li Zhang <lizh@nvidia.com>
> 
> cc'ed Cristian for review/comment.
> 
> > ---
> >   lib/librte_ethdev/rte_mtr.h | 28 ++++++++++++++++++++++++++++
> >   1 file changed, 28 insertions(+)
> >
> > diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
> > index 916a09c5c3..3e88904faf 100644
> > --- a/lib/librte_ethdev/rte_mtr.h
> > +++ b/lib/librte_ethdev/rte_mtr.h
> > @@ -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
> >

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
diff mbox series

Patch

diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
index 916a09c5c3..3e88904faf 100644
--- a/lib/librte_ethdev/rte_mtr.h
+++ b/lib/librte_ethdev/rte_mtr.h
@@ -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