[2/4] ethdev: allow meter color marker modification

Message ID 20220518043459.1281590-3-akozyrev@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Andrew Rybchenko
Headers
Series ethdev: separate metering and marking from policing |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Alexander Kozyrev May 18, 2022, 4:34 a.m. UTC
  Extend modify_field Flow API with support of Meter Color Marker
modifications. It allows setting the DS field of a packet to any
color marker: green, yellow or red. User is able to specify
an initial packet color for Meter API or create simple Metering
and Marking flow rules based on his own coloring alghorithm.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 doc/guides/rel_notes/release_22_07.rst | 1 +
 lib/ethdev/rte_flow.h                  | 1 +
 2 files changed, 2 insertions(+)
  

Comments

Cristian Dumitrescu May 19, 2022, 2:49 p.m. UTC | #1
> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Wednesday, May 18, 2022 5:35 AM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>;
> jerinjacobk@gmail.com; orika@nvidia.com; thomas@monjalon.net;
> ivan.malov@oktetlabs.ru; andrew.rybchenko@oktetlabs.ru;
> ferruh.yigit@xilinx.com; Awal, Mohammad Abdul
> <mohammad.abdul.awal@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>;
> jerinj@marvell.com; ajit.khaparde@broadcom.com; Richardson, Bruce
> <bruce.richardson@intel.com>
> Subject: [PATCH 2/4] ethdev: allow meter color marker modification
> 
> Extend modify_field Flow API with support of Meter Color Marker
> modifications. It allows setting the DS field of a packet to any
> color marker: green, yellow or red. User is able to specify
> an initial packet color for Meter API or create simple Metering
> and Marking flow rules based on his own coloring alghorithm.
> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
> ---
>  doc/guides/rel_notes/release_22_07.rst | 1 +
>  lib/ethdev/rte_flow.h                  | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/doc/guides/rel_notes/release_22_07.rst
> b/doc/guides/rel_notes/release_22_07.rst
> index a61a4d77dc..ec83178d98 100644
> --- a/doc/guides/rel_notes/release_22_07.rst
> +++ b/doc/guides/rel_notes/release_22_07.rst
> @@ -63,6 +63,7 @@ New Features
>  * **Extended Metering and Marking support in the Flow API.**
> 
>    * Added METER_COLOR item to match Color Marker set by a Meter.
> +  * Added ability to set Color Marker via modify_field Flow API.
> 
>  * **Updated Intel iavf driver.**
> 
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index e3f0e86eb6..817df34ed0 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -3714,6 +3714,7 @@ enum rte_flow_field_id {
>  	RTE_FLOW_FIELD_META,		/**< Metadata value. */
>  	RTE_FLOW_FIELD_POINTER,		/**< Memory pointer. */
>  	RTE_FLOW_FIELD_VALUE,		/**< Immediate value. */
> +	RTE_FLOW_FIELD_METER_COLOR,	/**< Meter Color Marker. */
>  };
> 
>  /**
> --
> 2.18.2

This is not really correct. The packet color is a sort if meta-data field that does not get sent out directly.

Yes, it can translate to a header field, but there are many possibilities: outer/inner VLAN PCP&DEI, IPv4/IPv6 DSCP, MPLS QoS, etc. We need to specify exactly which field from the packet needs to be modified.

We had the same problem for the input color mechanism, I suggest you take a look at Jerin's patch.
  
Alexander Kozyrev May 24, 2022, 12:19 p.m. UTC | #2
On Thur, May 19, 2022 10:49 Dumitrescu, Cristian <cristian.dumitrescu@intel.com>:
> This is not really correct. The packet color is a sort if meta-data field that does
> not get sent out directly.
> 
> Yes, it can translate to a header field, but there are many possibilities:
> outer/inner VLAN PCP&DEI, IPv4/IPv6 DSCP, MPLS QoS, etc. We need to specify
> exactly which field from the packet needs to be modified.
> 
> We had the same problem for the input color mechanism, I suggest you take a
> look at Jerin's patch.

You are absolutely correct, I'm not changing any way of color storing internally.
I changed the description in the v2 patch to reflect it is metadata field. Thanks.
  

Patch

diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index a61a4d77dc..ec83178d98 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -63,6 +63,7 @@  New Features
 * **Extended Metering and Marking support in the Flow API.**
 
   * Added METER_COLOR item to match Color Marker set by a Meter.
+  * Added ability to set Color Marker via modify_field Flow API.
 
 * **Updated Intel iavf driver.**
 
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index e3f0e86eb6..817df34ed0 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -3714,6 +3714,7 @@  enum rte_flow_field_id {
 	RTE_FLOW_FIELD_META,		/**< Metadata value. */
 	RTE_FLOW_FIELD_POINTER,		/**< Memory pointer. */
 	RTE_FLOW_FIELD_VALUE,		/**< Immediate value. */
+	RTE_FLOW_FIELD_METER_COLOR,	/**< Meter Color Marker. */
 };
 
 /**