From patchwork Fri Aug 11 14:07:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 130167 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B52A943035; Fri, 11 Aug 2023 16:07:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9343140F16; Fri, 11 Aug 2023 16:07:36 +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 A3D9F40E03 for ; Fri, 11 Aug 2023 16:07:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YghVKish93qcdSLt0hG0EhyPtPTzfgZG8duWqqldsj1+4D2F4TPBpbQEcf1KFvPIGrVGIRoYF1cJDtKiMt0cS/bolkRegi+zF5SQWFuPyYoL65ogQsv7O37/E2PyXoLwP8QgACmo+RIqACckc2EwwFWw1SA1Dzavh0seoqOGmVBF4sLFuTa8mdlcUiWK4JEKAX5gXjYKPlpPEadF7LCyX2rdXWntJU/2a1CxG81klIqXu/KILiq1s/C61JabqcLLsOEy2iWYePQhbl0HM1YOmzkqU2Y7RybS+e8NavTSuOFZbFsaqWlH9n5gxTMDepxTd97mtdW2B6B24Uz2hNC6/g== 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=CRXEC4ukkJm2hqaRS/nYagVelFAy54MqjRMZxnq3LGg=; b=fDnWMV9ZBgVQVAF7I8n/A0slyrKkE/KJX8oIgp+Ov1Ch/cFUVhHjVdgy9xUowZGUWxgTEgrvtcTjROWgwYimFHzTLl2t0pwE7JWEBpQerjF6T4Q9k7PIpQ/cc5FP4/kuuMEJKi0AKknUAbSS/PLgwv1DOOP1FnggWx5yHRVu++tgwLiPfONbLXh4sLEZhQr7sku8wuoTUEVGR++HQn3PW7oVp7f4fed1G/wShoRUCXFAGMdfSoeYkYElbjASpQ2K6AONh6h7DlZ6N+43iDK/EjPcpMfgW99IGM3g2k4lY2AdunjEWJjy+fSuU3WEtpPd5hfl+6GExuM+g7mppmff9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=CRXEC4ukkJm2hqaRS/nYagVelFAy54MqjRMZxnq3LGg=; b=o/+ZJV70yu0PlZA124W/y/J+y6zPJvSVPgRUZeKupm/2h0R7siyRH9ftA7RpSbgeLklqjzqYU/f5QN2aR55BjRCCDvF0LEBY8+y78T8Ii8gtkus0ahI3wHpi7j6FB+5KApXZaYh5iiDbFRNsATgnt93VSjYkCJ/Gi8SXrH+I4Ren2iYdAockCUmlcE33owpjKJ/9pzGQgGFgyvnCOJtdsrZSqW3yAC+o9EDWRa1GqTIwqDJS0zD28y2w5cmDvwgO+iir3qtoBEyf3dkoPUifLtHZemLYB5IjC9YVWa8HHJELSNXrPGSdiPmJ5UNZ5tVrrqxwom0Y22oGBQJFIGOzJQ== Received: from SA0PR11CA0020.namprd11.prod.outlook.com (2603:10b6:806:d3::25) by CH2PR12MB4280.namprd12.prod.outlook.com (2603:10b6:610:ac::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.20; Fri, 11 Aug 2023 14:07:31 +0000 Received: from SA2PEPF000015CD.namprd03.prod.outlook.com (2603:10b6:806:d3:cafe::2b) by SA0PR11CA0020.outlook.office365.com (2603:10b6:806:d3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.31 via Frontend Transport; Fri, 11 Aug 2023 14:07:31 +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 SA2PEPF000015CD.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.20 via Frontend Transport; Fri, 11 Aug 2023 14:07:31 +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; Fri, 11 Aug 2023 07:07:17 -0700 Received: from nvidia.com (10.126.230.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; Fri, 11 Aug 2023 07:07:15 -0700 From: Bing Zhao To: , , , CC: Subject: [RFC PATCH] ethdev: introduce NAT64 action Date: Fri, 11 Aug 2023 17:07:01 +0300 Message-ID: <20230811140701.372151-1-bingz@nvidia.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015CD:EE_|CH2PR12MB4280:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b04a333-3372-4dd1-1e31-08db9a744db5 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: lt9FjsXDqyv+eM6JbRBtS544wP9MU20z1jxf3p7yQWKELvv0+Wbcrvktc+95dFTWqe2+sAvjGLaYLKB9JK0/0Nr03rGPc4oDYR65YgxFFZ+QjO8HgNUeft8M8T352Pr/NWgeFJiqvRAU19dDm45UBzcWvWoYLUiaOWBeXEFZTD6QpkoOXfSZTFkwaRTL7IiYG+SizPBnssLAfKpMjBcksyhAgYnDnfONWbHXIlAgLumR1uHNJhw+e95iLbj2O9Sq2Tp/X4Bb1jbJn1FZFLpg5lplGWNYYo3hquGi+iCVOd00WZuaCD5Wk/9FPoIxcZh4VZo9Z4NRIu3Yqldv0mH1QoO1ZW3W5Zjsv1YPwY/6G3z5MSqUIsB2oFx6ukn5XMzxE83mxQ3GJhyIIsJrni5YAuryMhg9H8yAVmKABANXpLXl0l9MxFDDeF2x3XVI3fiYIED+u72dPgSkwRRem6DVW7yfGVKg22rS3LyeshrO/oW5QC+IL1dGzWbdCN9N8n0qpeOgvPTYZXPo3IOyxXUZD05GhXzWh93fsfe0ekCMHKflyPbGHSHbnXIO2NOkqrAENkhuT6+LNMlVOw2UyFlBvgbBfhC4qnehucXiMq/Ob6iswN8dogyNsHALa8MclyWqyzn/9LMwVqFgGZ9+32ZnnkTXdl6/snB2CrReBi6mCvQjSEl3pEKsoWoMX7pOfgkfrO9+IiEUnlZupkMptdnuEYo4cN/6FD4AisNMHAYrn7jP9g7Un2uYg0adDhlU9c/ZytQEaFQi53o3knFuJaHHO9LQCXr5l8NLea7XRAWgv/w= 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)(346002)(39860400002)(136003)(376002)(396003)(1800799006)(186006)(451199021)(82310400008)(36840700001)(40470700004)(46966006)(966005)(40460700003)(36756003)(55016003)(86362001)(40480700001)(356005)(82740400003)(7636003)(36860700001)(83380400001)(26005)(1076003)(47076005)(16526019)(2616005)(6286002)(336012)(478600001)(110136005)(426003)(6666004)(7696005)(70206006)(4326008)(316002)(41300700001)(8936002)(8676002)(2906002)(5660300002)(70586007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 14:07:31.1937 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b04a333-3372-4dd1-1e31-08db9a744db5 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: SA2PEPF000015CD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4280 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 In order to support the communication between IPv4 and IPv6 nodes in the network, different technologies are used, like dual-stacks, tunneling and NAT64. In some IPv4-only clients, it is hard to deploy new software and hardware to support IPv6. NAT64 is a choice and it will also reduce the unnecessary overhead of the traffic in the network. The NAT64 gateways take the responsibility of the packet headers translation between the IPv6 clouds and IPv4-only clouds. This action should support the offloading of the IP headers' translation. The following fields should be reset correctly in the translation. - Version - Traffic Class / TOS - Flow Label (0 in v4) - Payload Length / Total length - Next Header - Hop Limit / TTL Since there are different mapping and translating modes of the addresses, it will depend on the capabilities of each vendor. The ICMP* and transport layers protocol is out of the scope of NAT64 rte_flow action. Reference links: - https://datatracker.ietf.org/doc/html/rfc6146 - https://datatracker.ietf.org/doc/html/rfc6052 - https://datatracker.ietf.org/doc/html/rfc6145 Signed-off-by: Bing Zhao Acked-by: Ori Kam --- lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 271d854f78..b60a4f6654 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -265,6 +265,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(IPV6_EXT_REMOVE, sizeof(struct rte_flow_action_ipv6_ext_remove)), MK_FLOW_ACTION(INDIRECT_LIST, sizeof(struct rte_flow_action_indirect_list)), + MK_FLOW_ACTION(NAT64, sizeof(struct rte_flow_action_nat64)), }; int diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 86ed98c562..2002999a35 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -2989,6 +2989,13 @@ enum rte_flow_action_type { * @see struct rte_flow_action_indirect_list */ RTE_FLOW_ACTION_TYPE_INDIRECT_LIST, + + /** + * Support the NAT64 translation. + * + * @see struct rte_flow_action_nat64 + */ + RTE_FLOW_ACTION_TYPE_NAT64, }; /** @@ -4092,6 +4099,26 @@ rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v) *RTE_FLOW_DYNF_METADATA(m) = v; } +/** + * NAT64 translation type for IP headers. + */ +enum rte_flow_nat64_type { + RTE_FLOW_NAT64_6TO4 = 0, /**< IPv6 to IPv4 headers translation. */ + RTE_FLOW_NAT64_4TO6 = 1, /**< IPv4 to IPv6 headers translation. */ +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_NAT64 + * + * Specify the NAT64 translation type. + */ +struct rte_flow_action_nat64 { + enum rte_flow_nat64_type type; +}; + /** * Definition of a single action. *