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 31E5E43D16; Thu, 21 Mar 2024 15:24:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 01231427E1; Thu, 21 Mar 2024 15:24:56 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 71209402F2 for ; Thu, 21 Mar 2024 15:24:54 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d4aQqH4prNC89/jnEsx3UE0SIL874XlqDFKqI7WugOZm/8j2e81AAOspSN5Ja2RG81CB8CCcpc0k5uGsx2Zblz0oqxl5XN8enC9bXy8IGQivey91yK0eMiNzJymgOjUfm2/C63ZqKwhT8D0QkVYHdj3zoz99acPxAO/KBqh3lRLUbKRWTEEfvDoO5L4IahskEVUAnASc0t2xwBTHf9VuYi4vjRQSF+KATD1SKme3rcm3zoZlHOf74D1EsasLZvcYw+nLBa0FHwv4MLEOGlFnHEm+cXVTDvoJt1ZcGi8TZ30xu5L9CApJ25IeBqdswJgpO2L5KTA7oc9/k619ISfLhQ== 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=EXCUL/qU05UTcfkBSXrcl7jA3JE1pwPbO0FgBoQcGgY=; b=cRvbUaiJXa/rOUvlvKc9Ukj16c4o6vUKidt4JfEjluYSaYCFlwsWNu14ZqPTc3Mm7pKpMgyIgJnAwgG4XbN1Gx+Cnxkop+HJy3rx9/1aDCMFd5vc/gnHIjYP9Zv8UD719xODK+Caw2chWY5ivzEGnu0WfbMo2UhS3Egqy0eEkBM93JJMKmSu4VEMzHkDfMCnQjZ/zbN1E+I+awEM4mPOeukizkeze8Oad+jGih0yxhUKC9wSdRz1x04PXCX7zkMxjmaf+f7lsZ4EEXAZ33jzYaYgge7SMjlzi8NW4886WrECyjiluZT20MaqbcwNjMjGev/xUY78PgOuxilYIn7/8w== 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=EXCUL/qU05UTcfkBSXrcl7jA3JE1pwPbO0FgBoQcGgY=; b=WmSjFCFAv/yC/T2jDOM3XP/wSncOPQknUNlqnhKNxlWcjbOqg3yg7jnpatTLdQh7sW8+/zcpSlw2mIlqJTJgs4qE2bnwFiMR3pR5EUa3WQvQtPwhsPIBRXyFGJyAMxVrD/Xki+4rBtJMjH7LY1GT3XxksYTgajYc9D0KADXWjwqIq9/HgLOyxYcGQlIRR9eNLL4nHz3FoUvwKGMMNOHEgVEAahsXADyylu+EWyWFgKotvUEHK1XzskxB6yilto4XUKVecPAZi2tnHNOsS+ASskwKlNijlXot8sIwHD6iCkhYp1Ja+4wsZrhc+hpYIs7fu4RQnZHWnJxJWvbkLLr1nw== Received: from BN9PR03CA0965.namprd03.prod.outlook.com (2603:10b6:408:109::10) by SA1PR12MB5657.namprd12.prod.outlook.com (2603:10b6:806:234::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.34; Thu, 21 Mar 2024 14:24:50 +0000 Received: from BN1PEPF0000468C.namprd05.prod.outlook.com (2603:10b6:408:109:cafe::75) by BN9PR03CA0965.outlook.office365.com (2603:10b6:408:109::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.27 via Frontend Transport; Thu, 21 Mar 2024 14:24:49 +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 BN1PEPF0000468C.mail.protection.outlook.com (10.167.243.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Thu, 21 Mar 2024 14:24:49 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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, 21 Mar 2024 07:24:31 -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.1258.12; Thu, 21 Mar 2024 07:24:28 -0700 From: Yevgeny Kliteynik To: , , , , Dariusz Sosnowski , Ori Kam , Matan Azrad CC: , , , Subject: [PATCH 1/2] net/mlx5/hws: fix rule resize status check Date: Thu, 21 Mar 2024 16:24:13 +0200 Message-ID: <20240321142414.1573453-1-kliteyn@nvidia.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF0000468C:EE_|SA1PR12MB5657:EE_ X-MS-Office365-Filtering-Correlation-Id: ac2b0412-28f4-4279-f61c-08dc49b2aab1 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: T2KPFoSUemUXcoTzaeKFhgepBGJbj9OvmLEkc0CaXzv3NoOdLp4oLhL0RxTK0LJQ+oFUbzazXrqAXCiTDDkF1a6+tYyVyEzLhfOzV0obJ0Aymf3fFi8wsCgOb+5szCJRM3FtCDTZ75DEO5C8gEIjSA2YVRLrUqmOkAxBIJ8hxpYyZ3f8Id14inN7VKmFhzh4V4b8PXMEXgxBcMupJLDdV+aM/6Xz3P3iy4RQmWC3gL4Dmn3VGzG1eQNE/pBqLM8kg7ZP/szp48WEfHlL+PbrhLvsWkgHpmEfSHDoLaF3A9dqWM4NJ22xMRyRVpRfhK5LatPmFCkIby1LgBX0HHI6mxKbt87dRUAakrDLJ7jM/WWr034qrvX313FyKYD2hx5L5kAXayWPqBuEsM7/kM09CE6CAVRBGpTbLO31KvYy9P5vPXPgxnC7eEu9pj5AbW+lMn9TX74ql0K5Vs+AYCoOMjGc6Nu4Im5pxibu7XEb2G+5tyNpId7sqaAnJ2+DCJboUhE0Pdjt1w6fr+SP1GxWb9qLP29AuXbs9Dz83CN9y/oOjfQkZMzjjMdj/RmHhv87sYgHI317UEC/9a4MvnI9iST28dzYkrCg6TU6zZTNVBG4UF69NVo6VUF/52WBiu8eoNYE/V/chvv1KvZr50AfpUKfwV7NLVHZb/xf/qaLIgyUc50LwazsnVWbxT1Emj9QjnGiDFV28SuNAW1oVh0zKOoUEE3we8ajRk5KUO4aC8CoW0Aj+eqYP39i10gBQhr+ 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)(1800799015)(376005)(36860700004)(82310400014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2024 14:24:49.4532 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac2b0412-28f4-4279-f61c-08dc49b2aab1 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: BN1PEPF0000468C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB5657 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 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: Yevgeny Kliteynik 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 f14e1e6ecd..784f614d87 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 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.27.0