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 95E2743238; Sun, 29 Oct 2023 17:34:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2BC0C410FA; Sun, 29 Oct 2023 17:33:24 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2077.outbound.protection.outlook.com [40.107.223.77]) by mails.dpdk.org (Postfix) with ESMTP id D882B40ED2 for ; Sun, 29 Oct 2023 17:33:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FaKhbbJzboeGzVgj/drZGuSv7iXi81QWS2Ty4SOmX4FdOeZlBAMUjvTUIfvyhRg7iqDvxet0KrYLPWphrTAErSVHzfCyWvOerkOf+KLnyQocjNdsQYFZizrq44qDSylzlIiSJwWcFKRv8LRp159NpKHfXIjAAh3eWP5mXo9x8MwhVrD2ixyCJ6amKbgeBjqRr/RHtSyrp30jrIy9gkmXom0ZZlqDEn7ebjxw7r3LonAHS+y4LD6NfBn9k22c2Ef2Sw1YyAYI+t6qCGWv0XSSbjFVSMxwWq2OUDMUlz8G4WWbGRnBr3T7vWF2E3VYLpAk6ZqpS9HhIw7I770C3MCReg== 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=/m5AA5JYDNYi2ovljwAtSnLt3Yue3paDVWTxH/MYrzE=; b=Brlw/BGWPsa67tMp5hxHtNjDc4ShQ49xkKji2TgNt34dAMZCn5+JzVPkoV/EICbdEblwHub97cJ4W1D22TxeTyUK3SAlmppDml0HY0OmCRbRmZkBgZBc4tyGi6z5FZbdSgFtgz4q6bH8xM2YUk+f1xE288lS9lxx4mj++lqbpYLNvgPwkoDAzAvf4N4EQSJn8EYS6Rf/6ImGS+ZuuQuqoDA/qSsFNk4cBhDIN4fPT5/hZRP3KQoNLsZs4zxxkhg7ZA5z/VwOcGnMzptp93tlqwt9GuQZBftUbDS8yMsirsEsN1/OgONBzaQ0e0yUr2U9bLcw9gCkL2bPTiuujfYGsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=/m5AA5JYDNYi2ovljwAtSnLt3Yue3paDVWTxH/MYrzE=; b=do4+oMYVMYBLgzshbmJxWzGpWrnqC0ZF9WNGCqJbGP6suBFRVJ3p/JSOhT34Ja8ZrZr/et7yHYi97+1mdLGgvWZgBsGL9BcaZp22I4pNipIfeSvyDD+CeO5KKDGWZn7ljetz8GhhVlFZC6euqJpscIgVlY8g5cXKIEPGvR1nUq5IekaQrEF8MA/rdFBv8qy7K9UyWFbGnAi5cFOSTUdJcRQS3cKmq9b8Ty6k/+YgvXCNODSwAR+hhC5WiurjqVTujXXeVCJY6rH0GjIq9L3evK3hV64IGfh6goQgThAUrWvQOX/m3NAwOzkZvZhpAoU/IQFEJuZuQj8fA9EoeOau1A== Received: from MN2PR05CA0061.namprd05.prod.outlook.com (2603:10b6:208:236::30) by DM6PR12MB4404.namprd12.prod.outlook.com (2603:10b6:5:2a7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.26; Sun, 29 Oct 2023 16:33:20 +0000 Received: from BL02EPF0001A0FF.namprd03.prod.outlook.com (2603:10b6:208:236:cafe::f2) by MN2PR05CA0061.outlook.office365.com (2603:10b6:208:236::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.14 via Frontend Transport; Sun, 29 Oct 2023 16:33:20 +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 BL02EPF0001A0FF.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.15 via Frontend Transport; Sun, 29 Oct 2023 16:33:19 +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; Sun, 29 Oct 2023 09:33:04 -0700 Received: from nvidia.com (10.126.231.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.986.41; Sun, 29 Oct 2023 09:33:01 -0700 From: Gregory Etelson To: CC: , , , "Itamar Gozlan" , Hamdan Igbaria , Alex Vesker , Matan Azrad , Viacheslav Ovsiienko , Ori Kam , Suanming Mou Subject: [PATCH 15/30] net/mlx5/hws: check the rule status on rule update Date: Sun, 29 Oct 2023 18:31:47 +0200 Message-ID: <20231029163202.216450-15-getelson@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231029163202.216450-1-getelson@nvidia.com> References: <20231029163202.216450-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.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: BL02EPF0001A0FF:EE_|DM6PR12MB4404:EE_ X-MS-Office365-Filtering-Correlation-Id: e031c635-8f1c-4d0f-dd1d-08dbd89cc2ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XoYp9MYhEtGf14+74WkOWIfEZhbYwlk3yG2qISA5MQfm0VmkJr2EuHZTBMImna4Er/uSuXfjzfg6y9i/OzXEUNBs6KH3YUPNh+5+tMNv1NhPyReQOqhQLVH22hv9aJntT8jqPTTM5oKkQzLiqJi6aUMEBTRN5qdToIRq15b0rHBzweGuhMa49gxVH5Vb+XF/feJpxx3KUPRO1Xuoqqq3r20CVHst2HuFwcewpnVrmgmV5773BVcnRRwvpZI7yYysZo3383CrU6DE0T5oc6GTKiAATcIezMZtXBHIEk+5XypsZc1INC3YlhW184SoYChPml3EVmgafDVjDqo5T4Q7Bjn7yqG8hzi002kKLo06MflhwqoIxKN/snZYsc50j9bR2Eh+max2brFW6WSopkZnPs8gN3vUPeXhiUTDTl6QmNLT06rCZYq7724yHlYIu/Y9v6QhWuMhNVfzZgF33dhwZ1WuekVSD050zbkA1CvrS+FGKZYTNwFnoGOOlHICpCLf+BXDKSLlj6uwT+4Ui3Q44+20kNASfLxytbjglZEi1w7UDNOPgrMUrQG/dopmpDQXkW0jYcZXTFhQCTkuHwLFAmYBQKNQNMjtUftEXcEfBtJ2URrOxKkA0i+l8q5CFXdts5rUQgxJUB15mipA1rygoqqSXmCQOnbsyORBVYlJxVZp5IFoYopjz2V7g3Xcvb3NwxYmZ1ApBFXHmZIqZD4HGyNxtokUQ0/JPUWsKIYIgEhT+hL1UHi1zvIXeZ0lpokV 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)(4636009)(39860400002)(396003)(136003)(346002)(376002)(230922051799003)(64100799003)(186009)(82310400011)(451199024)(1800799009)(40470700004)(46966006)(36840700001)(40480700001)(55016003)(40460700003)(26005)(6286002)(16526019)(2616005)(1076003)(107886003)(478600001)(7696005)(6666004)(47076005)(36860700001)(336012)(426003)(2906002)(83380400001)(15650500001)(41300700001)(70206006)(5660300002)(70586007)(8936002)(4326008)(8676002)(316002)(6916009)(54906003)(356005)(82740400003)(7636003)(86362001)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2023 16:33:19.8048 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e031c635-8f1c-4d0f-dd1d-08dbd89cc2ed 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: BL02EPF0001A0FF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4404 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: Itamar Gozlan Only allow rule updates for rules with their status value equal to MLX5DR_RULE_STATUS_CREATED. Otherwise, the rule may be in an unstable stage like deleting and this will result in a faulty unexpected scenario. Signed-off-by: Hamdan Igbaria Reviewed-by: Alex Vesker Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_rule.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c index 980a99b226..70d5c19e1f 100644 --- a/drivers/net/mlx5/hws/mlx5dr_rule.c +++ b/drivers/net/mlx5/hws/mlx5dr_rule.c @@ -756,6 +756,12 @@ int mlx5dr_rule_action_update(struct mlx5dr_rule *rule_handle, if (mlx5dr_rule_enqueue_precheck(matcher->tbl->ctx, attr)) return -rte_errno; + if (rule_handle->status != MLX5DR_RULE_STATUS_CREATED) { + DR_LOG(ERR, "Current rule status does not allow update"); + rte_errno = EBUSY; + return -rte_errno; + } + ret = mlx5dr_rule_create_hws(rule_handle, attr, 0, -- 2.39.2