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 6CE88454E5; Wed, 26 Jun 2024 20:15:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB9DD4066D; Wed, 26 Jun 2024 20:15:29 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2081.outbound.protection.outlook.com [40.107.93.81]) by mails.dpdk.org (Postfix) with ESMTP id D352A40656 for ; Wed, 26 Jun 2024 20:15:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N0Dgpo3y/L2Qyb4xssgsD1BW7TO2kc0k1WJz9/2rxrNoGg5nr7APyb9RCFSL/0Y7S2J+E2awuqrjUnFngcEJPBrT4XWrwAHBYNn7GVbl5dc8RSQQHLbcmOV71e5PfHsqtph+kK/HIcb8AC89HHBIIKXvA5WuSiEtA+q+9j8eB+Fe4DFYKv1GlmgeaBkXxT6mwkMA6Mp+mpXYo+36DgNoW98k1i+ctu3J6kNM2X8k+g6U5ghj3F4sHVC855EI/GbH59z3GGhgDYRe1rrPX6S65od5x7TP8oNAarKdGolU7VZRwvpJPiZQ7a4peP2ubhjivHqYzskCTCQqpKoYuG0vUQ== 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=4mYeLSUW22UBtEcm9RdTCxzRYnNplfZDxnPywHMdTvM=; b=KRFeeg8UGY+NhvVMNQkz9SfVC7aIG9jxWDpo1QAIAxiq41wl9FbFKrNoqmoHQFKcXDdgAfiRmRLgZf5tnDk4GMlZWd9/YeaPsnkR+0+mPB0uDYy318Jt0tFPMTAGJbTV3d2QhrMIJN+Z+h1hpxTBUXTk+As3BAgVEDg02qoYQLM07FjOkGQevP5Mn2C9OKOkBmNQ5dJydT9qH4dgm1cxdP2Xomk6F5533EotY3VG9thH/FSGgfv+iQxWK/dTSXBNXQ6NFAInnY8l7lzESIm9UoY8We8JteH5JGYgBNhpRbozfrOYsmbdiRntQEuqDYCDzEH3qB7kY7i7h9SgDq6BbQ== 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=4mYeLSUW22UBtEcm9RdTCxzRYnNplfZDxnPywHMdTvM=; b=L+HfLPN2sP8fWatgbkIz5JTMLRE2C+v2c/nXjmlMMvoMlpou0hEe/G0LCslIvy8+99ya8agIZsF0Kw9LhUW61kHH29QWlRRx3Wiv9Org2BueyYRXsEnjVFlYqqaXAR69A96/sC/IHfh+uTVjWd+D8JivND1gcKuMUtB7L7ZAJoBy+ytnptoNUgNJq06pL2k5TVn/aZfIg/18OLOnnJxUoHGS55mFNDwL3w/IQjWAulXtP42q7FgR4W2hOuC+34NPUocrh8MNe07JidfsPpGnHGx8oTKVSKzTT0Z6QMziNq4+6PvsLELuo7IwuC7YTgw9EBiArX6Olk/iQuMlCdAX9g== Received: from SJ0PR13CA0092.namprd13.prod.outlook.com (2603:10b6:a03:2c5::7) by PH7PR12MB7211.namprd12.prod.outlook.com (2603:10b6:510:206::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.28; Wed, 26 Jun 2024 18:15:11 +0000 Received: from SJ5PEPF000001CB.namprd05.prod.outlook.com (2603:10b6:a03:2c5:cafe::e8) by SJ0PR13CA0092.outlook.office365.com (2603:10b6:a03:2c5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.16 via Frontend Transport; Wed, 26 Jun 2024 18:15:11 +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 SJ5PEPF000001CB.mail.protection.outlook.com (10.167.242.40) 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, 26 Jun 2024 18:15:11 +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, 26 Jun 2024 11:14:55 -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, 26 Jun 2024 11:14:54 -0700 From: Dariusz Sosnowski To: Viacheslav Ovsiienko , Bing Zhao , Ori Kam , Suanming Mou , Matan Azrad CC: Subject: [PATCH v3 4/8] net/mlx5: store original actions in template Date: Wed, 26 Jun 2024 20:14:24 +0200 Message-ID: <20240626181428.1678402-5-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240626181428.1678402-1-dsosnowski@nvidia.com> References: <20240612162426.978117-1-dsosnowski@nvidia.com> <20240626181428.1678402-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: SJ5PEPF000001CB:EE_|PH7PR12MB7211:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a5c1797-3312-4e16-f986-08dc960beb6d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230038|1800799022|82310400024|36860700011|376012; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Dvqxa9GzQtIecgMbbMO2oh71+vDqatEnom0E8hgPJb9f35Ox21TZRfVQyCPu?= =?us-ascii?Q?QFgYh/zFL8vWS/WOATB5DV7o0GMKRqDXxm+9d0Wb5Ogyj/9i3x2cOUtK2YuP?= =?us-ascii?Q?5sI1gsTD1TMligqxlGzSrpKy6hlG8SYfll+MhVBCWYBgjrx7fOJ6BWAif2+y?= =?us-ascii?Q?r/12q0Kc0lpzOIFhq/xBKes+Yy7JS3viv2O1tMdDtWIylzIYcEffvpzGu2g0?= =?us-ascii?Q?AEgpWO67v6jlhP946aWK+s2YahN/HUzpfPFt8a5HrqUvziNT7bOUh4LGny4Y?= =?us-ascii?Q?Z9vJA2dcWe9Vd+Anj0W4hO65CIiP8VsXcItekvbp8FLuea2c5/bHzWqhm65F?= =?us-ascii?Q?KtrB6aQZabU80j9HD/goDGF9NfAhfIqlsnzjW0eojlvlZnp7TDjpUGFKhgQx?= =?us-ascii?Q?jVsi9QM7tpotiUyvnVm0o8fOnVCzNQXXhGRh+YWHxMRZQGsmrHf7le0x53Jj?= =?us-ascii?Q?RXgZnLzfXKUijNFA72n6ibDripID5DKkpRC0qv1jt85s0sMVpTbZJ6U4PHTJ?= =?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OY7KynhAlqxq0x7SAQ3?= =?us-ascii?Q?IjsOrg4y26irH22XQxPGnuTFoqZOym86?= 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:(13230038)(1800799022)(82310400024)(36860700011)(376012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 18:15:11.8115 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a5c1797-3312-4e16-f986-08dc960beb6d 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: SJ5PEPF000001CB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7211 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 1ad261d529..1ccaf844b8 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -7750,6 +7750,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; @@ -7867,6 +7868,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) { @@ -7894,6 +7899,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