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 95496A0C47; Tue, 12 Oct 2021 17:28:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4EAA841149; Tue, 12 Oct 2021 17:28:28 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2053.outbound.protection.outlook.com [40.107.100.53]) by mails.dpdk.org (Postfix) with ESMTP id D7FB74113A for ; Tue, 12 Oct 2021 17:28:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AmR4juJKTwTHfzrYU5dWCWsJWdDEh9gnpHw8yr5w3F++0kkJDAdjDluMrmuLZKgt2wdrTxKXN+YoxxU0ZIrC9TIpz0RSpce7Ps38XuqHHvYi9di+MH9V7fpxJYnq0xWisweoyzCDc9jUyuAYCTeXkGCDJp2a4woqwMw+1vUbGDiUHDtxQjA9Z8vLa3KQL0o0Bsw9sBC8XF6d9g2L3+uX2I29fKCCCVEPGKQ/5Iv2cS+yeB/sX1hfQoW00Uoh57zhULxYboNgPCnLXNSXtjfUtBzFRk/6cnbml1DEM3LzXhUEZOmGC4hBvgYmtv9bfEm9xGM0MUwrOn26K7Bpk9MR5Q== 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=0nwX53DRqLdKdj1UIG92p6+udHdHSTM9uVOjNljjA34=; b=SegowB3nuGfk2fhTNBvoV7v649jyXqo+gFDxX84i2TwurtryaNZ3Z1o1PHbqH1j68YFeNAOmNTB3zsJ3EPRh7uiOXCVZLt/wyXZACGUENzHz4tJv0crycIjORIgG+QYvFLXkENvOXhKZkNvo+lwhYOxgiCri87H8lctm98+9O4XeGoLTUVswFWGQdpHMMfb5boxfk/Uos12tpcErie1Uotrmk+YxMjB0HUaHmVtjxkeSPaExCl64SFpsjsqcSwXp+7ljpufFSGyT+Wfzxs6PnK9f5rUUeOD11X3Zgb5F94bcflyXazeic+BYBYc3qmz+CnsJ7ov6sPXH4g3Kl4VdHg== 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 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=0nwX53DRqLdKdj1UIG92p6+udHdHSTM9uVOjNljjA34=; b=KZs0SV6M6RWmTBrd4xdBER8GeKsLrUv07BuIbMuIa/XMOTlTpR2zikhRgCzrQRKKISDrePZ28cEMIeOXmRog/IuevRFkNfkF/b4/IZQgXA6QgU/foHyGSsvwlWpcwSN9dFT/z0NJA6z98VoaN9a6UUoQik+Cl1r7FUEYuVYFPr1eu4BAoSnWwTMBGJrgxe6N6/ITrzAcSdPaUBD8l/I6ZsFU6XssFR4gmq84MDercKGvQHeccHJ0qkL9g0KURJ6FRdAufG9m7xHQmu4Vvq8l4+yCal3WKhd3tXmSueKHQQZsnnvUQ1784IsHWEChJBIVefjJ9kcAVFdlVLYuZd17Pw== Received: from DM8PR12MB5400.namprd12.prod.outlook.com (2603:10b6:8:3b::12) by DM4PR12MB5086.namprd12.prod.outlook.com (2603:10b6:5:389::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Tue, 12 Oct 2021 15:28:24 +0000 Received: from DM8PR12MB5400.namprd12.prod.outlook.com ([fe80::d03d:1f75:ca20:6a32]) by DM8PR12MB5400.namprd12.prod.outlook.com ([fe80::d03d:1f75:ca20:6a32%6]) with mapi id 15.20.4587.026; Tue, 12 Oct 2021 15:28:24 +0000 From: Ori Kam To: Jie Wang , "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , NBU-Contact-Thomas Monjalon , "andrew.rybchenko@oktetlabs.ru" , "xiaoyun.li@intel.com" , "stevex.yang@intel.com" , "jingjing.wu@intel.com" , "beilei.xing@intel.com" , "wenjun1.wu@intel.com" Thread-Topic: [dpdk-dev] [PATCH v2 3/3] ethdev: support PPPoL2TPv2oUDP RSS Hash Thread-Index: AQHXv1OFLgQs70dvcEaNz+v+1i39WqvPKW3g Date: Tue, 12 Oct 2021 15:28:24 +0000 Message-ID: References: <20210924151705.287571-1-jie1x.wang@intel.com> <20211012102508.275790-1-jie1x.wang@intel.com> <20211012102508.275790-4-jie1x.wang@intel.com> In-Reply-To: <20211012102508.275790-4-jie1x.wang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a70c974e-e88f-4784-9086-08d98d94eeaa x-ms-traffictypediagnostic: DM4PR12MB5086: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2201; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: n7+pndMzMQXRK817QV3bihqND24rHfq86xphVa15t5PoKRQIe8vggr2Pnx3L1rGcGXbud0C9xaYrdXXv3lE+r5BJKeLKclaiewgRK3THeER8k1pm/X0UPs3VXAd7YVfNf4SZTsBkNLjOC/o//8CMXReBFL0DhiC1mejeMhlThyTiqjFyRu0pL23ieDR8y2xNdRWSZWOYSPcpa1D2YkrDpYYE0c+9ZHcKEtcuEEqCduFQRiEmECRhX+YQHLSJhTIi5EsJZ2jtwuAbLx1YhxJszVjuiuwFPOyAYTgM9AIxg/Qd5GqZOxlw9RBCLvHASh1thxPcrVdROlOXfzr8itdyg4b49SGuq3n9fI7LRkPhba6MIGvrXzWHFH+l7QcpDSBQ+AXmsJoJdfK8117Vwc25KcgcSL2junn//chlpKkIppjK4VUyILmyRmT+sbPI8Vbu1GVK0abghdIUkL/SU/o94QjMgjoQJ7QDUd2f53YfPwBhb2TgwQsckaODGh7Ok4ZgEjXQHfauOBsqfd3XNEXN6z2QSmO1WWJtk8240i/G3dAtL2Bo+ZvUXf5J9nRyZEm2TK8oqcg274ym9m9U+E7jsnCe0KxbPQWmPRjL2KkWRzEz7IMj6y2zDBhVfiAIRjudAnPn1F/4BVkeMtpD/FP4HgFVtZZUX2L7yFhFhEP+sUXzlX53uvyVBcqLov7+brEwIQuSEtbTzt8NP5GlfnMPAA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR12MB5400.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(5660300002)(53546011)(110136005)(86362001)(9686003)(4326008)(8676002)(71200400001)(508600001)(52536014)(122000001)(7696005)(38070700005)(66476007)(66556008)(6506007)(33656002)(2906002)(76116006)(30864003)(55016002)(64756008)(66946007)(8936002)(186003)(316002)(26005)(54906003)(83380400001)(66446008)(7416002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?rcSK/eQM4PCpAWZvBbU0SRGzK3SsNFadFuza35S52xuXsjzIvQel4zhM2aBR?= =?us-ascii?Q?3PKTlj10ejn2Xxiwbx+tpnm98zqF/qdRAB9tJ0ELOyXmTeo1De4dL4hYBP45?= =?us-ascii?Q?HkJ73YQuPmNeNLZ9gE2oExFnXmGHXLE0uXMuhUQ6p+eBize5fJOpgzsohiYo?= =?us-ascii?Q?wivGL/MJBseeSbzrGgEJtFzTtvTxYTSw+wSbdAPDtuO+jLOH6eD4pTN8kTOR?= =?us-ascii?Q?lykUfIKV7SLAaoAjB/Dp6PdeDdk3vR1tHnXnzOMpwnCNWZTsI42EOLLI2G0V?= =?us-ascii?Q?9vpJRGBYLy1UWjAKe/JHUlIxiqEAKB6MSNBWZb38lmbpg3dktaxKAn2A2ybh?= =?us-ascii?Q?i7qXx3pKhOxvMUuhfh0CZMUFrTAImKkTk5pZx+29D76N9PceU+vL7AJYNjLp?= =?us-ascii?Q?AnqjA95ybPbrNeL1SQryDUZd61vGlYeHlhzHqPZK5psn/rC+dQntifJGlLWq?= =?us-ascii?Q?5PMLSLabLG0JI0JAdJoCVb1/tjuHKQDtFI8sXaqQYxeYrVweM+/5A84W3ocv?= =?us-ascii?Q?rS+jv53ZEbtJ7J5Ytqg8DOO6ynzQUfNCQy5MGJt/8g4QBvxTei28zo4ewBN1?= =?us-ascii?Q?fK5qkmkzCaOuCsDr7Jm9/9H/WaFn7rrwlxSIIxllzcG9IYH0CR4IM24UsUtH?= =?us-ascii?Q?0uQugcAh4IXJYJOH9KCsYxbmcKG40+hoGZWmUbAaCmgGUMm1LPf9G8ULQhQL?= =?us-ascii?Q?0X4G3fdjWP8bpCHLC7kED9e+T7mbvLcAbRIYVjqTj+wteC4sb586MJOwChKJ?= =?us-ascii?Q?hTkEtHvwKQTjJZmLJsyYavFfGA0aGVdp+Hi46qrAxdMEErUunGl5tmrjuCZX?= =?us-ascii?Q?Myax2KCn1E8l2LP9j3qDGaMEo6uTI8p0AYgYWVYinylLfGZBh4L58ta1JzIH?= =?us-ascii?Q?smicbtM55Xc5UGMK10cfdX9cPa/HkpbYe6eMDDlqF/aMftObB1jHswz3oW8W?= =?us-ascii?Q?7CJbHdq/rC5/ZDlnckTmcJQ3jhh8iPxWsheBhOeZrje660M6QziY7DeFAxZ/?= =?us-ascii?Q?lMzF//+L4Qyu4Kvg91YCS8+DtWWTYK0MMFAvDKndxElDMIQoIMbezuSmb7Aj?= =?us-ascii?Q?Rdf450SNErYn2LW1mfFEmUnEiFeYovAOtGhBBzXpZimL7BJmBCGFK+jSUDtB?= =?us-ascii?Q?UngKmOeFkLjO+QKh7vTDWrjEEcZPu8PWfQTy2d2E5eGzIKVNKKh+CT4wExdt?= =?us-ascii?Q?bv9lGf/bKgioSzqQff4SRthVcdHgZTU9aZxZcwc+wf8GJ30Fo3mwC+KZ5n4Z?= =?us-ascii?Q?KX3c64Zutg7MIM/ZiDVwWV73eWwl9Y8T1tUBaxSUOLcYKwhy0xWOfrC2LUqu?= =?us-ascii?Q?UCP7CHUQPsRQBLnb3qzJthZd?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR12MB5400.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a70c974e-e88f-4784-9086-08d98d94eeaa X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Oct 2021 15:28:24.7023 (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: QJt5opC7knFoe5BVe/Xwabk2K/TNoeHjoMoGCJV2P3+paet9bweNkG2aenv1zUzViqB7YUDTH/nSLd2E90e0Bg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5086 Subject: Re: [dpdk-dev] [PATCH v2 3/3] ethdev: support PPPoL2TPv2oUDP RSS Hash 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 Sender: "dev" Hi Jie, The first comment you are missing the maintainer (me) Second shouldn't this be the first patch of the series? Third this patch is about matching on new protocols why there is RSS hash i= n the title? > -----Original Message----- > From: dev On Behalf Of Jie Wang > Sent: Tuesday, October 12, 2021 1:25 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v2 3/3] ethdev: support PPPoL2TPv2oUDP RSS Has= h >=20 > Added flow pattern items and header formats of L2TPv2 and PPP to support = PPP over L2TPv2 over UDP > protocol RSS Hash. >=20 > Signed-off-by: Wenjun Wu > Signed-off-by: Jie Wang > --- > doc/guides/prog_guide/rte_flow.rst | 25 +++ > doc/guides/rel_notes/release_21_11.rst | 5 + > lib/ethdev/rte_flow.c | 2 + > lib/ethdev/rte_flow.h | 65 ++++++++ > lib/net/rte_l2tpv2.h | 214 +++++++++++++++++++++++++ > 5 files changed, 311 insertions(+) > create mode 100644 lib/net/rte_l2tpv2.h >=20 > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/r= te_flow.rst > index 2b42d5ec8c..e161fa8620 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -1425,6 +1425,31 @@ Matches a conntrack state after conntrack action. > - ``flags``: conntrack packet state flags. > - Default ``mask`` matches all state bits. >=20 > +Item: ``L2TPV2`` > +^^^^^^^^^^^^^^^^^^^ > + > +Matches a L2TPv2 header. > + > +- ``flags_version``: flags(12b), version(4b). > +- ``length``: total length of the message. > +- ``tunnel_id``: identifier for the control connection. > +- ``session_id``: identifier for a session within a tunnel. > +- ``ns``: sequence number for this date or control message. > +- ``nr``: sequence number expected in the next control message to be rec= eived. > +- ``offset_size``: offset of payload data. > +- ``offset_padding``: offset padding, variable length. > +- Default ``mask`` matches flags_version only. > + > +Item: ``PPP`` > +^^^^^^^^^^^^^^^^^^^ > + > +Matches a PPP header. > + > +- ``addr``: ppp address. > +- ``ctrl``: ppp control. > +- ``proto_id``: ppp protocol identifier. > +- Default ``mask`` matches addr, ctrl, proto_id. > + > Actions > ~~~~~~~ >=20 > diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_note= s/release_21_11.rst > index 93082723cf..af8e0733db 100644 > --- a/doc/guides/rel_notes/release_21_11.rst > +++ b/doc/guides/rel_notes/release_21_11.rst > @@ -67,6 +67,11 @@ New Features > Added macros ETH_RSS_IPV4_CHKSUM and ETH_RSS_L4_CHKSUM, now IPv4 and > TCP/UDP/SCTP header checksum field can be used as input set for RSS. >=20 > +* **Added L2TPV2 and PPP protocol support in rte_flow.** > + > + Added flow pattern items and header formats of L2TPv2 and PPP to > + support PPP over L2TPv2 over UDP protocol RSS Hash. > + > * **Updated Broadcom bnxt PMD.** >=20 > * Added flow offload support for Thor. > diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 8cb7a069= c8..307fbc3abe 100644 > --- a/lib/ethdev/rte_flow.c > +++ b/lib/ethdev/rte_flow.c > @@ -98,6 +98,8 @@ static const struct rte_flow_desc_data rte_flow_desc_it= em[] =3D { > MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)), > MK_FLOW_ITEM(ECPRI, sizeof(struct rte_flow_item_ecpri)), > MK_FLOW_ITEM(GENEVE_OPT, sizeof(struct rte_flow_item_geneve_opt)), > + MK_FLOW_ITEM(L2TPV2, sizeof(struct rte_flow_item_l2tpv2)), > + MK_FLOW_ITEM(PPP, sizeof(struct rte_flow_item_ppp)), Why not in the end? > MK_FLOW_ITEM(INTEGRITY, sizeof(struct rte_flow_item_integrity)), > MK_FLOW_ITEM(CONNTRACK, sizeof(uint32_t)), }; diff --git a/lib/ethdev/= rte_flow.h > b/lib/ethdev/rte_flow.h index 7b1ed7f110..a7a7bd983b 100644 > --- a/lib/ethdev/rte_flow.h > +++ b/lib/ethdev/rte_flow.h > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include >=20 > #ifdef __cplusplus > extern "C" { > @@ -574,6 +575,21 @@ enum rte_flow_item_type { > * @see struct rte_flow_item_conntrack. > */ > RTE_FLOW_ITEM_TYPE_CONNTRACK, > + > + /** > + * Matches L2TPV2 Header. > + * > + * See struct rte_flow_item_l2tpv2. > + */ > + RTE_FLOW_ITEM_TYPE_L2TPV2, > + > + /** > + * Matches PPP Header. > + * > + * See struct rte_flow_item_ppp. > + */ > + RTE_FLOW_ITEM_TYPE_PPP, > + > }; >=20 > /** > @@ -1799,6 +1815,55 @@ static const struct rte_flow_item_conntrack rte_fl= ow_item_conntrack_mask > =3D { }; #endif >=20 > +/** > + * @warning > + * @b EXPERIMENTAL: this structure may change without prior notice > + * RTE_FLOW_ITEM_TYPE_L2TPV2 > + * > + * Matches L2TPv2 Header > + */ > +struct rte_flow_item_l2tpv2 { > + struct rte_l2tpv2_combined_msg_hdr hdr; }; > + > +/** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV2. */ #ifndef __cplusplus > +static const struct rte_flow_item_l2tpv2 rte_flow_item_l2tpv2_mask =3D { > + /* > + * flags and version bit mask > + * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 > + * T L x x S x O P x x x x V V V V > + */ > + .hdr =3D { > + .common =3D { > + .flags_version =3D 0xcb0f, > + }, > + }, > +}; > +#endif > + > +/** > + * @warning > + * @b EXPERIMENTAL: this structure may change without prior notice > + * RTE_FLOW_ITEM_TYPE_PPP > + * > + * Matches PPP Header > + */ > +struct rte_flow_item_ppp { > + uint8_t addr; /**< ppp address(8) */ > + uint8_t ctrl; /**< ppp control(8) */ > + rte_be16_t proto_id; /**< ppp protocol id(16) */ }; > + > +/** Default mask for RTE_FLOW_ITEM_TYPE_PPP. */ #ifndef __cplusplus > +static const struct rte_flow_item_ppp rte_flow_item_ppp_mask =3D { > + .addr =3D 0xff, > + .ctrl =3D 0xff, > + .proto_id =3D 0xffff, > +}; > +#endif > + > /** > * Matching pattern item definition. > * > diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h new file mode 10= 0644 index > 0000000000..aea3c689be > --- /dev/null > +++ b/lib/net/rte_l2tpv2.h > @@ -0,0 +1,214 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2021 Mellanox Technologies, Ltd */ > + > +#ifndef _RTE_L2TPV2_H_ > +#define _RTE_L2TPV2_H_ > + > +/** > + * @file > + * > + * L2TP header: > + * 0 1 2 3 > + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 > + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ > + * |T|L|x|x|S|x|O|P|x|x|x|x| Ver | Length (opt) | > + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ > + * | Tunnel ID | Session ID | > + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ > + * | Ns (opt) | Nr (opt) | > + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ > + * | Offset Size (opt) | Offset pad... (opt) > + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ > + * > + * The Type (T) bit indicates the type of message. It is set to 0 for a > +data > + * message and 1 for a control message. > + * > + * If the Length (L) bit is 1, the Length field is present. This bit > +MUST be > + * set to 1 for control messages. > + * > + * The x bits are reserved for future extensions. All reserved bits > +MUST > + * be set to 0 on outgoing messages and ignored on incoming messages. > + * > + * If the Sequence (S) bit is set to 1 the Ns and Nr fields are present. > + * The S bit MUST be set to 1 for control messages. > + * > + * If the Offset (O) bit is 1, the Offset Size field is present. The O > + * bit MUST be set to 0 for control messages. > + * > + * If the Priority (P) bit is 1, this data message should receive > + * preferential treatment in its local queuing and transmission. > + * The P bit MUST be set to 0 for control messages. > + * > + * Ver MUST be 2, indicating the version of the L2TP data message header= . > + * > + * The Length field indicates the total length of the message in octets. > + * > + * Tunnel ID indicates the identifier for the control connection. > + * > + * Session ID indicates the identifier for a session within a tunnel. > + * > + * Ns indicates the sequence number for this data or control message. > + * > + * Nr indicates the sequence number expected in the next control > +message > + * to be received. > + * > + * The Offset Size field, if present, specifies the number of octets > + * past the L2TP header at which the payload data is expected to start. > + * Actual data within the offset padding is undefined. If the offset > + * field is present, the L2TP header ends after the last octet of the > + * offset padding. > + */ > + > +#include > +#include > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/** > + * L2TPv2 Common Header > + */ > +RTE_STD_C11 > +struct rte_l2tpv2_common_hdr { > + union { > + rte_be16_t flags_version; > + struct { > +#if RTE_BYTE_ORDER =3D=3D RTE_LITTLE_ENDIAN > + rte_be16_t t:1; /**< message Type */ > + rte_be16_t l:1; /**< length option bit*/ > + rte_be16_t res1:2; /**< reserved */ > + rte_be16_t s:1; /**< ns/nr option bit*/ > + rte_be16_t res2:1; /**< reserved */ > + rte_be16_t o:1; /**< offset option bit*/ > + rte_be16_t p:1; /**< priority option bit*/ > + rte_be16_t res3:4; /**< reserved */ > + rte_be16_t ver:4; /**< protocol version */ > +#elif RTE_BYTE_ORDER =3D=3D RTE_BIG_ENDIAN > + rte_be16_t ver:4; /**< protocol version */ > + rte_be16_t res3:4; /**< reserved */ > + rte_be16_t p:1; /**< priority option bit*/ > + rte_be16_t o:1; /**< offset option bit*/ > + rte_be16_t res2:1; /**< reserved */ > + rte_be16_t s:1; /**< ns/nr option bit*/ > + rte_be16_t res1:2; /**< reserved */ > + rte_be16_t l:1; /**< length option bit*/ > + rte_be16_t t:1; /**< message Type */ > +#endif > + }; > + }; > +}; > + > +/* > + * L2TPv2 message Header contains all options(length, ns, nr, > + * offset size, offset padding). > + */ > +struct rte_l2tpv2_msg_with_all_options { > + rte_be16_t length; /**< length(16) */ > + rte_be16_t tunnel_id; /**< tunnel id(16) */ > + rte_be16_t session_id; /**< session id(16) */ > + rte_be16_t ns; /**< Ns(16) */ > + rte_be16_t nr; /**< Nr(16) */ > + rte_be16_t offset_size; /**< offset size(16) */ > + uint8_t *offset_padding; /**< offset padding(variable length) */ > +}; > + > +/* > + * L2TPv2 message Header contains all options except length(ns, nr, > + * offset size, offset padding). > + */ > +struct rte_l2tpv2_msg_without_length { > + rte_be16_t tunnel_id; /**< tunnel id(16) */ > + rte_be16_t session_id; /**< session id(16) */ > + rte_be16_t ns; /**< Ns(16) */ > + rte_be16_t nr; /**< Nr(16) */ > + rte_be16_t offset_size; /**< offset size(16) */ > + uint8_t *offset_padding; /**< offset padding(variable length) */ > +}; > + > +/* > + * L2TPv2 message Header contains all options except ns_nr(length, > + * offset size, offset padding). > + * Ns and Nr MUST be toghter. > + */ > +struct rte_l2tpv2_msg_without_ns_nr { > + rte_be16_t length; /**< length(16) */ > + rte_be16_t tunnel_id; /**< tunnel id(16) */ > + rte_be16_t session_id; /**< session id(16) */ > + rte_be16_t offset_size; /**< offset size(16) */ > + uint8_t *offset_padding; /**< offset padding(variable length) */ > +}; > + > +/* > + * L2TPv2 message Header contains all options except ns_nr(length, ns, n= r). > + * offset size and offset padding MUST be toghter. > + */ > +struct rte_l2tpv2_msg_without_offset { > + rte_be16_t length; /**< length(16) */ > + rte_be16_t tunnel_id; /**< tunnel id(16) */ > + rte_be16_t session_id; /**< session id(16) */ > + rte_be16_t ns; /**< Ns(16) */ > + rte_be16_t nr; /**< Nr(16) */ > +}; > + > +/* > + * L2TPv2 message Header contains options offset size and offset padding= . > + */ > +struct rte_l2tpv2_msg_with_offset { > + rte_be16_t tunnel_id; /**< tunnel id(16) */ > + rte_be16_t session_id; /**< session id(16) */ > + rte_be16_t offset_size; /**< offset size(16) */ > + uint8_t *offset_padding; /**< offset padding(variable length) */ > +}; > + > +/* > + * L2TPv2 message Header contains options ns and nr. > + */ > +struct rte_l2tpv2_msg_with_ns_nr { > + rte_be16_t tunnel_id; /**< tunnel id(16) */ > + rte_be16_t session_id; /**< session id(16) */ > + rte_be16_t ns; /**< Ns(16) */ > + rte_be16_t nr; /**< Nr(16) */ > +}; > + > +/* > + * L2TPv2 message Header contains option length. > + */ > +struct rte_l2tpv2_msg_with_length { > + rte_be16_t length; /**< length(16) */ > + rte_be16_t tunnel_id; /**< tunnel id(16) */ > + rte_be16_t session_id; /**< session id(16) */ > +}; > + > +/* > + * L2TPv2 message Header without all options. > + */ > +struct rte_l2tpv2_msg_without_all_options { > + rte_be16_t tunnel_id; /**< tunnel id(16) */ > + rte_be16_t session_id; /**< session id(16) */ > +}; > + > +/** > + * L2TPv2 Combined Message Header Format: Common Header + Options */ > +RTE_STD_C11 > +struct rte_l2tpv2_combined_msg_hdr { > + struct rte_l2tpv2_common_hdr common; > + union { > + struct rte_l2tpv2_msg_with_all_options type0; > + struct rte_l2tpv2_msg_without_length type1; > + struct rte_l2tpv2_msg_without_ns_nr type2; > + struct rte_l2tpv2_msg_without_offset type3; > + struct rte_l2tpv2_msg_with_offset type4; > + struct rte_l2tpv2_msg_with_ns_nr type5; > + struct rte_l2tpv2_msg_with_length type6; > + struct rte_l2tpv2_msg_without_all_options type7; > + }; > +}; > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _RTE_L2TPV2_H_ */ > -- > 2.25.1 Best, Ori