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 25A09A034F; Wed, 9 Jun 2021 04:07:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 978F640689; Wed, 9 Jun 2021 04:07:37 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2076.outbound.protection.outlook.com [40.107.92.76]) by mails.dpdk.org (Postfix) with ESMTP id AB5994067A; Wed, 9 Jun 2021 04:07:36 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IDvLIDLswNO/QZ/MSPFzIwxvd4flHSRlNfSgUJwBG6vP0IUYa9BQmHUMvD7sOHaP/pbcB8SkjjbJaOdJg68pM3THJB1VVR76XEOqPG68NDw1TkJ3aRwJc1lsSkbJysUzNQU/Wgi4gzLwmDNvHExlWK6Yu4GAlyIOSuH+ja0JGOdLfnpiYI6zpqsf4s0W7gKv7K9Dm3fjUw5sowRRjaMvvTdBLWcNJs9QZmxoIJedgaDn6Wq0uhyTfTG8w6JLCdwqHMnL+DtMyO3gDHnI++9JdPEF8qrrswdvLjqOsw946hbDxYskPYP8vIs94Fz2w9cMCNrfSulBK64vTBclbg5aUg== 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-SenderADCheck; bh=DfGXQ3FD55X3HGRpaMU2qM+qzGhRy5nIV8ei/1Fek6o=; b=Lt6rQYTrJeHLyrpp3k/4BFFgKJZimFQ/l+A5jg+L16Y4tfF5nEGG5+oKzsdcourcsEaneCP1oXhXMbOGGV3cOXaYoHmH7jToV8jnOf0bOa6tfcx8clWl7Q7DaUmdxyZJqi7usThm5eOEVBI9J7dfBT1bs+rZ6wivLQGIWNtrlVW7ajncp7YRIHftj9HfUYrdQ2i1EFJtwU+zKLR3x16JtwP1hsrDjdamdPBWTswFGxFJ0ZpnslCCjxk6EU3QmhXlF7iZfNurwD8H2I1zax1PyE716+ULjwCq7OazGbactJn/lT5Rq89BO9nPOGhJwwU9OtnNfZPVLVVZNrBABxw+XA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none 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=DfGXQ3FD55X3HGRpaMU2qM+qzGhRy5nIV8ei/1Fek6o=; b=gExg6nEl2CbCaF4Miodnuf7mR802POAlGFPCtLuwCiuD2T23ZfFRzobVZ38f1S1AYjMRD8H69LCajAbSpsBuF1GPmRcxteFevICTblORShKWibN81weHU4P3zs4l378ymVJxg7bSZlw9ue0u7gDQJYU+fOsgG2PAJYNpT1xkpkKifNceJdYvO12ZBpcbSeW7LtofdcFMXzu+HVHIq+5+HpA6AblNmvDExpg03Tak9AOWBk6/CrDZrfjXpx6F5T4yJqZrjqeFaKASnsb980mC8k8c3wpyFYd0BM9H+NXuXDb8hBzmfW9hRyoJx4SccXsD9Wn9pp/mlerMNHki5B5N4w== Received: from DM3PR14CA0141.namprd14.prod.outlook.com (2603:10b6:0:53::25) by DM6PR12MB4331.namprd12.prod.outlook.com (2603:10b6:5:21a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21; Wed, 9 Jun 2021 02:07:33 +0000 Received: from DM6NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:0:53:cafe::18) by DM3PR14CA0141.outlook.office365.com (2603:10b6:0:53::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20 via Frontend Transport; Wed, 9 Jun 2021 02:07:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT065.mail.protection.outlook.com (10.13.172.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4195.22 via Frontend Transport; Wed, 9 Jun 2021 02:07:32 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 9 Jun 2021 02:07:28 +0000 From: Li Zhang To: , , , CC: , , , Date: Wed, 9 Jun 2021 05:07:11 +0300 Message-ID: <20210609020711.7339-1-lizh@nvidia.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6be3c3cf-30db-428c-261e-08d92aeb57e7 X-MS-TrafficTypeDiagnostic: DM6PR12MB4331: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JGyCn260syP6z9Z6v37K8YED3ZGsT/qe4NlfGAH5Dy1TltCeJ37fYkvqhcX7GYlYe6pg8ZpPpX9GLSXb4KHjHyVGdETpWModkTzUSzpfpUfI8FsJHJDLFIkHm1v4Jj6AQkmP4QggHrGx7Syrzf6Tz8S9l79m/3xdDxV5zkUSjL+eNIIYIbM+sK0fvERzZdcm0V/E8Ct7VfiRwUyOsartkc94b1QuAQ/mipNu/pTVu7cMdOdD10TDtL9lptLDCgSb6N7Qs5cLHYUmmyCHjq6qO0MW8soNkHBE2lKQ/1cjjEQH4DMgabm+V0hzRoLOCsho60MfSvufENj8+c8S7nZivUG0/BVzMl3tUuETVk2j5X8zvZ3iq2iJtqssM6S0oMikftJ4r9g7zddsqnqLz5d5gx2ciQygGpy8h7v5xFZczBZ1IxrQxtoaoI4HLPnyDbYdZqHSdtBy0/sOkRzc64gRFDN1axf7iRTRceLpp4/NGyd+B5Bzap/k9ZNm2px45ZZdpNnght5hmGEeg3l7U/jgD0eoO8WlqgXHSuFBm0RDr0iDvlxmaOPsSmui/ZDb/bIYY2JoKhF38nU1tqGUfOmpCpOdCki9reP647c6yc2udGYh+59BF80DssMacNBeN8wjR34Z75vO29vD9l5Wskx1MIByrBPrz2x50LkWWqtOcgU= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(39860400002)(396003)(46966006)(36840700001)(16526019)(8676002)(186003)(82740400003)(4326008)(26005)(336012)(8936002)(356005)(70206006)(426003)(2616005)(83380400001)(70586007)(6286002)(36906005)(86362001)(82310400003)(478600001)(55016002)(6666004)(316002)(110136005)(54906003)(7696005)(5660300002)(2906002)(36860700001)(7636003)(47076005)(36756003)(1076003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2021 02:07:32.9035 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6be3c3cf-30db-428c-261e-08d92aeb57e7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4331 Subject: [dpdk-dev] [PATCH] net/mlx5: fix meter policy creation error flow 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 Sender: "dev" When an error appears in the policy creation, the IDs mapping between the user policy ID to the driver policy ID is skipped. Wrongly, the driver tried to clean the mapping in this case what caused an error. Skip the clearance in this case. Fixes: afb4aa4f122 ("net/mlx5: support meter policy operations") Cc: stable@dpdk.org Signed-off-by: Li Zhang Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_meter.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c index 16991748dc..d7ce5cd2f6 100644 --- a/drivers/net/mlx5/mlx5_flow_meter.c +++ b/drivers/net/mlx5/mlx5_flow_meter.c @@ -559,7 +559,8 @@ static int __mlx5_flow_meter_policy_delete(struct rte_eth_dev *dev, uint32_t policy_id, struct mlx5_flow_meter_policy *mtr_policy, - struct rte_mtr_error *error) + struct rte_mtr_error *error, + bool clear_l3t) { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_flow_meter_sub_policy *sub_policy; @@ -590,7 +591,7 @@ __mlx5_flow_meter_policy_delete(struct rte_eth_dev *dev, } } } - if (priv->sh->mtrmng->policy_idx_tbl) { + if (priv->sh->mtrmng->policy_idx_tbl && clear_l3t) { if (mlx5_l3t_clear_entry(priv->sh->mtrmng->policy_idx_tbl, policy_id)) { rte_spinlock_unlock(&mtr_policy->sl); @@ -768,7 +769,7 @@ mlx5_flow_meter_policy_add(struct rte_eth_dev *dev, policy_add_err: if (mtr_policy) { ret = __mlx5_flow_meter_policy_delete(dev, policy_id, - mtr_policy, error); + mtr_policy, error, false); mlx5_free(mtr_policy); if (ret) return ret; @@ -815,7 +816,7 @@ mlx5_flow_meter_policy_delete(struct rte_eth_dev *dev, RTE_MTR_ERROR_TYPE_METER_POLICY_ID, NULL, "Meter policy id is invalid. "); ret = __mlx5_flow_meter_policy_delete(dev, policy_id, mtr_policy, - error); + error, true); if (ret) return ret; mlx5_free(mtr_policy); @@ -1909,7 +1910,7 @@ mlx5_flow_meter_flush(struct rte_eth_dev *dev, struct rte_mtr_error *error) "meter policy invalid."); if (__mlx5_flow_meter_policy_delete(dev, i, sub_policy->main_policy, - error)) + error, true)) return -rte_mtr_error_set(error, EINVAL, RTE_MTR_ERROR_TYPE_METER_POLICY_ID, -- 2.27.0