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 <akozy...@nvidia.com>
---
 lib/ethdev/rte_flow.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

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.
  *
-- 
2.18.2

Reply via email to