net/mlx5: optimize tag traversal with hash list
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.h
index ffb6886..998da61 100644 (file)
@@ -333,14 +333,13 @@ struct mlx5_flow_dv_match_params {
 /* Matcher structure. */
 struct mlx5_flow_dv_matcher {
        LIST_ENTRY(mlx5_flow_dv_matcher) next;
-       /* Pointer to the next element. */
+       /**< Pointer to the next element. */
+       struct mlx5_flow_tbl_resource *tbl;
+       /**< Pointer to the table(group) the matcher associated with. */
        rte_atomic32_t refcnt; /**< Reference counter. */
        void *matcher_object; /**< Pointer to DV matcher */
        uint16_t crc; /**< CRC of key. */
        uint16_t priority; /**< Priority of matcher. */
-       uint8_t egress; /**< Egress matcher. */
-       uint8_t transfer; /**< 1 if the flow is E-Switch flow. */
-       uint32_t group; /**< The matcher group. */
        struct mlx5_flow_dv_match_params mask; /**< Matcher mask. */
 };
 
@@ -362,12 +361,11 @@ struct mlx5_flow_dv_encap_decap_resource {
 
 /* Tag resource structure. */
 struct mlx5_flow_dv_tag_resource {
-       LIST_ENTRY(mlx5_flow_dv_tag_resource) next;
-       /* Pointer to next element. */
-       rte_atomic32_t refcnt; /**< Reference counter. */
+       struct mlx5_hlist_entry entry;
+       /**< hash list entry for tag resource, tag value as the key. */
        void *action;
        /**< Verbs tag action object. */
-       uint32_t tag; /**< the tag value. */
+       rte_atomic32_t refcnt; /**< Reference counter. */
 };
 
 /*
@@ -394,12 +392,9 @@ struct mlx5_flow_dv_modify_hdr_resource {
 
 /* Jump action resource structure. */
 struct mlx5_flow_dv_jump_tbl_resource {
-       LIST_ENTRY(mlx5_flow_dv_jump_tbl_resource) next;
-       /* Pointer to next element. */
        rte_atomic32_t refcnt; /**< Reference counter. */
-       void *action; /**< Pointer to the rdma core action. */
        uint8_t ft_type; /**< Flow table type, Rx or Tx. */
-       struct mlx5_flow_tbl_resource *tbl; /**< The target table. */
+       void *action; /**< Pointer to the rdma core action. */
 };
 
 /* Port ID resource structure. */
@@ -437,6 +432,18 @@ struct mlx5_flow_mreg_copy_resource {
        struct rte_flow *flow; /* Built flow for copy. */
 };
 
+/* Table data structure of the hash organization. */
+struct mlx5_flow_tbl_data_entry {
+       struct mlx5_hlist_entry entry;
+       /**< hash list entry, 64-bits key inside. */
+       struct mlx5_flow_tbl_resource tbl;
+       /**< flow table resource. */
+       LIST_HEAD(matchers, mlx5_flow_dv_matcher) matchers;
+       /**< matchers' header associated with the flow table. */
+       struct mlx5_flow_dv_jump_tbl_resource jump;
+       /**< jump resource, at most one for each table created. */
+};
+
 /*
  * Max number of actions per DV flow.
  * See CREATE_FLOW_MAX_FLOW_ACTIONS_SUPPORTED
@@ -520,7 +527,10 @@ struct mlx5_flow {
 #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. */
 };
 
@@ -841,4 +851,6 @@ int mlx5_flow_create_policer_rules(struct rte_eth_dev *dev,
 int mlx5_flow_destroy_policer_rules(struct rte_eth_dev *dev,
                                    struct mlx5_flow_meter *fm,
                                    const struct rte_flow_attr *attr);
+int mlx5_flow_meter_flush(struct rte_eth_dev *dev,
+                         struct rte_mtr_error *error);
 #endif /* RTE_PMD_MLX5_FLOW_H_ */