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 1087644060; Wed, 12 Jun 2024 18:26:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1125D4278D; Wed, 12 Jun 2024 18:25:24 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2062.outbound.protection.outlook.com [40.107.223.62]) by mails.dpdk.org (Postfix) with ESMTP id C36CA42789 for ; Wed, 12 Jun 2024 18:25:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FJHblQ86z0XOpBgfzL+OZGr2ahfvgQvpT4/Z+v1bB++HQx5TY7sU5hhhrDxuWfC11FcqOCv+Suj8GxQ7OFrQZQ/N/3TG9SgmHCtxicSVpFAOSTcilYmZWlEwYdOza5UGkfnWUyDLaUmQ0Nh6PUNaoFvb0FbmkmbD8luucuAJB4xQ4mK/H97RnOejtqk7i9n60YDdB2tJSAHniy0+RZXa/C6roS2YnEBwIl1l7HA73Rt23n4xYEBnNwzYfoAZRR++f0Wo+YxvCQYSLznC8Hf7XNWEEJtU3nKhV7QqyyrsOIcRQ05un8sePLAzB+lQ/y5emb52s37+s8tL9fYGwmGHJA== 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=n836FNKIdWryr5874dRtvIyaj7msNr7pH0XojDndR0s=; b=mlPVZ9uAyCobwdURgA3aUhH//g4Hcswt7uKnUZrfNeydMmqaGOrdKPwm/f7bogOIE1XzZSjNyzz5AmrCoCiuCTJ1+XJAv98pAU33llrGYHZENzUTx24OJ21YCVF9H1p9jMTRSiKvnTOzcMu4AGldYMmtdV6ZWyPyUfZNro8NsMEi1TM3SW5aMeCyXagcNgDoqMkQqQbuOaNrDiTR7a42fqsbuh7xoIp/iUe9h2YBWlp+u9WEUkxs5EoWGozCELj253F/vhDPMH6pLoli9kL7ddO/E2Ttnr4grOGXRfas+n+fedBS+A+pcubsIbu93fNzWCSCu9zbBclUwaf6JyPaoA== 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=n836FNKIdWryr5874dRtvIyaj7msNr7pH0XojDndR0s=; b=bKPSFu1/GcM5V9vGxBW/VAV0nuuFORj+nCb69gIRNEjgL+K+QZSvarcz/rZZFAIwmsr+lcUN4JV6zH7V3UfJjOapARrGk1iQXbftDh+ZmMBmFLP4xphobBYAODbUO4YUJz5gW1l+sNtGbEKIUNjWcW82xXsxNs5GHe+WisAtU3y1aUoU2HZRIPvFQCBuyowPPJ03u3wnY3bMfdQFQB8sK/+dqfiKi1n+BvJmBSRbg25u5L4jhSHNvK4osM8iGryuozHCbIksptXBmeDWoG4kg7TlOdevj+hIwDsP6Cr0IHFaFzy0sWpqv0Uzug5FONomDcg+ERzdY2Q+8q9JscVYNg== Received: from MN2PR11CA0016.namprd11.prod.outlook.com (2603:10b6:208:23b::21) by SN7PR12MB7418.namprd12.prod.outlook.com (2603:10b6:806:2a5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Wed, 12 Jun 2024 16:25:18 +0000 Received: from BN2PEPF000044A7.namprd04.prod.outlook.com (2603:10b6:208:23b:cafe::e5) by MN2PR11CA0016.outlook.office365.com (2603:10b6:208:23b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.21 via Frontend Transport; Wed, 12 Jun 2024 16:25:18 +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 BN2PEPF000044A7.mail.protection.outlook.com (10.167.243.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Wed, 12 Jun 2024 16:25:17 +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.1544.4; Wed, 12 Jun 2024 09:24:57 -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.1544.4; Wed, 12 Jun 2024 09:24:55 -0700 From: Dariusz Sosnowski To: Viacheslav Ovsiienko , Ori Kam , Suanming Mou , Matan Azrad CC: Subject: [PATCH v2 4/8] net/mlx5: store original actions in template Date: Wed, 12 Jun 2024 18:24:22 +0200 Message-ID: <20240612162426.978117-5-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240612162426.978117-1-dsosnowski@nvidia.com> References: <20240605183419.489323-1-dsosnowski@nvidia.com> <20240612162426.978117-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: 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: BN2PEPF000044A7:EE_|SN7PR12MB7418:EE_ X-MS-Office365-Filtering-Correlation-Id: bdeb6a79-fe78-4e6c-3fad-08dc8afc3f7f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230034|36860700007|376008|1800799018|82310400020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?vHzbo1dFH/87zu+2NATz7Qofexicz3OCj/2dLvzKv/qZmXs6GSN3EvTE7W+o?= =?us-ascii?Q?45jL0yY5CkCi2qU+T+54C0pkdmw4UvtLoj2a1wXJ1EcgkmjoSIf5/Idq1tNP?= =?us-ascii?Q?Lx9e3g4BBRp+G7edVtmUtbemrx4RXc0WzCgGOdHO+OAxMgbBcHoB8/t+JC7z?= =?us-ascii?Q?FyfmdCu93xMLMk57nOEdAvHif+8YR0T/svKFiwNybOOPOIrp6GkrMfJR5T1W?= =?us-ascii?Q?dULNWxl4KQyzqOj7nGMKw7MtNBCZlRl3pjkgPVhXIK3GQwLweYJPA6BQ46Ba?= =?us-ascii?Q?ZK5nCXPpd/YTfzOtl3TKLQ9NEy1skU3zkfq5255uB9qlzE52+vRucdXuif9U?= =?us-ascii?Q?Wb3MwHDwKwJswb6gbmmkqG+e/kLdYW+HASPgjiTJHan1nPImWNCGwJ2/X4zq?= =?us-ascii?Q?Vml6ETAnUuVlnnU3THQotfYIbfR7QJnhXCFspb7YSSaZh1nrkyVgVoGcu7c/?= =?us-ascii?Q?2O0pdmG969ks0T1jzZruAKhGmSl33A0Wj2OdMQTWiZ6DpbZ/EnM+PAMl2n2x?= =?us-ascii?Q?Vbn1XWevMm/J/HPDDZjOp5Jrl55CNh08wnGWmx7q+PuMVjF+WQtlvhFxIaI9?= =?us-ascii?Q?TuVMC4KEOk/3uoSNvdorCWl3FDuBndhy4FKigL8RUvHytYwO0fr0o8qAqaoY?= =?us-ascii?Q?DuosC4S7ypuYhug18cjzq6OREkCQ3HuzVLZuhhQcvRCJocHjWYMCWeFWXFJT?= =?us-ascii?Q?8MsSFqwCzQckjO+70dJtgpze+hym3uh946LXnhW44sUy94tSjgxBwda1tkEV?= =?us-ascii?Q?c2K8haCQxBqMZ4vzFuVAAy1/MyvpsNNNfKf/GInMF1g65nJjYmkpUpCt8alN?= =?us-ascii?Q?HfaexzKxFsLJHZ0Trb69zGXwlmXKi45SPvoQgQhGogFpkN2HgAigbPVceAeB?= =?us-ascii?Q?/2KI2tOlKl//g3nbimVso80jA3GHNZ8iBlz1iLsHao0E8wP7HZRX/yttPsjf?= =?us-ascii?Q?u+1FrNeFUvZR4Q78Efmm6jdrKHrjzc3SlN+2jA1AhhJl2j02q/LualbIyEbK?= =?us-ascii?Q?rFP1HtK+be5dcdA6f2Py0JI0KpsbKKrLwFm7Q4Tmargwf+4vITm8t9MILnL5?= =?us-ascii?Q?OmdQBkbPPThJmRWq6faqKPngLCgLY9ASpCLh4xIUn+u+HaG55ximHMCCWwrX?= =?us-ascii?Q?AIvXNGz3+axfo7iyBOi0tYDkQZviZvkAid3ByoLRJ9qPLWh0Vya7nTpZuRgT?= =?us-ascii?Q?SlL38OBL0YzufG/CwfChZyp9Wf/QS+tJrwscBGG4KUmWLZb5djlwCj7wM8gT?= =?us-ascii?Q?ZI1ASsbTDRd8ay6Z/aajdfClP9OJBNP1FZok0KGkuCLB5RNkfEbt8P+r175A?= =?us-ascii?Q?Erq+2dz2QZmtlQPp3eKfWWmjd5NX+kgvB9ZUW64pOvcjxpGntMkAVMox2mMy?= =?us-ascii?Q?hOAO/6U4yuspGzgYE5KB7pU3/M+KuO7H/ynxtkrX1PPAzqBK9w=3D=3D?= 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:(13230034)(36860700007)(376008)(1800799018)(82310400020); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2024 16:25:17.9432 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bdeb6a79-fe78-4e6c-3fad-08dc8afc3f7f 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: BN2PEPF000044A7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7418 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 When actions template is created in mlx5 PMD, some actions will be replaced with another or some actions will be added to implement required template semantics on NVIDIA NICs. For example: - RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID actions is replaced with modify field action. - Modify field action is added for preserving metadata between FDB and NIC domains. - Modify field action is added when quota action is used to amend ASO syndrome. Types of actions and their order in flow rules based on some actions template must match the original, not modified one. This patch adds preserving of the original actions for actions template to allow for easier validation of ordering and types on fast path. Signed-off-by: Dariusz Sosnowski Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow.h | 1 + drivers/net/mlx5/mlx5_flow_hw.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 5c2cc2b7c1..8e99e76e5d 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1532,6 +1532,7 @@ struct rte_flow_actions_template { /* Template attributes. */ struct rte_flow_actions_template_attr attr; struct rte_flow_action *actions; /* Cached flow actions. */ + struct rte_flow_action *orig_actions; /* Original flow actions. */ struct rte_flow_action *masks; /* Cached action masks.*/ struct mlx5dr_action_template *tmpl; /* mlx5dr action template. */ uint64_t action_flags; /* Bit-map of all valid action in template. */ diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 0ddae54ed2..ddc9cf24d6 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -7745,6 +7745,7 @@ __flow_hw_actions_template_create(struct rte_eth_dev *dev, { struct mlx5_priv *priv = dev->data->dev_private; int len, act_len, mask_len; + int orig_act_len; unsigned int act_num; unsigned int i; struct rte_flow_actions_template *at = NULL; @@ -7862,6 +7863,10 @@ __flow_hw_actions_template_create(struct rte_eth_dev *dev, len += RTE_ALIGN(mask_len, 16); len += RTE_ALIGN(act_num * sizeof(*at->dr_off), 16); len += RTE_ALIGN(act_num * sizeof(*at->src_off), 16); + orig_act_len = rte_flow_conv(RTE_FLOW_CONV_OP_ACTIONS, NULL, 0, actions, error); + if (orig_act_len <= 0) + return NULL; + len += RTE_ALIGN(orig_act_len, 16); at = mlx5_malloc(MLX5_MEM_ZERO, len + sizeof(*at), RTE_CACHE_LINE_SIZE, rte_socket_id()); if (!at) { @@ -7889,6 +7894,12 @@ __flow_hw_actions_template_create(struct rte_eth_dev *dev, at->src_off = RTE_PTR_ADD(at->dr_off, RTE_ALIGN(act_num * sizeof(*at->dr_off), 16)); memcpy(at->src_off, src_off, act_num * sizeof(at->src_off[0])); + at->orig_actions = RTE_PTR_ADD(at->src_off, + RTE_ALIGN(act_num * sizeof(*at->src_off), 16)); + orig_act_len = rte_flow_conv(RTE_FLOW_CONV_OP_ACTIONS, at->orig_actions, orig_act_len, + actions, error); + if (orig_act_len <= 0) + goto error; at->actions_num = act_num; for (i = 0; i < at->actions_num; ++i) at->dr_off[i] = UINT16_MAX; -- 2.39.2