From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33E2B45643; Thu, 18 Jul 2024 11:58:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91BF942E74; Thu, 18 Jul 2024 11:58:01 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2067.outbound.protection.outlook.com [40.107.244.67]) by mails.dpdk.org (Postfix) with ESMTP id 01BAC42E63 for ; Thu, 18 Jul 2024 11:57:59 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qXTO09jJevMk/vgBikcH023XwdAtXbnLlTsFiKays1zL08kQ2KgX38HWMsHWOGuNtoF2TqcPeAxTBtMPw5P25IgZStUwxXqTptCEkWNp7U1vBWg7v9Cw0QiYNPYl9eq9h3o5vNhe1KA4AFu9Abd/Sl3pdbqVr8Iep470QKO2e32y/LyK+ibkMBS9por8hxB9L5iS+VI6DwX9rsX5Lem9cWh8oYm6fUIrWMfnvTn84XbvDD8AOI0OX+7Sn1aiaYEEThM3GpPDdpkDkzX8OCvmSQH6gKKQ5w0QIJz2MvX0zRrzTgVuleIuUW2acXtErbHrRji6iHZymP/P4h7FRUx5Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I3smW3Na3abWpKiWWtbnaW/AqPemwWRU/+GPvnIM+jo=; b=DL/AfunOy5pVuOjgkcihdvmm+X3vx9TPgDf3Pj7+NkMgEiDUJbxFYVOKj31ZlI+QSKIR2QXPM1oK/bYycnX26KyyggMditJRYjYPU4+d1Gi5YIVt2vZpVUFPjYmQ2OaHW0LgSPl4QTyY908iwhbfst1m5Syf/LahFV/wNnHdWe5ASnemnsffMC7rEczZocAaXJjoaZW9Lxsx1Lijbb2QB2Tx6tomJhhFF7zmOkdfEO9Jj9joM2hgKJGVIHXaYLumEFWlAcwQ8p0n8gAJCAHtCQNWK4MjDmXelgMFZQkcegoUQipuPXPv8YOCWVr8/ZBKNE3efSmhFd19sIQjlpcCcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I3smW3Na3abWpKiWWtbnaW/AqPemwWRU/+GPvnIM+jo=; b=VDnKc26GsrNg7IyA+tyv398QyAYoTygfBrXFRAJ6m6N1D2ZweFfSR04OJxR3tzUQOlPyaI9+kGo29YlIkGkQdYLK00F3ipdaBIsnm3vT2hihY0FbfIOqsIbozMwiMftLKshJ+xt27Qg+wJOjRP8RnbWVaUGBFbH52j4ky8iKZpD5Wtr1X10n9czmISpWNgnzA0D9F/K4SpAGuR4EN7e5hRf1NOzE+GTq0mphvlsOWy+pwsu2Z5B7TP9DXO4H2t2RVDGzaETyQ69q/oMPLLqTx+Dm3dwao5+gNYm1i5PlMUM5Eh6PFZpRhOgKSH9a0QSYTNCvQY3Vrg7uiod2vI+mkQ== Received: from BY3PR05CA0054.namprd05.prod.outlook.com (2603:10b6:a03:39b::29) by MN0PR12MB5857.namprd12.prod.outlook.com (2603:10b6:208:378::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36; Thu, 18 Jul 2024 09:57:56 +0000 Received: from SJ5PEPF000001ED.namprd05.prod.outlook.com (2603:10b6:a03:39b:cafe::39) by BY3PR05CA0054.outlook.office365.com (2603:10b6:a03:39b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.19 via Frontend Transport; Thu, 18 Jul 2024 09:57:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by SJ5PEPF000001ED.mail.protection.outlook.com (10.167.242.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.11 via Frontend Transport; Thu, 18 Jul 2024 09:57:56 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 18 Jul 2024 02:57:41 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 18 Jul 2024 02:57:39 -0700 From: Dariusz Sosnowski To: Viacheslav Ovsiienko , Bing Zhao , Ori Kam , Suanming Mou , Matan Azrad , Gregory Etelson CC: , Raslan Darawsheh Subject: [PATCH 3/3] net/mlx5: fix RSS and queue action validation Date: Thu, 18 Jul 2024 11:57:17 +0200 Message-ID: <20240718095717.290960-4-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240718095717.290960-1-dsosnowski@nvidia.com> References: <20240718095717.290960-1-dsosnowski@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001ED:EE_|MN0PR12MB5857:EE_ X-MS-Office365-Filtering-Correlation-Id: bcf475b4-137c-4dfc-191a-08dca710195d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?JUzed7oOdnsJZitZBuiXskZjuMb2wIH/0cDvYRsIa7Gj/+3InG1Ocyvu2bFW?= =?us-ascii?Q?0RQEByRBlnEzKO7SWK/PaaicX4dJ8o9NPH3hKAVIZbhb7APc4tt78HtwkICn?= =?us-ascii?Q?cQwDbHoQV2A/iWFeywlDSPkNhgx0dMRZMqkLT9bIxohNzAS8xNqRLxxF7xHj?= =?us-ascii?Q?BxdIzkktODQ3SXkEhE6cdVZYjsxfTy3PLAWd63ECmo3HcreTo0KVN4Qp2RiR?= =?us-ascii?Q?TNJcKy2Uv/q8uXVhV1sCTP2JwT0z0/Q594XfvTIqKoOweHwIDerl1CKuEYfA?= =?us-ascii?Q?raf+dKSsSlVy8Z4PryuAZKIsu3lcP7+NfGxhplqmDaeoaWUybUQEHEccumYX?= =?us-ascii?Q?XvJc0HqDSdnkiX8MdBjOIZ3fWNi7ulPtkRYc2RJfpWcjvcEceTtYGG686yWg?= =?us-ascii?Q?rCE9j3A1BSvq916ULXPBcqkjW45QVkymHf8a6wEhA17jgc1EXMaErIGW7qQ7?= =?us-ascii?Q?9LthlTMm73BP48FF+CvhEDIjfLAXPFeMqrO7yDS9mo2YXifseOUYuldGofjO?= =?us-ascii?Q?lmYJP79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Fa?= =?us-ascii?Q?jSOMeHhTaVPBhhqdA1H0OixzbCwLQgNK?= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2024 09:57:56.5364 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bcf475b4-137c-4dfc-191a-08dca710195d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001ED.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5857 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org mlx5 PMD supports configuration where Rx queues managed by DPDK are not set up. Externally allocated RQs can be used by mapping them to some DPDK Rx queue indexes using rte_pmd_mlx5_external_rx_queue_id_map() API. In this case, mlx5 PMD will allow creating flow rules which reference such external RQ. HWS validation of RSS and QUEUE unmasked flow actions in actions templates worked by constructing a "mock" action which was then checked. This procedure incorrectly assumed that queue index 0 can be used as "always valid queue", which is not the case in scenario mentioned above, because queue 0 was not set up This patch fixes that by removing "mock" actions, since there's no real data available for validation. RSS and QUEUE validation in unmasked action case only checks flow attributes. Fixes: d6dc072aeb12 ("net/mlx5: validate flow actions in table creation") Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_hw.c | 37 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 39d1cd96d4..d243b59b71 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -6806,8 +6806,6 @@ mlx5_hw_validate_action_mark(struct rte_eth_dev *dev, &attr, error); } -#define MLX5_FLOW_DEFAULT_INGRESS_QUEUE 0 - static int mlx5_hw_validate_action_queue(struct rte_eth_dev *dev, const struct rte_flow_action *template_action, @@ -6817,22 +6815,22 @@ mlx5_hw_validate_action_queue(struct rte_eth_dev *dev, struct rte_flow_error *error) { const struct rte_flow_action_queue *queue_mask = template_mask->conf; - const struct rte_flow_action *action = - queue_mask && queue_mask->index ? template_action : - &(const struct rte_flow_action) { - .type = RTE_FLOW_ACTION_TYPE_QUEUE, - .conf = &(const struct rte_flow_action_queue) { - .index = MLX5_FLOW_DEFAULT_INGRESS_QUEUE - } - }; const struct rte_flow_attr attr = { .ingress = template_attr->ingress, .egress = template_attr->egress, .transfer = template_attr->transfer }; + bool masked = queue_mask != NULL && queue_mask->index; - return mlx5_flow_validate_action_queue(action, action_flags, - dev, &attr, error); + if (template_attr->egress || template_attr->transfer) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ATTR, NULL, + "QUEUE action supported for ingress only"); + if (masked) + return mlx5_flow_validate_action_queue(template_action, action_flags, dev, + &attr, error); + else + return 0; } static int @@ -6844,22 +6842,15 @@ mlx5_hw_validate_action_rss(struct rte_eth_dev *dev, struct rte_flow_error *error) { const struct rte_flow_action_rss *mask = template_mask->conf; - const struct rte_flow_action *action = mask ? template_action : - &(const struct rte_flow_action) { - .type = RTE_FLOW_ACTION_TYPE_RSS, - .conf = &(const struct rte_flow_action_rss) { - .queue_num = 1, - .queue = (uint16_t [1]) { - MLX5_FLOW_DEFAULT_INGRESS_QUEUE - } - } - }; if (template_attr->egress || template_attr->transfer) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR, NULL, "RSS action supported for ingress only"); - return mlx5_validate_action_rss(dev, action, error); + if (mask != NULL) + return mlx5_validate_action_rss(dev, template_action, error); + else + return 0; } static int -- 2.39.2