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 E945643C35; Thu, 29 Feb 2024 12:53:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9BD0542D27; Thu, 29 Feb 2024 12:52:45 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2067.outbound.protection.outlook.com [40.107.92.67]) by mails.dpdk.org (Postfix) with ESMTP id 0841C427E3 for ; Thu, 29 Feb 2024 12:52:44 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IPMzZWtBtDy6P6zZOSHLZvdLbD7ZUaLHVsNBeMuQhTjq5rkbQkeHpQhBmB6RhhREBzELDW3Pw3a9o/3mFwbZx44pdYxV0eACqjFMRCi1w/kNKvFmOCEF0WdQcbexXXYCQdONZKoiBdrlb6TpXr+hD4QGt2I0BmGUCOJq9XvhQOFnQPdn5kCZHATsqjCsTxV00b3q08BRVmjeHGoPSS//y+2O582jOGyMmhBIaczLUqoNKRuFx0G7K0bORq7o/DynlF0ksU17JMKexvocnDMSNkDBk8PuUJIMEJWBfKwsF8LuWISAqt+reHRoh6dYjBkF595MGLTZsBykw7cUh2R5Ug== 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=/F9n5WF51DoktZpzDpp7/iZMvufrvOEe2mEphubU2Eo=; b=MdBn2YS1m8pbV9IHKkmWHUT0974DQCsvG0E8MjiAO7MbfDOhS0g12o46d+rlWyxYhBKkfoQFm+E93rc+bzHnq6U5OTrWdHKhC2/aCjfA1MRAbFcegKBn24O1nC1o8uMPNcsy25ABvJ5yGQOZRTLngg8nGfKTR/7VMVpDKQmEG3sprAU9+7B3g0XO4YTHnqLame/DKgbd44vt9ehpPk23fdpVb/98Xna1w/QP04VtE8L3LWDAi5OAAc9fpL/YwimSqWPeLf5JWk43bDw4leua+2jkKdEMvJ0VW9P5FxhHexyOMqcrhecDk7jdpbZIjDghGB3FgSesHIFFUZjIG7J3cQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=/F9n5WF51DoktZpzDpp7/iZMvufrvOEe2mEphubU2Eo=; b=klU1gMrJz7xs3gGEzcHeXuA45lQEw7NAhso99zxpL1zpwrwGLezM8gpFyFYhUa9t3Idb7ZtXdGcdVlZNY/z601IfJbLk4JZa0Q01tAlkklUoyQ8c6jT3R/OR6zB9GufXm7+X4dUcm7RAyfME93XggbNSbpSEv02+DlZc/PA2ETxQ+fm9MdK/4Ju4XPhXOy3tqMREB+a75fWh+iUvZDNUnUPnZPRm7AdLUVq6pIHSeGj/Fn0QwlsPCSQe/7ZCn4xXt1a3+1CtlKyCz4m4j3/JJHzzVJEsFIKL2AcVfget7eU66OHFzGTOBXpBI1aU8IKRQLzNNnaja+98WBf9aSUy+Q== Received: from BLAPR05CA0004.namprd05.prod.outlook.com (2603:10b6:208:36e::8) by DM4PR12MB6592.namprd12.prod.outlook.com (2603:10b6:8:8a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Thu, 29 Feb 2024 11:52:41 +0000 Received: from BL6PEPF0001AB4B.namprd04.prod.outlook.com (2603:10b6:208:36e:cafe::a) by BLAPR05CA0004.outlook.office365.com (2603:10b6:208:36e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.12 via Frontend Transport; Thu, 29 Feb 2024 11:52:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL6PEPF0001AB4B.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Thu, 29 Feb 2024 11:52:40 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 29 Feb 2024 03:52:19 -0800 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, 29 Feb 2024 03:52:16 -0800 From: Dariusz Sosnowski To: Viacheslav Ovsiienko , Ori Kam , Suanming Mou , Matan Azrad CC: , Raslan Darawsheh , Bing Zhao , Erez Shitrit Subject: [PATCH v2 03/11] net/mlx5/hws: add check if matcher contains complex rules Date: Thu, 29 Feb 2024 12:51:48 +0100 Message-ID: <20240229115157.201671-4-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240229115157.201671-1-dsosnowski@nvidia.com> References: <20240228170046.176600-1-dsosnowski@nvidia.com> <20240229115157.201671-1-dsosnowski@nvidia.com> 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-TrafficTypeDiagnostic: BL6PEPF0001AB4B:EE_|DM4PR12MB6592:EE_ X-MS-Office365-Filtering-Correlation-Id: 69f37663-a75a-44a3-c221-08dc391ceeec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d2VPkrcz385zNNPFcEWrkH296MoGiDMSoiezSnHTIqAk0huqJ0iyy05WAsN1v4z+dC0nxbq5Sh1ODLp1fkUKLBkri6Sz8phq+J7m2ETQxdanWFzcYEsc+Baw8iVcHg+dnp/oQyPtvAeqrWKiykStqTz6iUHJqcd4vuCdth9T5F1FC4Nn+SmQ9oMfjvWnW+YOsSjn73cxsHk8YIIklm0jTb5HNabv/yZKy3qGR6S0N0dG28m/p/1TF3IArlw/LHRaFoLDN2GhWPPc/a6y7PQ4/WVW+dJsynzfJ1MIXX17OkuGEVbyfjQ80EjNHEmj/WDr90RmGvMMB6JPgNbTL9h37CorYDMw0JaOrvzTrDGZZP93cQ8/ZB9aJX7VSBffZcFlfF38Cimj8BLUtvosd4sjDYPO13RF4pzzdpJZ/Mp5V7KMblcYrOZGbV/G82U7TZPCzHMjJspSwRSKFhb4sGSW+SZM8VXuayX4zo/27jK1WdeL3yeoDBwKzQNlcJswsWMhHDR+M0LdjCPuwETdeCRoJlejZZCmAjmPwzlrz1SZgYxaGRoo733IYRaFEG6J6QfVzShyGP2vKF04DnX7m/EWutNKnSyFAipo9x/VPJQAUMxw9UT45oUfmHAQ8AZrpyqv97L0xK3K3wbp8YxjRCZBizZsj6NWU0NaM5uHew2l70SdPBVjFX4OqDGRcM7ZrjHbJBLWbAOyNZfMNx0NRQsKliLG8m/yDNaXp37PEsMAlE1Lb0Iz5XmA6F4iSQl0SyTq X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(82310400014)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 11:52:40.8253 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69f37663-a75a-44a3-c221-08dc391ceeec 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB4B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6592 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: Erez Shitrit The function returns true if that matcher can contain complicated rule, which means rule that needs more than one writing to the HW in order to have it. Signed-off-by: Erez Shitrit Acked-by: Ori Kam --- drivers/net/mlx5/hws/mlx5dr.h | 8 ++++++++ drivers/net/mlx5/hws/mlx5dr_action.c | 6 ++++++ drivers/net/mlx5/hws/mlx5dr_action.h | 2 ++ drivers/net/mlx5/hws/mlx5dr_matcher.c | 17 +++++++++++++++++ 4 files changed, 33 insertions(+) diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h index c5824a6480..36ecccf9ac 100644 --- a/drivers/net/mlx5/hws/mlx5dr.h +++ b/drivers/net/mlx5/hws/mlx5dr.h @@ -500,6 +500,14 @@ int mlx5dr_matcher_resize_rule_move(struct mlx5dr_matcher *src_matcher, */ bool mlx5dr_matcher_is_updatable(struct mlx5dr_matcher *matcher); +/* Check matcher if might contain rules that need complex structure + * + * @param[in] matcher + * that the rule belongs to. + * @return true when the matcher is contains such rules, false otherwise. + */ +bool mlx5dr_matcher_is_dependent(struct mlx5dr_matcher *matcher); + /* Get the size of the rule handle (mlx5dr_rule) to be used on rule creation. * * @return size in bytes of rule handle struct. diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index 96cad553aa..084d4d606e 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -3686,6 +3686,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->flags |= ASF_SINGLE1 | ASF_REMOVE; setter->set_single = &mlx5dr_action_setter_ipv6_route_ext_pop; setter->idx_single = i; + at->need_dep_write = true; break; case MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT: @@ -3712,6 +3713,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr; setter->idx_double = i; setter->extra_data = 2; + at->need_dep_write = true; break; case MLX5DR_ACTION_TYP_MODIFY_HDR: @@ -3720,6 +3722,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->flags |= ASF_DOUBLE | ASF_MODIFY; setter->set_double = &mlx5dr_action_setter_modify_header; setter->idx_double = i; + at->need_dep_write = true; break; case MLX5DR_ACTION_TYP_ASO_METER: @@ -3747,6 +3750,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->flags |= ASF_DOUBLE | ASF_INSERT; setter->set_double = &mlx5dr_action_setter_insert_ptr; setter->idx_double = i; + at->need_dep_write = true; break; case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3: @@ -3757,6 +3761,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->idx_double = i; setter->set_single = &mlx5dr_action_setter_common_decap; setter->idx_single = i; + at->need_dep_write = true; break; case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2: @@ -3765,6 +3770,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_INSERT; setter->set_double = &mlx5dr_action_setter_tnl_l3_to_l2; setter->idx_double = i; + at->need_dep_write = true; break; case MLX5DR_ACTION_TYP_TAG: diff --git a/drivers/net/mlx5/hws/mlx5dr_action.h b/drivers/net/mlx5/hws/mlx5dr_action.h index 064c18a90c..57e059a572 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.h +++ b/drivers/net/mlx5/hws/mlx5dr_action.h @@ -151,6 +151,8 @@ struct mlx5dr_action_template { uint8_t num_of_action_stes; uint8_t num_actions; uint8_t only_term; + /* indicates rule might require dependent wqe */ + bool need_dep_write; uint32_t flags; }; diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index 4e4da8e8f6..1c64abfa57 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -1542,6 +1542,23 @@ bool mlx5dr_matcher_is_updatable(struct mlx5dr_matcher *matcher) return true; } +bool mlx5dr_matcher_is_dependent(struct mlx5dr_matcher *matcher) +{ + int i; + + if (matcher->action_ste.max_stes || mlx5dr_matcher_req_fw_wqe(matcher)) + return true; + + for (i = 0; i < matcher->num_of_at; i++) { + struct mlx5dr_action_template *at = &matcher->at[i]; + + if (at->need_dep_write) + return true; + } + + return false; +} + static int mlx5dr_matcher_resize_precheck(struct mlx5dr_matcher *src_matcher, struct mlx5dr_matcher *dst_matcher) { -- 2.39.2