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 4B462455E3 for ; Tue, 9 Jul 2024 14:32:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DDC844281D; Tue, 9 Jul 2024 14:32:02 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2086.outbound.protection.outlook.com [40.107.220.86]) by mails.dpdk.org (Postfix) with ESMTP id 11472427C7; Tue, 9 Jul 2024 14:32:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a2vUe6GW3f5u4iTDGBbFL7tR+h1FbrXTK5pAlCPBSf9arcjFwiHhZPUI+rE+ZpXvPRNT3Hv8F4dFjUr5XDNo0fGX6IpHZxccuzbCM+SJi2ZXtn7zoqpkHmtMyGDmQ2DBs91Kk/YJqCHi9IhFuqlyfex+Xra8x3jMYJsNiq8fYcno/AIsBGYxc5zFPT2PV0PRCOUrQgNKDyHK6LrnAd5jwFXfWwOuw8A408/2ZWbr6RhOd3SE7xIHJcAh+zG7+DHhi6LjEBG+ekmOUPuIklZYyjhDqIXryoUBENVycz0H90wL/L3KIwMkv04lpjfaV3/7cfnJLrrnw9OlRnwaHtM/8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=DTI1rpiSfVQeT9hxOukXF+R4Sdvk3wayOd4+BDnriZI=; b=decVefTRxVsDVwAk93vUuoZkLhB2mJvdcrBkuXt4+ds7ytVmdCBr0XRJmTEuyFe6BV6PsLHpWXczXxLu5DG9edEOpgEDs1RqN7kcJiB3MgmaSvpGnTD3XQLnucnORwp1M/b6WtIYhNQY+UiqQ7S1YQgENS62n2qDcCi3p0YiJqfyEKGI63gi9I0XeOPZLFDNQ0HvdLNFiqUeWIYLErNX/XPhW/yN7DtiBwrOH1vr5msCm0Z/3aBjvRrUQE+w+8DvE+hyO2StUYagpgFkhzRlLAW+IW65p3qLjuwDkjfKYtIvOTUGoIodgxHpX4NMrtDlQWO8MqJu4Xiof/ZbsQkMdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=monjalon.net 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=DTI1rpiSfVQeT9hxOukXF+R4Sdvk3wayOd4+BDnriZI=; b=Zr3uRkwBzcoxY0jSIUjHpVkJyXzS1V35NxTaATmoKJ8NXYAtR3kcwgOOx0byfYrHdwsP3RY1ll/CQbqY7WBCz2mCqxShnvHrFOrmcIzR9hF3UQKmqXMojNQqbzthOmN9yekqnJ5fHymIl/eXd5qx3hCjkxofw+7crkpv5WZyOxX3EKBKwrgVkQsg9b0wn0KvGXxcdW81f/Dx2NJSCd9g0/lKhqI3Vvsncd5fL41pCgZTOu/QFE8P8an3Ok53KUZTM0hi9DbagrponC4dn8dXzMKogfiXuiPDgng4GKieg88RXnRHZ0/62zVn0rxXEr8XTQ0g4cchbz6ZUDVSKLI4cQ== Received: from BL1P221CA0007.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::33) by DS0PR12MB8788.namprd12.prod.outlook.com (2603:10b6:8:14f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Tue, 9 Jul 2024 12:31:58 +0000 Received: from BN2PEPF000055DE.namprd21.prod.outlook.com (2603:10b6:208:2c5:cafe::2e) by BL1P221CA0007.outlook.office365.com (2603:10b6:208:2c5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36 via Frontend Transport; Tue, 9 Jul 2024 12:31:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN2PEPF000055DE.mail.protection.outlook.com (10.167.245.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.1 via Frontend Transport; Tue, 9 Jul 2024 12:31:58 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 9 Jul 2024 05:31:25 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 9 Jul 2024 05:31:25 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Tue, 9 Jul 2024 05:31:21 -0700 From: Itamar Gozlan To: , , , , , , , , Dariusz Sosnowski , Bing Zhao , Ori Kam , Matan Azrad CC: , Subject: [PATCH 3/8] net/mlx5/hws: strictly range templates check fix Date: Tue, 9 Jul 2024 15:30:58 +0300 Message-ID: <20240709123103.2101902-4-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240709123103.2101902-1-igozlan@nvidia.com> References: <20240707102532.2045942-10-igozlan@nvidia.com> <20240709123103.2101902-1-igozlan@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000055DE:EE_|DS0PR12MB8788:EE_ X-MS-Office365-Filtering-Correlation-Id: 9fd7de52-f55e-42ad-1b04-08dca013200d X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?/0r3frb11J3g8es69jJiZXc8wS8NXaqd3dQ7VK4mQ71NSlXCn0Ee4eY+cEa6?= =?us-ascii?Q?Lj4qVnA8RsvzWbIIC9Rjt2lc0LoF0pIC7RRlIr+hCLBJU2r6wTdmRBUM9OEg?= =?us-ascii?Q?fPBKWqrYBrloGgd9y97BZUjmVDgxxmRXb9fPluJPYNL2YFrdk1zlKHoLNtsF?= =?us-ascii?Q?IhO9vcfZ+yUzY1sxYkWD92vrgrnSlHC0ZpR1BxU6n6YNszD29oL1bJBdPS9V?= =?us-ascii?Q?/W17a2W0EhRa1IDQ6XRhfOLMlbvoG0spkzCCePq3bmpT3rzkozVQzfirnP1m?= =?us-ascii?Q?U54h1+EpPJgzghAF4IeoilLFSAe0KUsKfvvVvaG+14qLSmjJcpztXQmYi9RK?= =?us-ascii?Q?C0RvW1K70Z8DOnlw1kh+d/sg2g/by1NdVFpVjnKUpCc8pcAXWKM92b/tmvhO?= =?us-ascii?Q?6BohIK7n7pE+8KzsialyNO56SjbcgyVhx44BF0GPVVTQRn3ddi78xZ1u5XDc?= =?us-ascii?Q?ygp8mWy4Wy+2v3hpH3DnNgdbdLBH7hJhZ9xrtx96OYs6akf5DotEHJ+GCRpW?= =?us-ascii?Q?6QsT3MONoJR3mOl075lOkHNPGgMwawoCA3d0eHasR0vxDTxYTwE7csJO2bmq?= =?us-ascii?Q?TohZz/OUpgtD3oHUUXRiabtEE+cLgIHQicBjnKkj1lX4qchB8ERzGUOaSdso?= =?us-ascii?Q?q/U+5orKLkngof13w4ReML/lvZabSww0pg07HZkkE4qSVB6XbbFo2OyzV1+e?= =?us-ascii?Q?A/+hIixPAs7QBA8S67gSNZi1Sj/IvQnclDAm+PT1BU3cYhBE++z54omuaPvw?= =?us-ascii?Q?PA1wNllQW29APCLMPzeX6fAnE2ZyGlIdn872I7d9c4i6i9biPQQ1qVnEkoNp?= =?us-ascii?Q?SAptp7Jg2Tx0xByJV4DUY0pFXccAPC1yWIJdLk8A040cvUCrxOcQMyZ0q43N?= =?us-ascii?Q?aV8AI8Cr4EQb+YhUy9dgCM4ft1AbguoqNNMRUOHgeu6659/zpcd3WT2zqpJv?= =?us-ascii?Q?ONGKgN+07B//RC8p6LyoDoU3VcS+DH3W/XMtDgN7ajPr2nn/0z1gCRoyX/xc?= =?us-ascii?Q?IXdZdbliWfqId08qEUPHLy2Sqh9PSB/HDpFSm4AJm15FOK4kYj0JiRIndHvj?= =?us-ascii?Q?kOb/tRKbn1NI3zlkQBC+C3YcxKwEa/J9jFrVQT/7EEXdgJ/AyTECbOepMrko?= =?us-ascii?Q?66Zlimw/jT5s7m+n021ZOhdjefWlr1SzXANY7HvaNAuyjU4lGoj4bBymj507?= =?us-ascii?Q?s+2JAapJNteH2xyHGKnPbCD7gPON4ZtW1yGVj1MLLNlieBT63jxygY3sIkD5?= =?us-ascii?Q?nb13SIhUutnabRSibhzQY+oBBHYF0Qzcl3TJ1mkx0tyj1PFJT63kUZFS+Ie7?= =?us-ascii?Q?+3y0czyGOYOm1dkzvyOzCYrrMr1qbglR7Gz9qKPNX7MOehNLeXx9WwfKyISd?= =?us-ascii?Q?15T9K5mbSoPNAxwrJ/WHLjK97jBAm877euZvbHtopGAiv0W6WrR0FtouudCW?= =?us-ascii?Q?dMSmdYPbaFs7NdE8JzhIYh9BJ0G3tp95L2WqZyBr06VtpcqjIP05Zg=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026)(921020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 12:31:58.0289 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9fd7de52-f55e-42ad-1b04-08dca013200d 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF000055DE.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8788 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Using range and non range templates is not allowed, and in HWS there is a check that enforce that limitation with constantly check that, in a loop, if the current template defined as range, the last one should also be defined as range. But, in the case where there are two templates in the following order: (1) template with range, and (2) template without range. The existing checks will not cover this case. This commit fixes that hole by maintain the invariant that if a template without a range exist, all the previous match template are also. Fixes: 9732ffe13bd6 ("net/mlx5/hws: add range definer creation") Cc: valex@nvidia.com Cc: stable@dpdk.org Signed-off-by: Itamar Gozlan Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_definer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c index 9ebda9267d..51a3f7be4b 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.c +++ b/drivers/net/mlx5/hws/mlx5dr_definer.c @@ -4041,15 +4041,18 @@ mlx5dr_definer_matcher_range_init(struct mlx5dr_context *ctx, /* Create optional range definers */ for (i = 0; i < matcher->num_of_mt; i++) { - if (!mt[i].fcr_sz) - continue; - /* All must use range if requested */ - if (i && !mt[i - 1].range_definer) { + bool is_range = !!mt[i].fcr_sz; + bool has_range = matcher->flags & MLX5DR_MATCHER_FLAGS_RANGE_DEFINER; + + if (i && ((is_range && !has_range) || (!is_range && has_range))) { DR_LOG(ERR, "Using range and non range templates is not allowed"); goto free_definers; } + if (!mt[i].fcr_sz) + continue; + matcher->flags |= MLX5DR_MATCHER_FLAGS_RANGE_DEFINER; /* Create definer without fcr binding, already binded */ mt[i].range_definer = mlx5dr_definer_alloc(ctx, -- 2.39.3