net/mlx5: do not split hairpin flow in explicit mode
authorBing Zhao <bingz@nvidia.com>
Mon, 26 Oct 2020 16:37:46 +0000 (00:37 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 3 Nov 2020 22:35:04 +0000 (23:35 +0100)
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>
drivers/net/mlx5/mlx5_flow.c

index 0c496ee..42820e8 100644 (file)
@@ -3617,6 +3617,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
        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;
@@ -3626,8 +3627,8 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
                        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++;
@@ -3636,8 +3637,8 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
                        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++;