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 4D0C745847; Thu, 22 Aug 2024 17:33:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6C3542EE3; Thu, 22 Aug 2024 17:33:06 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2072.outbound.protection.outlook.com [40.107.92.72]) by mails.dpdk.org (Postfix) with ESMTP id A5C1B42E52 for ; Thu, 22 Aug 2024 17:33:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fiZzf9SkOIcAv7h9yjl+WDr/eCHO4U3kVp7Qt3Xuz8BEvAqtKmTUCaCNH9Y1uq7DkvyqdeNjr3W8XOVXwKN25ER7NgtdZQKZceaLX6ZBVP6ZDLHF9ODs1p7dePJhkSZthII3CqAGp55ZbAL9KI7oJ9n5J1Z1xchk5Tf7BTQ9x56+tczW+mM0fQt0gdTe/3p/2/FpUzU/duNFEZ3Wjp0OrWUpfjapHi/tW4oYcUmM9NPkxQjq8GKYQ+P+VpE9pitpsyn/6tjMc6zk8XFCv+mBnaNKWxylasyBnID7n3srP5ODDNKtg1TcXOb9sSWOSL0goqzonS8XGQlQuw/4RJUqCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=44mydM6R5jNZHLFqI6IFlnVDYP0nz3w8LOhWvEpkKcI=; b=UulOHiJERwN53c7nvG44ZpWQ2kTjuVbsMwhHt43aWR5Fs8Y/0mshr4/gFR9zhmv4GtFi1T+O2kIyRhmOTW8FwgwS5b7M3QhPS8YC5QbIy2Isbnz7GO01Y5bdWHKJBc6b5dPwQAK6a0AEK/R02+I6qPVaI3YLakVIBmqmVIHZYy57yMis1DlagMoFkeT3WJmE537WgTbmNFS+tzmz0ZOe3Q9DuSx4ZbwOj/0mDD0fel7lAVpoXzNM3wHQhehPjf4VMscvOEcf9xOtmkF+cKAdJeVzZ3Me8XsuSIe+9Wi5EzzuOXcA1ScbKkfJ3FFPP5IsEJ9PNAQV+Bewhjp5mQHIpA== 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 (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=44mydM6R5jNZHLFqI6IFlnVDYP0nz3w8LOhWvEpkKcI=; b=a1BYbRHxZqED5QtcSnlsP2wkrK6LBJe9ejw9rvyAFIbYo3fXP/sESg/8tQ7ceHtzuS846Cd+rxGZ4K17Z44x33QUqpfGtYawCTa7qen7Cd0PTwv1uu+ZL+gdRL4YEtZdFwwhaF5RSsJutlq8BFZ/PmeEPFS8iPQP91zd95pKcZOu7XDZlBW6qeMwcXgyBoJV9IcKjD4LEuo3nkTJsTFdz3pi7MyQZsY8z64S3fykYH0o3Z1gEy8sr6MLbKeXBp0Oz3XIJvC+kS4NUAgXx+pbrr3pB36g9HJ4O2VWH3z5EchCUlweGuvxXBeRZVDnvU0iGpNhshLtmnmshQ8NW/l5Vw== Received: from BL1PR13CA0309.namprd13.prod.outlook.com (2603:10b6:208:2c1::14) by DM4PR12MB5916.namprd12.prod.outlook.com (2603:10b6:8:69::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.16; Thu, 22 Aug 2024 15:33:00 +0000 Received: from BN3PEPF0000B076.namprd04.prod.outlook.com (2603:10b6:208:2c1:cafe::80) by BL1PR13CA0309.outlook.office365.com (2603:10b6:208:2c1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.13 via Frontend Transport; Thu, 22 Aug 2024 15:32:59 +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 BN3PEPF0000B076.mail.protection.outlook.com (10.167.243.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.11 via Frontend Transport; Thu, 22 Aug 2024 15:32:59 +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.1544.4; Thu, 22 Aug 2024 08:32:36 -0700 Received: from pegasus01.mtr.labs.mlnx (10.126.230.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.1544.4; Thu, 22 Aug 2024 08:32:33 -0700 From: Alexander Kozyrev To: CC: , , , , , , , , Subject: [PATCH] mbuf: add transport mode ESP packet type Date: Thu, 22 Aug 2024 18:32:18 +0300 Message-ID: <20240822153218.3782170-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] 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: BN3PEPF0000B076:EE_|DM4PR12MB5916:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c5a98a0-1eae-495a-0718-08dcc2bfb41e 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; ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?3l65xjaAyITiJhbH+q9HBIAcc43WhDU9mLpBhsgIumOhelJvk9gRuY1UrnDE?= =?us-ascii?Q?H1ny4zYiay/JaDc7ALcwBB3emAqhudmXQPlufIiyWX8uWqwMcr2Tz6vw4zSH?= =?us-ascii?Q?+WevDgogwcsQse5tkxQ5kckxytN0Ey0JfT9kOiaJqqzknSR8LUGm+MznlJu0?= =?us-ascii?Q?0H382WBfSVgVnIV/6wTQzqs1osweqC5umDZ/cioYExaFoPJjmVaW5Jk50kWE?= =?us-ascii?Q?/PhW657H6Nqc0pgNpOR3KY/9+Nn9n1Bm5xEOiu8ep6C2ABEExFeJSKiL9wY+?= =?us-ascii?Q?9xtHmsHLqBz/PnKzfRUzKr8ePQRSTTWLC4JW2RlUCnURsrR5wkDc9S3Kj/pv?= =?us-ascii?Q?uD2Td1+MkCcq/HJSZsZb8vsh+xeO8FFONOK/qoRhK76TO/b4a1yjMi6gtNxV?= =?us-ascii?Q?Ss9IXMJ2jYtyBO9+bRnvQHtXd62wD5oi7zYUi1CtWKESLePouiWMaIE8Y0yI?= =?us-ascii?Q?gNfLzEYzAOuyWJnxrjwDTxxKJ39SNvMSY4Z6Ncylfxc7RilV0PjPH2Z6HAsa?= =?us-ascii?Q?z8JAnUV8Kn6+vYVIrrDFoUGN92fa2dY1L6Rw9LrS0BIZe7rInlPs6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FsNzQycwUvdAkrGr?= 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:(13230040)(82310400026)(376014)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 15:32:59.4145 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c5a98a0-1eae-495a-0718-08dcc2bfb41e 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: BN3PEPF0000B076.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5916 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 Support the IP Encapsulating Security Payload (ESP) in transport mode. Currently, we have RTE_PTYPE_TUNNEL_ESP for the ESP tunnel mode. Transport mode can be detected by parsing the "Next Header" field. The Next Header is TCP for the transport mode and IP for the tunnel mode. Add RTE_PTYPE_L4_ESP for the regular transport mode and RTE_PTYPE_INNER_L4_ESP for the ESP over UDP packets. Signed-off-by: Alexander Kozyrev --- lib/mbuf/rte_mbuf_ptype.c | 2 ++ lib/mbuf/rte_mbuf_ptype.h | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/lib/mbuf/rte_mbuf_ptype.c b/lib/mbuf/rte_mbuf_ptype.c index d6f906b06c..ab180b3dda 100644 --- a/lib/mbuf/rte_mbuf_ptype.c +++ b/lib/mbuf/rte_mbuf_ptype.c @@ -50,6 +50,7 @@ const char *rte_get_ptype_l4_name(uint32_t ptype) case RTE_PTYPE_L4_ICMP: return "L4_ICMP"; case RTE_PTYPE_L4_NONFRAG: return "L4_NONFRAG"; case RTE_PTYPE_L4_IGMP: return "L4_IGMP"; + case RTE_PTYPE_L4_ESP: return "L4_ESP"; default: return "L4_UNKNOWN"; } } @@ -112,6 +113,7 @@ const char *rte_get_ptype_inner_l4_name(uint32_t ptype) case RTE_PTYPE_INNER_L4_SCTP: return "INNER_L4_SCTP"; case RTE_PTYPE_INNER_L4_ICMP: return "INNER_L4_ICMP"; case RTE_PTYPE_INNER_L4_NONFRAG: return "INNER_L4_NONFRAG"; + case RTE_PTYPE_INNER_L4_ESP: return "INNER_L4_ESP"; default: return "INNER_L4_UNKNOWN"; } } diff --git a/lib/mbuf/rte_mbuf_ptype.h b/lib/mbuf/rte_mbuf_ptype.h index f2276e2909..c46a94f89f 100644 --- a/lib/mbuf/rte_mbuf_ptype.h +++ b/lib/mbuf/rte_mbuf_ptype.h @@ -247,7 +247,7 @@ extern "C" { * It refers to those packets of any IP types, which can be recognized as * fragmented. A fragmented packet cannot be recognized as any other L4 types * (RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, RTE_PTYPE_L4_SCTP, RTE_PTYPE_L4_ICMP, - * RTE_PTYPE_L4_NONFRAG). + * RTE_PTYPE_L4_NONFRAG, RTE_PTYPE_L4_IGMP, RTE_PTYPE_L4_ESP). * * Packet format: * <'ether type'=0x0800 @@ -290,14 +290,15 @@ extern "C" { * * It refers to those packets of any IP types, while cannot be recognized as * any of above L4 types (RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, - * RTE_PTYPE_L4_FRAG, RTE_PTYPE_L4_SCTP, RTE_PTYPE_L4_ICMP). + * RTE_PTYPE_L4_FRAG (for IPv6), RTE_PTYPE_L4_SCTP, RTE_PTYPE_L4_ICMP, + * RTE_PTYPE_L4_IGMP (for IPv4), RTE_PTYPE_L4_ESP). * * Packet format: * <'ether type'=0x0800 - * | 'version'=4, 'protocol'!=[6|17|132|1], 'MF'=0, 'frag_offset'=0> + * | 'version'=4, 'protocol'!=[1|2|6|17|50|132], 'MF'=0, 'frag_offset'=0> * or, * <'ether type'=0x86DD - * | 'version'=6, 'next header'!=[6|17|44|132|1]> + * | 'version'=6, 'next header'!=[1|6|17|44|50|132]> */ #define RTE_PTYPE_L4_NONFRAG 0x00000600 /** @@ -308,6 +309,17 @@ extern "C" { * | 'version'=4, 'protocol'=2, 'MF'=0, 'frag_offset'=0> */ #define RTE_PTYPE_L4_IGMP 0x00000700 +/** + * ESP (IP Encapsulating Security Payload) transport packet type. + * + * Packet format: + * <'ether type'=0x0800 + * | 'version'=4, 'protocol'=50, 'MF'=0, 'frag_offset'=0> + * or, + * <'ether type'=0x86DD + * | 'version'=6, 'next header'=50> + */ +#define RTE_PTYPE_L4_ESP 0x00000800 /** * Mask of layer 4 packet types. * It is used for outer packet for tunneling cases. @@ -652,12 +664,24 @@ extern "C" { * * Packet format (inner only): * <'ether type'=0x0800 - * | 'version'=4, 'protocol'!=[6|17|132|1], 'MF'=0, 'frag_offset'=0> + * | 'version'=4, 'protocol'!=[1|6|17|50|132], 'MF'=0, 'frag_offset'=0> * or, * <'ether type'=0x86DD - * | 'version'=6, 'next header'!=[6|17|44|132|1]> + * | 'version'=6, 'next header'!=[1|6|17|44|50|132]> */ #define RTE_PTYPE_INNER_L4_NONFRAG 0x06000000 +/** + * ESP (IP Encapsulating Security Payload) transport packet type. + * It is used for inner packet only. + * + * Packet format (inner only): + * <'ether type'=0x0800 + * | 'version'=4, 'protocol'=50, 'MF'=0, 'frag_offset'=0> + * or, + * <'ether type'=0x86DD + * | 'version'=6, 'next header'=50> + */ +#define RTE_PTYPE_INNER_L4_ESP 0x08000000 /** * Mask of inner layer 4 packet types. */ -- 2.18.2