DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bing Zhao <bingz@mellanox.com>
To: orika@mellanox.com, viacheslavo@mellanox.com,
	rasland@mellanox.com, matan@mellanox.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 5/6] net/mlx5: remove the DV support macro checking
Date: Tue,  4 Feb 2020 13:33:21 +0200	[thread overview]
Message-ID: <1580816002-159035-6-git-send-email-bingz@mellanox.com> (raw)
In-Reply-To: <1580816002-159035-1-git-send-email-bingz@mellanox.com>

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 <bingz@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


  parent reply	other threads:[~2020-02-04 11:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 13:32 [dpdk-dev] [PATCH 0/6] net/mlx5: move to non-cached mode for flow rules Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 1/6] net/mlx5: introduce non-cached flows tailq list Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 2/6] net/mlx5: change operations of non-cached flows Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 3/6] net/mlx5: flow type check before creating Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 4/6] net/mlx5: introduce handle structure for DV flows Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 5/6] net/mlx5: remove the DV support macro checking Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 6/6] net/mlx5: do not save device flow matcher value Bing Zhao
2020-02-04 11:33 ` [dpdk-dev] [PATCH v2 0/6] net/mlx5: move to non-cached mode for flow rules Bing Zhao
2020-02-04 11:33   ` [dpdk-dev] [PATCH v2 1/6] net/mlx5: introduce non-cached flows tailq list Bing Zhao
2020-02-04 11:33   ` [dpdk-dev] [PATCH v2 2/6] net/mlx5: change operations of non-cached flows Bing Zhao
2020-02-04 11:33   ` [dpdk-dev] [PATCH v2 3/6] net/mlx5: flow type check before creating Bing Zhao
2020-02-04 11:33   ` [dpdk-dev] [PATCH v2 4/6] net/mlx5: introduce handle structure for DV flows Bing Zhao
2020-02-04 11:33   ` Bing Zhao [this message]
2020-02-04 11:33   ` [dpdk-dev] [PATCH v2 6/6] net/mlx5: do not save device flow matcher value Bing Zhao
2020-03-24 15:16   ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: move to non-cached mode for flow rules Bing Zhao
2020-03-24 15:16     ` [dpdk-dev] [PATCH v3 1/4] net/mlx5: change operations for non-cached flows Bing Zhao
2020-03-24 15:16     ` [dpdk-dev] [PATCH v3 2/4] net/mlx5: reorganize mlx5 flow structures Bing Zhao
2020-03-24 15:16     ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: separate the flow handle resource Bing Zhao
2020-03-24 15:16     ` [dpdk-dev] [PATCH v3 4/4] net/mlx5: check device stat before creating flow Bing Zhao
2020-03-24 15:33   ` [dpdk-dev] [PATCH v4 0/4] net/mlx5: move to non-cached mode for flow rules Bing Zhao
2020-03-24 15:33     ` [dpdk-dev] [PATCH v4 1/4] net/mlx5: change operations for non-cached flows Bing Zhao
2020-03-24 15:33     ` [dpdk-dev] [PATCH v4 2/4] net/mlx5: reorganize mlx5 flow structures Bing Zhao
2020-03-24 15:33     ` [dpdk-dev] [PATCH v4 3/4] net/mlx5: separate the flow handle resource Bing Zhao
2020-03-24 15:34     ` [dpdk-dev] [PATCH v4 4/4] net/mlx5: check device stat before creating flow Bing Zhao
2020-03-25  9:13     ` [dpdk-dev] [PATCH v4 0/4] net/mlx5: move to non-cached mode for flow rules Matan Azrad
2020-03-29 15:50     ` Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1580816002-159035-6-git-send-email-bingz@mellanox.com \
    --to=bingz@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=orika@mellanox.com \
    --cc=rasland@mellanox.com \
    --cc=viacheslavo@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).