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 E7E2943CA5; Thu, 14 Mar 2024 12:44:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C08B242EDB; Thu, 14 Mar 2024 12:43:39 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2085.outbound.protection.outlook.com [40.107.243.85]) by mails.dpdk.org (Postfix) with ESMTP id 9D6AA42ECC for ; Thu, 14 Mar 2024 12:43:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E/AZe/hmudDjfQS08rhrEOmNtrqQy/Ebh+WyU/EhIchMyAIJaae8qVHQRCvXHBzwRgkRxDVYg12/539MHhiNfK2YzmjpDeE3ziNC+Hr8r2+g44OR1sgaVQ3jfKvmISXi8PLfXZfUPzuh40stqS03LZOpOQSRFV/1txAm9mt2sMWBU+AXHtPWFqdtWz7IFoClEkWQjPIPsV+DCFHLZ7unCjcFO7Gu8jxtodDMgpANNS0qbkCq/furQmY8cck8nIaHMXaWUqB0nRVeYd3dJokJYaNvIN9PNPF2qSD9lqHkdYPgq+FZ0N0odkiy0Wx0Uhz4HzLuiZBZ2vzs24fmgJyDnw== 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=NQxJgIlO1iuKcyHGuqLuf6ZWEg488S1jViRG5gr1qs4=; b=gNoH0Rd3I+7hIiFv9FRPxZOoo4szJOkbtG035/u6fwQpzOwZh+PhPdbYZ8WKcZ5XaRANTaAZ6KYSBg5D0TBfVZkUjcpqdkVmdjIPx48cMqHEqGQ6HFfn0P1qhZl7VXtW3HQ670kNg9tv/G1BUz99ce9F44pD7Jw12CRvg/UwlVT6bxwG+NEYoB/m2bcrEQuM0GUDW7FgAuYPzJfdpxnVXFYLzQD1hyJQw83CJIGOreGxxOTD7SgVPXxICPrQCV0v16hA9nS10qWdNoGW7wlqHyhuTzkzNW0ayFmKiq4dQcWDCZayvKO2xSq+ClWXxf8okuOOA70bFw9B4kKpANH2bw== 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=NQxJgIlO1iuKcyHGuqLuf6ZWEg488S1jViRG5gr1qs4=; b=MT9jQtVrj4lbBUAMj9oFE8noV4OiY5shyzhHvj1s7VMDvv1QPZjXxGuTCcINs0D6H/VwTf5Il3ISLAsAubc+VTcEv+aKLrRQ4a9BJaf2hGAXjJ996Tta7uGkFc3069RQw/yVCm91wb/uZgz+vRJNXNMwLeop1VTqZwbjQl1OnN2c2mFtPDPbCjkCmI2PD8dptehGiGSlV/F63dq+4qScgASYDtGe9Lt+v2ZqjpZkhj6jFzS8RPWb/mcs/x/1vL4f031yDeZPFQivtlNcpYxJ6n/V6dtz6i3oPYamwMMjYHsEvWPfkWUKksKfX683bjLAm1TwpPj3onU+sPZtZJngEA== Received: from DS7PR03CA0167.namprd03.prod.outlook.com (2603:10b6:5:3b2::22) by MN6PR12MB8514.namprd12.prod.outlook.com (2603:10b6:208:474::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.33; Thu, 14 Mar 2024 11:43:32 +0000 Received: from CY4PEPF0000E9DB.namprd05.prod.outlook.com (2603:10b6:5:3b2:cafe::b2) by DS7PR03CA0167.outlook.office365.com (2603:10b6:5:3b2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.21 via Frontend Transport; Thu, 14 Mar 2024 11:43:32 +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 CY4PEPF0000E9DB.mail.protection.outlook.com (10.167.241.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.12 via Frontend Transport; Thu, 14 Mar 2024 11:43:32 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.986.41; Thu, 14 Mar 2024 04:43:22 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Thu, 14 Mar 2024 04:43:21 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12 via Frontend Transport; Thu, 14 Mar 2024 04:43:18 -0700 From: Itamar Gozlan To: , , , , , , , Dariusz Sosnowski , Ori Kam , Suanming Mou , Matan Azrad CC: , Subject: [PATCH 10/13] net/mlx5/hws: fix rule is in resize check Date: Thu, 14 Mar 2024 13:42:17 +0200 Message-ID: <20240314114220.203241-10-igozlan@nvidia.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240314114220.203241-1-igozlan@nvidia.com> References: <20240314114220.203241-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: CY4PEPF0000E9DB:EE_|MN6PR12MB8514:EE_ X-MS-Office365-Filtering-Correlation-Id: be9e4b3c-a756-4331-0395-08dc441bf990 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; X-Microsoft-Antispam-Message-Info: EI50Wio1Lb1rgT7iqvW/P3Q9cTis89llMK4Lk1hhv9//vyqp5Ovt+xkRUfoVZkwAjuuNZI/nnQa1QkjPUuOnHAP9VS6aFsb1ZWyKTnTsaoHbnoeX1Z6rjCb7NNKLYAvjvC07QIubaE7+C3YoHO3H5FtMy7Ai+TvEI6Z30p9/QX6r7diV4tb4PFsfq4HsO52IGzfPbq+5TTyQZMrqGauMRqSV9w6rxK5APLd4wrfuiF7fVG53WzO9sxazGVEfpb55WJurUyHBZ7ujOkEG9YzC3dskZyPsVq8MtHvLTXBjWanFreFpLlewvrcbknFF/qvvwKI1jdtlJpDMZRPUW+LZazygFSM76bKROatPPR/tW7QMqvkRTkeCdcCFkOzjLE5oVN8Gv47wsGieaz4JztxihlrFfLgs35ZOeKw6eQxb4AS7vynqwRSSCpU/91xh/zfOKtplpvOVl1mIoRTHcUayO7E4bSefRAF55BiQlGyRe9+VjWNwEbSjruk1IT9l/OgafUyWs7waAQAi7YO8jBXu5YSwbbQupqJogp48ewvpPio86JAZV3s+OIUaRj+RyvDqlbOWJDPI/t33wogewYPhHp9QPaLxzW3v5wR4inyLsBIMgRGkY/aY2CHHxpphKMRQzJ7fucqcN/2XCOlxQWOeL+I7kV39GoTkNCXkuipL3DtkHOk/GkYLc5dwGAilPspsTo27Yvqgqf9rapzgsgP/hTMSiemd2m1mMwX/cCM15LKn90/hvZ0mCffI95T389PVr80yp/nDawOGaP74cBsgZg== 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:(13230031)(36860700004)(376005)(1800799015)(82310400014)(921011); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2024 11:43:32.0444 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be9e4b3c-a756-4331-0395-08dc441bf990 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: CY4PEPF0000E9DB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR12MB8514 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 From: Alex Vesker The check to detect if a rule is in resize was done incorrectly, this can lead to an incorrect function call upon completion for rules which are not in resize (move). Since the resize_info is in a union we cannot rely only on the pointer value but also need to make sure the matcher is in resize process, this assures us the resize info is valid. Fixes: 762feceb8294 ("net/mlx5/hws: support resizable matchers") Signed-off-by: Alex Vesker Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_rule.c | 7 +++++++ drivers/net/mlx5/hws/mlx5dr_rule.h | 6 +----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c index 7bcf2de55f..3e8e90ba76 100644 --- a/drivers/net/mlx5/hws/mlx5dr_rule.c +++ b/drivers/net/mlx5/hws/mlx5dr_rule.c @@ -350,6 +350,13 @@ static void mlx5dr_rule_move_init(struct mlx5dr_rule *rule, rule->resize_info->state = MLX5DR_RULE_RESIZE_STATE_WRITING; } +bool mlx5dr_rule_move_in_progress(struct mlx5dr_rule *rule) +{ + return unlikely(mlx5dr_matcher_is_in_resize(rule->matcher)) && + rule->resize_info && + rule->resize_info->state != MLX5DR_RULE_RESIZE_STATE_IDLE; +} + static int mlx5dr_rule_create_hws_fw_wqe(struct mlx5dr_rule *rule, struct mlx5dr_rule_attr *attr, uint8_t mt_idx, diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.h b/drivers/net/mlx5/hws/mlx5dr_rule.h index 07adf9c5ad..dffaec1c0f 100644 --- a/drivers/net/mlx5/hws/mlx5dr_rule.h +++ b/drivers/net/mlx5/hws/mlx5dr_rule.h @@ -72,10 +72,6 @@ int mlx5dr_rule_move_hws_remove(struct mlx5dr_rule *rule, int mlx5dr_rule_move_hws_add(struct mlx5dr_rule *rule, struct mlx5dr_rule_attr *attr); -static inline bool mlx5dr_rule_move_in_progress(struct mlx5dr_rule *rule) -{ - return rule->resize_info && - rule->resize_info->state != MLX5DR_RULE_RESIZE_STATE_IDLE; -} +bool mlx5dr_rule_move_in_progress(struct mlx5dr_rule *rule); #endif /* MLX5DR_RULE_H_ */ -- 2.39.3