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 39D3B42DD1; Tue, 4 Jul 2023 12:48:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2924242D12; Tue, 4 Jul 2023 12:48:27 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id C576242D10 for ; Tue, 4 Jul 2023 12:48:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BrhN80NhVUzTpivoGS1fmvwgD5iNnjSULpRssJHxm2zhIhnNixTK1HpImvlYxaxK5nH/et2nD2XSVbHYYjwH+P083SiIftAyLmKh4EmJabvn049Ou4fx1a3xKG4QFBorETqCOUtcv1p44no7LtKjTjvqE0Drv5b7U44CDxvLM2ieEJRbYpv26iRig3k6psJf7VQVYgaGTx/BXTRP8qd7U0fF6SfTNk9w3zNA23N2klYogYSkFtKvWOMyMcdXBHxAHZW5fy6x8LNXW7IzPP+QtgFw9mZftSu5TJ1IrLt1ATG0YPzcRlzTe2z6DUNB5ycbgIGd4VCxwut6cG5nXEeqSw== 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=s6Z870rGHHMAyojkZY2etlAQXfIvYJcSpEVQo0/BLZM=; b=NoG8hTyXBUzTHTP78KXORh+c+FW/fGpI5+XKa0zfCBCdzBEAsbWEIP5TZ/g/jpAk1dy+/l3InWWW0bn6aBk2+WLUxz16VpAeM5zoYX51WelyQ4O/qk+rcC1AfD4JL499GoizJ+1PRm1GxNOh2I1fZoY4G3RtYcD0kET0K0VWGVYhg6gjXi26jAgLH9OVJcgtv9fJY6OAiczhbm0xzHZ3EZZjb4vbWFZ6xxaJcoLSKcC7/1UD5MarymmwkqWWuKmlydRjMLbZWvowGeNka261e5lwr1cccUjiWsLdD5Z0uoGSxqZZMUWb4MY6xVKt6+ZXGY0J//9RLbhZo+qN3XZYZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=monjalon.net 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 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=s6Z870rGHHMAyojkZY2etlAQXfIvYJcSpEVQo0/BLZM=; b=LMapwCjWteXIAlC4akkWV4b7G6PKTOpMCtsh4DoR0jMS5Azrmpgt6qyr+VUvjUAEsNMy90Gil4YqJHO+diMkBFdzNKg4Y9KMTdvD3fatOKFYR8/Te3Gsrx0de03viN3rSIOaopyQDXWFLbDPsX6O5Nk5K+iI977nhddpTvwuP+WfAb3P4vaNdvE/eIsHy4iMp5HSa+OD+FkPg+GWwfGtbCTRpIasglOLalTr6FQN0GO1IDYlBdo0BCksm6Lg9F/ntx2YBevMP2Fjdo3RA7EGcIfssvIRW4vFvUEEpyhkh8w4H4VUkP/vEs1dYOig4afFAr5c5ngP82WXpQJ4GhxtQg== Received: from MW4PR04CA0207.namprd04.prod.outlook.com (2603:10b6:303:86::32) by MN2PR12MB4189.namprd12.prod.outlook.com (2603:10b6:208:1d8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Tue, 4 Jul 2023 10:48:23 +0000 Received: from CO1NAM11FT076.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::ef) by MW4PR04CA0207.outlook.office365.com (2603:10b6:303:86::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.31 via Frontend Transport; Tue, 4 Jul 2023 10:48:23 +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 CO1NAM11FT076.mail.protection.outlook.com (10.13.174.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.43 via Frontend Transport; Tue, 4 Jul 2023 10:48:23 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) 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.986.5; Tue, 4 Jul 2023 03:48:12 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 4 Jul 2023 03:48:11 -0700 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Tue, 4 Jul 2023 03:48:09 -0700 From: Itamar Gozlan To: , , , , , Ori Kam CC: , Shun Hao Subject: [v1 3/5] net/mlx5/hws: remove duplicated reformat type Date: Tue, 4 Jul 2023 13:46:43 +0300 Message-ID: <20230704104645.19800-3-igozlan@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230704104645.19800-1-igozlan@nvidia.com> References: <20230702045758.23244-4-igozlan@nvidia.com> <20230704104645.19800-1-igozlan@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT076:EE_|MN2PR12MB4189:EE_ X-MS-Office365-Filtering-Correlation-Id: 86441812-9f92-4b7a-6aa4-08db7c7c3057 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GF0u86s4NH8E4XgD5xObdB4SUTjcIBpsUXsybLrahvlZrxjduMdQzd7r3s8CvnzRzuKdLt0Ri8CoSPfhXpTTwpHxYdB9qqRDivSoJ62QBST6vQS/q1CjyRpCWoma1qoHgncgPcemN9/wDm+4QBXOQRPjfCYcwmugX/D4EHoMAfRbNRlKVIzVXg/8VULshCHfzqGaxINN+sNHDk3PyUIR5+VIy/NKDCCws/5y9Qw7T5urEFQf1FTorl2ij2wzzZcJ7hFgjZYo11SA+CqhwF0AVvj4miBRvU14sSHfWr3UNpBc77HNZlw87qQFex9HfB5LUoYxnodUjZb6QP3B1JB3rxhR/UbkwPCa/KtlYfXRMeRsWdjpbVnFAVCPDht437uhGCF8CazcW95ukyltXfJbNSKgDkGCB6lySVdRdg5D9KSpAgyyrSq7HxBJ2pXsuhnxyHqqF4gOPg+5sHJDXdIq9x7V7RpP2QIDHaMZz3+6Nd4Sb+HcMfkzn01zcxRiQkfwe9C4megH6PiafFeqtxPwY+qWSB5Lq96Uh7oVLmg/0Le//HGvbRVA9z5UDnAV1a0Y5c3bhANvMpzE0wVodM6D9FJk1+JXoc3vun7LNV6XWhRoQqc+3Taz7LKxbVBU908I00HCpGUrqGW/GahsHhFtdtC8viisGx3sFCFaxvIaqcksr2rdJY5WRIimEsDaGSVezhKPVlXZnQgWKDkDZRRi9/Rv71zhCQAFQWardN8LeK1SzjX02MJfSQ4nZdSHWb29 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:(13230028)(4636009)(39860400002)(376002)(346002)(396003)(136003)(451199021)(36840700001)(40470700004)(46966006)(336012)(40460700003)(41300700001)(86362001)(7696005)(30864003)(6666004)(82310400005)(2616005)(7636003)(107886003)(6286002)(83380400001)(356005)(82740400003)(186003)(1076003)(426003)(26005)(47076005)(36860700001)(40480700001)(55016003)(54906003)(110136005)(2906002)(478600001)(36756003)(316002)(70586007)(4326008)(70206006)(6636002)(8936002)(8676002)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2023 10:48:23.0318 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86441812-9f92-4b7a-6aa4-08db7c7c3057 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: CO1NAM11FT076.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4189 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: Shun Hao Currently there are two enum definitions for reformat type: mlx5dr_action_reformat_type and mlx5dr_action_type. They are actually the same. This patch remove the unnecessary mlx5dr_action_reformat_type so use only one definition for reformat type. Signed-off-by: Shun Hao Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr.h | 19 ++--- drivers/net/mlx5/hws/mlx5dr_action.c | 110 ++++++++++---------------- drivers/net/mlx5/hws/mlx5dr_debug.c | 8 +- drivers/net/mlx5/hws/mlx5dr_pat_arg.c | 2 +- drivers/net/mlx5/mlx5_flow_hw.c | 34 ++++---- 5 files changed, 68 insertions(+), 105 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h index 7942fb0a8f..7d5af4c9bb 100644 --- a/drivers/net/mlx5/hws/mlx5dr.h +++ b/drivers/net/mlx5/hws/mlx5dr.h @@ -29,10 +29,10 @@ enum mlx5dr_matcher_resource_mode { enum mlx5dr_action_type { MLX5DR_ACTION_TYP_LAST, - MLX5DR_ACTION_TYP_TNL_L2_TO_L2, - MLX5DR_ACTION_TYP_L2_TO_TNL_L2, - MLX5DR_ACTION_TYP_TNL_L3_TO_L2, - MLX5DR_ACTION_TYP_L2_TO_TNL_L3, + MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2, + MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2, + MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2, + MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3, MLX5DR_ACTION_TYP_DROP, MLX5DR_ACTION_TYP_TIR, MLX5DR_ACTION_TYP_FT, @@ -62,13 +62,6 @@ enum mlx5dr_action_flags { MLX5DR_ACTION_FLAG_SHARED = 1 << 6, }; -enum mlx5dr_action_reformat_type { - MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2, - MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2, - MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2, - MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3, -}; - enum mlx5dr_action_aso_meter_color { MLX5DR_ACTION_ASO_METER_COLOR_RED = 0x0, MLX5DR_ACTION_ASO_METER_COLOR_YELLOW = 0x1, @@ -487,7 +480,7 @@ mlx5dr_action_create_counter(struct mlx5dr_context *ctx, * @param[in] ctx * The context in which the new action will be created. * @param[in] reformat_type - * Type of reformat. + * Type of reformat prefixed with MLX5DR_ACTION_TYP_REFORMAT. * @param[in] data_sz * Size in bytes of data. * @param[in] inline_data @@ -500,7 +493,7 @@ mlx5dr_action_create_counter(struct mlx5dr_context *ctx, */ struct mlx5dr_action * mlx5dr_action_create_reformat(struct mlx5dr_context *ctx, - enum mlx5dr_action_reformat_type reformat_type, + enum mlx5dr_action_type reformat_type, size_t data_sz, void *inline_data, uint32_t log_bulk_size, diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index e2db85940c..851cee8802 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -18,8 +18,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_MAX] = { [MLX5DR_TABLE_TYPE_NIC_RX] = { BIT(MLX5DR_ACTION_TYP_TAG), - BIT(MLX5DR_ACTION_TYP_TNL_L2_TO_L2) | - BIT(MLX5DR_ACTION_TYP_TNL_L3_TO_L2), + BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2) | + BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2), BIT(MLX5DR_ACTION_TYP_POP_VLAN), BIT(MLX5DR_ACTION_TYP_POP_VLAN), BIT(MLX5DR_ACTION_TYP_CTR), @@ -28,8 +28,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_ BIT(MLX5DR_ACTION_TYP_PUSH_VLAN), BIT(MLX5DR_ACTION_TYP_PUSH_VLAN), BIT(MLX5DR_ACTION_TYP_MODIFY_HDR), - BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) | - BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3), + BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) | + BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3), BIT(MLX5DR_ACTION_TYP_FT) | BIT(MLX5DR_ACTION_TYP_MISS) | BIT(MLX5DR_ACTION_TYP_TIR) | @@ -46,8 +46,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_ BIT(MLX5DR_ACTION_TYP_PUSH_VLAN), BIT(MLX5DR_ACTION_TYP_PUSH_VLAN), BIT(MLX5DR_ACTION_TYP_MODIFY_HDR), - BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) | - BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3), + BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) | + BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3), BIT(MLX5DR_ACTION_TYP_FT) | BIT(MLX5DR_ACTION_TYP_MISS) | BIT(MLX5DR_ACTION_TYP_DROP) | @@ -55,8 +55,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_ BIT(MLX5DR_ACTION_TYP_LAST), }, [MLX5DR_TABLE_TYPE_FDB] = { - BIT(MLX5DR_ACTION_TYP_TNL_L2_TO_L2) | - BIT(MLX5DR_ACTION_TYP_TNL_L3_TO_L2), + BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2) | + BIT(MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2), BIT(MLX5DR_ACTION_TYP_POP_VLAN), BIT(MLX5DR_ACTION_TYP_POP_VLAN), BIT(MLX5DR_ACTION_TYP_CTR), @@ -65,8 +65,8 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_ BIT(MLX5DR_ACTION_TYP_PUSH_VLAN), BIT(MLX5DR_ACTION_TYP_PUSH_VLAN), BIT(MLX5DR_ACTION_TYP_MODIFY_HDR), - BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L2) | - BIT(MLX5DR_ACTION_TYP_L2_TO_TNL_L3), + BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2) | + BIT(MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3), BIT(MLX5DR_ACTION_TYP_FT) | BIT(MLX5DR_ACTION_TYP_MISS) | BIT(MLX5DR_ACTION_TYP_VPORT) | @@ -292,10 +292,10 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[], case MLX5DR_ACTION_TYP_DROP: attr[i].type = MLX5DV_FLOW_ACTION_DROP; break; - case MLX5DR_ACTION_TYP_TNL_L2_TO_L2: - case MLX5DR_ACTION_TYP_L2_TO_TNL_L2: - case MLX5DR_ACTION_TYP_TNL_L3_TO_L2: - case MLX5DR_ACTION_TYP_L2_TO_TNL_L3: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3: case MLX5DR_ACTION_TYP_MODIFY_HDR: attr[i].type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION; attr[i].action = action->flow_action; @@ -503,7 +503,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action, attr->action_offset = MLX5DR_ACTION_OFFSET_HIT; attr->dest_tir_num = obj->id; break; - case MLX5DR_ACTION_TYP_TNL_L3_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2: case MLX5DR_ACTION_TYP_MODIFY_HDR: attr->action_offset = MLX5DR_ACTION_OFFSET_DW6; if (action->modify_header.num_of_actions == 1) { @@ -529,14 +529,14 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action, attr->action_offset = MLX5DR_ACTION_OFFSET_HIT; attr->dest_table_id = action->root_tbl.sa->id; break; - case MLX5DR_ACTION_TYP_TNL_L2_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2: attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_REMOVE; attr->action_offset = MLX5DR_ACTION_OFFSET_DW5; attr->remove_header.decap = 1; attr->remove_header.start_anchor = MLX5_HEADER_ANCHOR_PACKET_START; attr->remove_header.end_anchor = MLX5_HEADER_ANCHOR_INNER_MAC; break; - case MLX5DR_ACTION_TYP_L2_TO_TNL_L2: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2: attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT; attr->action_offset = MLX5DR_ACTION_OFFSET_DW6; attr->insert_header.encap = 1; @@ -544,7 +544,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action, attr->insert_header.arg_id = action->reformat.arg_obj->id; attr->insert_header.header_size = action->reformat.header_size; break; - case MLX5DR_ACTION_TYP_L2_TO_TNL_L3: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3: attr->action_type = MLX5_IFC_STC_ACTION_TYPE_HEADER_INSERT; attr->action_offset = MLX5DR_ACTION_OFFSET_DW6; attr->insert_header.encap = 1; @@ -1128,49 +1128,24 @@ mlx5dr_action_create_pop_vlan(struct mlx5dr_context *ctx, uint32_t flags) return NULL; } -static int -mlx5dr_action_conv_reformat_type_to_action(uint32_t reformat_type, - enum mlx5dr_action_type *action_type) -{ - switch (reformat_type) { - case MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2: - *action_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2; - break; - case MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2: - *action_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L2; - break; - case MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2: - *action_type = MLX5DR_ACTION_TYP_TNL_L3_TO_L2; - break; - case MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3: - *action_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L3; - break; - default: - DR_LOG(ERR, "Invalid reformat type requested"); - rte_errno = ENOTSUP; - return rte_errno; - } - return 0; -} - static void mlx5dr_action_conv_reformat_to_verbs(uint32_t action_type, uint32_t *verb_reformat_type) { switch (action_type) { - case MLX5DR_ACTION_TYP_TNL_L2_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2: *verb_reformat_type = MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2; break; - case MLX5DR_ACTION_TYP_L2_TO_TNL_L2: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2: *verb_reformat_type = MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL; break; - case MLX5DR_ACTION_TYP_TNL_L3_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2: *verb_reformat_type = MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_TO_L2; break; - case MLX5DR_ACTION_TYP_L2_TO_TNL_L3: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3: *verb_reformat_type = MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L3_TUNNEL; break; @@ -1470,16 +1445,16 @@ mlx5dr_action_create_reformat_hws(struct mlx5dr_context *ctx, int ret; switch (action->type) { - case MLX5DR_ACTION_TYP_TNL_L2_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2: ret = mlx5dr_action_create_stcs(action, NULL); break; - case MLX5DR_ACTION_TYP_L2_TO_TNL_L2: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2: ret = mlx5dr_action_handle_l2_to_tunnel_l2(ctx, data_sz, data, bulk_size, action); break; - case MLX5DR_ACTION_TYP_L2_TO_TNL_L3: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3: ret = mlx5dr_action_handle_l2_to_tunnel_l3(ctx, data_sz, data, bulk_size, action); break; - case MLX5DR_ACTION_TYP_TNL_L3_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2: ret = mlx5dr_action_handle_tunnel_l3_to_l2(ctx, data_sz, data, bulk_size, action); break; @@ -1494,21 +1469,16 @@ mlx5dr_action_create_reformat_hws(struct mlx5dr_context *ctx, struct mlx5dr_action * mlx5dr_action_create_reformat(struct mlx5dr_context *ctx, - enum mlx5dr_action_reformat_type reformat_type, + enum mlx5dr_action_type reformat_type, size_t data_sz, void *inline_data, uint32_t log_bulk_size, uint32_t flags) { - enum mlx5dr_action_type action_type; struct mlx5dr_action *action; int ret; - ret = mlx5dr_action_conv_reformat_type_to_action(reformat_type, &action_type); - if (ret) - return NULL; - - action = mlx5dr_action_create_generic(ctx, flags, action_type); + action = mlx5dr_action_create_generic(ctx, flags, reformat_type); if (!action) return NULL; @@ -1712,7 +1682,7 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action) case MLX5DR_ACTION_TYP_DROP: case MLX5DR_ACTION_TYP_CTR: case MLX5DR_ACTION_TYP_FT: - case MLX5DR_ACTION_TYP_TNL_L2_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2: case MLX5DR_ACTION_TYP_ASO_METER: case MLX5DR_ACTION_TYP_ASO_CT: case MLX5DR_ACTION_TYP_PUSH_VLAN: @@ -1726,18 +1696,18 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action) mlx5dr_action_destroy_stcs(action); mlx5dr_action_put_shared_stc(action, MLX5DR_CONTEXT_SHARED_STC_POP); break; - case MLX5DR_ACTION_TYP_TNL_L3_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2: case MLX5DR_ACTION_TYP_MODIFY_HDR: mlx5dr_action_destroy_stcs(action); if (action->modify_header.num_of_actions > 1) mlx5dr_pat_arg_destroy_modify_header(action->ctx, action); break; - case MLX5DR_ACTION_TYP_L2_TO_TNL_L3: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3: mlx5dr_action_destroy_stcs(action); mlx5dr_action_put_shared_stc(action, MLX5DR_CONTEXT_SHARED_STC_DECAP); mlx5dr_cmd_destroy_obj(action->reformat.arg_obj); break; - case MLX5DR_ACTION_TYP_L2_TO_TNL_L2: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2: mlx5dr_action_destroy_stcs(action); mlx5dr_cmd_destroy_obj(action->reformat.arg_obj); break; @@ -1747,10 +1717,10 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action) static void mlx5dr_action_destroy_root(struct mlx5dr_action *action) { switch (action->type) { - case MLX5DR_ACTION_TYP_TNL_L2_TO_L2: - case MLX5DR_ACTION_TYP_L2_TO_TNL_L2: - case MLX5DR_ACTION_TYP_TNL_L3_TO_L2: - case MLX5DR_ACTION_TYP_L2_TO_TNL_L3: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3: case MLX5DR_ACTION_TYP_MODIFY_HDR: ibv_destroy_flow_action(action->flow_action); break; @@ -2256,7 +2226,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->idx_double = i; break; - case MLX5DR_ACTION_TYP_TNL_L2_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2: /* Single remove header to header */ setter = mlx5dr_action_setter_find_first(last_setter, ASF_SINGLE1 | ASF_MODIFY); setter->flags |= ASF_SINGLE1 | ASF_REMOVE | ASF_REPARSE; @@ -2264,7 +2234,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->idx_single = i; break; - case MLX5DR_ACTION_TYP_L2_TO_TNL_L2: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2: /* Double insert header with pointer */ setter = mlx5dr_action_setter_find_first(last_setter, ASF_DOUBLE); setter->flags |= ASF_DOUBLE | ASF_REPARSE; @@ -2272,7 +2242,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->idx_double = i; break; - case MLX5DR_ACTION_TYP_L2_TO_TNL_L3: + case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3: /* Single remove + Double insert header with pointer */ setter = mlx5dr_action_setter_find_first(last_setter, ASF_SINGLE1 | ASF_DOUBLE); setter->flags |= ASF_SINGLE1 | ASF_DOUBLE | ASF_REPARSE | ASF_REMOVE; @@ -2282,7 +2252,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->idx_single = i; break; - case MLX5DR_ACTION_TYP_TNL_L3_TO_L2: + case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2: /* Double modify header list with remove and push inline */ setter = mlx5dr_action_setter_find_first(last_setter, ASF_DOUBLE | ASF_REMOVE); diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c index d249f8d869..5064b23b7d 100644 --- a/drivers/net/mlx5/hws/mlx5dr_debug.c +++ b/drivers/net/mlx5/hws/mlx5dr_debug.c @@ -6,10 +6,10 @@ const char *mlx5dr_debug_action_type_str[] = { [MLX5DR_ACTION_TYP_LAST] = "LAST", - [MLX5DR_ACTION_TYP_TNL_L2_TO_L2] = "TNL_L2_TO_L2", - [MLX5DR_ACTION_TYP_L2_TO_TNL_L2] = "L2_TO_TNL_L2", - [MLX5DR_ACTION_TYP_TNL_L3_TO_L2] = "TNL_L3_TO_L2", - [MLX5DR_ACTION_TYP_L2_TO_TNL_L3] = "L2_TO_TNL_L3", + [MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2] = "TNL_L2_TO_L2", + [MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2] = "L2_TO_TNL_L2", + [MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2] = "TNL_L3_TO_L2", + [MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3] = "L2_TO_TNL_L3", [MLX5DR_ACTION_TYP_DROP] = "DROP", [MLX5DR_ACTION_TYP_TIR] = "TIR", [MLX5DR_ACTION_TYP_FT] = "FT", diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c index bedaedb677..309a61d477 100644 --- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c +++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c @@ -73,7 +73,7 @@ static bool mlx5dr_pat_compare_pattern(enum mlx5dr_action_type cur_type, return false; /* All decap-l3 look the same, only change is the num of actions */ - if (type == MLX5DR_ACTION_TYP_TNL_L3_TO_L2) + if (type == MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2) return true; for (i = 0; i < num_of_actions; i++) { diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 330386df77..e1adc081c1 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -1420,7 +1420,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, struct rte_flow_action *actions = at->actions; struct rte_flow_action *action_start = actions; struct rte_flow_action *masks = at->masks; - enum mlx5dr_action_reformat_type refmt_type = 0; + enum mlx5dr_action_type refmt_type = 0; const struct rte_flow_action_raw_encap *raw_encap_data; const struct rte_flow_item *enc_item = NULL, *enc_item_m = NULL; uint16_t reformat_src = 0; @@ -1575,7 +1575,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, masks->conf)->definition; reformat_used = true; reformat_src = actions - action_start; - refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2; + refmt_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2; break; case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: MLX5_ASSERT(!reformat_used); @@ -1586,13 +1586,13 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, masks->conf)->definition; reformat_used = true; reformat_src = actions - action_start; - refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2; + refmt_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2; break; case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: case RTE_FLOW_ACTION_TYPE_NVGRE_DECAP: MLX5_ASSERT(!reformat_used); reformat_used = true; - refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2; + refmt_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2; break; case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: raw_encap_data = @@ -1608,18 +1608,18 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, if (reformat_used) { refmt_type = data_size < MLX5_ENCAPSULATION_DECISION_SIZE ? - MLX5DR_ACTION_REFORMAT_TYPE_TNL_L3_TO_L2 : - MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L3; + MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 : + MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3; } else { reformat_used = true; refmt_type = - MLX5DR_ACTION_REFORMAT_TYPE_L2_TO_TNL_L2; + MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2; } reformat_src = actions - action_start; break; case RTE_FLOW_ACTION_TYPE_RAW_DECAP: reformat_used = true; - refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2; + refmt_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2; break; case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL: flow_hw_translate_group(dev, cfg, attr->group, @@ -4523,10 +4523,10 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = { [RTE_FLOW_ACTION_TYPE_JUMP] = MLX5DR_ACTION_TYP_FT, [RTE_FLOW_ACTION_TYPE_QUEUE] = MLX5DR_ACTION_TYP_TIR, [RTE_FLOW_ACTION_TYPE_RSS] = MLX5DR_ACTION_TYP_TIR, - [RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP] = MLX5DR_ACTION_TYP_L2_TO_TNL_L2, - [RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP] = MLX5DR_ACTION_TYP_L2_TO_TNL_L2, - [RTE_FLOW_ACTION_TYPE_VXLAN_DECAP] = MLX5DR_ACTION_TYP_TNL_L2_TO_L2, - [RTE_FLOW_ACTION_TYPE_NVGRE_DECAP] = MLX5DR_ACTION_TYP_TNL_L2_TO_L2, + [RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP] = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2, + [RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP] = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2, + [RTE_FLOW_ACTION_TYPE_VXLAN_DECAP] = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2, + [RTE_FLOW_ACTION_TYPE_NVGRE_DECAP] = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2, [RTE_FLOW_ACTION_TYPE_MODIFY_FIELD] = MLX5DR_ACTION_TYP_MODIFY_HDR, [RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT] = MLX5DR_ACTION_TYP_VPORT, [RTE_FLOW_ACTION_TYPE_CONNTRACK] = MLX5DR_ACTION_TYP_ASO_CT, @@ -4604,7 +4604,7 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at) enum mlx5dr_action_type action_types[MLX5_HW_MAX_ACTS] = { MLX5DR_ACTION_TYP_LAST }; unsigned int i; uint16_t curr_off; - enum mlx5dr_action_type reformat_act_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2; + enum mlx5dr_action_type reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2; uint16_t reformat_off = UINT16_MAX; uint16_t mhdr_off = UINT16_MAX; uint16_t cnt_off = UINT16_MAX; @@ -4642,16 +4642,16 @@ flow_hw_dr_actions_template_create(struct rte_flow_actions_template *at) data_size = raw_encap_data->size; if (reformat_off != UINT16_MAX) { reformat_act_type = data_size < MLX5_ENCAPSULATION_DECISION_SIZE ? - MLX5DR_ACTION_TYP_TNL_L3_TO_L2 : - MLX5DR_ACTION_TYP_L2_TO_TNL_L3; + MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2 : + MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3; } else { reformat_off = curr_off++; - reformat_act_type = MLX5DR_ACTION_TYP_L2_TO_TNL_L2; + reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2; } break; case RTE_FLOW_ACTION_TYPE_RAW_DECAP: reformat_off = curr_off++; - reformat_act_type = MLX5DR_ACTION_TYP_TNL_L2_TO_L2; + reformat_act_type = MLX5DR_ACTION_TYP_REFORMAT_TNL_L2_TO_L2; break; case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD: if (mhdr_off == UINT16_MAX) { -- 2.18.1