Configure a meter profile at the time of the flow rule insertion.
Pass all the needed parameters to configure the meter profile
and insert the metering rule simultaneously.

The meter profile can be reused in multiple flow rules in order
to share the profile and optimize the flow insertion process.
Setting meter profile to NULL means keeping old profile config.

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

diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 870d1b4a06..964f057fa2 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -33,6 +33,7 @@
 #include <rte_bitops.h>
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
+#include <rte_mtr.h>
 #include <rte_meter.h>
 #include <rte_gtp.h>
 #include <rte_l2tpv2.h>
@@ -2908,6 +2909,13 @@ enum rte_flow_action_type {
         * @see struct rte_flow_action_ethdev
         */
        RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
+       /**
+        * Extended Traffic metering and policing (MTR).
+        *
+        * See struct rte_flow_action_meter_ext.
+        * See file rte_mtr.h for MTR object configuration.
+        */
+       RTE_FLOW_ACTION_TYPE_METER_EXT,
 };
 
 /**
@@ -3154,6 +3162,20 @@ struct rte_flow_action_meter {
        uint32_t mtr_id; /**< MTR object ID created with rte_mtr_create(). */
 };
 
+/**
+ * RTE_FLOW_ACTION_TYPE_METER_EXT
+ *
+ * Traffic metering and policing (MTR).
+ *
+ * Meters an IP packet stream and marks its packets either
+ * green, yellow, or red for future processing, according to a policy.
+ */
+struct rte_flow_action_meter_ext {
+       uint32_t mtr_id; /**< MTR object ID. */
+       struct rte_meter_profile *profile; /**< MTR profile. */
+       struct rte_mtr_params *params; /**< MTR parameters. */
+};
+
 /**
  * RTE_FLOW_ACTION_TYPE_SECURITY
  *
-- 
2.18.2

Reply via email to