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 1EE9A4296C; Mon, 17 Apr 2023 11:26:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7A0BE42D29; Mon, 17 Apr 2023 11:26:29 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2072.outbound.protection.outlook.com [40.107.237.72]) by mails.dpdk.org (Postfix) with ESMTP id B3A4042D0B for ; Mon, 17 Apr 2023 11:26:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H8A47HEtSLZOu6lvoLINSrD+KRhs0bbLTVDrwbGmtguR0d0RepqZ/DO+YPpFs83PZv6afAqygaAtVnODm/jpCXn5DH4DHGRIdmk3lNWNnbpbwT7iFk2m8pMHmJydzE5h4Oyu/GUew3L/IVBuQeO0v0WNM8zX36IziFDgezsaJry5obkZthghmQCOYyMur/MLLqjsl4NtQp5Yj5O8TV/ztVjm0z8209tRRbHnFKPKB9gIN3cMaCEQLjYIXZwfG+tDm0nt4kdive/4bLoKpJ3ZjGUERaTIjGgSMmFSWNP4pI0jlhH6LnMYfmHCSeJi6sZAO3Qjy57G3DOMy2x2A3dNmw== 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=JeG6bEMMKUX8YyuJBVmbf/8h7CHQkefOy66JIWnPoGc=; b=RryI7aUdZpIW0sFw4F5bHB9GOBqERtnceZbeKheKATELtDRkVc6/f1HGqAlgMQJ+UswRCd7DgwpVNweuuiBEK7ZPLb7tKfECSll8RLOmAmMHDJgmeETfmruaNPXZ8LUGXx4O651QB2qRoKRGTTzYXj281XJpFcDazCRAF+Bqz6yZkHi7fo+StKKX77apmAoHBn47h46la6usmLFI91ee0br5rjDzhgfvfO43vp5Cu4vgngLivCOpkcnup0eh/CCTJiNNuXK7nqnnDcqQ3wA7t5UxtYAnY6jm0HKIMAEH83YUJAn1ujrwgHohMGCv84OW0UdEHMoAUUDfEHF8/pY8rA== 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 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=JeG6bEMMKUX8YyuJBVmbf/8h7CHQkefOy66JIWnPoGc=; b=Ak1nHsw95/DSD2ElbNmwhVqvytQqchrCujrOiS1FKNinW6m8ztkQwFanCZB6MDdy5cps7ZAvXPnlru909y5n27BEsOXODWjJi4YvO1sBpekfmZ8E6m+YjIb9Y64DWTrjej7559Y/t/F6KhsBhZ6FBa1w37Ecen6nzRG8mE2/whzed1RZnBFfHxLiNurBaLhPmYa6nKVsyALPLU2T2UaVJe7hQ01cZDP9pNVyOhSbZGmtAbuimDaO75AsaA0ehc1vjOaJDjtmkZUbHVOQBiR9KMF9kG0T/VvBpDehGOvIOJekkbwnbt+jrovHqnrt5XMDOLULcljEAgzgYoMwf/Sjyw== Received: from BN9PR03CA0621.namprd03.prod.outlook.com (2603:10b6:408:106::26) by MN0PR12MB5857.namprd12.prod.outlook.com (2603:10b6:208:378::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Mon, 17 Apr 2023 09:26:26 +0000 Received: from BN8NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::56) by BN9PR03CA0621.outlook.office365.com (2603:10b6:408:106::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.46 via Frontend Transport; Mon, 17 Apr 2023 09:26:26 +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 BN8NAM11FT053.mail.protection.outlook.com (10.13.177.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.19 via Frontend Transport; Mon, 17 Apr 2023 09:26:25 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 17 Apr 2023 02:26:10 -0700 Received: from nvidia.com (10.126.231.37) 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; Mon, 17 Apr 2023 02:26:08 -0700 From: Rongwei Liu To: , , , , Subject: [PATCH v1 7/8] net/mlx5/hws: add setter for IPv6 routing push pop Date: Mon, 17 Apr 2023 12:25:39 +0300 Message-ID: <20230417092540.2617450-8-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230417092540.2617450-1-rongweil@nvidia.com> References: <20230417092540.2617450-1-rongweil@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT053:EE_|MN0PR12MB5857:EE_ X-MS-Office365-Filtering-Correlation-Id: 092e1ac5-e889-4a93-eb77-08db3f25d142 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: 5XQc0CK2jSpoPhHDZb8uv5xpb6o9IZpgp1j8j4YE89UBy5D8q+LwpfM0hn6BYnBaX7DuCOSHnUTFTgTcu4Aman0fnSdADIZt+fclE3l/X6fLlPhjqaWAUW2TkR1zWjUk+yZ8N8ivuP4IPw287DDe3Fe6hCSnjjnOGfc0WrafiebXTYg9EfMAwSy72DAEnGdI4hkgrJTeQl+R4j4fckc/2biSlCxwYmtSMEpzhghmsXoiBpzfAAZmYWU9nk9vdes2LDUHfI2VyWK3O5Emcw1UddMaiUBSAyKFfZ+12Mqn7qn98L1ZMGalcv1FtPkPhxNERD9qkodB/f+ZT7H370OE/qtb/1kAmc6vSn0faz2yGipUck1/pLhzn/ecsAtD+wx0KdYC4GJfBaEylvGoP/9BgPskZhG2/l4aq3nhzID5komrZDztrbcFMC6fjaE3I0zFKgvniZje4iHi2uOE7tHC+lY3Ae8HN0upeav6ZMRxv0/SjQ0Rb755AOK5csFk+sAasJMbssynlf5C6MKWbvhE9v1HF91c15tR388wzam4ck05MSowbHkLwjt2pCVCsuSZ8JS3N7vS9gZJg6FxRoMpCYYMxvfqq2YegJXtMU1gvTRQBeUuCYnNZqdW5XwU9eIpaqmbuPkt1Cp8d7pifr6fO14yjHBRLBFWV8IYed/zNinefyu07OqEewriFLP/b+VPRpYytNw9Ref+n+glszlqYQkL4EsA4dV0Gg0v+CfBchfIzOzchVebEVQIla2UphGhojaSHZSuV7H2eZWUw7Hm/ljbzGS8Q6831BmGqPTOidc= 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:(13230028)(4636009)(396003)(39860400002)(376002)(346002)(136003)(451199021)(46966006)(36840700001)(40470700004)(478600001)(6666004)(34020700004)(8936002)(8676002)(316002)(41300700001)(82740400003)(55016003)(40480700001)(70586007)(70206006)(7636003)(110136005)(356005)(40460700003)(16526019)(6286002)(186003)(2906002)(36756003)(26005)(1076003)(336012)(86362001)(83380400001)(426003)(47076005)(82310400005)(2616005)(36860700001)(5660300002)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 09:26:25.8189 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 092e1ac5-e889-4a93-eb77-08db3f25d142 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: BN8NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5857 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 The rte action will be translated to 3 dr_actions which need 3 setters to program them. For each setter, it may have different reparsing properties. Setter which requires no reparse can't share the same one with the one has reparse enabled even if there is spare space. Signed-off-by: Rongwei Liu --- drivers/net/mlx5/hws/mlx5dr_action.c | 144 +++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c index fa38654644..9f2386479a 100644 --- a/drivers/net/mlx5/hws/mlx5dr_action.c +++ b/drivers/net/mlx5/hws/mlx5dr_action.c @@ -2318,6 +2318,57 @@ mlx5dr_action_setter_modify_header(struct mlx5dr_actions_apply_data *apply, } } +static void +mlx5dr_action_setter_ipv6_routing_pop1(struct mlx5dr_actions_apply_data *apply, + struct mlx5dr_actions_wqe_setter *setter) +{ + struct mlx5dr_rule_action *rule_action; + struct mlx5dr_action *action; + + rule_action = &apply->rule_action[setter->idx_double]; + action = rule_action->action; + MLX5_ASSERT(action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_POP); + rule_action->action = action->recom.action1; + MLX5_ASSERT(rule_action->action->flags & MLX5DR_ACTION_FLAG_SHARED); + MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_MODIFY_HDR); + mlx5dr_action_setter_modify_header(apply, setter); + rule_action->action = action; +} + +static void +mlx5dr_action_setter_ipv6_routing_pop2(struct mlx5dr_actions_apply_data *apply, + struct mlx5dr_actions_wqe_setter *setter) +{ + struct mlx5dr_rule_action *rule_action; + struct mlx5dr_action *action; + + rule_action = &apply->rule_action[setter->idx_double]; + action = rule_action->action; + MLX5_ASSERT(action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_POP); + rule_action->action = action->recom.action2; + MLX5_ASSERT(rule_action->action->flags & MLX5DR_ACTION_FLAG_SHARED); + MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_MODIFY_HDR); + mlx5dr_action_setter_modify_header(apply, setter); + rule_action->action = action; +} + +static void +mlx5dr_action_setter_ipv6_routing_pop3(struct mlx5dr_actions_apply_data *apply, + struct mlx5dr_actions_wqe_setter *setter) +{ + struct mlx5dr_rule_action *rule_action; + struct mlx5dr_action *action; + + rule_action = &apply->rule_action[setter->idx_double]; + action = rule_action->action; + MLX5_ASSERT(action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_POP); + rule_action->action = action->recom.action3; + MLX5_ASSERT(rule_action->action->flags & MLX5DR_ACTION_FLAG_SHARED); + MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_POP); + mlx5dr_action_setter_modify_header(apply, setter); + rule_action->action = action; +} + static void mlx5dr_action_setter_insert_ptr(struct mlx5dr_actions_apply_data *apply, struct mlx5dr_actions_wqe_setter *setter) @@ -2346,6 +2397,60 @@ mlx5dr_action_setter_insert_ptr(struct mlx5dr_actions_apply_data *apply, } } +static void +mlx5dr_action_setter_ipv6_routing_push1(struct mlx5dr_actions_apply_data *apply, + struct mlx5dr_actions_wqe_setter *setter) +{ + struct mlx5dr_rule_action *rule_action; + struct mlx5dr_rule_action tmp; + + rule_action = &apply->rule_action[setter->idx_double]; + tmp = *rule_action; + MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH); + rule_action->action = tmp.action->recom.action1; + MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH); + rule_action->reformat.offset = tmp.recom.offset; + rule_action->reformat.data = tmp.recom.data; + mlx5dr_action_setter_insert_ptr(apply, setter); + *rule_action = tmp; +} + +static void +mlx5dr_action_setter_ipv6_routing_push2(struct mlx5dr_actions_apply_data *apply, + struct mlx5dr_actions_wqe_setter *setter) +{ + struct mlx5dr_rule_action *rule_action; + struct mlx5dr_action *action; + + rule_action = &apply->rule_action[setter->idx_double]; + action = rule_action->action; + MLX5_ASSERT(action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH); + rule_action->action = action->recom.action2; + MLX5_ASSERT(rule_action->action->flags & MLX5DR_ACTION_FLAG_SHARED); + MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_MODIFY_HDR); + mlx5dr_action_setter_modify_header(apply, setter); + rule_action->action = action; +} + +static void +mlx5dr_action_setter_ipv6_routing_push3(struct mlx5dr_actions_apply_data *apply, + struct mlx5dr_actions_wqe_setter *setter) +{ + struct mlx5dr_rule_action *rule_action; + struct mlx5dr_rule_action tmp; + + rule_action = &apply->rule_action[setter->idx_double]; + tmp = *rule_action; + MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH); + rule_action->action = tmp.action->recom.action3; + MLX5_ASSERT(rule_action->action->type == MLX5DR_ACTION_TYP_MODIFY_HDR); + rule_action->modify_header.offset = tmp.recom.offset; + rule_action->modify_header.data = tmp.recom.mhdr; + MLX5_ASSERT(rule_action->action->modify_header.num_of_actions > 1); + mlx5dr_action_setter_modify_header(apply, setter); + *rule_action = tmp; +} + static void mlx5dr_action_setter_tnl_l3_to_l2(struct mlx5dr_actions_apply_data *apply, struct mlx5dr_actions_wqe_setter *setter) @@ -2553,6 +2658,45 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at) setter->idx_double = i; break; + case MLX5DR_ACTION_TYP_IPV6_ROUTING_POP: + /* Double internal modify header list */ + setter = mlx5dr_action_setter_find_first(last_setter, + ASF_DOUBLE | ASF_REMOVE); + setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_REPARSE; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_pop1; + setter->idx_double = i; + setter++; + setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_REPARSE; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_pop2; + setter->idx_double = i; + setter++; + /* restore IPv6 protocol + pop via modify list. */ + setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_REPARSE; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_pop3; + setter->idx_double = i; + break; + + case MLX5DR_ACTION_TYP_IPV6_ROUTING_PUSH: + /* Double insert header with pointer */ + setter = mlx5dr_action_setter_find_first(last_setter, ASF_DOUBLE); + /* Can't squeeze with reparsing setter */ + if (setter->flags & ASF_REPARSE) + setter++; + setter->flags |= ASF_DOUBLE; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_push1; + setter->idx_double = i; + setter++; + /* Set IPv6 protocol to 0x2b */ + setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_REPARSE; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_push2; + setter->idx_double = i; + setter++; + /* Load next hop IPv6 address and restore srv6.next_hdr */ + setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_REPARSE; + setter->set_double = &mlx5dr_action_setter_ipv6_routing_push3; + setter->idx_double = i; + break; + case MLX5DR_ACTION_TYP_MODIFY_HDR: /* Double modify header list */ setter = mlx5dr_action_setter_find_first(last_setter, ASF_DOUBLE | ASF_REMOVE); -- 2.27.0