net/mlx5: fix RSS queue type validation
authorXiaoyu Min <jackmin@nvidia.com>
Mon, 16 Nov 2020 02:07:59 +0000 (10:07 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 20 Nov 2020 20:10:05 +0000 (21:10 +0100)
When the RSS queues' types are not uniformed, i.e, mixed with normal Rx
queue and hairpin queue, PMD accept this flow after commit[1] instead of
rejecting it.

This because commit[1] creates Rx queue object as DevX type via DevX API
instead of IBV type via Verbs, in which the latter will check the queues'
type when creating Verbs ind table but the former doesn't check when
creating DevX ind table.

However, in any case, logically PMD should check whether the input
configuration of RSS action is reasonable or not, which should
include queues' type check as well as the others.

So add the check of RSS queues' type in validation function to fix issue.

[1]:
commit 6deb19e1b2d2 ("net/mlx5: separate Rx queue object creations")

Fixes: 63bd16292c3a ("net/mlx5: support RSS on hairpin")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyu Min <jackmin@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_flow.c

index c4071cd..ad891d6 100644 (file)
@@ -1411,6 +1411,7 @@ mlx5_validate_action_rss(struct rte_eth_dev *dev,
 {
        struct mlx5_priv *priv = dev->data->dev_private;
        const struct rte_flow_action_rss *rss = action->conf;
+       enum mlx5_rxq_type rxq_type = MLX5_RXQ_TYPE_UNDEFINED;
        unsigned int i;
 
        if (rss->func != RTE_ETH_HASH_FUNCTION_DEFAULT &&
@@ -1476,6 +1477,8 @@ mlx5_validate_action_rss(struct rte_eth_dev *dev,
                                          RTE_FLOW_ERROR_TYPE_ACTION_CONF,
                                          NULL, "No queues configured");
        for (i = 0; i != rss->queue_num; ++i) {
+               struct mlx5_rxq_ctrl *rxq_ctrl;
+
                if (rss->queue[i] >= priv->rxqs_n)
                        return rte_flow_error_set
                                (error, EINVAL,
@@ -1485,6 +1488,15 @@ mlx5_validate_action_rss(struct rte_eth_dev *dev,
                        return rte_flow_error_set
                                (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_CONF,
                                 &rss->queue[i], "queue is not configured");
+               rxq_ctrl = container_of((*priv->rxqs)[rss->queue[i]],
+                                       struct mlx5_rxq_ctrl, rxq);
+               if (i == 0)
+                       rxq_type = rxq_ctrl->type;
+               if (rxq_type != rxq_ctrl->type)
+                       return rte_flow_error_set
+                               (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION_CONF,
+                                &rss->queue[i],
+                                "combining hairpin and regular RSS queues is not supported");
        }
        return 0;
 }