As the new hardware steering operation will be implemented under the
new rte_flow_q APIs. This is not compatible with the existing rte_flow
PMD's Direct Rules flow operation routine.

This commit introduces an extra dv_flow_en = 2 to specify the new flow
operation initialize routine.

Signed-off-by: Suanming Mou <suanmi...@nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_os.c | 4 ++++
 drivers/net/mlx5/mlx5.c          | 2 +-
 drivers/net/mlx5/mlx5.h          | 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index aecdc5a68a..52e52a4ad7 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -295,6 +295,8 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv)
        err = mlx5_alloc_table_hash_list(priv);
        if (err)
                goto error;
+       if (priv->config.dv_flow_en == 2)
+               return 0;
        /* The resources below are only valid with DV support. */
 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
        /* Init port id action list. */
@@ -1712,6 +1714,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
        priv->drop_queue.hrxq = mlx5_drop_action_create(eth_dev);
        if (!priv->drop_queue.hrxq)
                goto error;
+       if (priv->config.dv_flow_en == 2)
+               return eth_dev;
        /* Port representor shares the same max priority with pf port. */
        if (!priv->sh->flow_priority_check_flag) {
                /* Supported Verbs flow priority number detection. */
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 67eda41a60..a4826a583b 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1933,7 +1933,7 @@ mlx5_args_check(const char *key, const char *val, void 
*opaque)
        } else if (strcmp(MLX5_DV_ESW_EN, key) == 0) {
                config->dv_esw_en = !!tmp;
        } else if (strcmp(MLX5_DV_FLOW_EN, key) == 0) {
-               config->dv_flow_en = !!tmp;
+               config->dv_flow_en = tmp;
        } else if (strcmp(MLX5_DV_XMETA_EN, key) == 0) {
                if (tmp != MLX5_XMETA_MODE_LEGACY &&
                    tmp != MLX5_XMETA_MODE_META16 &&
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 737ad6895c..f3b991e549 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -259,7 +259,8 @@ struct mlx5_dev_config {
        unsigned int l3_vxlan_en:1; /* Enable L3 VXLAN flow creation. */
        unsigned int vf_nl_en:1; /* Enable Netlink requests in VF mode. */
        unsigned int dv_esw_en:1; /* Enable E-Switch DV flow. */
-       unsigned int dv_flow_en:1; /* Enable DV flow. */
+       /* Enable DV flow. 1 means SW steering, 2 means HW steering. */
+       unsigned int dv_flow_en:2;
        unsigned int dv_xmeta_en:2; /* Enable extensive flow metadata. */
        unsigned int lacp_by_user:1;
        /* Enable user to manage LACP traffic. */
-- 
2.25.1

Reply via email to