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 5451F42D88; Thu, 29 Jun 2023 09:27:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B32ED42D16; Thu, 29 Jun 2023 09:26:48 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2047.outbound.protection.outlook.com [40.107.95.47]) by mails.dpdk.org (Postfix) with ESMTP id 2E0F041104 for ; Thu, 29 Jun 2023 09:22:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fo9VLvarHnLxk6M4CXURV1JsaAQMzdM2uyXX2VHeXWd5g1g4xUZEN5PMB0/SvTebNNlphNS+DmpN8vLQE5sj607k97QyA3alUhX7xN3eNajPiqptV5tpQI9WSe4VdZ68laSAn6uOXmOqez3pqIUW4LltkOJENPKRtTGj1kDseSiP1t7VnOMjy6emqjBwqNCaaWGzAooe0kA2TX+2GQhskDFqsMoGhIYmLDcInVs9DI7grn7LlfqLqlUyf/eT3ZrlYKgC1kFJNXdd/y+3ZytZV6PHtJqL7L4TZL5spYjAzmv/m6alOInBIMuHZFS5SnK8Uh8q5MX7VkHKLXONEk/qlg== 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=GLzzEgQNsbxutZeZw57PT42Jq5feXMH20O8cIGhO3Po=; b=mwTN+mO3uPl2oCb+frsjnIv23I5CSYEzwFwmS9yMMVdApCzF7uMw4V5xQ8kJoMAL78weihD0BeHjEp2TsAZuX8a2nWwdBEoA8gBcViU8t1c+i9veqrWcMSB+FGue4eN4LwmTXQiHDjnGQ8H8I9ud6D0twZpQL2UkCYS5cpvbuFjomRhZ6ToiZmrGdyyHIRdPCpepMpHVVvGCPYsBryLlxQLVz+RDvcDStJhF+wUV4CmPV+tO/tdcXQvT4mDhRuweZ5xkOK3sznLTytbsbQu3YBJIRlxz56xjlEXthhJlvTU3bYTzJHAiVVbEM/+h/+C0of9cfcer78iyHkZHXtGS/A== 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=GLzzEgQNsbxutZeZw57PT42Jq5feXMH20O8cIGhO3Po=; b=ASrqNbr6bGM8LV2lEnGo/GNYh9LmIMSAGXEak1aMEGStAfDGDD+eAxtv/XzdmXrnLBH/3zQHPJJVVE55bv7+ZyszqVTWIuxli2qf9e6KoQesfxQUZpeLPKbFh6fhVEQGsOAjzHpI72tCyN5GDU34YcUPmnVr8aPspIeeDA5cMdq4qrneQ8O3DFxY/WUsaH7R28vWZQLl9m1kT6AmKA4YtM7s5WIdEQdJIpvZdy7fBtr0zlQlJjU706uJr+j51Jr97hFFsWahjSB8ENABMYpC7oWBdkyCicL5Fz6NxrhcTjBapnX0PqBROEg8uM4gcyvJh1RWU2vRiu+jzgRHgFI0WA== Received: from DM6PR03CA0076.namprd03.prod.outlook.com (2603:10b6:5:333::9) by MW4PR12MB6973.namprd12.prod.outlook.com (2603:10b6:303:20a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Thu, 29 Jun 2023 07:22:13 +0000 Received: from DM6NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:5:333:cafe::6b) by DM6PR03CA0076.outlook.office365.com (2603:10b6:5:333::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.20 via Frontend Transport; Thu, 29 Jun 2023 07:22:12 +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 DM6NAM11FT062.mail.protection.outlook.com (10.13.173.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.49 via Frontend Transport; Thu, 29 Jun 2023 07:22:12 +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.986.5; Thu, 29 Jun 2023 00:22:00 -0700 Received: from rnnvmail204.nvidia.com (10.129.68.6) 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.986.37; Thu, 29 Jun 2023 00:22:00 -0700 Received: from nvidia.com (10.127.8.12) by mail.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 via Frontend Transport; Thu, 29 Jun 2023 00:21:57 -0700 From: Itamar Gozlan To: , , , , , Ori Kam CC: , Shun Hao Subject: [PATCH 3/5] net/mlx5/hws: remove duplicated reformat type Date: Thu, 29 Jun 2023 10:21:23 +0300 Message-ID: <20230629072125.20369-3-igozlan@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230629072125.20369-1-igozlan@nvidia.com> References: <20230629072125.20369-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: DM6NAM11FT062:EE_|MW4PR12MB6973:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a91b787-fb76-4444-57c6-08db78718ea5 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: 6cP1AYsGyr/1VzlJW8WtCNTuvofe9nNbS9qeKl8bEU8AUqaNleB84RK52OjKvaYQh3LZ/8XnFSlhrR4GUya5ig3hGj4oq/ls0c0pLxuw57tAS9O+Yvcr+2HjauiGb9fJneTbnXw74Yr1J9yxdVaNo0okonkPlcMPQteuldAqWxgKRm0rEAAtPTpnK9TBo8yYLrVgVgBJV4X6mykcznLScyau22owB3Cnd9D2ljXygEKLYACrPmv3FXAhCZLnCb3g+EkGnTpebS+/8tZO9UZh9aJZ0E2Stt7skovPGKGEUgz68qR6E2At9LySAGJJwS61rgalkJguL8b1DYJBgp2D1qwYU4NskWMzDG1h+gQt06EKISP5M1edXuhYW4S32unCzpy/Qv1o5rUjCS+AMJyVNuL+5j6Kpcr/IV1AQzNz7gGGs3hG2/uRenVTu7VjR4AmOkcFNLIQhvsdaIWC+dnYUetf/joyvADHnHyjDEn6MBU8VHrkF73qHjzY4+77yQx/tEDcNHtMXlU4eu9KIHo1h8wmlSrjB+Sgb0JztcLFv1kjedK5F4TEScxcokUhNJJn4gu6BV7yef/kghpTcNzsF2GJxx19XApWvRDIcEZiEaKMcmbDogGG6Sx1zRLd8/gRakRmH85/J1kVh7qAn0GUmOr6bXEY4vTXHmbmyYTKQepC9Ebe5JosgZ4BtTOthXhuE4vpS9z5bxDklKEVHarDCc+P5Pw7Hll4DZvYzmZcYgTzM5H4dKZyrg4wWuorzwqV 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)(396003)(136003)(376002)(346002)(451199021)(46966006)(36840700001)(40470700004)(5660300002)(4326008)(70206006)(478600001)(36756003)(316002)(6636002)(70586007)(8936002)(8676002)(2906002)(40460700003)(110136005)(36860700001)(30864003)(54906003)(41300700001)(82310400005)(7696005)(40480700001)(55016003)(186003)(86362001)(47076005)(6666004)(426003)(26005)(336012)(6286002)(356005)(1076003)(107886003)(2616005)(82740400003)(83380400001)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2023 07:22:12.1332 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2a91b787-fb76-4444-57c6-08db78718ea5 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: DM6NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6973 X-Mailman-Approved-At: Thu, 29 Jun 2023 09:26:43 +0200 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 --- 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 b5137a822a..e274fbf34d 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -1418,7 +1418,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; @@ -1573,7 +1573,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); @@ -1584,13 +1584,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 = @@ -1606,18 +1606,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, @@ -4517,10 +4517,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, @@ -4598,7 +4598,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; @@ -4636,16 +4636,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