net/mlx5: add port flow configuration
[dpdk.git] / drivers / net / mlx5 / mlx5.h
index 0f465d0..f0edf7f 100644 (file)
@@ -33,7 +33,9 @@
 #include "mlx5_utils.h"
 #include "mlx5_os.h"
 #include "mlx5_autoconf.h"
-
+#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
+#include "mlx5_dr.h"
+#endif
 
 #define MLX5_SH(dev) (((struct mlx5_priv *)(dev)->data->dev_private)->sh)
 
@@ -287,7 +289,8 @@ struct mlx5_sh_config {
        int tx_skew; /* Tx scheduling skew between WQE and data on wire. */
        uint32_t reclaim_mode:2; /* Memory reclaim mode. */
        uint32_t dv_esw_en:1; /* Enable E-Switch DV flow. */
-       uint32_t dv_flow_en:1; /* Enable DV flow. */
+       /* Enable DV flow. 1 means SW steering, 2 means HW steering. */
+       unsigned int dv_flow_en:2;
        uint32_t dv_xmeta_en:2; /* Enable extensive flow metadata. */
        uint32_t dv_miss_info:1; /* Restore packet after partial hw miss. */
        uint32_t l3_vxlan_en:1; /* Enable L3 VXLAN flow creation. */
@@ -319,6 +322,26 @@ struct mlx5_lb_ctx {
        uint16_t refcnt; /* Reference count for representors. */
 };
 
+/* HW steering queue job descriptor type. */
+enum {
+       MLX5_HW_Q_JOB_TYPE_CREATE, /* Flow create job type. */
+       MLX5_HW_Q_JOB_TYPE_DESTROY, /* Flow destroy job type. */
+};
+
+/* HW steering flow management job descriptor. */
+struct mlx5_hw_q_job {
+       uint32_t type; /* Job type. */
+       struct rte_flow *flow; /* Flow attached to the job. */
+       void *user_data; /* Job user data. */
+};
+
+/* HW steering job descriptor LIFO pool. */
+struct mlx5_hw_q {
+       uint32_t job_idx; /* Free job index. */
+       uint32_t size; /* LIFO size. */
+       struct mlx5_hw_q_job **job; /* LIFO header. */
+} __rte_cache_aligned;
+
 #define MLX5_COUNTERS_PER_POOL 512
 #define MLX5_MAX_PENDING_QUERIES 4
 #define MLX5_CNT_CONTAINER_RESIZE 64
@@ -1478,6 +1501,12 @@ struct mlx5_priv {
        struct mlx5_flex_item flex_item[MLX5_PORT_FLEX_ITEM_NUM];
        /* Flex items have been created on the port. */
        uint32_t flex_item_map; /* Map of allocated flex item elements. */
+#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
+       struct mlx5dr_context *dr_ctx; /**< HW steering DR context. */
+       uint32_t nb_queue; /* HW steering queue number. */
+       /* HW steering queue polling mechanism job descriptor LIFO. */
+       struct mlx5_hw_q *hw_q;
+#endif
 };
 
 #define PORT_ID(priv) ((priv)->dev_data->port_id)