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

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

Checks

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

Commit Message

Li Zhang Jan. 25, 2021, 1:02 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

Li Zhang Jan. 25, 2021, 1:20 a.m. UTC | #1
Li Zhang (1):
  lib/librte_ethdev: add definitions for packet per second.

 lib/librte_ethdev/rte_mtr.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
  
Ajit Khaparde Feb. 12, 2021, 9:35 p.m. UTC | #2
On Sun, Jan 24, 2021 at 5:02 PM Li Zhang <lizh@nvidia.com> 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.
>
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?



> 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(+)
>
> diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
> index 916a09c5c3..6413892aec 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
> --
> 2.21.0
>
>
  
Li Zhang Feb. 23, 2021, 2:11 a.m. UTC | #3
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
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Ajit Khaparde
> Sent: Saturday, February 13, 2021 5:36 AM
> To: Li Zhang <lizh@nvidia.com>
> Cc: Dekel Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>;
> dpdk-dev <dev@dpdk.org>; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; Raslan Darawsheh <rasland@nvidia.com>
> Subject: Re: [dpdk-dev] [PATCH] [RFC]: adds support PPS(packet per second) on
> meter
> 
> On Sun, Jan 24, 2021 at 5:02 PM Li Zhang <lizh@nvidia.com> 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.
> >
> 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?
> 
> 
> 
> > 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(+)
> >
> > diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
> > index 916a09c5c3..6413892aec 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
> > --
> > 2.21.0
> >
> >
  

Patch

diff --git a/lib/librte_ethdev/rte_mtr.h b/lib/librte_ethdev/rte_mtr.h
index 916a09c5c3..6413892aec 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