From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 07A8F2C55 for ; Wed, 17 May 2017 14:20:21 +0200 (CEST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP; 17 May 2017 05:20:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,354,1491289200"; d="scan'208";a="101686970" Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by orsmga005.jf.intel.com with ESMTP; 17 May 2017 05:20:19 -0700 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by IRSMSX107.ger.corp.intel.com (163.33.3.99) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 17 May 2017 13:20:18 +0100 Received: from irsmsx106.ger.corp.intel.com ([169.254.8.202]) by irsmsx112.ger.corp.intel.com ([169.254.1.61]) with mapi id 14.03.0319.002; Wed, 17 May 2017 13:20:18 +0100 From: "Chilikin, Andrey" To: Thomas Monjalon , "dev@dpdk.org" , "olivier.matz@6wind.com" , "Richardson, Bruce" CC: Ray Zhang Thread-Topic: [dpdk-dev] [PATCH v1] net: support PPPOE in software packet type parser Thread-Index: AQHSzoWlvnn0PA5HEEOJhCm4SGe536H4cOAA Date: Wed, 17 May 2017 12:20:18 +0000 Message-ID: References: <1491559197-3307-1-git-send-email-skytap@host-1.skytap.example> <1491560817-3558-1-git-send-email-skytap@host-1.skytap.example> <1958581.a6L38vVbnc@xps> In-Reply-To: <1958581.a6L38vVbnc@xps> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzAyNGVkOTEtMzc2My00OGFhLTk3MjAtNTlhZDg4NWIyNjVkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IndUaUc2NVd6ZUlyOG9sWlVRM0xvZ1pKenN0ZVFjcERBeWlHQWNUVjBxUTQ9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v1] net: support PPPOE in software packet type parser 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: , X-List-Received-Date: Wed, 17 May 2017 12:20:22 -0000 PPPoE consists of two stages with different ethertypes - Discovery and Sess= ion, so RTE_PTYPE_L2_ETHER_PPPOE looks ambiguous to me. This patch adds onl= y PPPoE Session Stage packet type. Should it include PPPoE Discovery Stage = as well (Ethertype x8863)? =20 /Andrey > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon > Sent: Tuesday, May 16, 2017 9:47 PM > To: dev@dpdk.org; olivier.matz@6wind.com; Richardson, Bruce > > Cc: Ray Zhang > Subject: Re: [dpdk-dev] [PATCH v1] net: support PPPOE in software packet = type > parser >=20 > Any volunteer to review this patch, please? >=20 > 07/04/2017 12:26, Ray Zhang: > > From: Ray Zhang > > > > Add a new RTE_PTYPE_L2_ETHER_PPPOE and its support in > > rte_net_get_ptype() > > > > Signed-off-by: Ray Zhang > > --- > > > > Resend the patch > > > > lib/librte_mbuf/rte_mbuf_ptype.h | 7 +++++++ > > lib/librte_net/rte_ether.h | 12 ++++++++++++ > > lib/librte_net/rte_net.c | 19 +++++++++++++++++++ > > 3 files changed, 38 insertions(+) > > > > diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h > > b/lib/librte_mbuf/rte_mbuf_ptype.h > > index ff6de9d..7dd03de 100644 > > --- a/lib/librte_mbuf/rte_mbuf_ptype.h > > +++ b/lib/librte_mbuf/rte_mbuf_ptype.h > > @@ -150,6 +150,13 @@ > > */ > > #define RTE_PTYPE_L2_ETHER_QINQ 0x00000007 > > /** > > + * PPPOE packet type. > > + * > > + * Packet format: > > + * <'ether type'=3D[0x8864]> > > + */ > > +#define RTE_PTYPE_L2_ETHER_PPPOE 0x00000008 > > +/** > > * Mask of layer 2 packet types. > > * It is used for outer packet for tunneling cases. > > */ > > diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h > > index ff3d065..d76edb3 100644 > > --- a/lib/librte_net/rte_ether.h > > +++ b/lib/librte_net/rte_ether.h > > @@ -323,12 +323,24 @@ struct vxlan_hdr { > > uint32_t vx_vni; /**< VNI (24) + Reserved (8). */ > > } __attribute__((__packed__)); > > > > +/** > > + * PPPOE protocol header > > + */ > > +struct pppoe_hdr { > > + uint8_t type_ver; > > + uint8_t code; > > + uint16_t sid; > > + uint16_t length; > > + uint16_t proto; > > +} __attribute__((packed)); > > + > > /* Ethernet frame types */ > > #define ETHER_TYPE_IPv4 0x0800 /**< IPv4 Protocol. */ #define > > ETHER_TYPE_IPv6 0x86DD /**< IPv6 Protocol. */ #define ETHER_TYPE_ARP > > 0x0806 /**< Arp Protocol. */ #define ETHER_TYPE_RARP 0x8035 /**< > > Reverse Arp Protocol. */ #define ETHER_TYPE_VLAN 0x8100 /**< IEEE > > 802.1Q VLAN tagging. */ > > +#define ETHER_TYPE_PPPOE 0x8864 /**< PPPoE Protocol */ > > #define ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */ > > #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time > > Protocol. */ #define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP > > and Marker). */ diff --git a/lib/librte_net/rte_net.c > > b/lib/librte_net/rte_net.c index a8c7aff..439c2f6 100644 > > --- a/lib/librte_net/rte_net.c > > +++ b/lib/librte_net/rte_net.c > > @@ -302,6 +302,25 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf > *m, > > off +=3D 2 * sizeof(*vh); > > hdr_lens->l2_len +=3D 2 * sizeof(*vh); > > proto =3D vh->eth_proto; > > + } else if (proto =3D=3D rte_cpu_to_be_16(ETHER_TYPE_PPPOE)) { > > + const struct pppoe_hdr *ph; > > + struct pppoe_hdr ph_copy; > > + > > + pkt_type =3D RTE_PTYPE_L2_ETHER_PPPOE; > > + ph =3D rte_pktmbuf_read(m, off, sizeof(*ph), &ph_copy); > > + if (unlikely(ph =3D=3D NULL)) > > + return pkt_type; > > + > > + off +=3D sizeof(*ph); > > + hdr_lens->l2_len +=3D sizeof(*ph); > > + if (ph->code !=3D 0) /* Not Seesion Data */ > > + return pkt_type; > > + if (ph->proto =3D=3D rte_cpu_to_be_16(0x21)) > > + proto =3D rte_cpu_to_be_16(ETHER_TYPE_IPv4); > > + else if (ph->proto =3D=3D rte_cpu_to_be_16(0x57)) > > + proto =3D rte_cpu_to_be_16(ETHER_TYPE_IPv6); > > + else > > + return pkt_type; > > }