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 AC4D0A04A4; Wed, 2 Mar 2022 11:33:34 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8614342723; Wed, 2 Mar 2022 11:33:34 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2066.outbound.protection.outlook.com [40.107.237.66]) by mails.dpdk.org (Postfix) with ESMTP id 3905042722 for ; Wed, 2 Mar 2022 11:33:33 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MF3EtW614kzw+hVd7PkrkDP+2Kpd0jtQgfj5nfhzndDfyXZvlOF3Pui7Z6zs5Sopfyy9IjlYlJBrzLpa/wju64BVNG8zfQnKube9980DUJBXSMgQMgcq9mQIY0Hejg/wogIo97Ga3O6wt/el1Z6GI5qezNfZZpjIYd0eBo7rtMR85Ixgqet6qN+r0crVAyOxuPusUaNn565uHSaJPpjfv4tXlpBhdITI9nyWavEIDGpHLMouN1NK61qNC8VMb3tT5iXrOiKHL3EiiBfGnVnv9qSe5JsTVOwvBBovnvAbwTX7POB42nBU1Bq8bSqOgtXOIR4Z4KI3XV+acZJqr0xHrg== 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=gDDvgB4N4p214J+B9LEB7npcl244TdVFT5BQBQPgNg8=; b=GbHlVw2yUnTKuZizP9dJncOghCjxP4Xtrm/lNpDt08ufuTD7pczS47X06aATv8XfcXuGkJiMnId8xzDeRn0Wsi4p0ltmF4dlPsP84uaC9PcjhX95aO5zl0LXPIa2jhRwYqPM1f6wCzIcLSNVbLkBoK2AbRye40sG6p4PwPEE4gBDNmxQ2qcGbUXLmn4ii/6R813wmXk1RpSuNCxNG/7Gj1wE8DnIeV4GFWa+05Fncu/+/7NEuQrwwVFcsxq7sPCzFaDiR+VodDbXQj5qt2GbMMqEki4lL5TYiY2vMEieA3A0uF9q2ia7TV8qY/DcZOZY+jVrJGtmPl60DZy7fLX5AA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) 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 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=gDDvgB4N4p214J+B9LEB7npcl244TdVFT5BQBQPgNg8=; b=nosgRe0zqbkvS3twdahtrQw/Xd8vs7lMHEGZT6pExYFx1LFBr2ZeLI02gXeV4CSOOGu8WcrBHrrQEsFx/Bm0thThmNTF+LOBQEhaEGfvSRwVWsXndT6yN89X9/aBIfNC4keuSKTDpJfYGtAM+JhvhxpoeKlxSjFShKjZh5XRmEjzAO87SEitX5C05wpqIHz9C2osRAIhq3cD+iVhri3nkz4ruXAKNYtvf4PIyZavMBM32W2irOW2ve+DzzaHzd0IjyukNFKtjZCHz31j1Csy/I7XmttpjA3xEj+a29gfm6OREmQ7YF0zjuyMrdQkl186mQkUvxkTckY+kf1vy4QS/A== Received: from BN8PR12CA0027.namprd12.prod.outlook.com (2603:10b6:408:60::40) by CY4PR1201MB0102.namprd12.prod.outlook.com (2603:10b6:910:1b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Wed, 2 Mar 2022 10:33:30 +0000 Received: from BN8NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:408:60:cafe::a5) by BN8PR12CA0027.outlook.office365.com (2603:10b6:408:60::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.13 via Frontend Transport; Wed, 2 Mar 2022 10:33:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) 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 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT063.mail.protection.outlook.com (10.13.177.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5038.14 via Frontend Transport; Wed, 2 Mar 2022 10:33:29 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 2 Mar 2022 10:33:20 +0000 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.986.9; Wed, 2 Mar 2022 02:33:16 -0800 From: Shun Hao To: , , , , Raja Zidane CC: , , Subject: [PATCH v1] net/mlx5: fix meter policy creation assert Date: Wed, 2 Mar 2022 12:33:01 +0200 Message-ID: <20220302103302.10940-1-shunh@nvidia.com> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: becd0754-4086-48c1-22f8-08d9fc381825 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0102:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AWpgJEaqIKHZ1JgvSLe0gosoFB/JRkYlOdaGLhhp9hgJGyWngqzhBRnpWfAgXQ+OI9sf0nui+XR5jga/VajwOeyAEhPiy/jk62QQsJliM+p7VEglRxHcWOvB3+6B9akUkC8SYo55JFUUZAJ8y1TLXYFype5Q16+B1XSHcuqfk1jQtUyL02mTJ784qiZU2OpJIZzHTMjLcCEwXutipP93GHCbohqJcvE0ww6hJwABjdFDtYaXiLgzbc41fp8DPTSKJWbmb/NAHyo9ifpL+GyEmupBvDq1WhYmxC/v3kK408ILqh0gOA3iX5Zv4htfLkvTO2wjsiDzDJ89wQArggaJeOlUXuxR2EuTlgyEHNKAMCVyYnJ2PsQYWIrsQiDE/obBlO34nT58F4i7O6xMXKmi62JjU8/EMIWSUTrhwNhM8pgXmbnXse6c+lfZCGPtmwSjnZN7nqaIKwrzP7BZh52yZmlkiZBdzCdwOXxFkNSfAVIu4krbeFoZCVIV/lzfeXwQv/7ZcDRHm5LD3SQ3wpeGZrPh41m/sGiEOQ1Tmf07mZIOsHPouXQf7ocLOxdabwBjltHGDKaBE2V60tdm1r2+WvX0x4YTM0sJ4aND4Sa8wLeKJCybAo9r+G95yRQRXzaSL25iQNWnqDzEDjRmxHpABfS08AcOePQkEhyXdtqZxr5y+7j+/UFJSVE5jV90mIZZxfYsDs0nJWkyPodXLyAbOA== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(86362001)(82310400004)(508600001)(2906002)(36860700001)(356005)(316002)(81166007)(8676002)(4326008)(6636002)(55016003)(70586007)(70206006)(5660300002)(8936002)(40460700003)(110136005)(1076003)(426003)(336012)(2616005)(186003)(47076005)(16526019)(26005)(6286002)(83380400001)(7696005)(6666004)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2022 10:33:29.0435 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: becd0754-4086-48c1-22f8-08d9fc381825 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0102 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 meter policy creation doesn't belong to RTE flow creation process, so thread workspace was not initialized and there will be assert error when using it. This patch removes the incorrect using of thread workspace in meter policy creation, and adds a flag in policy instead. When creating RTE flow, can use the flag to set the mark flag in thread workspace. Fixes: 082becbf1f35 ("net/mlx5: fix mark enabling for Rx") Cc: stable@dpdk.org Signed-off-by: Shun Hao Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_flow.c | 2 ++ drivers/net/mlx5/mlx5_flow_dv.c | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 0f0045a2b5..b6405c0254 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -779,6 +779,8 @@ struct mlx5_flow_meter_policy { /* If yellow color policy is skipped. */ uint32_t skip_g:1; /* If green color policy is skipped. */ + uint32_t mark:1; + /* If policy contains mark action. */ rte_spinlock_t sl; uint32_t ref_cnt; /* Use count. */ diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a690e2d337..2c7dcdd468 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -6287,6 +6287,8 @@ flow_create_split_meter(struct rte_eth_dev *dev, fm->policy_id, NULL); MLX5_ASSERT(wks->policy); + if (wks->policy->mark) + wks->mark = 1; if (wks->policy->is_hierarchy) { wks->final_policy = mlx5_flow_meter_hierarchy_get_final_policy(dev, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index ae88a1cc29..c57f48fca7 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -15524,9 +15524,7 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev, (MLX5_MAX_MODIFY_NUM + 1)]; } mhdr_dummy; struct mlx5_flow_dv_modify_hdr_resource *mhdr_res = &mhdr_dummy.res; - struct mlx5_flow_workspace *wks = mlx5_flow_get_thread_workspace(); - MLX5_ASSERT(wks); egress = (domain == MLX5_MTR_DOMAIN_EGRESS) ? 1 : 0; transfer = (domain == MLX5_MTR_DOMAIN_TRANSFER) ? 1 : 0; memset(&dh, 0, sizeof(struct mlx5_flow_handle)); @@ -15564,7 +15562,6 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev, NULL, "cannot create policy " "mark action for this color"); - wks->mark = 1; if (flow_dv_tag_resource_register(dev, tag_be, &dev_flow, &flow_err)) return -rte_mtr_error_set(error, @@ -15576,6 +15573,7 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev, act_cnt->rix_mark = dev_flow.handle->dvh.rix_tag; action_flags |= MLX5_FLOW_ACTION_MARK; + mtr_policy->mark = 1; break; } case RTE_FLOW_ACTION_TYPE_SET_TAG: @@ -15859,6 +15857,8 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev, act_cnt->next_sub_policy = NULL; mtr_policy->is_hierarchy = 1; mtr_policy->dev = next_policy->dev; + if (next_policy->mark) + mtr_policy->mark = 1; action_flags |= MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY; break; -- 2.20.0