net/mlx5: support meter modification operations
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.h
index d8f1537..672552b 100644 (file)
@@ -523,6 +523,10 @@ struct mlx5_flow {
        bool external; /**< true if the flow is created external to PMD. */
 };
 
+/* Flow meter state. */
+#define MLX5_FLOW_METER_DISABLE 0
+#define MLX5_FLOW_METER_ENABLE 1
+
 #define MLX5_MAN_WIDTH 8
 /* Modify this value if enum rte_mtr_color changes. */
 #define RTE_MTR_DROPPED RTE_COLORS
@@ -553,16 +557,32 @@ struct mlx5_meter_domains_infos {
        /**< FDB meter table. */
        void *drop_actn;
        /**< Drop action as not matched. */
+       uint32_t fmp[MLX5_ST_SZ_DW(flow_meter_parameters)];
+       /**< Flow meter parameter. */
+       size_t fmp_size;
+       /**< Flow meter parameter size. */
+       void *meter_action;
+       /**< Flow meter action. */
 };
 
 /* Meter parameter structure. */
 struct mlx5_flow_meter {
+       TAILQ_ENTRY(mlx5_flow_meter) next;
+       /**< Pointer to the next flow meter structure. */
        uint32_t meter_id;
        /**< Meter id. */
+       struct rte_mtr_params params;
+       /**< Meter rule parameters. */
+       struct mlx5_flow_meter_profile *profile;
+       /**< Meter profile parameters. */
        struct mlx5_meter_domains_infos *mfts;
        /**< Flow table created for this meter. */
        uint32_t ref_cnt;
        /**< Use count. */
+       uint32_t active_state:1;
+       /**< Meter state. */
+       uint32_t shared:1;
+       /**< Meter shared or not. */
 };
 
 /* RFC2697 parameter structure. */
@@ -636,6 +656,14 @@ typedef struct mlx5_meter_domains_infos *(*mlx5_flow_create_mtr_tbls_t)
                                            (struct rte_eth_dev *dev);
 typedef int (*mlx5_flow_destroy_mtr_tbls_t)(struct rte_eth_dev *dev,
                                        struct mlx5_meter_domains_infos *tbls);
+typedef int (*mlx5_flow_create_policer_rules_t)
+                                       (struct rte_eth_dev *dev,
+                                        struct mlx5_flow_meter *fm,
+                                        const struct rte_flow_attr *attr);
+typedef int (*mlx5_flow_destroy_policer_rules_t)
+                                       (struct rte_eth_dev *dev,
+                                        const struct mlx5_flow_meter *fm,
+                                        const struct rte_flow_attr *attr);
 struct mlx5_flow_driver_ops {
        mlx5_flow_validate_t validate;
        mlx5_flow_prepare_t prepare;
@@ -646,6 +674,8 @@ struct mlx5_flow_driver_ops {
        mlx5_flow_query_t query;
        mlx5_flow_create_mtr_tbls_t create_mtr_tbls;
        mlx5_flow_destroy_mtr_tbls_t destroy_mtr_tbls;
+       mlx5_flow_create_policer_rules_t create_policer_rules;
+       mlx5_flow_destroy_policer_rules_t destroy_policer_rules;
 };
 
 
@@ -776,4 +806,10 @@ struct mlx5_meter_domains_infos *mlx5_flow_create_mtr_tbls
                                        (struct rte_eth_dev *dev);
 int mlx5_flow_destroy_mtr_tbls(struct rte_eth_dev *dev,
                               struct mlx5_meter_domains_infos *tbl);
+int mlx5_flow_create_policer_rules(struct rte_eth_dev *dev,
+                                  struct mlx5_flow_meter *fm,
+                                  const struct rte_flow_attr *attr);
+int mlx5_flow_destroy_policer_rules(struct rte_eth_dev *dev,
+                                   struct mlx5_flow_meter *fm,
+                                   const struct rte_flow_attr *attr);
 #endif /* RTE_PMD_MLX5_FLOW_H_ */