From patchwork Wed Jun 26 18:14:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Sosnowski X-Patchwork-Id: 141886 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 30CDF454E5; Wed, 26 Jun 2024 20:15:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F362A4065D; Wed, 26 Jun 2024 20:15:20 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2050.outbound.protection.outlook.com [40.107.237.50]) by mails.dpdk.org (Postfix) with ESMTP id 305A740647 for ; Wed, 26 Jun 2024 20:15:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lieLy/twN4CgdgTUrnNkZNpF7jrBaGUMeU3+E4ge0+yge31DWS7koxJzNZXLtBnhH5m/yMsqQxFl8zGZRdzcGdYlI4c3fnFTyDHwHDV/4LoCedRwDbqRFm3uYzh2SM2ablL54bJ7KrYVTve9lftDrx6kO3W1fSnmK5EmBkagz0RERw4AGc+KhapHTAgjDptt6ERzoZ4Vgcx3t6r8EM7HbPt0kI1YZrEmgExFLvJvdVGqcfJ+naAQbbTkqR22wbU4i5Zvht1MXU3nhG28NdBQ26UbSNhISrBim2n61iML0YZHbtKuZPpWPb/4QeuPTM7CmsWfPF2ILh0DHMPT0pBVJQ== 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=uF43DKZW5LP/IyPwaVtEyTlAbJFAurp9TAyR08u2Lj0=; b=ClZBPNgQ14JJmQYmPtuVJf/cq3KeWgJfDcnl0zHKj+tJudZ9tbn0gRgfy3gQAY+0oRIGzD41EPOgCsAinqNBPZA8KNdxP0RnYlJMHFVgvYdvE72uD5a90lX9Wyx8dgmJgCd73qyDGFC6Z9EGM7nU/YGIzMlR0SiPS9y+dzrX1Y/iWyYVdFN9MNc7zltwxMEFy2uODV4tuL/ejg1DxTGjwyIp81ud7gi7C1sTiu1fEuIWwrQ5xNH2JMI66aIK8kB9OCiza3r0XellSt88ajMiqDKyyif1YAs7e7eLJtRrNR8XRsZ7KxwvOvvRKT8tk1WSF6KXBS+n3xLSGZ3dtePuYA== 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=uF43DKZW5LP/IyPwaVtEyTlAbJFAurp9TAyR08u2Lj0=; b=fx3cl7CukQ8ovt0jkXdnAVqJjzJWBgqsanW3SHNa+1SrsDeVe7wb0Q7X/p36d3jJLa6nYy96ne81cGF0ZsmOg6BV8PUaiHM+m3ZOP2yvXNOAAixErJhbx6TYTiFMjPfH+ZTU3zLsjq3beYf1jJHGe5PgkQlEdgU+AddCmo6wVIwwTCCtnj0nbMjgVDLo3Drkz4Ta5kC6J/4Om567syYrobxiNLhlPHSKEBxWRNzQd/P9FIp55mamgUR+WeP6sxrPmgCzIkjm28OCK6qW1DMi/LBgjYab97EbZiEanoEf8e7/kU0GYXrcruhagXodB3wuyDX/+0ewbKjaqTf58zLaMw== Received: from SA1P222CA0196.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c4::23) by LV8PR12MB9334.namprd12.prod.outlook.com (2603:10b6:408:20b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Wed, 26 Jun 2024 18:15:12 +0000 Received: from SA2PEPF00003F62.namprd04.prod.outlook.com (2603:10b6:806:3c4:cafe::a4) by SA1P222CA0196.outlook.office365.com (2603:10b6:806:3c4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.24 via Frontend Transport; Wed, 26 Jun 2024 18:15:12 +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 SA2PEPF00003F62.mail.protection.outlook.com (10.167.248.37) 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:12 +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.1544.4; Wed, 26 Jun 2024 11:14: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, 26 Jun 2024 11:14:56 -0700 From: Dariusz Sosnowski To: Viacheslav Ovsiienko , Bing Zhao , Ori Kam , Suanming Mou , Matan Azrad CC: Subject: [PATCH v3 5/8] net/mlx5: store expected type on indirect action Date: Wed, 26 Jun 2024 20:14:25 +0200 Message-ID: <20240626181428.1678402-6-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 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: SA2PEPF00003F62:EE_|LV8PR12MB9334:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b253d1e-1bb8-49a5-de41-08dc960bebd1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230038|36860700011|82310400024|1800799022|376012; X-Microsoft-Antispam-Message-Info: umqVptsAgzmzTpfqAthuTbJL0uZ2SN5TymJnR7sVvaL3fkdeA7qM9G2aX4Slve/AFhnjWjno1SAq8oyuRIYFGg5iCCdjsp48rGUedoB9Z5bnjQo+3xzcOv3aP+7MxxFHVi8KQUJ1UORr/RkiGBD4do2zeuseQ18IRG0uVrIAkCMQTKEPs9iEDuocJEwvNgPw0C5RWOLe4/1xLOxh+R04rYrIRlZLRtTMhoHEMYOVNf1r2TW783QpAUXhqwOAut+fSYoVNnDZB2LLxlP5idi7aH6dMc6wFKCj3rkmmILbIgirGR5Osv7/jaqI5cksSzGvziohZtDo/jbXZQOXNHHZKhYw/J1aL2Abh082R1qgTIOwdNbehzgEjfiZo0KjgUT83oiPKoWRRGM8cg8ELjkReN4u6xfw5l5s3YKbKQcyb1UcmLKrW+pOysFOfUvESKznNfOdMTj3hoUTGfbv/5nOdwF1zZbp6k6O8an7TQpqTPH2vwKsQaCbn9egJe1Ow4OMOFpicv7AP2IF8rmlVl0iumO6TX3qGNfVxNhOPyeYob/5fcTau4UHGTnfUtUDl2ZNNu5AdLbWHmw7Gg23FwXbxCwB6THVXCHRKZJ7WM/g2ROW5/SZsZhvmlhztF4MdPsBXNsO8wibI8NDSuSZ2y2txovqoL4cjsfeeUpdkAxVpJjvWqvq3+KavwxKQ5TjoRwtXr2FIHAuzruTxS0w5jXIF89CCdjnt8J26oV+2GnHh10AfRTGguhrVaY9tbhG0aKIvPcs4xVsKKQLq0ezmIURJB213A0eLEgmlMkVsbi5j2FzsqhZQCDo0eddR5L7qYDfR0DTb6o8XLnjxGhmt+Ft74jw056ni+0jK0KPviSAF44c7beArjvWQaTwuzE7jr2/wFZ+AjRfPdB4vnK9Vw8DjtKjl24Yf89Mz0OKhO8Qb7FlrmvBINQQTahm2MkjNxJ7yE+m/uL7seI2NlrSBqvhvohVBFB+YSt1RpDhSr+DFhBmJZCKyorIQbNgOdrwjj0FVnyjsW4zR0BljOiRpSgYC8Cbj4eHzJ8Ji0EqVTo8OTFQbOUShPbcWuXglQw7/7yxYE20VbdYjQ5ufBPqeyPwlo0jMLLtOPfAQa7x8uKfUULKO4VWaeoIBzDYnlesIlLsy9/earXzQ1J5q7XFn4SFT/t3C7dq+vQU/6YwIQTf6wPJpeMPsNgmhur+7jkLw56ueMCslOm5cHu2CKTRL8Oe6iypeqaFOoPySfKiqEOtjNMRg1DB7R9g4ad63TODdyALHlwbSIpFMGoofovVxLgS/lXNTY05qKP+FFf3I8sNvYtrlUTqaN+23mzjDvB9Rw3uQZkeEhqOQ8+d2G1mnFtM/rrrbuszVrYFiIFv4VjqKZMeKv8SM7Opg4A8A8C/kF4RJKzKiOWKDnO3VDH0g0Z6Qg== 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:(13230038)(36860700011)(82310400024)(1800799022)(376012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 18:15:12.3411 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b253d1e-1bb8-49a5-de41-08dc960bebd1 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: SA2PEPF00003F62.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9334 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 template table is created, list of unmasked actions is recorded for future flow rule insertions. This patch expands entries for RTE_FLOW_ACTION_TYPE_INDIRECT actions in this list with information about expected indirect action type. This will be used in follow up commits which add flow rule operation validation. Specifically, this will be used to verify if indirect action provided by the user references an action of a correct type. Signed-off-by: Dariusz Sosnowski Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow.h | 4 ++++ drivers/net/mlx5/mlx5_flow_hw.c | 22 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 8e99e76e5d..33847e2272 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1442,6 +1442,10 @@ struct mlx5_action_construct_data { uint16_t action_dst; /* mlx5dr_rule_action dst offset. */ indirect_list_callback_t indirect_list_cb; union { + struct { + /* Expected type of indirection action. */ + enum rte_flow_action_type expected_type; + } indirect; struct { /* encap data len. */ uint16_t len; diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 1ccaf844b8..f337f76450 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -997,6 +997,24 @@ __flow_hw_act_data_general_append(struct mlx5_priv *priv, return 0; } +static __rte_always_inline int +__flow_hw_act_data_indirect_append(struct mlx5_priv *priv, + struct mlx5_hw_actions *acts, + enum rte_flow_action_type type, + enum rte_flow_action_type mask_type, + uint16_t action_src, + uint16_t action_dst) +{ + struct mlx5_action_construct_data *act_data; + + act_data = __flow_hw_act_data_alloc(priv, type, action_src, action_dst); + if (!act_data) + return -1; + act_data->indirect.expected_type = mask_type; + LIST_INSERT_HEAD(&acts->act_list, act_data, next); + return 0; +} + static __rte_always_inline int flow_hw_act_data_indirect_list_append(struct mlx5_priv *priv, struct mlx5_hw_actions *acts, @@ -2486,9 +2504,9 @@ __flow_hw_translate_actions_template(struct rte_eth_dev *dev, if (flow_hw_shared_action_translate (dev, actions, acts, src_pos, dr_pos)) goto err; - } else if (__flow_hw_act_data_general_append + } else if (__flow_hw_act_data_indirect_append (priv, acts, RTE_FLOW_ACTION_TYPE_INDIRECT, - src_pos, dr_pos)){ + masks->type, src_pos, dr_pos)){ goto err; } break;