From patchwork Wed Jan 31 09:38:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 136230 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 9F54F43A1A; Wed, 31 Jan 2024 10:38:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8CAF1427E5; Wed, 31 Jan 2024 10:38:55 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2072.outbound.protection.outlook.com [40.107.244.72]) by mails.dpdk.org (Postfix) with ESMTP id D7113427E0 for ; Wed, 31 Jan 2024 10:38:53 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R70805DO2A3uuaBzwIECqblwiSM+h7YP48H1ivN3iJhxRuprf6ZQafdOe/pymUB7/K5SKdDS4JhFzCbMPSWzM7hliSBtRadhVLKbR8cby86q81Gm5OHfeDn1awaeLTVuosuCcf9eM/MJwEY5UOwEd+VxMTzRkAoqCid9JylOwMfeykSone/SzRMSqU9jqVxzdU0gIqqAttl2Y8LgZfjwJXEaxYYz50My/X+K1VTjy4g1XPGPmHExT3BTOJttdslYEZqEh/hSnYirjFyccHNfdV7X3Vgy2DwedQphF+ieQCjmxzysLlOmMW2/Ow8NfmQ8/oZ/ezrTFqP2zL/QruGdBA== 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=hPWz4UByh/xdY7LJhLiwkVeNo13XqYN+6OhDtBh4pg0=; b=GKPmSdGHVrNRXbHmNM80RKAQl/z2BArZSl9jE8xY8iEay4jqSzb461B0AZBygVjIQT1NiJpE0rhp3OPi+boODkZ+kh82vtx4vyonfbeqQUPEGoa9nhFqMYaFO9lxnmTDZSZNtuRwvXm0QRxPqRnEZN1Aj7qtZvstYBhGnMOqtyX0Y1HXkQYsBe9+3hU/eWADojXwpmG024exiBsOPSkKbrtc1udDyoki7cDL2twxdrO5mPx/SwA8FEOylroF5WFeanbkrtlvDlt3HYSFJsdpyuQn8Jc0GcMamI6tfZOx6u5A0xLa2ee7LO3Y8T+eiQA6Z1hBvcdiyy7f2kDoVDNd8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=intel.com 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 (0) 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=hPWz4UByh/xdY7LJhLiwkVeNo13XqYN+6OhDtBh4pg0=; b=klKN7aBifgPgVsBw4nLctVBv64vkTutEqQ33gFXBRPhfJXrGjwBlBbcv3hmiZpiSzrMn3uPo4PY34t/MVFVdm9YxbSFjhAwMB6+2X28fo/XJBvoXijklEi0079qTQHE40DLiRhB2OnK1FeJs/i27qiY13kdA8vsPCtzhWV1+d1jhJpGPrVBqwSBB9uisE+KwWKnOIMqFjbK6+Uy40Cxz/qra2n57qEyCZKNUEH2MnDIlnaKgr3ETv3Z1obRgGoSPJfqsC+f4cYJMSWthRhGSxTCQ73pB/5DfIOlVERCIV15J1Jq9WbKObjKFdGYm+eROvbE1MWzjiXKvNEHMSB952Q== Received: from BLAPR03CA0063.namprd03.prod.outlook.com (2603:10b6:208:329::8) by MW3PR12MB4586.namprd12.prod.outlook.com (2603:10b6:303:53::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.22; Wed, 31 Jan 2024 09:38:50 +0000 Received: from MN1PEPF0000F0E4.namprd04.prod.outlook.com (2603:10b6:208:329:cafe::a) by BLAPR03CA0063.outlook.office365.com (2603:10b6:208:329::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.24 via Frontend Transport; Wed, 31 Jan 2024 09:38:49 +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 MN1PEPF0000F0E4.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.19 via Frontend Transport; Wed, 31 Jan 2024 09:38:49 +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.41; Wed, 31 Jan 2024 01:38:33 -0800 Received: from nvidia.com (10.126.231.35) 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.41; Wed, 31 Jan 2024 01:38:30 -0800 From: Bing Zhao To: , , , , , , , , , , , Subject: [PATCH v2 1/2] ethdev: introduce NAT64 action Date: Wed, 31 Jan 2024 11:38:03 +0200 Message-ID: <20240131093804.357465-2-bingz@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240131093804.357465-1-bingz@nvidia.com> References: <20231227090731.2569427-1-bingz@nvidia.com> <20240131093804.357465-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E4:EE_|MW3PR12MB4586:EE_ X-MS-Office365-Filtering-Correlation-Id: f32c02ff-153b-4ef2-bd7e-08dc22406e12 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: 4atTsptpx6y4SvsIw5khuIA+Gs5KbTGaUbtSaMEDYno/GKl/hUVG9HmVw3vkJ6XdtNcagreBFOJ/KZkQONa3SlrqDXWhylDIYPSb6T6XrW+uuYp4cNfp2+Fd4CMOF6al77bvV5ETOfXGfU9yCrpXdfI303EaUoGw7n+O9CNpxf7AAsF22yTb/3WwQAfeS9+6uskuThSMHtng16EKfF+zgKw9ynwelGNwOOK0/SU7uwMku/Ftm8OJue7PtpBndCiFcSUgM5iC+wWiHJH17Jw74rOqSzbLmyRpna3Srh7xxEv4SryAvsoSdslaEyMArkft5FJNT6v/xq7AsHR6CbQhDhVwToR31fwrd6Acl944Di18mK1R4CzknhkPztkI0E3X481z/IX6WcgaqhDpcnPidzGdCT4/WxPkrJhDjTGq0LgwGAYtODIYqdkrC8jcQ5HKPM4iq9CmAxXi+2ZBw/pGO0L35gvUQa8lo6pfQX8UHtFjXR/4ESv70GJl3aJfR+8zlVbSSg7zqgHBQcIv0HUTEB1lyC2Ll9zoJkJTi3C2CtlHm8BGrZUa9DoLG90xTMqYj+5mvz44s3MJNgH2KuyQKqHued42ewGCsN8pcQc41sUntPOSeabXv19V4/xPIc4HV/BkJbOrKotfQIhRlz2Rh0K3PeQRChJQs5KD/0kl5dmhHbEdYa5VD2uZECHu28dhQoHHloOvnReiefy3L2EZxFU44laWFfxOrAv5uWGw9Ao9NSg1wszYAjSxs4NtBYJyfMAaN8YTZQY1TzQxBKg1Z2PthozpH3NKTngyKcpjOMqhNAuCyPQArl5SFwO+YsQKm8oAfTG8vNQbdpWF8vzl8w== 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:(13230031)(4636009)(376002)(396003)(136003)(346002)(39860400002)(230922051799003)(230173577357003)(230273577357003)(451199024)(1800799012)(82310400011)(186009)(64100799003)(46966006)(36840700001)(40470700004)(41300700001)(83380400001)(47076005)(6286002)(2616005)(426003)(336012)(16526019)(26005)(1076003)(356005)(7636003)(36860700001)(8936002)(8676002)(5660300002)(2906002)(478600001)(966005)(7696005)(70586007)(6666004)(82740400003)(110136005)(316002)(6636002)(70206006)(921011)(86362001)(36756003)(40480700001)(40460700003)(55016003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2024 09:38:49.7397 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f32c02ff-153b-4ef2-bd7e-08dc22406e12 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: MN1PEPF0000F0E4.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4586 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(or) hardware to support IPv6 protocol. 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. The commit introduce the NAT64 flow action to offload the software involvement to the hardware. 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 The PMD needs to support the basic conversion of the fields above, and the well-known prefix will be used when translating IPv4 address to IPv6 address. Another modify fields can be used after the NAT64 to support other modes with different prefix and offset. 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 --- doc/guides/nics/features/default.ini | 1 + doc/guides/prog_guide/rte_flow.rst | 8 ++++++++ lib/ethdev/rte_flow.c | 1 + lib/ethdev/rte_flow.h | 27 +++++++++++++++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index 6d50236292..4db7e41193 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -171,6 +171,7 @@ mark = meter = meter_mark = modify_field = +nat64 = nvgre_decap = nvgre_encap = of_copy_ttl_in = diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 900fdaefb6..7af329bd93 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -3520,6 +3520,14 @@ The packets will be received by the kernel driver sharing the same device as the DPDK port on which this action is configured. +Action: ``NAT64`` +^^^^^^^^^^^^^^^^^ + +This action does the header translation between IPv4 and IPv6. Besides +converting the IP addresses, other fields in the IP header are handled as +well. The ``type`` field should be provided as defined in the +``rte_flow_action_nat64`` when creating the action. + Negative types ~~~~~~~~~~~~~~ diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 3f58d792f9..156545454c 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -271,6 +271,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { sizeof(struct rte_flow_action_indirect_list)), MK_FLOW_ACTION(PROG, sizeof(struct rte_flow_action_prog)), + 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 1267c146e5..1dded812ec 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -3051,6 +3051,13 @@ enum rte_flow_action_type { * @see struct rte_flow_action_prog. */ RTE_FLOW_ACTION_TYPE_PROG, + + /** + * Support the NAT64 translation. + * + * @see struct rte_flow_action_nat64 + */ + RTE_FLOW_ACTION_TYPE_NAT64, }; /** @@ -4180,6 +4187,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. * From patchwork Wed Jan 31 09:38:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bing Zhao X-Patchwork-Id: 136231 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 8AC2E43A1A; Wed, 31 Jan 2024 10:39:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B09442D0B; Wed, 31 Jan 2024 10:38:57 +0100 (CET) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2059.outbound.protection.outlook.com [40.107.102.59]) by mails.dpdk.org (Postfix) with ESMTP id 93FE0427E7 for ; Wed, 31 Jan 2024 10:38:55 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EcTxPyyj96g8YPacJ/URTvapk/GZTRFYX/1m0KTbRtB3pBDjBlrDZeFKXOZf412fhJ21lGmDA8fcoTTpFwrM8hi9AltzTxbo0btIEHll2WCo3vgpCtDitddJ9YEBi6zjh10uYfXosRAZ4KFpOE5CO+UQP07YbQSgN2wAfoPZstLxcWc5PGGsI5HCk/JzNOx7vMeXbJjiBFi37xLRWQ9e5y1KS2cF/PobWnbOcvl5q5i0/LiCzkkDGAtDRLT3FpK8kj1AjVi/B/Q1QDw7dPg3ZqJlDykRWtnlKE0HDyFlyBau7fT6RGu7da08itNrESxfcDZR4CGuz4JZZ10NvjE0EQ== 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=r5knkG83eLGz7TzJe/29PF9WrJXIU1ubDSXeRFI9FX8=; b=TAaTUi4OJ8qL3+J7k1yzmfwPQdvPT8tN4azcxwhBpwUOUU1gBjC7qpCQVr35Gv5T9KfSr3jxrsuUi9nu7Nime32peAuI6feybnJbhs1S1lu99u2qevHUQFgSDBzYS7s9om4jorZy7zBF0+aQaRCjuLCn/Nd18ZfNQGmWTczyM+CaEi7vU0nQEk3Z3Ik7Urww9eUs2k0f8yF3bernOUqrqdHJOgooHrLb/ctmwzmM/74c0NyBXWeJW21CNoka27l2U0afhAGcJQtVdSbcnJFL9+T6VkaYiSNjSuPgmNDkUMqnlW8b/VLCab/BLeEUyahp3SYMZkvXHEflYXw8oFLmFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=intel.com 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 (0) 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=r5knkG83eLGz7TzJe/29PF9WrJXIU1ubDSXeRFI9FX8=; b=tZe5KyF2VecA0v3waZ6FPxBYmFxuVNnjQsCpDESMr+u9xJtks257BMEgC43n0I1lD1EOEtNno6U1uPdUgH/7fy/WdPHyv0tU/czgg0NtbDZAc4EpmraKFq8+3vcfpiI7RpUVxS3w+5il752SejHFg/JJGrFIFiXbGQZj3Ss4xY4V2Er6JfKZd5hjMgiHJAopZNH/plFrhp+P0rK9PKVWf9Y5gD/+oklPmwuZ1GC5KvAXBHMCrDmbyxQ5QeMziF9gQjpsWy6W5Y+YrNlm3joyihhScunVKROR0AN26c2pQyr8TDQYUdr9GyzWk3pzt1JiiV03O9MJfIYFPwtlls/ciA== Received: from MN2PR16CA0004.namprd16.prod.outlook.com (2603:10b6:208:134::17) by SA3PR12MB7806.namprd12.prod.outlook.com (2603:10b6:806:31d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.22; Wed, 31 Jan 2024 09:38:51 +0000 Received: from BL6PEPF0001AB71.namprd02.prod.outlook.com (2603:10b6:208:134:cafe::c5) by MN2PR16CA0004.outlook.office365.com (2603:10b6:208:134::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.22 via Frontend Transport; Wed, 31 Jan 2024 09:38:51 +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 BL6PEPF0001AB71.mail.protection.outlook.com (10.167.242.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.16 via Frontend Transport; Wed, 31 Jan 2024 09:38:50 +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.41; Wed, 31 Jan 2024 01:38:38 -0800 Received: from nvidia.com (10.126.231.35) 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.41; Wed, 31 Jan 2024 01:38:35 -0800 From: Bing Zhao To: , , , , , , , , , , , Subject: [PATCH v2 2/2] app/testpmd: add support for NAT64 in the command line Date: Wed, 31 Jan 2024 11:38:04 +0200 Message-ID: <20240131093804.357465-3-bingz@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240131093804.357465-1-bingz@nvidia.com> References: <20231227090731.2569427-1-bingz@nvidia.com> <20240131093804.357465-1-bingz@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB71:EE_|SA3PR12MB7806:EE_ X-MS-Office365-Filtering-Correlation-Id: 6fdfb4f0-6b90-4a5d-a036-08dc22406ec1 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: 4Ge9l4VjTNquf009n6b6Y+iFnGC1YmiFkNjoaPtKWL6E0WSGYkTkWogVd8xLp8o8B+M6HSTpb9rExQvSTxtr1jUO4Qw9Or+RDpHlgTjOji5UViriO3OBZtYYtgH0FHZKLhTWIQ5snR5oLG8iNNCdphPm7yJ0Oh/TVVOvFvH4SKrIExiEaDBNZ5lboDYGZ59NkCaRO4GXUFN5jwjmX4QHdwFFJPdyeEILjJy6v/S+onsc0tgYHZqLPHhweEQwqueNG5YpISUkV32ukA2f+GjKpFwOfhg2XBoYspsNN+FIWUUUIo4FmG68ef4H/U6HD/UaE+gSyJM+HY06jIELjW4XYNMa9NawWSGFfW/pVCWEOqyRbrJn1nPm9VUttfuCWekmy7BiJp+vBHEm3R/yW/pDc56fq8fULZ2SSxTY0W3oMJICAEom0dRXBVOreo1uWYd/JZocHUL6KmxR5+8KR6qW4vFjOyZnEeXWh8pv28/9J5Qj23H9PPc/+smG0ljcvK9Gs4jk/ZY+tW90tyQVhCXXy0eIozYqNDayfyxlCx1/kfOPdr4Edy7Ucb4wnvyOgUn/tjRRuBHJqJ/8XoVCsGWdn8lS7jU0RdNW93CLNocBZaCfWzImCDhhNBWz7Pxf+AsdI9D+Sz3AsHaR8s/yVkMYiWNQFr9hsnSVKAlE5qYEmei+PqHPkaUqV/0WTr6ecl68DzXXhzuEiZtjgHTDlsjHjkHaYPZYQ+k+5KoI8iZ0YKDeC9og+UqVbhnvh7nDiNVq 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:(13230031)(4636009)(376002)(346002)(396003)(39860400002)(136003)(230922051799003)(451199024)(64100799003)(186009)(1800799012)(82310400011)(40470700004)(46966006)(36840700001)(41300700001)(8676002)(110136005)(2906002)(5660300002)(8936002)(86362001)(70586007)(70206006)(316002)(36756003)(36860700001)(6636002)(356005)(47076005)(82740400003)(7636003)(7696005)(478600001)(6666004)(83380400001)(26005)(6286002)(1076003)(16526019)(2616005)(426003)(336012)(921011)(55016003)(40460700003)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2024 09:38:50.9171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6fdfb4f0-6b90-4a5d-a036-08dc22406ec1 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: BL6PEPF0001AB71.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7806 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 type of NAT64 action will be parsed. Usage example with template API: ... flow actions_template 0 create ingress actions_template_id 1 \ template count / nat64 / jump / end mask count / nat64 / \ jump / end flow template_table 0 create group 1 priority 0 ingress table_id \ 0x1 rules_number 8 pattern_template 0 actions_template 1 flow queue 0 create 2 template_table 0x1 pattern_template 0 \ actions_template 0 postpone no pattern eth / end actions count / \ nat64 type 1 / jump group 2 / end ... Signed-off-by: Bing Zhao Acked-by: Ori Kam --- app/test-pmd/cmdline_flow.c | 23 +++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 4062879552..d26986a9ab 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -733,6 +733,8 @@ enum index { ACTION_IPV6_EXT_PUSH, ACTION_IPV6_EXT_PUSH_INDEX, ACTION_IPV6_EXT_PUSH_INDEX_VALUE, + ACTION_NAT64, + ACTION_NAT64_MODE, }; /** Maximum size for pattern in struct rte_flow_item_raw. */ @@ -2209,6 +2211,7 @@ static const enum index next_action[] = { ACTION_QUOTA_QU, ACTION_IPV6_EXT_REMOVE, ACTION_IPV6_EXT_PUSH, + ACTION_NAT64, ZERO, }; @@ -2550,6 +2553,12 @@ static const enum index action_represented_port[] = { ZERO, }; +static const enum index action_nat64[] = { + ACTION_NAT64_MODE, + ACTION_NEXT, + ZERO, +}; + static int parse_set_raw_encap_decap(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -7077,6 +7086,20 @@ static const struct token token_list[] = { .call = parse_vc_action_ipv6_ext_push_index, .comp = comp_set_ipv6_ext_index, }, + [ACTION_NAT64] = { + .name = "nat64", + .help = "NAT64 IP headers translation", + .priv = PRIV_ACTION(NAT64, sizeof(struct rte_flow_action_nat64)), + .next = NEXT(action_nat64), + .call = parse_vc, + }, + [ACTION_NAT64_MODE] = { + .name = "type", + .help = "NAT64 translation type", + .next = NEXT(action_nat64, NEXT_ENTRY(COMMON_UNSIGNED)), + .args = ARGS(ARGS_ENTRY(struct rte_flow_action_nat64, type)), + .call = parse_vc_conf, + }, /* Top level command. */ [SET] = { .name = "set", diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 38ab421547..d1801c1b26 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -4169,6 +4169,10 @@ This section lists supported actions and their attributes, if any. - ``src_ptr``: pointer to source immediate value. - ``width``: number of bits to copy. +- ``nat64``: NAT64 IP headers translation + + - ``type {unsigned}``: NAT64 translation type + Destroying flow rules ~~~~~~~~~~~~~~~~~~~~~