net/mlx5: add abstraction for multiple flow drivers
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.h
index 1e4209a..d2ec6d3 100644 (file)
        (MLX5_FLOW_LAYER_INNER_L2 | MLX5_FLOW_LAYER_INNER_L3 | \
         MLX5_FLOW_LAYER_INNER_L4)
 
-/* Actions that modify the fate of matching traffic. */
-#define MLX5_FLOW_FATE_DROP (1u << 0)
-#define MLX5_FLOW_FATE_QUEUE (1u << 1)
-#define MLX5_FLOW_FATE_RSS (1u << 2)
-
-/* Modify a packet. */
-#define MLX5_FLOW_MOD_FLAG (1u << 0)
-#define MLX5_FLOW_MOD_MARK (1u << 1)
-#define MLX5_FLOW_MOD_COUNT (1u << 2)
-
 /* Actions */
 #define MLX5_FLOW_ACTION_DROP (1u << 0)
 #define MLX5_FLOW_ACTION_QUEUE (1u << 1)
 /* Max number of actions per DV flow. */
 #define MLX5_DV_MAX_NUMBER_OF_ACTIONS 8
 
+enum mlx5_flow_drv_type {
+       MLX5_FLOW_TYPE_MIN,
+       MLX5_FLOW_TYPE_DV,
+       MLX5_FLOW_TYPE_VERBS,
+       MLX5_FLOW_TYPE_MAX,
+};
+
 /* Matcher PRM representation */
 struct mlx5_flow_dv_match_params {
        size_t size;
@@ -138,6 +135,8 @@ struct mlx5_flow_dv_match_params {
        /**< Matcher value. This value is used as the mask or as a key. */
 };
 
+#define MLX5_DV_MAX_NUMBER_OF_ACTIONS 8
+
 /* Matcher structure. */
 struct mlx5_flow_dv_matcher {
        LIST_ENTRY(mlx5_flow_dv_matcher) next;
@@ -159,6 +158,11 @@ struct mlx5_flow_dv {
        struct mlx5_flow_dv_match_params value;
        /**< Holds the value that the packet is compared to. */
        struct ibv_flow *flow; /**< Installed flow. */
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+       struct mlx5dv_flow_action_attr actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS];
+       /**< Action list. */
+#endif
+       int actions_n; /**< number of actions. */
 };
 
 /* Verbs specification header. */
@@ -187,7 +191,9 @@ struct mlx5_flow {
        struct rte_flow *flow; /**< Pointer to the main flow. */
        uint32_t layers; /**< Bit-fields that holds the detected layers. */
        union {
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
                struct mlx5_flow_dv dv;
+#endif
                struct mlx5_flow_verbs verbs;
        };
 };
@@ -206,7 +212,7 @@ struct mlx5_flow_counter {
 /* Flow structure. */
 struct rte_flow {
        TAILQ_ENTRY(rte_flow) next; /**< Pointer to the next flow structure. */
-       struct rte_flow_attr attributes; /**< User flow attribute. */
+       enum mlx5_flow_drv_type drv_type; /**< Drvier type. */
        uint32_t layers;
        /**< Bit-fields of present layers see MLX5_FLOW_LAYER_*. */
        struct mlx5_flow_counter *counter; /**< Holds flow counter. */
@@ -310,13 +316,5 @@ int mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item,
                                      uint64_t item_flags,
                                      struct rte_eth_dev *dev,
                                      struct rte_flow_error *error);
-void mlx5_flow_init_driver_ops(struct rte_eth_dev *dev);
-
-/* mlx5_flow_dv.c */
-void mlx5_flow_dv_get_driver_ops(struct mlx5_flow_driver_ops *flow_ops);
-
-/* mlx5_flow_verbs.c */
-
-void mlx5_flow_verbs_get_driver_ops(struct mlx5_flow_driver_ops *flow_ops);
 
 #endif /* RTE_PMD_MLX5_FLOW_H_ */