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 5443AA0547; Thu, 21 Oct 2021 11:27:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 13B00410E2; Thu, 21 Oct 2021 11:27:01 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 18FD640142 for ; Thu, 21 Oct 2021 11:26:58 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10143"; a="226446750" X-IronPort-AV: E=Sophos;i="5.87,169,1631602800"; d="scan'208";a="226446750" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2021 02:26:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,169,1631602800"; d="scan'208";a="445271150" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga003.jf.intel.com with ESMTP; 21 Oct 2021 02:26:57 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 21 Oct 2021 02:26:57 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 21 Oct 2021 02:26:56 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Thu, 21 Oct 2021 02:26:56 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.41) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Thu, 21 Oct 2021 02:26:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dJPBDDP5HpH6ypa/9ioftRUFPaTjAW3Md/miRLbOdVTyBFDo72CyrkbUnpckBT2RyTG/IxTXJD8FI1K1nFwP3gmaFJLYejqTAG5O+CG0rSGSuw3g0iQNbwM5zc6IzOWMyivJ8Vy6f35ATifBVNicH0xV8ueSM1gwtDiFrG8n0Mz2uiJ1EJXhqebduE873MEQp3qHxrvUraScEss4CZ3H70Oe0lw9wL1JuN7xX4wrlt0bAzWkUPmFumm//Ti7ZheqpEs80zlR/OkyBw/G9RsYtDyvTxM37MZV/GHa4k14zdDBGyFDnsXvC1bvcCvnjimiCP3nwX0EMs912EMI2GQkOA== 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=zotTU1dOne+Jx/F/YMhYngBOe1Nf1Ihg/zhW65HJkCw=; b=UMrXBeZXjDK+q7YuW9Hppqyjj71Z/rFUkLAJk7QkJdNMJZfjXaZ7RIc3wZS9wpYA1ltd3HbBbRVrgrHx9hodLTFgAo/eTsFluvxYpNAkOc1pfPzJPRN+gX/1AGtuPK0rpwUtrgcHhxrNd6+C0BOPAFHyHSSpyykdSlls43xN4G7jw8MWZ+qe6Y3P/VE6evdSfThBoix4VNhiIEn0cAU8CSlDA2S9QzQRmSnJ8ADTF+EqtspRH+URozS4VcYa7DkD5lzy/1tqVQAjMKranV2GWrnMniA5n/APiV2i5IXtRFmPJjj9FDIEONnbkHn+x85UwI0P47WZhjZMSG+hl7Xxww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zotTU1dOne+Jx/F/YMhYngBOe1Nf1Ihg/zhW65HJkCw=; b=ZqVFpgf6MR3Z+POGtGu7VWQ+755DyU5Xrmtx3HERKqCts0Pg8hwZa7N+lu1OzWNnTCBjKFTA2ix/cqbHJFnASKs1jCwcCTB3mtK1KzWtBRTKgd18GEruuzDnOqVGZ90r0oohkl5Gx6vM/z36/gODz6A9UubBrr5tdvgloInrUl8= Authentication-Results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB5142.namprd11.prod.outlook.com (2603:10b6:510:39::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Thu, 21 Oct 2021 09:26:52 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c%5]) with mapi id 15.20.4608.018; Thu, 21 Oct 2021 09:26:52 +0000 Message-ID: <603be412-675e-dd69-00a3-7b8d1ef26810@intel.com> Date: Thu, 21 Oct 2021 10:26:44 +0100 Content-Language: en-US To: Ori Kam , Jie Wang , "dev@dpdk.org" , Olivier Matz CC: 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" References: <20211020093224.1410449-1-jie1x.wang@intel.com> <20211021062603.1549268-1-jie1x.wang@intel.com> <20211021062603.1549268-2-jie1x.wang@intel.com> From: Ferruh Yigit X-User: ferruhy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DB6P192CA0021.EURP192.PROD.OUTLOOK.COM (2603:10a6:4:b8::31) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 Received: from [192.168.0.206] (37.228.236.146) by DB6P192CA0021.EURP192.PROD.OUTLOOK.COM (2603:10a6:4:b8::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18 via Frontend Transport; Thu, 21 Oct 2021 09:26:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ae9477e1-913f-4617-682e-08d99474ea9e X-MS-TrafficTypeDiagnostic: PH0PR11MB5142: X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:359; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oj+E5CCpRAYRm/U4+nBop+5Eu40+tVkrNf7Au7OnCttJcEYJTW61hNgYZca1xwhl1LN45g1o3hL/4TssMXm7oZAnsYNTN7iiYJ0XIWZYEKm4Y9QDezZsm/JuGGTaUlVUnM3YIAl7CxbKKYznsVQreUN0+K0giZzg34ryMjKzwHoGpLI4iSQRbcFwJ8Ylh4ZKtDuU+nJ/qn6B0ty4TEL7UsDD+0XaUamQvuBu6hfl0j/e+g3b3XJMKah8VRWN1Ubci8PaFuOscpJS9IktFem6srd1HlqMS6hfjNHCUAL4tcbcTw7HNmLCGQSf3kpvqGQQ5nFBQTNSjStVpKKZCy2o0aq8jN0ujijB2W1Tdoeh8l1bTDeMqGUReecU0Xep2FG3z6sZYxyTj78w+CDOykhgR/QY9SlamTlw0khWbTgTFmuZnd3odwcIbg9oJxgveARrqqi120UDDbOxWdxH7UqwpayQ8TbZsm3KGW3lBK5++NJlFRUSshWwQky8nNUJcvk0a2RsuE04Ay1pr5sjkkVYBeWiZl0ovH++/0esitRwQDQl+GTrXXWRg/Sru3rgQPBv+j9SaHcEQOBdPHGw1hEMHvMthe/dcY8lJj1QMvz1vNZn6Uev42IUfa+AEuX4fSd+e4ELwsSltMsvXYViTdhhFSaVhkAJCg1BDHpvBkffbPCA4mzqTuDuc1f+M7wAgpW5T1bVCLv4DD+Z+3E9BsMhrw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(8676002)(8936002)(44832011)(16576012)(31686004)(6486002)(5660300002)(6666004)(508600001)(30864003)(82960400001)(4326008)(2616005)(66946007)(107886003)(26005)(38100700002)(956004)(66556008)(53546011)(66476007)(110136005)(54906003)(316002)(86362001)(2906002)(186003)(83380400001)(31696002)(36756003)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VnFtdTJRVHpkWW1HYnJtZ2JHTFJiSkhYVi9zeUNUYUJxR0lIazgwRUZJSis0?= =?utf-8?B?SlZzV2ZUdEI0TS93SG5jWElwZEhuMUxVUlRIOXBnRVk5a25kakhGTVhUTXF6?= =?utf-8?B?a2ltaWJqL0ZsOGJYYkVoT1BDcFBiYTlXakp0QTVWVS84YWs1TnJ1SGF3eWEw?= =?utf-8?B?MTlSMldjMUJwWko2M3JS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e1-913f-4617-682e-08d99474ea9e X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 09:26:52.5701 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ferruh.yigit@intel.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5142 X-OriginatorOrg: intel.com 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" On 10/21/2021 8:50 AM, Ori Kam wrote: > 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 >> >> Added flow pattern items and header formats of L2TPv2 and PPP. >> >> 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 >> >> 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) >> >> - **QoS**: >> [metering] (@ref rte_meter.h), >> diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/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 = >> ipv6 = >> ipv6_ext = >> ipv6_frag_ext = >> +l2tpv2 = >> l2tpv3oip = >> mark = >> meta = >> @@ -121,6 +122,7 @@ pfcp = >> phy_port = >> port_id = >> port_representor = >> +ppp = >> pppoed = >> pppoes = >> pppoe_proto_id = >> 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 = Y >> ipv4 = Y >> ipv6 = Y >> ipv6_frag_ext = Y >> +l2tpv2 = Y >> l2tpv3oip = Y >> pfcp = Y >> +ppp = Y >> sctp = Y >> tcp = Y >> udp = Y >> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_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. >> >> +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 received. >> +- ``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 >> ~~~~~~~ >> >> diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/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 >> >> Added an ethdev API which can help users get device configuration. >> >> +* **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.** >> >> * 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[] = { >> 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)), >> }; >> >> /** 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 >> >> #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, >> }; >> >> /** >> @@ -1900,6 +1916,55 @@ static const struct rte_flow_item_ethdev rte_flow_item_ethdev_mask = { >> }; >> #endif >> >> +/** >> + * @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 = { >> + /* >> + * 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 = { >> + .common = { >> + .flags_version = 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 = { >> + .hdr = { >> + .addr = 0xff, >> + .ctrl = 0xff, >> + .proto_id = 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 = files( >> 'rte_higig.h', >> 'rte_ecpri.h', >> 'rte_geneve.h', >> + 'rte_l2tpv2.h', >> + 'rte_ppp.h', >> ) >> >> sources = 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 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 { >> + /** header flags and protocol version */ >> + rte_be16_t flags_version; >> + struct { >> +#if RTE_BYTE_ORDER == 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 == 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, nr). >> + * 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. > There is not gap in this struct, should we still pack it? What it the expectation on packing the protocol structs? Have '__rte_packed' always?