From: Bing Zhao Date: Mon, 26 Oct 2020 16:37:46 +0000 (+0800) Subject: net/mlx5: do not split hairpin flow in explicit mode X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=509f8470de555ade258599380ec40a6df980120a;p=dpdk.git net/mlx5: do not split hairpin flow in explicit mode 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 Acked-by: Viacheslav Ovsiienko --- diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 0c496eeab0..42820e8520 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -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++;