+#define MLX5_ENCAP_MAX_LEN 132
+
+/* Encap/decap resource key of the hash organization. */
+union mlx5_flow_encap_decap_key {
+ struct {
+ uint32_t ft_type:8; /**< Flow table type, Rx or Tx. */
+ uint32_t refmt_type:8; /**< Header reformat type. */
+ uint32_t buf_size:8; /**< Encap buf size. */
+ uint32_t table_level:8; /**< Root table or not. */
+ uint32_t cksum; /**< Encap buf check sum. */
+ };
+ uint64_t v64; /**< full 64bits value of key */
+};
+
+/* Encap/decap resource structure. */
+struct mlx5_flow_dv_encap_decap_resource {
+ struct mlx5_hlist_entry entry;
+ /* Pointer to next element. */
+ rte_atomic32_t refcnt; /**< Reference counter. */
+ void *action;
+ /**< Encap/decap action object. */
+ uint8_t buf[MLX5_ENCAP_MAX_LEN];
+ size_t size;
+ uint8_t reformat_type;
+ uint8_t ft_type;
+ uint64_t flags; /**< Flags for RDMA API. */
+ uint32_t idx; /**< Index for the index memory pool. */
+};
+
+/* Tag resource structure. */
+struct mlx5_flow_dv_tag_resource {
+ struct mlx5_hlist_entry entry;
+ /**< hash list entry for tag resource, tag value as the key. */
+ void *action;
+ /**< Tag action object. */
+ rte_atomic32_t refcnt; /**< Reference counter. */
+ uint32_t idx; /**< Index for the index memory pool. */
+};
+
+/*
+ * Number of modification commands.
+ * The maximal actions amount in FW is some constant, and it is 16 in the
+ * latest releases. In some old releases, it will be limited to 8.
+ * Since there is no interface to query the capacity, the maximal value should
+ * be used to allow PMD to create the flow. The validation will be done in the
+ * lower driver layer or FW. A failure will be returned if exceeds the maximal
+ * supported actions number on the root table.
+ * On non-root tables, there is no limitation, but 32 is enough right now.
+ */
+#define MLX5_MAX_MODIFY_NUM 32
+#define MLX5_ROOT_TBL_MODIFY_NUM 16
+
+/* Modify resource structure */
+struct mlx5_flow_dv_modify_hdr_resource {
+ struct mlx5_hlist_entry entry;
+ /* Pointer to next element. */
+ rte_atomic32_t refcnt; /**< Reference counter. */
+ void *action;
+ /**< Modify header action object. */
+ uint8_t ft_type; /**< Flow table type, Rx or Tx. */
+ uint32_t actions_num; /**< Number of modification actions. */
+ uint64_t flags; /**< Flags for RDMA API. */
+ struct mlx5_modification_cmd actions[];
+ /**< Modification actions. */
+};
+
+/* Modify resource key of the hash organization. */
+union mlx5_flow_modify_hdr_key {
+ struct {
+ uint32_t ft_type:8; /**< Flow table type, Rx or Tx. */
+ uint32_t actions_num:5; /**< Number of modification actions. */
+ uint32_t group:19; /**< Flow group id. */
+ uint32_t cksum; /**< Actions check sum. */
+ };
+ uint64_t v64; /**< full 64bits value of key */
+};
+
+/* Jump action resource structure. */
+struct mlx5_flow_dv_jump_tbl_resource {
+ rte_atomic32_t refcnt; /**< Reference counter. */
+ uint8_t ft_type; /**< Flow table type, Rx or Tx. */
+ void *action; /**< Pointer to the rdma core action. */
+};
+
+/* Port ID resource structure. */
+struct mlx5_flow_dv_port_id_action_resource {
+ ILIST_ENTRY(uint32_t)next;
+ /* Pointer to next element. */
+ rte_atomic32_t refcnt; /**< Reference counter. */
+ void *action;
+ /**< Action object. */
+ uint32_t port_id; /**< Port ID value. */
+};
+
+/* Push VLAN action resource structure */
+struct mlx5_flow_dv_push_vlan_action_resource {
+ ILIST_ENTRY(uint32_t)next;
+ /* Pointer to next element. */
+ rte_atomic32_t refcnt; /**< Reference counter. */
+ void *action; /**< Action object. */
+ uint8_t ft_type; /**< Flow table type, Rx, Tx or FDB. */
+ rte_be32_t vlan_tag; /**< VLAN tag value. */
+};
+
+/* Metadata register copy table entry. */
+struct mlx5_flow_mreg_copy_resource {
+ /*
+ * Hash list entry for copy table.
+ * - Key is 32/64-bit MARK action ID.
+ * - MUST be the first entry.
+ */
+ struct mlx5_hlist_entry hlist_ent;
+ LIST_ENTRY(mlx5_flow_mreg_copy_resource) next;
+ /* List entry for device flows. */
+ uint32_t refcnt; /* Reference counter. */
+ uint32_t appcnt; /* Apply/Remove counter. */
+ uint32_t idx;
+ uint32_t rix_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. */
+ uint32_t idx; /**< index for the indexed mempool. */
+};
+
+/* Sub rdma-core actions list. */
+struct mlx5_flow_sub_actions_list {
+ uint32_t actions_num; /**< Number of sample actions. */
+ uint64_t action_flags;
+ void *dr_queue_action;
+ void *dr_tag_action;
+ void *dr_cnt_action;
+ void *dr_port_id_action;
+ void *dr_encap_action;
+};
+
+/* Sample sub-actions resource list. */
+struct mlx5_flow_sub_actions_idx {
+ uint32_t rix_hrxq; /**< Hash Rx queue object index. */
+ uint32_t rix_tag; /**< Index to the tag action. */
+ uint32_t cnt;
+ uint32_t rix_port_id_action; /**< Index to port ID action resource. */
+ uint32_t rix_encap_decap; /**< Index to encap/decap resource. */
+};
+
+/* Sample action resource structure. */
+struct mlx5_flow_dv_sample_resource {
+ ILIST_ENTRY(uint32_t)next; /**< Pointer to next element. */
+ uint32_t refcnt; /**< Reference counter. */
+ void *verbs_action; /**< Verbs sample action object. */
+ uint8_t ft_type; /** Flow Table Type */
+ uint32_t ft_id; /** Flow Table Level */
+ uint32_t ratio; /** Sample Ratio */
+ uint64_t set_action; /** Restore reg_c0 value */
+ void *normal_path_tbl; /** Flow Table pointer */
+ void *default_miss; /** default_miss dr_action. */
+ struct mlx5_flow_sub_actions_idx sample_idx;
+ /**< Action index resources. */
+ struct mlx5_flow_sub_actions_list sample_act;
+ /**< Action resources. */