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 82FA0A0547; Thu, 21 Oct 2021 09:50:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44282410E2; Thu, 21 Oct 2021 09:50:29 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2063.outbound.protection.outlook.com [40.107.96.63]) by mails.dpdk.org (Postfix) with ESMTP id DC12A40142 for ; Thu, 21 Oct 2021 09:50:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T8eqlp6ho4F0IC927EjYK+fon5RIbTO1n7BNaYsUSDFXXnFxa+fYGA1gudN8zunI7hFRZH1V7qCgI17Py2r1PYQcC/0cUvE4SnOWBQM5fvMZ4TjHxI3IiA/blLYREiYrlMqwLpUvPVVn5k/+yxG8hF91x0YQI9uWltladQFQHgr782pRDI9sJ0d3WhWimPnw68/Zdw4iVGGyANRVRs8KyDNQhCyk1llMHIO/DbT7veFj1t20Cm1tkTt4UIxPNRC43qftxdyglSM/eqyGufKMm+ZMKWrdae3LEBt6sKnK6Hto0FDaufKs0WIlngImZN7K36Vn8cU0+ks88VN3DQ0XyQ== 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=tggHpVwkosLCOJMXcwFcuJG6dCbcu0F8nkR4KjK7z0w=; b=P5J6vANpOlr8DEkPkns1EkLfRLYZY/SmFX1X7gbswqhvkJrbEtvoT06PxW6eEuOQKU83hW/7eJ3kT14EzX072DZIl5/m568wZNER1eLb95tF+4dFdoLAjGl1RVentEtqApest3dW+jQxLA+HplFxHvfFyKwXOFqoMLo1G23HtIVH7r/BxIw0glke72NulSjQSg/yXqgMo9pcWCClb7gq3GX+SAxrtdQDVwysAVGLNOC0mAzXrGDg+f/QUSuXfvzxECXB4dkcFyB6s5ernVCIgz4bX4oqLqCzi7UA2C2iy59Eqm7bhSo2xxsqoqDhW7019KgQW4AdRuuoom/nXdJw1Q== 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=tggHpVwkosLCOJMXcwFcuJG6dCbcu0F8nkR4KjK7z0w=; b=aVyGkMJoA9ge18eR4FcAY0Z2srPjaAqo/fHHBJdFxc3/zsVkDPAvai4PfMW3pFVLbTWScIhG7PYSlO2Pal6ipG13Wy+rSn5vmgrX75y1Asis+N1BSCV9kjy/aP8ORJvrkRdRqUGoB4ABLhafQW6uKVhtukFNdT3bldGN0iP5a1wFu+mDQfvK2PK59QbXtSPLRIu7ZjojOMyKUKr5QUCKqzwooZTO4xg021CiP0x2f9DUBNFXrMsqiTUVYf/D0VEhJGr9Z++s/84VoBPBMxe/NY9nQNQEA2WGk5duomGzUhKzz+ldXcyDCMOxLHH6vdLG2uP8jnR3R2fBOw/3lQeTfQ== Received: from DM8PR12MB5400.namprd12.prod.outlook.com (2603:10b6:8:3b::12) by DM4PR12MB5102.namprd12.prod.outlook.com (2603:10b6:5:391::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Thu, 21 Oct 2021 07:50:19 +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.4628.018; Thu, 21 Oct 2021 07:50:18 +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" , "qi.z.zhang@intel.com" Thread-Topic: [PATCH v7 1/3] ethdev: support L2TPv2 and PPP procotol Thread-Index: AQHXxkSelNwe4TbmZ0mPjh8AxdYtJ6vdEg6A Date: Thu, 21 Oct 2021 07:50:18 +0000 Message-ID: References: <20211020093224.1410449-1-jie1x.wang@intel.com> <20211021062603.1549268-1-jie1x.wang@intel.com> <20211021062603.1549268-2-jie1x.wang@intel.com> In-Reply-To: <20211021062603.1549268-2-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: a5a897b1-09b9-4521-78d4-08d994676d88 x-ms-traffictypediagnostic: DM4PR12MB5102: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:303; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GDOmCtpB3L44E57BEsnsjm66K6Mq35b1f/mYT6pIhj1HhNmpLhXNtOrEF0BmZa1BmVh6QCfBKnL1nYxnWItJzIa01Bos9CtDYDYTJIkyS80Wve2hRn5jL+8eV5mWEel6t/YG2TzEVWY1mTA72yundTB2ovkBLaVTE/2fNvhaPSuiL80nnCf3emTIQY+U8snN7KgykjdF22LHa84P2RqpgCfbYsa1uET74Tn8boty3t7atathPCHrVfBD7/2uoGiQMxLdaaKvkfuStmmG3/fgZsarYAdti112JvMpCQ34fA8UXhv8IRdkhvxhNHyJCIEHPSWAVQh0wpUNMX9dQ9ICZzMic3EI/aHshIjlCzLBhK9pthwD1Mtdp1Ak0QIPC/iI2LTsNhKZ+d6g5s7i5JrzJgetjtu5i9cFosAngSTEsCqCcvTBPR4S1JZbntbyugNGioI2jkF20FDnxC12X168N7iDBOiSN97UHflupuiOND+vhYmE173zpQ6VnFCeTKZvbatA0KOFTcQ6tw7xjtaTUzAWeds0z9aIBCzlvnLWE7Pvo9cBrOAtkpKX1bsh1rBvs1USFjR1c9GS1xrRZH2fY8WI9GUplz1bQ0qRkKvzSgK/q10/X/VPGFL5O+yIgimthOtmtbKSVR1MHZn15dRZys03X+0zbdaDFIhNNJtRlxWscxmovHJDhIvdYPYJneVHlcQSdRwHDJY6wO+6yvKscg== 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)(52536014)(64756008)(6506007)(30864003)(66476007)(53546011)(66556008)(71200400001)(66446008)(66946007)(186003)(33656002)(5660300002)(122000001)(38070700005)(4326008)(9686003)(55016002)(38100700002)(110136005)(54906003)(508600001)(7416002)(86362001)(83380400001)(316002)(2906002)(7696005)(76116006)(8676002)(8936002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: 3wVwwNUUSiIth6DsJqrr8v5SGgcAK23gZrgwdFFmyPA9qjaoekeEHFmrGgF4iNM7QabzlgT5xK96iLBrhMAeTcFqVJCO3s3mLxJaUpTLSctE8Fy+TkdBGIYOJg8vgyEOEak3JbFmZvLU+DkCgLa7m2qPcvfxtImVElY4It1rZ9rt4nXvFiuBj/sqgBnDPFv/1Rxmo+d3Jtk8MNecdmDj0bZSdr1Gbb0dEa0k6NiFp1tXn/UuQiNhmcpLyjpm+opMxYCy9yIwVdfjpIsnsBFQloI6K4M3p56kAKaV3wfPowohWvUnMwVS4uwm1zuKl9ycr/nyCt7ehPYYh5D7t+QfyzmrLZv6GbJcICL8b83VaRB+KQWKrfJ31DftpyKqJuQJAvmS1MVmcknLRcbzGmxHs0BdZE2xMHXUaseDZFBSO+ZzL/YLLaLZ6V0BAMVEMEq7lnVZ1k1nTmzWF1NxMR2kbg== 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: a5a897b1-09b9-4521-78d4-08d994676d88 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Oct 2021 07:50:18.8773 (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: orika@nvidia.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5102 Subject: Re: [dpdk-dev] [PATCH v7 1/3] ethdev: support L2TPv2 and PPP procotol 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, > -----Original Message----- > From: Jie Wang > Sent: Thursday, October 21, 2021 9:26 AM > Subject: [PATCH v7 1/3] ethdev: support L2TPv2 and PPP procotol >=20 > Added flow pattern items and header formats of L2TPv2 and PPP. >=20 > Signed-off-by: Wenjun Wu > Signed-off-by: Jie Wang > --- > doc/api/doxy-api-index.md | 2 + > doc/guides/nics/features/default.ini | 2 + > doc/guides/nics/features/iavf.ini | 2 + > doc/guides/prog_guide/rte_flow.rst | 25 +++ > doc/guides/rel_notes/release_21_11.rst | 4 + > lib/ethdev/rte_flow.c | 2 + > lib/ethdev/rte_flow.h | 65 +++++++ > lib/net/meson.build | 2 + > lib/net/rte_l2tpv2.h | 234 +++++++++++++++++++++++++ > lib/net/rte_ppp.h | 34 ++++ > 10 files changed, 372 insertions(+) > create mode 100644 lib/net/rte_l2tpv2.h > create mode 100644 lib/net/rte_ppp.h >=20 > diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md > index 1992107a03..42db196afe 100644 > --- a/doc/api/doxy-api-index.md > +++ b/doc/api/doxy-api-index.md > @@ -121,6 +121,8 @@ The public API headers are grouped by topics: > [VXLAN] (@ref rte_vxlan.h), > [Geneve] (@ref rte_geneve.h), > [eCPRI] (@ref rte_ecpri.h) > + [L2TPv2] (@ref rte_l2tpv2.h) > + [PPP] (@ref rte_ppp.h) >=20 > - **QoS**: > [metering] (@ref rte_meter.h), > diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/featu= res/default.ini > index 09914b1ad3..8e6a28c419 100644 > --- a/doc/guides/nics/features/default.ini > +++ b/doc/guides/nics/features/default.ini > @@ -110,6 +110,7 @@ ipv4 =3D > ipv6 =3D > ipv6_ext =3D > ipv6_frag_ext =3D > +l2tpv2 =3D > l2tpv3oip =3D > mark =3D > meta =3D > @@ -121,6 +122,7 @@ pfcp =3D > phy_port =3D > port_id =3D > port_representor =3D > +ppp =3D > pppoed =3D > pppoes =3D > pppoe_proto_id =3D > diff --git a/doc/guides/nics/features/iavf.ini b/doc/guides/nics/features= /iavf.ini > index d00ca934c3..a916275b88 100644 > --- a/doc/guides/nics/features/iavf.ini > +++ b/doc/guides/nics/features/iavf.ini > @@ -50,8 +50,10 @@ icmp6 =3D Y > ipv4 =3D Y > ipv6 =3D Y > ipv6_frag_ext =3D Y > +l2tpv2 =3D Y > l2tpv3oip =3D Y > pfcp =3D Y > +ppp =3D Y > sctp =3D Y > tcp =3D Y > udp =3D Y > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/r= te_flow.rst > index aeba374182..a2169517c3 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -1573,6 +1573,31 @@ rte_flow_flex_item_create() routine. > as padded with trailing zeroes up to full configured length, both for > value and mask. >=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 041383ee2a..283770131c 100644 > --- a/doc/guides/rel_notes/release_21_11.rst > +++ b/doc/guides/rel_notes/release_21_11.rst > @@ -105,6 +105,10 @@ New Features >=20 > Added an ethdev API which can help users get device configuration. >=20 > +* **Added L2TPv2 and PPP protocol support in rte_flow.** > + > + Added flow pattern items and header formats of L2TPv2 and PPP protocol= . > + > * **Updated AF_XDP PMD.** >=20 > * Disabled secondary process support. > diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c > index bcf0513b3c..d268784532 100644 > --- a/lib/ethdev/rte_flow.c > +++ b/lib/ethdev/rte_flow.c > @@ -156,6 +156,8 @@ static const struct rte_flow_desc_data rte_flow_desc_= item[] =3D { > MK_FLOW_ITEM(REPRESENTED_PORT, sizeof(struct rte_flow_item_ethdev)), > MK_FLOW_ITEM_FN(FLEX, sizeof(struct rte_flow_item_flex), > rte_flow_item_flex_conv), > + MK_FLOW_ITEM(L2TPV2, sizeof(struct rte_flow_item_l2tpv2)), > + MK_FLOW_ITEM(PPP, sizeof(struct rte_flow_item_ppp)), > }; >=20 > /** Generate flow_action[] entry. */ > diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h > index 64ed7f2618..300e99e16b 100644 > --- a/lib/ethdev/rte_flow.h > +++ b/lib/ethdev/rte_flow.h > @@ -35,6 +35,8 @@ > #include > #include > #include > +#include > +#include >=20 > #ifdef __cplusplus > extern "C" { > @@ -644,6 +646,20 @@ enum rte_flow_item_type { > * @see struct rte_flow_item_flex. > */ > RTE_FLOW_ITEM_TYPE_FLEX, > + > + /** > + * 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 > /** > @@ -1900,6 +1916,55 @@ static const struct rte_flow_item_ethdev rte_flow_= item_ethdev_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 RTE_BE16(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 { > + struct rte_ppp_hdr hdr; > +}; > + > +/** Default mask for RTE_FLOW_ITEM_TYPE_PPP. */ > +#ifndef __cplusplus > +static const struct rte_flow_item_ppp rte_flow_item_ppp_mask =3D { > + .hdr =3D { > + .addr =3D 0xff, > + .ctrl =3D 0xff, > + .proto_id =3D RTE_BE16(0xffff), > + } > +}; > +#endif > + > /** > * Matching pattern item definition. > * > diff --git a/lib/net/meson.build b/lib/net/meson.build > index a4e395e9c5..e899846578 100644 > --- a/lib/net/meson.build > +++ b/lib/net/meson.build > @@ -19,6 +19,8 @@ headers =3D files( > 'rte_higig.h', > 'rte_ecpri.h', > 'rte_geneve.h', > + 'rte_l2tpv2.h', > + 'rte_ppp.h', > ) >=20 > sources =3D files( > diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h > new file mode 100644 > index 0000000000..18ea759ff4 > --- /dev/null > +++ b/lib/net/rte_l2tpv2.h > @@ -0,0 +1,234 @@ > +/* 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 MUS= T 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 { > + /** header flags and protocol version */ > + 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) */ > +}; Why not packed? > + > +/** > + * 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) */ > +}; Why not packed? Same for all structs. > + > +/** > + * 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; /**< common header */ > + union { > + /** header with all options */ > + struct rte_l2tpv2_msg_with_all_options type0; > + /** header with all options except length */ > + struct rte_l2tpv2_msg_without_length type1; > + /** header with all options except ns/nr */ > + struct rte_l2tpv2_msg_without_ns_nr type2; > + /** header with all options except offset */ > + struct rte_l2tpv2_msg_without_offset type3; > + /** header with offset options */ > + struct rte_l2tpv2_msg_with_offset type4; > + /** header with ns/nr options */ > + struct rte_l2tpv2_msg_with_ns_nr type5; > + /** header with length option */ > + struct rte_l2tpv2_msg_with_length type6; > + /** header without all options */ > + struct rte_l2tpv2_msg_without_all_options type7; > + }; > +}; > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _RTE_L2TPV2_H_ */ > diff --git a/lib/net/rte_ppp.h b/lib/net/rte_ppp.h > new file mode 100644 > index 0000000000..2a53cd969f > --- /dev/null > +++ b/lib/net/rte_ppp.h > @@ -0,0 +1,34 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2021 Mellanox Technologies, Ltd > + */ > + > +#ifndef _RTE_PPP_H_ > +#define _RTE_PPP_H_ > + > +/** > + * @file > + * > + * PPP headers definition. > + */ > + > +#include > +#include > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/** > + * PPP Header > + */ > +struct rte_ppp_hdr { > + uint8_t addr; /**< PPP address(8) */ > + uint8_t ctrl; /**< PPP control(8) */ > + rte_be16_t proto_id; /**< PPP protocol identifier(16) */ > +} __rte_packed; > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _RTE_PPP_H_ */ > -- > 2.25.1 Best, Ori