[v3,6/7] net/mlx5: not split hairpin flow in explicit mode
diff mbox series

Message ID 1603730267-267228-7-git-send-email-bingz@nvidia.com
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers show
Series
  • add two ports hairpin mode support in mlx5 PMD
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bing Zhao Oct. 26, 2020, 4:37 p.m. UTC
In the current implementation, the hairpin flow will be split into
two flows implicitly if there is some action that only belongs to the
Tx part. A Tx device flow will be inserted by the mlx5 PMD itself.

In hairpin between two ports, the explicit Tx flow mode will be the
only one to be supported. It is not the appropriate behavior to
insert a Tx flow into another device implicitly. The application
could create any flow as it likes and has full control of the user
flows. Hairpin flows will have no difference from standard flows and
the application can decide how to chain Rx and Tx flows together.

Even in the single port hairpin, this explicit Tx flow mode could
also be supported.

When checking if the hairpin needs to be split, it will just return
if the hairpin queue is with "tx_explicit" attribute. Then in the
following steps for validation and translation, the code path will
be the same as that for standard flows.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
v3: remove unnecessary checking of hairpin queue type
---
 drivers/net/mlx5/mlx5_flow.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 949b9ce..4756cf9 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3618,6 +3618,7 @@  struct rte_flow_shared_action *
 	const struct rte_flow_action_queue *queue;
 	const struct rte_flow_action_rss *rss;
 	const struct rte_flow_action_raw_encap *raw_encap;
+	const struct rte_eth_hairpin_conf *conf;
 
 	if (!attr->ingress)
 		return 0;
@@ -3627,8 +3628,8 @@  struct rte_flow_shared_action *
 			queue = actions->conf;
 			if (queue == NULL)
 				return 0;
-			if (mlx5_rxq_get_type(dev, queue->index) !=
-			    MLX5_RXQ_TYPE_HAIRPIN)
+			conf = mlx5_rxq_get_hairpin_conf(dev, queue->index);
+			if (conf != NULL && !!conf->tx_explicit)
 				return 0;
 			queue_action = 1;
 			action_n++;
@@ -3637,8 +3638,8 @@  struct rte_flow_shared_action *
 			rss = actions->conf;
 			if (rss == NULL || rss->queue_num == 0)
 				return 0;
-			if (mlx5_rxq_get_type(dev, rss->queue[0]) !=
-			    MLX5_RXQ_TYPE_HAIRPIN)
+			conf = mlx5_rxq_get_hairpin_conf(dev, rss->queue[0]);
+			if (conf != NULL && !!conf->tx_explicit)
 				return 0;
 			queue_action = 1;
 			action_n++;