Some structures are defined in the mlx5_flow header file and only
used for flows with DV driver type. When using inbox driver, the DV
mode is not supported. But the code is unique and there is no need
to use pre-processing macro since all code could be compiled.

Signed-off-by: Bing Zhao <bi...@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 42 ++++++++----------------------------------
 drivers/net/mlx5/mlx5_flow.h |  2 --
 2 files changed, 8 insertions(+), 36 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 1121904..2b2ba20 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -716,7 +716,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, 
int32_t priority,
  */
 static void
 flow_drv_rxq_flags_set(struct rte_eth_dev *dev,
-                      enum mlx5_flow_drv_type type __rte_unused,
+                      enum mlx5_flow_drv_type type,
                       void *sub_flow)
 {
        struct mlx5_priv *priv = dev->data->dev_private;
@@ -726,7 +726,6 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, 
int32_t priority,
        uint64_t layers;
        unsigned int i;
 
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
        if (type == MLX5_FLOW_TYPE_DV) {
                struct mlx5_flow_dv_handle *handle = sub_flow;
                mark = !!(handle->action_flags &
@@ -735,16 +734,13 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev 
*dev, int32_t priority,
                tunnel = !!(layers & MLX5_FLOW_LAYER_TUNNEL);
                flow = handle->m_flow;
        } else {
-#endif
                struct mlx5_flow *dev_flow = sub_flow;
                mark = !!(dev_flow->actions &
                            (MLX5_FLOW_ACTION_FLAG | MLX5_FLOW_ACTION_MARK));
                layers = dev_flow->layers;
                tunnel = !!(dev_flow->layers & MLX5_FLOW_LAYER_TUNNEL);
                flow = dev_flow->flow;
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
        }
-#endif
        for (i = 0; i != flow->rss.queue_num; ++i) {
                int idx = (*flow->rss.queue)[i];
                struct mlx5_rxq_ctrl *rxq_ctrl =
@@ -793,15 +789,13 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev 
*dev, int32_t priority,
 flow_rxq_flags_set(struct rte_eth_dev *dev, struct rte_flow *flow)
 {
        struct mlx5_flow *dev_flow;
+       struct mlx5_flow_dv_handle *handle;
        enum mlx5_flow_drv_type type = flow->drv_type;
 
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
-       struct mlx5_flow_dv_handle *handle;
        if (type == MLX5_FLOW_TYPE_DV)
                SLIST_FOREACH(handle, &flow->handles, next)
                        flow_drv_rxq_flags_set(dev, type, (void *)handle);
        else
-#endif
                LIST_FOREACH(dev_flow, &flow->dev_flows, next)
                        flow_drv_rxq_flags_set(dev, type, (void *)dev_flow);
 }
@@ -820,7 +814,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, 
int32_t priority,
  */
 static void
 flow_drv_rxq_flags_trim(struct rte_eth_dev *dev,
-                       enum mlx5_flow_drv_type type __rte_unused,
+                       enum mlx5_flow_drv_type type,
                        void *sub_flow)
 {
        struct mlx5_priv *priv = dev->data->dev_private;
@@ -831,7 +825,6 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, 
int32_t priority,
        unsigned int i;
 
        MLX5_ASSERT(dev->data->dev_started);
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
        if (type == MLX5_FLOW_TYPE_DV) {
                struct mlx5_flow_dv_handle *handle = sub_flow;
                mark = !!(handle->action_flags &
@@ -840,16 +833,13 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev 
*dev, int32_t priority,
                tunnel = !!(layers & MLX5_FLOW_LAYER_TUNNEL);
                flow = handle->m_flow;
        } else {
-#endif
                struct mlx5_flow *dev_flow = sub_flow;
                mark = !!(dev_flow->actions &
                            (MLX5_FLOW_ACTION_FLAG | MLX5_FLOW_ACTION_MARK));
                layers = dev_flow->layers;
                tunnel = !!(layers & MLX5_FLOW_LAYER_TUNNEL);
                flow = dev_flow->flow;
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
        }
-#endif
        for (i = 0; i != flow->rss.queue_num; ++i) {
                int idx = (*flow->rss.queue)[i];
                struct mlx5_rxq_ctrl *rxq_ctrl =
@@ -894,15 +884,13 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev 
*dev, int32_t priority,
 flow_rxq_flags_trim(struct rte_eth_dev *dev, struct rte_flow *flow)
 {
        struct mlx5_flow *dev_flow;
+       struct mlx5_flow_dv_handle *handle;
        enum mlx5_flow_drv_type type = flow->drv_type;
 
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
-       struct mlx5_flow_dv_handle *handle;
        if (type == MLX5_FLOW_TYPE_DV)
                SLIST_FOREACH(handle, &flow->handles, next)
                        flow_drv_rxq_flags_trim(dev, type, (void *)handle);
        else
-#endif
                LIST_FOREACH(dev_flow, &flow->dev_flows, next)
                        flow_drv_rxq_flags_trim(dev, type, (void *)dev_flow);
 }
@@ -2402,7 +2390,6 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev 
*dev, int32_t priority,
                             struct rte_flow *flow)
 {
        struct mlx5_flow *dev_flow;
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
        struct mlx5_flow_dv_handle *handle;
        enum mlx5_flow_drv_type type = flow->drv_type;
 
@@ -2411,13 +2398,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev 
*dev, int32_t priority,
                        if (handle->qrss_id)
                                flow_qrss_free_id(dev, handle->qrss_id);
        } else {
-#endif
                LIST_FOREACH(dev_flow, &flow->dev_flows, next)
                        if (dev_flow->qrss_id)
                                flow_qrss_free_id(dev, dev_flow->qrss_id);
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
        }
-#endif
 }
 
 static int
@@ -3509,18 +3493,14 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev 
*dev, int32_t priority,
                return -rte_errno;
        dev_flow->external = external;
        dev_flow->flow = flow;
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
        if (flow->drv_type == MLX5_FLOW_TYPE_DV) {
                SLIST_INSERT_HEAD(&flow->handles, dev_flow->dv_handle, next);
                dev_flow->dv_handle->sidx = flow->sub_flows++;
                dev_flow->dv_handle->m_flow = flow;
        } else {
-#endif
                /* Subflow obj was created, we must include one in the list. */
                LIST_INSERT_HEAD(&flow->dev_flows, dev_flow, next);
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
        }
-#endif
        if (sub_flow)
                *sub_flow = dev_flow;
        return flow_drv_translate(dev, dev_flow, attr, items, actions, error);
@@ -3982,11 +3962,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev 
*dev, int32_t priority,
                         * reallocation becomes possible (for example, for
                         * other flows in other threads).
                         */
-                       dev_flow->qrss_id = qrss_id;
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
                        if (flow->drv_type == MLX5_FLOW_TYPE_DV)
                                dev_flow->dv_handle->qrss_id = qrss_id;
-#endif
+                       else
+                               dev_flow->qrss_id = qrss_id;
                        qrss_id = 0;
                        ret = mlx5_flow_get_reg_id(dev, MLX5_COPY_MARK, 0,
                                                   error);
@@ -4098,11 +4077,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev 
*dev, int32_t priority,
                        ret = -rte_errno;
                        goto exit;
                }
-               dev_flow->mtr_flow_id = mtr_tag_id;
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
                if (flow->drv_type == MLX5_FLOW_TYPE_DV)
                        dev_flow->dv_handle->mtr_flow_id = mtr_tag_id;
-#endif
+               else
+                       dev_flow->mtr_flow_id = mtr_tag_id;
                /* Prepare the suffix flow match pattern. */
                sfx_items = (struct rte_flow_item *)((char *)sfx_actions +
                             act_size);
@@ -4337,19 +4315,15 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev 
*dev, int32_t priority,
                                            actions_hairpin_tx.actions, error);
                if (!dev_flow)
                        goto error;
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
                if (flow->drv_type == MLX5_FLOW_TYPE_DV) {
                        SLIST_INSERT_HEAD(&flow->handles,
                                          dev_flow->dv_handle, next);
                        dev_flow->dv_handle->sidx = flow->sub_flows++;
                        dev_flow->dv_handle->m_flow = flow;
                } else {
-#endif
                        dev_flow->flow = flow;
                        LIST_INSERT_HEAD(&flow->dev_flows, dev_flow, next);
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
                }
-#endif
                dev_flow->external = 0;
                ret = flow_drv_translate(dev, dev_flow, &attr_tx,
                                         items_tx.items,
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 10ac9c3..5e517c3 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -579,9 +579,7 @@ struct mlx5_flow {
        uint32_t group; /**< The group index. */
        uint8_t transfer; /**< 1 if the flow is E-Switch flow. */
        union {
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
                struct mlx5_flow_dv_handle *dv_handle;
-#endif
                struct mlx5_flow_verbs verbs;
        };
        union {
-- 
1.8.3.1

Reply via email to