[v2,1/3] ethdev: add meter color matching to Flow API

Message ID 20220502200439.4100965-2-akozyrev@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Andrew Rybchenko
Headers
Series ethdev: datapath-focused meter actions |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Alexander Kozyrev May 2, 2022, 8:04 p.m. UTC
  Introduce Meter Color pattern item to provide greater
flexibility for Traffic Metering handling in the RTE Flow API.
Matching on a color marker allows a user to manage
Metering policies as part of common flow rules management.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 lib/ethdev/rte_flow.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
  

Patch

diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index d8827dd184..67f54fba0e 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -671,6 +671,12 @@  enum rte_flow_item_type {
 	 * See struct rte_flow_item_gre_opt.
 	 */
 	RTE_FLOW_ITEM_TYPE_GRE_OPTION,
+	/**
+	 * Matches Meter Color.
+	 *
+	 * See struct rte_flow_item_meter_color.
+	 */
+	RTE_FLOW_ITEM_TYPE_METER_COLOR,
 };
 
 /**
@@ -1990,6 +1996,26 @@  static const struct rte_flow_item_ppp rte_flow_item_ppp_mask = {
 };
 #endif
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ITEM_TYPE_METER_COLOR
+ *
+ * Matches a meter color set in the packet meta-data
+ * (i.e. struct rte_mbuf::sched::color).
+ */
+struct rte_flow_item_meter_color {
+		enum rte_color color; /**< Packet color. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_METER_COLOR. */
+#ifndef __cplusplus
+static const struct rte_flow_item_meter_color rte_flow_item_meter_color_mask = {
+		.color = RTE_COLORS,
+};
+#endif
+
 /**
  * Matching pattern item definition.
  *