From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 34280A04C7; Tue, 15 Sep 2020 15:56:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E3531BF7F; Tue, 15 Sep 2020 15:56:43 +0200 (CEST) Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by dpdk.org (Postfix) with ESMTP id 820021BF59 for ; Tue, 15 Sep 2020 15:56:42 +0200 (CEST) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 15 Sep 2020 06:54:20 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Tue, 15 Sep 2020 06:56:41 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Tue, 15 Sep 2020 06:56:41 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 15 Sep 2020 13:56:39 +0000 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.48) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 15 Sep 2020 13:56:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f42ESRqKeLoju0P7WIrmaTV+hfjYym81e4POjd+grLEkTIkr7Hf9n03KW2xaMCRW77ll3yPLqHnHN1cFQKRainlxLiUCFcD7pvxfCopgtgWRtUXD2fht3izCnTM6OmpBA1AduJ4s5NE7yxFQqcyUFBuWtOJktKUFhi7btxgTkeqLHGFuRrft39zsMsyO3f2Bq9SWwCba9sfmKNZ5XvQo6q5WICmJUdT/30iPjTcAayIzw4JBYBy1oJjsjp6C3orE7Bs1MT4vCsF6ComFkzbh7kOylbVcn7AS4R9lQCe/eRum6sOMCNJiv5avZmAIXe1iWxAKf8YNA5hoYQ76Jw3tVg== 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-SenderADCheck; bh=YwWQIMk+cGzNNf6vosDBICggsn2o9/DUPz3P5HTtbXA=; b=HtoS0+/VLvvrQNjtrZD1wft2B6fj5qN3t8QGElj3o0DnpriZ1TIFr3B5dMjpq7pYGEr54XXCTOVpaOHBlEQPCmFiqkhMYvyaJXQ1vW90QS3vv/Vx3mN3RGKnvDLVIUz0UV6/LDFtWqEdJBrWtWQs01XEDOS6HfoX2rGpzzymyaMTlkhPl4gJUjKvf5y5wsXxf7voQktVD+PwUnJoBAchq//btfgyxrhkyppXew8RNNr7kcX2PgJmrHIskbemdGjNvJs89O9v8HRpLsDc3E4425U7BeeYdkB5nPzlxHFfBuInrlAHiRp/U+Vv6z9IQIPbkynCSWBiPByNThr5ozCeYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none Received: from DM5PR12MB1161.namprd12.prod.outlook.com (2603:10b6:3:73::16) by DM6PR12MB3370.namprd12.prod.outlook.com (2603:10b6:5:38::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Tue, 15 Sep 2020 13:56:37 +0000 Received: from DM5PR12MB1161.namprd12.prod.outlook.com ([fe80::b0b9:2a96:7ad7:9a93]) by DM5PR12MB1161.namprd12.prod.outlook.com ([fe80::b0b9:2a96:7ad7:9a93%8]) with mapi id 15.20.3370.019; Tue, 15 Sep 2020 13:56:37 +0000 From: Ophir Munk To: Ophir Munk , "dev@dpdk.org" , Wenzhuo Lu , Beilei Xing , "Bernard Iremonger" , Ferruh Yigit , "olivier.matz@6wind.com" CC: Ophir Munk Thread-Topic: [PATCH v4 1/3] app/testpmd: add GENEVE parsing Thread-Index: AQHWi2KR8ZV7zBuaNUCLn137I85f7qlpt7+A Date: Tue, 15 Sep 2020 13:56:37 +0000 Message-ID: References: <20200915125319.16568-2-ophirmu@nvidia.com> <20200915131717.18252-1-ophirmu@nvidia.com> <20200915131717.18252-2-ophirmu@nvidia.com> In-Reply-To: <20200915131717.18252-2-ophirmu@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [84.229.96.120] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bed07f87-2a3e-470b-7bc0-08d8597f2a5e x-ms-traffictypediagnostic: DM6PR12MB3370: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:397; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XFETi4CNJTg4S+iGHEiKAII7NxCiBdNHXJ7a+JQ92m3Xoo28yEKvrPM3ZWBbATrZsfpIyUGAgW0GEJrr6og7ZnMt/9Yd7D1tVCZg7NMlTlKI9q2QMu/hyKQHNXtFm73VQY/IdSl9DlMtmw6rPQLO2DWS6H2PeZTGkhRHEfR+DEN9ci0yRbd28+EAraiH9ZBunjwjDj5/4CTaNewqDB0EL4siG4dJSWQeCXGAdXcMn3vqe0xZH7vJpebeeLnHKqO3hAn6YCzAYjsANpWe/i5bQa82QcY8wzKBV9bNq/o2tEYWOgaCEg+OCVRkXXOuPcsq6vb3KQjMhFz2t2OaLYZ/AFXg8ZFqZ2kfemUGmwHXAZTSds/qpuBOmmAPUTIK8S2j x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR12MB1161.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(366004)(396003)(346002)(376002)(39860400002)(86362001)(7696005)(186003)(2906002)(66946007)(53546011)(6506007)(64756008)(66446008)(66556008)(66476007)(4326008)(76116006)(55016002)(107886003)(9686003)(316002)(478600001)(52536014)(5660300002)(83380400001)(26005)(33656002)(8676002)(110136005)(8936002)(71200400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: 8THcUDQBCm1mZwidJzLHYHDLRPNFt1tHoIp5uNhNaWMFXNXGc/oM2t/1QtploV4xyGZS1nH3lwtoq9rlayzbALc72a5txGv7/8LpBNee8ORJO/0FvTCukIjSC+7y67facBYrUGowJ+V0M2wA+xmKQjjqRJFXKlREKrAZeww8jpGA4ekoDHUH7u7tYOJz6j4aWujlOybNDUgktRAsaHlcJAOeKvEJqrTLU8ABvU+4BzkZaIp6iG4RLYYCdD0QA4nlWQaUPnnJi32tO+xU3CKdIOL9K6e1YeOhzuwK7PWTSBSeuH3R6FU24GPCZySOJpRcAtfb0rRkPpR5X6l5CFgu7dwiS0K+cndnWzhaeWCLyA6a0HkR+M9zhYhxRj0ON3jrh4N6knH6noYi6agStgqsvT0k10U+2NtxeZKlz3CHIqjuArPcw9ETnvu9/z4lbtvJqKFPNY1i46mGV+jhXRJbkZ2VFOAmr2riywd5WMpNfEjcmorM/pos8smPG9/FlTtoFEuKSM2E+NnBt7HW0at+NwsPsHMv+ekovjnN77GbRAYb6lSoHYs/L2uF3DRse/SCXZuCmpABq813G/0nY6rZeppFRa06bAcpLp4qUMRq1IruHxzn6jAVFzkZDYNdckT+ydGGZngtCs6JGaq+3EDSCA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1161.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bed07f87-2a3e-470b-7bc0-08d8597f2a5e X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Sep 2020 13:56:37.7579 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: bB0mNhVZRAxgLKWlAuoy1Axshvu4Qv+nb16AP7rlD2lK4xWYIaYD4YBD8F+1fs8eVeqUVq7h+RzTNttolQo7bg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3370 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1600178060; bh=YwWQIMk+cGzNNf6vosDBICggsn2o9/DUPz3P5HTtbXA=; h=X-PGP-Universal:ARC-Seal:ARC-Message-Signature: ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic: Thread-Index:Date:Message-ID:References:In-Reply-To: Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:authentication-results:x-originating-ip: x-ms-publictraffictype:x-ms-office365-filtering-correlation-id: x-ms-traffictypediagnostic:x-ms-exchange-transport-forked: x-microsoft-antispam-prvs:x-ms-oob-tlc-oobclassifiers: x-ms-exchange-senderadcheck:x-microsoft-antispam: x-microsoft-antispam-message-info:x-forefront-antispam-report: x-ms-exchange-antispam-messagedata:Content-Type: Content-Transfer-Encoding:MIME-Version: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; b=mZ2w+8vzUef4eQ38DFEVOzvH/EXP9nqDzksx0+EkuHt0lmVXfDRZHm7aU7/qYt6Mw FLJ9b644xOR/+SPSwTqOHnv/edsa16/HjncxoPrQ8yz8jW8T9TfqQjqAZdC/00SIEF 8HgRJQIz2SuKwEk2vITWtmPZAi8NXTqP1MgttTZuP+tKFh1n3vObsmVIbi8prthaxl tOLATwj6JVgfYWxEgattwXXdn43JWOUS19Gjndbc3RiFKyiopcmh+k+GSlzuBhm3LO 9FEaAQbFvDgsbOFmLY59s60vXdqzAGQw5AtYLBUFQUeuvP9EyXic3AYyc3av64Ckhp BidbToeCEfalA== Subject: Re: [dpdk-dev] [PATCH v4 1/3] app/testpmd: add GENEVE parsing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Adding Olivier who is the maintainer of the Network headers (lib/librte_net= /rte_geneve.h). > -----Original Message----- > From: Ophir Munk > Sent: Tuesday, September 15, 2020 4:17 PM > To: dev@dpdk.org; Wenzhuo Lu ; Beilei Xing > ; Bernard Iremonger > ; Ferruh Yigit > Cc: Ophir Munk ; Ophir Munk > > Subject: [PATCH v4 1/3] app/testpmd: add GENEVE parsing >=20 > From: Ophir Munk >=20 > GENEVE is a widely used tunneling protocol in modern Virtualized Networks= . > testpmd already supports parsing of several tunneling protocols including > VXLAN, VXLAN-GPE, GRE. This commit adds GENEVE parsing of inner > protocols (IPv4-0x0800, IPv6-0x86dd, Ethernet-0x6558) based on IETF draft= - > ietf-nvo3-geneve-09. GENEVE is considered more flexible than the other > protocols. In terms of protocol format GENEVE header has a variable leng= th > options as opposed to other tunneling protocols which have a fixed header > size. >=20 > Signed-off-by: Ophir Munk > --- > app/test-pmd/csumonly.c | 70 > ++++++++++++++++++++++++++++++++++++++++++- > app/test-pmd/testpmd.h | 1 + > lib/librte_net/meson.build | 3 +- > lib/librte_net/rte_geneve.h | 72 > +++++++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 > lib/librte_net/rte_geneve.h >=20 > diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index > 7ece398..eb87b9b 100644 > --- a/app/test-pmd/csumonly.c > +++ b/app/test-pmd/csumonly.c > @@ -43,6 +43,7 @@ > #include > #include > #include > +#include >=20 > #include "testpmd.h" >=20 > @@ -63,6 +64,7 @@ > #endif >=20 > uint16_t vxlan_gpe_udp_port =3D 4790; > +uint16_t geneve_udp_port =3D RTE_GENEVE_DEFAULT_PORT; >=20 > /* structure that caches offload info for the current packet */ struct > testpmd_offload_info { @@ -333,6 +335,64 @@ parse_vxlan_gpe(struct > rte_udp_hdr *udp_hdr, > info->l2_len +=3D RTE_ETHER_VXLAN_GPE_HLEN; } >=20 > +/* Fill in outer layers length */ > +static void > +update_tunnel_outer(struct testpmd_offload_info *info) { > + info->is_tunnel =3D 1; > + info->outer_ethertype =3D info->ethertype; > + info->outer_l2_len =3D info->l2_len; > + info->outer_l3_len =3D info->l3_len; > + info->outer_l4_proto =3D info->l4_proto; } > + > +/* Parse a geneve header */ > +static void > +parse_geneve(struct rte_udp_hdr *udp_hdr, > + struct testpmd_offload_info *info) { > + struct rte_ether_hdr *eth_hdr; > + struct rte_ipv4_hdr *ipv4_hdr; > + struct rte_ipv6_hdr *ipv6_hdr; > + struct rte_geneve_hdr *geneve_hdr; > + uint16_t geneve_len; > + > + /* Check udp destination port. */ > + if (udp_hdr->dst_port !=3D _htons(geneve_udp_port)) > + return; > + > + geneve_hdr =3D (struct rte_geneve_hdr *)((char *)udp_hdr + > + sizeof(struct rte_udp_hdr)); > + geneve_len =3D sizeof(struct rte_geneve_hdr) + geneve_hdr->opt_len * > 4; > + if (!geneve_hdr->proto || geneve_hdr->proto =3D=3D > + _htons(RTE_GENEVE_TYPE_IPV4)) { > + update_tunnel_outer(info); > + ipv4_hdr =3D (struct rte_ipv4_hdr *)((char *)geneve_hdr + > + geneve_len); > + parse_ipv4(ipv4_hdr, info); > + info->ethertype =3D _htons(RTE_ETHER_TYPE_IPV4); > + info->l2_len =3D 0; > + } else if (geneve_hdr->proto =3D=3D _htons(RTE_GENEVE_TYPE_IPV6)) { > + update_tunnel_outer(info); > + ipv6_hdr =3D (struct rte_ipv6_hdr *)((char *)geneve_hdr + > + geneve_len); > + info->ethertype =3D _htons(RTE_ETHER_TYPE_IPV6); > + parse_ipv6(ipv6_hdr, info); > + info->l2_len =3D 0; > + > + } else if (geneve_hdr->proto =3D=3D _htons(RTE_GENEVE_TYPE_ETH)) { > + update_tunnel_outer(info); > + eth_hdr =3D (struct rte_ether_hdr *)((char *)geneve_hdr + > + geneve_len); > + parse_ethernet(eth_hdr, info); > + } else > + return; > + > + info->l2_len +=3D > + (sizeof(struct rte_udp_hdr) + sizeof(struct rte_geneve_hdr) + > + ((struct rte_geneve_hdr *)geneve_hdr)->opt_len * 4); } > + > /* Parse a gre header */ > static void > parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info > *info) @@ -865,9 +925,17 @@ pkt_burst_checksum_forward(struct > fwd_stream *fs) > } > parse_vxlan(udp_hdr, &info, > m->packet_type); > - if (info.is_tunnel) > + if (info.is_tunnel) { > tx_ol_flags |=3D > PKT_TX_TUNNEL_VXLAN; > + goto tunnel_update; > + } > + parse_geneve(udp_hdr, &info); > + if (info.is_tunnel) { > + tx_ol_flags |=3D > + PKT_TX_TUNNEL_GENEVE; > + goto tunnel_update; > + } > } else if (info.l4_proto =3D=3D IPPROTO_GRE) { > struct simple_gre_hdr *gre_hdr; >=20 > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index > a8ae5cc..f405d4e 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -452,6 +452,7 @@ extern struct fwd_lcore **fwd_lcores; extern struct > fwd_stream **fwd_streams; >=20 > extern uint16_t vxlan_gpe_udp_port; /**< UDP port of tunnel VXLAN-GPE. > */ > +extern uint16_t geneve_udp_port; /**< UDP port of tunnel GENEVE. */ >=20 > extern portid_t nb_peer_eth_addrs; /**< Number of peer ethernet > addresses. */ extern struct rte_ether_addr > peer_eth_addrs[RTE_MAX_ETHPORTS]; diff --git > a/lib/librte_net/meson.build b/lib/librte_net/meson.build index > 24ed825..52d3a97 100644 > --- a/lib/librte_net/meson.build > +++ b/lib/librte_net/meson.build > @@ -16,7 +16,8 @@ headers =3D files('rte_ip.h', > 'rte_net_crc.h', > 'rte_mpls.h', > 'rte_higig.h', > - 'rte_ecpri.h') > + 'rte_ecpri.h', > + 'rte_geneve.h') >=20 > sources =3D files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.= c') deps +=3D > ['mbuf'] diff --git a/lib/librte_net/rte_geneve.h b/lib/librte_net/rte_ge= neve.h > new file mode 100644 index 0000000..d50f5b3 > --- /dev/null > +++ b/lib/librte_net/rte_geneve.h > @@ -0,0 +1,72 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2020 Mellanox Technologies, Ltd */ > + > +#ifndef _RTE_GENEVE_H_ > +#define _RTE_GENEVE_H_ > + > +/** > + * @file > + * > + * GENEVE-related definitions > + */ > + > +#include > + > +#include > + > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/** GENEVE default port. */ > +#define RTE_GENEVE_DEFAULT_PORT 6081 > + > +/** > + * GENEVE protocol header. (draft-ietf-nvo3-geneve-09) > + * Contains: > + * 2-bits version (must be 0). > + * 6-bits option length in four byte multiples, not including the eight > + * bytes of the fixed tunnel header. > + * 1-bit control packet. > + * 1-bit critical options in packet. > + * 6-bits reserved > + * 16-bits Protocol Type. The protocol data unit after the Geneve header > + * following the EtherType convention. Ethernet itself is represented by > + * the value 0x6558. > + * 24-bits Virtual Network Identifier (VNI). Virtual network unique iden= tified. > + * 8-bits reserved bits (must be 0 on transmission and ignored on receip= t). > + * More-bits (optional) variable length options. > + */ > +__extension__ > +struct rte_geneve_hdr { > +#if RTE_BYTE_ORDER =3D=3D RTE_BIG_ENDIAN > + uint8_t ver:2; /**< Version (2). */ > + uint8_t opt_len:6; /**< Options length (6). */ > + uint8_t oam:1; /**< Control packet (1). */ > + uint8_t critical:1; /**< Critical packet (1). */ > + uint8_t rsvd1:6; /**< Reserved (6). */ > +#else > + uint8_t opt_len:6; /**< Options length (6). */ > + uint8_t ver:2; /**< Version (2). */ > + uint8_t rsvd1:6; /**< Reserved (6). */ > + uint8_t critical:1; /**< Critical packet (1). */ > + uint8_t oam:1; /**< Control packet (1). */ > +#endif > + rte_be16_t proto; /**< Protocol type (16). */ > + uint8_t vni[3]; /**< Virtual network identifier (24). */ > + uint8_t rsvd2; /**< Reserved (8). */ > + uint8_t opts[]; /** +} __rte_packed; > + > +/* GENEVE next protocol types */ > +#define RTE_GENEVE_TYPE_IPV4 0x0800 /**< IPv4 Protocol. > */ > +#define RTE_GENEVE_TYPE_IPV6 0x86dd /**< IPv6 Protocol. > */ > +#define RTE_GENEVE_TYPE_ETH 0x6558 /**< Ethernet > Protocol. */ > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* RTE_GENEVE_H_ */ > -- > 2.8.4