#define MLX5_FLOW_ACTION_SET_TAG (1ull << 32)
#define MLX5_FLOW_ACTION_MARK_EXT (1ull << 33)
#define MLX5_FLOW_ACTION_SET_META (1ull << 34)
+#define MLX5_FLOW_ACTION_METER (1ull << 35)
#define MLX5_FLOW_FATE_ACTIONS \
(MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | \
#endif
struct mlx5_flow_verbs verbs;
};
- uint32_t qrss_id; /**< Uniqie Q/RSS suffix subflow tag. */
+ union {
+ uint32_t qrss_id; /**< Uniqie Q/RSS suffix subflow tag. */
+ uint32_t mtr_flow_id; /**< Unique meter match flow id. */
+ };
bool external; /**< true if the flow is created external to PMD. */
};
/* Modify this value if enum rte_mtr_color changes. */
#define RTE_MTR_DROPPED RTE_COLORS
+/* Meter policer statistics */
+struct mlx5_flow_policer_stats {
+ struct mlx5_flow_counter *cnt[RTE_COLORS + 1];
+ /**< Color counter, extra for drop. */
+ uint64_t stats_mask;
+ /**< Statistics mask for the colors. */
+};
+
/* Meter table structure. */
struct mlx5_meter_domain_info {
struct mlx5_flow_tbl_resource *tbl;
/**< FDB meter table. */
void *drop_actn;
/**< Drop action as not matched. */
+ void *count_actns[RTE_MTR_DROPPED + 1];
+ /**< Counters for match and unmatched statistics. */
uint32_t fmp[MLX5_ST_SZ_DW(flow_meter_parameters)];
/**< Flow meter parameter. */
size_t fmp_size;
/**< Meter rule parameters. */
struct mlx5_flow_meter_profile *profile;
/**< Meter profile parameters. */
+ struct rte_flow_attr attr;
+ /**< Flow attributes. */
struct mlx5_meter_domains_infos *mfts;
/**< Flow table created for this meter. */
+ struct mlx5_flow_policer_stats policer_stats;
+ /**< Meter policer statistics. */
uint32_t ref_cnt;
/**< Use count. */
uint32_t active_state:1;
struct mlx5_flow_counter *counter; /**< Holds flow counter. */
struct mlx5_flow_mreg_copy_resource *mreg_copy;
/**< pointer to metadata register copy table resource. */
+ struct mlx5_flow_meter *meter; /**< Holds flow meter. */
LIST_HEAD(dev_flows, mlx5_flow) dev_flows;
/**< Device flows that are part of the flow. */
struct mlx5_fdir *fdir; /**< Pointer to associated FDIR if any. */
void *data,
struct rte_flow_error *error);
typedef struct mlx5_meter_domains_infos *(*mlx5_flow_create_mtr_tbls_t)
- (struct rte_eth_dev *dev);
+ (struct rte_eth_dev *dev,
+ const struct mlx5_flow_meter *fm);
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,
const struct mlx5_flow_meter *fm,
const struct rte_flow_attr *attr);
+typedef struct mlx5_flow_counter * (*mlx5_flow_counter_alloc_t)
+ (struct rte_eth_dev *dev);
+typedef void (*mlx5_flow_counter_free_t)(struct rte_eth_dev *dev,
+ struct mlx5_flow_counter *cnt);
+typedef int (*mlx5_flow_counter_query_t)(struct rte_eth_dev *dev,
+ struct mlx5_flow_counter *cnt,
+ bool clear, uint64_t *pkts,
+ uint64_t *bytes);
struct mlx5_flow_driver_ops {
mlx5_flow_validate_t validate;
mlx5_flow_prepare_t prepare;
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;
+ mlx5_flow_counter_alloc_t counter_alloc;
+ mlx5_flow_counter_free_t counter_free;
+ mlx5_flow_counter_query_t counter_query;
};
struct rte_eth_dev *dev,
struct rte_flow_error *error);
struct mlx5_meter_domains_infos *mlx5_flow_create_mtr_tbls
- (struct rte_eth_dev *dev);
+ (struct rte_eth_dev *dev,
+ const struct mlx5_flow_meter *fm);
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,