From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA357A04DD; Mon, 16 Nov 2020 03:08:10 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AEC37323E; Mon, 16 Nov 2020 03:08:08 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 271851DB9; Mon, 16 Nov 2020 03:08:06 +0100 (CET) From: Xiaoyu Min To: Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Cc: dev@dpdk.org, Xiaoyu Min , stable@dpdk.org Date: Mon, 16 Nov 2020 10:07:59 +0800 Message-Id: <109d4f4e6b5dc9588af9603207d5d4a490fdb725.1605492098.git.jackmin@nvidia.com> X-Mailer: git-send-email 2.24.0.rc0.3.g12a4aeaad8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/mlx5: fix validate RSS queues types X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Xiaoyu Min 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 reject it. This because commit[1] create 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 create verbs ind table but the formmer doesn't check when create 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. Fixes: 63bd16292c3a ("net/mlx5: support RSS on hairpin") Cc: stable@dpdk.org [1]: commit 6deb19e1b2d2 ("net/mlx5: separate Rx queue object creations") Signed-off-by: Xiaoyu Min Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 324349ed19..8f2efc7493 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1595,6 +1595,9 @@ 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) { + enum mlx5_rxq_type rxq_type = MLX5_RXQ_TYPE_UNDEFINED; + struct mlx5_rxq_ctrl *rxq_ctrl; + if (rss->queue[i] >= priv->rxqs_n) return rte_flow_error_set (error, EINVAL, @@ -1604,6 +1607,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; } -- 2.25.1