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 EB19642DAE; Tue, 4 Jul 2023 18:06:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D885B42D17; Tue, 4 Jul 2023 18:06:25 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2061.outbound.protection.outlook.com [40.107.220.61]) by mails.dpdk.org (Postfix) with ESMTP id 9C04642BFE for ; Tue, 4 Jul 2023 18:06:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RQzRsMmxUgywYrb23gqGhsV+19jiqBkI4/1JaahQm2AgFYTGM3/gv++JB4dKWqwqbT/yYHuxQ93jb2DG2SHil9A6+PLbTiI0YHQ62V4gEpjfZ9lvhCNFgww/OyOPCZwTdorzF3rgV9+e57lmaquFFqz2ZZeTBL2JSNOoIYepTj3/wco7YDWrkgMCTnS71YbmViEVdOy79aSwJThWzJQKEffWsJhmZq9kzmiNPhEJ6Aghh/ELVax0UA4Z0dG78i4Cj0v/M4H4c5flXJ4+FjQ+9xEGXazinAg5qU+RHLCptWukmSXR168CTTJULSEx4dlm47gO+aJDvQkIiw1UW+kx4g== 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=LNYCXentkzIup9yK7r3RFwqGXlq9JHJ6mbQcbDnYsrtKuR6HUJsxmxvo8a7+mMX3k+Ww7ayTKPxyPHSFl0C3Y5v6yIYDYb8dox9gAXMFgxoUrHvCtrOPSoam3fGbYsfjqrrShwjlZEIIrQapSoQpxWzkmw/CegjjDnyjCls2ZIjfXXdgAnqSc2I+srPe0EZ9YdVVkVLLRoWaLAaxwPQQRe0o4GAczktSFW5NZUyY9gz74XPZ5NE7niq/aPzLJ4Y12UgiLaR2Rny5KbtUNZXYkqd42DPE4PP0JbwnaO9EKBQcoI3GMsH3Za+3ybIZyg7gDRocNN8fTqeseCR9vzl0QQ== 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=RvdFw84UBY/wORL6WI+8xTtLxmYdRO/o0SV9jCuGyKYuVkVfwhCuLDKCYoGCFvKKGkgy5jZDb176iogheENPFuRWABrgXLo0Hd+YY0yI/EQ5AW9wOOD3Oj0F9i8f/WnXCzPVmiFKSBkDxAXC0S2GXnoEy3qkuunRVZVh9ihRoybXa7HhuOZm35Qh3o4oq2qltLQEFodXkhs9gbRVhtElhUx5i+GXF0CZ98Whmhopgjp8bRPQin3QyWfeMiuRh7nPW57A63pAxB2jOTL++7tqIR+XyvRVxGyVNfQhIME2QlNROR3IOX6jzAp3WuBccuaWvY2f+PfzDSE+a2iWxleP1A== Received: from DM6PR02CA0127.namprd02.prod.outlook.com (2603:10b6:5:1b4::29) by IA1PR12MB8223.namprd12.prod.outlook.com (2603:10b6:208:3f3::10) 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 16:06:21 +0000 Received: from DM6NAM11FT091.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::c) by DM6PR02CA0127.outlook.office365.com (2603:10b6:5:1b4::29) 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 16:06:21 +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 DM6NAM11FT091.mail.protection.outlook.com (10.13.173.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.44 via Frontend Transport; Tue, 4 Jul 2023 16:06:20 +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; Tue, 4 Jul 2023 09:06:11 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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; Tue, 4 Jul 2023 09:06:10 -0700 Received: from nvidia.com (10.127.8.12) by mail.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 via Frontend Transport; Tue, 4 Jul 2023 09:06:08 -0700 From: Itamar Gozlan To: , , , , , Ori Kam CC: , Shun Hao Subject: [v3 3/5] net/mlx5/hws: remove duplicated reformat type Date: Tue, 4 Jul 2023 19:04:51 +0300 Message-ID: <20230704160454.4187-3-igozlan@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230704160454.4187-1-igozlan@nvidia.com> References: <20230704104645.19800-5-igozlan@nvidia.com> <20230704160454.4187-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: DM6NAM11FT091:EE_|IA1PR12MB8223:EE_ X-MS-Office365-Filtering-Correlation-Id: efc73cfd-4454-49f6-cd58-08db7ca89b77 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: o82P5f+kEC1Bm101oyaUkU/QG6CvhxugSlDopH6u6RF43zPnLjUxoIO76Yf6t2LbProYiP5+T4ViPoS//nNdEJfA7OO7Kh3HSLLIbphW7xkT1wfLTEVPIp1nG+6R53C7SBMihbKUffDJxq0iGGLkcLmOgwZtgDlNQ6BsKwH08TAiwlPk6XjkOqBgsAH9UOpyleU/CZA84JSeWrDyXgCeySGrFooIUvc/hlldZWWcNSGD42jLiDf7htRrQxE75nFk1eptet24HMMoNYOi/wi4W2FgqqxE88C6zBlytDzXjU6+atTsOIFYrnewP9pwWYDXNVxNj7CbtArts7plZ7Dm0dGnJJISRfSJPqbWJy5DhTNI6SidyT4brge+DPKzZM+4DpqoEYXDuD3PnpNwK4Gd4+eyHPq/13tBqjXEIf+QtGuhWD/iVBspUWbnYnEh1ZCHmEanumomw2VrOVQaBzmuFKWA5Yle17jBSWJSDnxZqg16pYFpApjpc2OXFUDnRFMwJZnXmpVFqNj9hk0fhDVMu5Arx3X4FDVyzjh0/e52n7lMS3VhwhJJGHjyXFa6xNav5K/4ONLhbs9GyRzDMVqr0isaYWKmco/ks/gnNmiIsgENYs4nQOQ3q76R13SiFe4J1hxiNxA5V+/lgq+yEvTVar50k3nsJ6BCbMbJGliJ+HF0EgWomyH9gpvkju8Gmz8XEkrY0cjTEbkY51/jwq7uv/U84r5fpgSmVsWF3GpfgNuOl9ropE+OWFsAm+tb+2bE 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)(376002)(346002)(136003)(39860400002)(396003)(451199021)(40470700004)(46966006)(36840700001)(26005)(478600001)(1076003)(6666004)(82740400003)(107886003)(86362001)(2616005)(6286002)(186003)(36860700001)(54906003)(7636003)(6636002)(4326008)(70586007)(426003)(83380400001)(356005)(336012)(110136005)(70206006)(7696005)(316002)(47076005)(5660300002)(8676002)(8936002)(30864003)(40460700003)(41300700001)(2906002)(40480700001)(55016003)(82310400005)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2023 16:06:20.6164 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: efc73cfd-4454-49f6-cd58-08db7ca89b77 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: DM6NAM11FT091.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8223 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