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 9162743E57 for ; Sat, 13 Apr 2024 14:56:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B0F840DD8; Sat, 13 Apr 2024 14:56:02 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2066.outbound.protection.outlook.com [40.107.223.66]) by mails.dpdk.org (Postfix) with ESMTP id D24E3400D6 for ; Sat, 13 Apr 2024 14:56:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QEPrzpzsk67w3a0wlhEG4/KVldZoCDJy4wrDGoJg99Pe/aYHiv9ajis7cxgBo8eD1WEx5peUjTOEFI5kmADaPUoQjr8z9Xg7RSwYdgLM+fkju7JU92zVpF8BK/hPSePbWNtW5wC8ajSEonT6Lx+9az0PpFDqIczB9YYC4MDMmRXzzCIkPqNyZcRpErxZ3TwsKIqvHqz/iEw8brPhXDy4hBpIF8CMsQkxfY6z91ahTze+tDkYqNFMphX5i7D2LVfh9Ne1/co/rUsM8CQWtegpOdiCF/nhABDN8dxt/Jk+sMX+RHyk258t7yuaU5B/w1oNCupNStmwzMP3ojG+uII/3Q== 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=wXOaM6+sJufJasS+R5j0O62FF3JolEZnldEhdoPs/AQ=; b=Y04Rlcc9alCi2eu51HBYkxp4qbyKa2IxXUvcCbCPPhZ4zD7RZG4Q6X/4ntYEEtdGyos4WsnjyP6HErVXBkF5u1VTN+xPCIoJH9ez8t9pxIOKWoMzMQDC0LXOFFfIIh5yP7eZT7ZSct9Eu8zOpX6QJvQaJrfntWSoCq8cslPKPJKHTgMesOdG252VncxtjMpWFaFzjUEwAfPtvUI9HKo95m4fw5J5Xy+Gx0NAfRxQ9VqZhrx5sMww+4K4Zqh0W0OyUKw37OvnGNK8uGiH1fgDRto+upnnxfpyPeUxVFdLqHjVVN5x+TCUvN7Vd+/wJlSGXUKUgqbzPiOjrX/EPZHIOQ== 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=wXOaM6+sJufJasS+R5j0O62FF3JolEZnldEhdoPs/AQ=; b=ciQhiCzymKj5dChoWvyYIFbt7thxKL3CfWmyVKtmHhiepm5uwqh+Cx+QjWXf8VmMUbLZUmQ2ph+R/VdFfNpVT+U2t005nIEs4XPKCvbKHLAP1zYI/+ZL5tqvgSuG2FBvatwE2XAcpmNScAwhuM1eCzf/CzQ5tJKvfhh1W314SseKzGuonrABwcpeytWYGsuaR9yFYWO+M7OXvLpBCD+ukOsncSO3EJEwD0lcWtBPRZEc3O9WrWVlld8ApW1F2e/TnhH/azAJAAETqEcX49V/QrnniMrmVAjws1k5Xy3EF0+wvjCq1X7ZKUAjSLq6b+66BgyCmMTjYkeRQ7xTmwUh5g== Received: from SJ0PR05CA0140.namprd05.prod.outlook.com (2603:10b6:a03:33d::25) by SA1PR12MB6920.namprd12.prod.outlook.com (2603:10b6:806:258::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.43; Sat, 13 Apr 2024 12:55:54 +0000 Received: from SJ1PEPF00001CDD.namprd05.prod.outlook.com (2603:10b6:a03:33d:cafe::27) by SJ0PR05CA0140.outlook.office365.com (2603:10b6:a03:33d::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7495.16 via Frontend Transport; Sat, 13 Apr 2024 12:55:54 +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 SJ1PEPF00001CDD.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Sat, 13 Apr 2024 12:55:54 +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; Sat, 13 Apr 2024 05:55:45 -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.1258.12; Sat, 13 Apr 2024 05:55:44 -0700 From: Xueming Li To: Gregory Etelson CC: Suanming Mou , dpdk stable Subject: patch 'net/mlx5: fix flow action template expansion' has been queued to stable release 23.11.1 Date: Sat, 13 Apr 2024 20:49:01 +0800 Message-ID: <20240413125005.725659-61-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240413125005.725659-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> <20240413125005.725659-1-xuemingl@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: SJ1PEPF00001CDD:EE_|SA1PR12MB6920:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d60ffb8-d062-4a90-cb8e-08dc5bb90e31 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UdKlM18/UEQSm0YqiFp8MeZIZNiveod8+rbhZXH41LpcO4z6n3Rwhnck5jTWvqhtoD+oZnsWfADKWqOBmpSud81du+AWgoxrT8VLy0U1CGT6UD7q/obRXf5S0ER49DmCH9TQeTssByZ9EnP9jX3bnSdVyElw2KMl6UeVTI4PjvMHH5thosB6qJ8ve1dOns1eMqVdEuq5JYNJlTqWlD2fw5XdspWyKXkIoVdDtdMKYhk60gZ3RBBhkE6V0VJQiHMPbYVBTGCD5EjT56qlzfzkHMxvcspPD+eUDtFqshV+8+WD1e775E4plhJeAz6jLnXob0wsNNsaalwlaFBVK761uK5EKFDh44jnuFzq3rTTPSL38CPXVv9CbKdeZzDa2HWNNvkN+29QORa3ANN31zqaUzMdWzDGseZndR1iM0OVVaxwvbRLrVz0RX1FvgX3TJOtfoG3NBvIs8js7pZPwSzYZOtmDOCCefH1eisq3t8siI7Ucck2WHxZ7gDaEj3yQfwzUnlNYxHVue43xR+INuHFIFgvvP2iNMmz66eWCjqLFSgfgQhD2FPAwAR1f0JtaIj31rPIf11BaUYrchzhHAVhBaXLoRcZIWTzjH0exx3aLIvxE+Yo5s1B78088+cwZdqY3YEIRfMx5fByCBRreKHNVPka32tVp/5HUaLbZSLtau4WdCEPYYw8/l3OFUP47RpG8t+V5iI2IsMzQXOivi1xoWjK8R/UIaLtMnblb6KKDPHj+Y659Z5hDLxlLtd7NUAe 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)(1800799015)(82310400014)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2024 12:55:54.4833 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4d60ffb8-d062-4a90-cb8e-08dc5bb90e31 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: SJ1PEPF00001CDD.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6920 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 23.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/15/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=a10a65c3967651721c6a09c6d554536c2b769ac5 Thanks. Xueming Li --- >From a10a65c3967651721c6a09c6d554536c2b769ac5 Mon Sep 17 00:00:00 2001 From: Gregory Etelson Date: Thu, 29 Feb 2024 12:19:55 +0200 Subject: [PATCH] net/mlx5: fix flow action template expansion Cc: Xueming Li [ upstream commit 487191742f4620392ca103c4e2a3a69491a2ea2c ] MLX5 PMD actions template compilation may implicitly add MODIFY_HEADER to actions list provided by application. MLX5 actions in a template list must be arranged according to the HW supported order. The PMD must place new MODIFY_HEADER in the correct location relative to existing actions. The patch adds indirect actions list to calculation of the new MODIFY_HEADER location. Fixes: e26f50adbf38 ("net/mlx5: support indirect list meter mark action") Signed-off-by: Gregory Etelson Acked-by: Suanming Mou --- drivers/net/mlx5/mlx5_flow_hw.c | 80 +++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 7cef9bd3ff..7e4ead1875 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -110,6 +110,9 @@ mlx5_tbl_multi_pattern_process(struct rte_eth_dev *dev, struct mlx5_tbl_multi_pattern_ctx *mpat, struct rte_flow_error *error); +static __rte_always_inline enum mlx5_indirect_list_type +flow_hw_inlist_type_get(const struct rte_flow_action *actions); + static __rte_always_inline int mlx5_multi_pattern_reformat_to_index(enum mlx5dr_action_type type) { @@ -5456,6 +5459,69 @@ mlx5_decap_encap_reformat_type(const struct rte_flow_action *actions, MLX5_FLOW_ACTION_ENCAP : MLX5_FLOW_ACTION_DECAP; } +enum mlx5_hw_indirect_list_relative_position { + MLX5_INDIRECT_LIST_POSITION_UNKNOWN = -1, + MLX5_INDIRECT_LIST_POSITION_BEFORE_MH = 0, + MLX5_INDIRECT_LIST_POSITION_AFTER_MH, +}; + +static enum mlx5_hw_indirect_list_relative_position +mlx5_hw_indirect_list_mh_position(const struct rte_flow_action *action) +{ + const struct rte_flow_action_indirect_list *conf = action->conf; + enum mlx5_indirect_list_type list_type = mlx5_get_indirect_list_type(conf->handle); + enum mlx5_hw_indirect_list_relative_position pos = MLX5_INDIRECT_LIST_POSITION_UNKNOWN; + const union { + struct mlx5_indlst_legacy *legacy; + struct mlx5_hw_encap_decap_action *reformat; + struct rte_flow_action_list_handle *handle; + } h = { .handle = conf->handle}; + + switch (list_type) { + case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY: + switch (h.legacy->legacy_type) { + case RTE_FLOW_ACTION_TYPE_AGE: + case RTE_FLOW_ACTION_TYPE_COUNT: + case RTE_FLOW_ACTION_TYPE_CONNTRACK: + case RTE_FLOW_ACTION_TYPE_METER_MARK: + case RTE_FLOW_ACTION_TYPE_QUOTA: + pos = MLX5_INDIRECT_LIST_POSITION_BEFORE_MH; + break; + case RTE_FLOW_ACTION_TYPE_RSS: + pos = MLX5_INDIRECT_LIST_POSITION_AFTER_MH; + break; + default: + pos = MLX5_INDIRECT_LIST_POSITION_UNKNOWN; + break; + } + break; + case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR: + pos = MLX5_INDIRECT_LIST_POSITION_AFTER_MH; + break; + case MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT: + switch (h.reformat->action_type) { + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2: + pos = MLX5_INDIRECT_LIST_POSITION_BEFORE_MH; + break; + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3: + pos = MLX5_INDIRECT_LIST_POSITION_AFTER_MH; + break; + default: + pos = MLX5_INDIRECT_LIST_POSITION_UNKNOWN; + break; + } + break; + default: + pos = MLX5_INDIRECT_LIST_POSITION_UNKNOWN; + break; + } + return pos; +} + +#define MLX5_HW_EXPAND_MH_FAILED 0xffff + static inline uint16_t flow_hw_template_expand_modify_field(struct rte_flow_action actions[], struct rte_flow_action masks[], @@ -5492,6 +5558,7 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[], * @see action_order_arr[] */ for (i = act_num - 2; (int)i >= 0; i--) { + enum mlx5_hw_indirect_list_relative_position pos; enum rte_flow_action_type type = actions[i].type; uint64_t reformat_type; @@ -5522,6 +5589,13 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[], if (actions[i - 1].type == RTE_FLOW_ACTION_TYPE_RAW_DECAP) i--; break; + case RTE_FLOW_ACTION_TYPE_INDIRECT_LIST: + pos = mlx5_hw_indirect_list_mh_position(&actions[i]); + if (pos == MLX5_INDIRECT_LIST_POSITION_UNKNOWN) + return MLX5_HW_EXPAND_MH_FAILED; + if (pos == MLX5_INDIRECT_LIST_POSITION_BEFORE_MH) + goto insert; + break; default: i++; /* new MF inserted AFTER actions[i] */ goto insert; @@ -6476,6 +6550,12 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, action_flags, act_num, expand_mf_num); + if (pos == MLX5_HW_EXPAND_MH_FAILED) { + rte_flow_error_set(error, ENOMEM, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, "modify header expansion failed"); + return NULL; + } act_num += expand_mf_num; for (i = pos + expand_mf_num; i < act_num; i++) src_off[i] += expand_mf_num; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-04-13 20:43:06.928512110 +0800 +++ 0061-net-mlx5-fix-flow-action-template-expansion.patch 2024-04-13 20:43:05.007753918 +0800 @@ -1 +1 @@ -From 487191742f4620392ca103c4e2a3a69491a2ea2c Mon Sep 17 00:00:00 2001 +From a10a65c3967651721c6a09c6d554536c2b769ac5 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 487191742f4620392ca103c4e2a3a69491a2ea2c ] @@ -17 +19,0 @@ -Cc: stable@dpdk.org @@ -26 +28 @@ -index c1dbdc5f19..f3f4649c5d 100644 +index 7cef9bd3ff..7e4ead1875 100644 @@ -29,3 +31,3 @@ -@@ -88,6 +88,9 @@ mlx5_tbl_multi_pattern_process(struct rte_eth_dev *dev, - static void - mlx5_destroy_multi_pattern_segment(struct mlx5_multi_pattern_segment *segment); +@@ -110,6 +110,9 @@ mlx5_tbl_multi_pattern_process(struct rte_eth_dev *dev, + struct mlx5_tbl_multi_pattern_ctx *mpat, + struct rte_flow_error *error); @@ -39 +41 @@ -@@ -5820,6 +5823,69 @@ mlx5_decap_encap_reformat_type(const struct rte_flow_action *actions, +@@ -5456,6 +5459,69 @@ mlx5_decap_encap_reformat_type(const struct rte_flow_action *actions, @@ -109 +111 @@ -@@ -5856,6 +5922,7 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[], +@@ -5492,6 +5558,7 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[], @@ -117 +119 @@ -@@ -5886,6 +5953,13 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[], +@@ -5522,6 +5589,13 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[], @@ -131 +133 @@ -@@ -6891,6 +6965,12 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, +@@ -6476,6 +6550,12 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev,