DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net: support PPPOE in software packet type parser
@ 2017-04-07  9:59 skytap
  2017-04-07 10:12 ` Thomas Monjalon
  2017-04-07 10:26 ` [dpdk-dev] [PATCH v1] " Ray Zhang
  0 siblings, 2 replies; 5+ messages in thread
From: skytap @ 2017-04-07  9:59 UTC (permalink / raw)
  To: dev; +Cc: Ray Zhang

From: Ray Zhang <zhanglei002@gmail.com>

Add a new RTE_PTYPE_L2_ETHER_PPPOE and its support in
rte_net_get_ptype()

Signed-off-by: Ray Zhang <zhanglei002@gmail.com>
---
 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'=[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 += 2 * sizeof(*vh);
 		hdr_lens->l2_len += 2 * sizeof(*vh);
 		proto = vh->eth_proto;
+	} else if (proto == rte_cpu_to_be_16(ETHER_TYPE_PPPOE)) {
+		const struct pppoe_hdr *ph;
+		struct pppoe_hdr ph_copy;
+
+		pkt_type = RTE_PTYPE_L2_ETHER_PPPOE;
+		ph = rte_pktmbuf_read(m, off, sizeof(*ph), &ph_copy);
+		if (unlikely(ph == NULL))
+			return pkt_type;
+
+		off += sizeof(*ph);
+		hdr_lens->l2_len += sizeof(*ph);
+		if (ph->code != 0) /* Not Seesion Data */
+			return pkt_type;
+		if (ph->proto == rte_cpu_to_be_16(0x21))
+			proto = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
+		else if (ph->proto == rte_cpu_to_be_16(0x57))
+			proto = rte_cpu_to_be_16(ETHER_TYPE_IPv6);
+		else
+			return pkt_type;
 	}
 
  l3:
-- 
1.9.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] net: support PPPOE in software packet type parser
  2017-04-07  9:59 [dpdk-dev] [PATCH] net: support PPPOE in software packet type parser skytap
@ 2017-04-07 10:12 ` Thomas Monjalon
  2017-04-07 10:26 ` [dpdk-dev] [PATCH v1] " Ray Zhang
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2017-04-07 10:12 UTC (permalink / raw)
  To: skytap; +Cc: dev

Hi,

Please, when sending a new patch version, follow these advices:
- use --in-reply-to
- use -v for version numbering
- use --annotate to put a changelog below ---

You can find more guidelines here:
	http://dpdk.org/dev#send

Thank you for contributing

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v1] net: support PPPOE in software packet type parser
  2017-04-07  9:59 [dpdk-dev] [PATCH] net: support PPPOE in software packet type parser skytap
  2017-04-07 10:12 ` Thomas Monjalon
@ 2017-04-07 10:26 ` Ray Zhang
  2017-05-16 20:47   ` Thomas Monjalon
  1 sibling, 1 reply; 5+ messages in thread
From: Ray Zhang @ 2017-04-07 10:26 UTC (permalink / raw)
  To: dev; +Cc: Ray Zhang

From: Ray Zhang <zhanglei002@gmail.com>

Add a new RTE_PTYPE_L2_ETHER_PPPOE and its support in
rte_net_get_ptype()

Signed-off-by: Ray Zhang <zhanglei002@gmail.com>
---

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'=[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 += 2 * sizeof(*vh);
 		hdr_lens->l2_len += 2 * sizeof(*vh);
 		proto = vh->eth_proto;
+	} else if (proto == rte_cpu_to_be_16(ETHER_TYPE_PPPOE)) {
+		const struct pppoe_hdr *ph;
+		struct pppoe_hdr ph_copy;
+
+		pkt_type = RTE_PTYPE_L2_ETHER_PPPOE;
+		ph = rte_pktmbuf_read(m, off, sizeof(*ph), &ph_copy);
+		if (unlikely(ph == NULL))
+			return pkt_type;
+
+		off += sizeof(*ph);
+		hdr_lens->l2_len += sizeof(*ph);
+		if (ph->code != 0) /* Not Seesion Data */
+			return pkt_type;
+		if (ph->proto == rte_cpu_to_be_16(0x21))
+			proto = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
+		else if (ph->proto == rte_cpu_to_be_16(0x57))
+			proto = rte_cpu_to_be_16(ETHER_TYPE_IPv6);
+		else
+			return pkt_type;
 	}
 
  l3:
-- 
1.9.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v1] net: support PPPOE in software packet type parser
  2017-04-07 10:26 ` [dpdk-dev] [PATCH v1] " Ray Zhang
@ 2017-05-16 20:47   ` Thomas Monjalon
  2017-05-17 12:20     ` Chilikin, Andrey
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2017-05-16 20:47 UTC (permalink / raw)
  To: dev, olivier.matz, bruce.richardson; +Cc: Ray Zhang

Any volunteer to review this patch, please?

07/04/2017 12:26, Ray Zhang:
> From: Ray Zhang <zhanglei002@gmail.com>
> 
> Add a new RTE_PTYPE_L2_ETHER_PPPOE and its support in
> rte_net_get_ptype()
> 
> Signed-off-by: Ray Zhang <zhanglei002@gmail.com>
> ---
> 
> 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'=[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 += 2 * sizeof(*vh);
>  		hdr_lens->l2_len += 2 * sizeof(*vh);
>  		proto = vh->eth_proto;
> +	} else if (proto == rte_cpu_to_be_16(ETHER_TYPE_PPPOE)) {
> +		const struct pppoe_hdr *ph;
> +		struct pppoe_hdr ph_copy;
> +
> +		pkt_type = RTE_PTYPE_L2_ETHER_PPPOE;
> +		ph = rte_pktmbuf_read(m, off, sizeof(*ph), &ph_copy);
> +		if (unlikely(ph == NULL))
> +			return pkt_type;
> +
> +		off += sizeof(*ph);
> +		hdr_lens->l2_len += sizeof(*ph);
> +		if (ph->code != 0) /* Not Seesion Data */
> +			return pkt_type;
> +		if (ph->proto == rte_cpu_to_be_16(0x21))
> +			proto = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
> +		else if (ph->proto == rte_cpu_to_be_16(0x57))
> +			proto = rte_cpu_to_be_16(ETHER_TYPE_IPv6);
> +		else
> +			return pkt_type;
>  	}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v1] net: support PPPOE in software packet type parser
  2017-05-16 20:47   ` Thomas Monjalon
@ 2017-05-17 12:20     ` Chilikin, Andrey
  0 siblings, 0 replies; 5+ messages in thread
From: Chilikin, Andrey @ 2017-05-17 12:20 UTC (permalink / raw)
  To: Thomas Monjalon, dev, olivier.matz, Richardson, Bruce; +Cc: Ray Zhang

PPPoE consists of two stages with different ethertypes - Discovery and Session, so RTE_PTYPE_L2_ETHER_PPPOE looks ambiguous to me. This patch adds only PPPoE Session Stage packet type. Should it include PPPoE Discovery Stage as well (Ethertype x8863)?  

/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
> <bruce.richardson@intel.com>
> Cc: Ray Zhang <zhanglei002@gmail.com>
> Subject: Re: [dpdk-dev] [PATCH v1] net: support PPPOE in software packet type
> parser
> 
> Any volunteer to review this patch, please?
> 
> 07/04/2017 12:26, Ray Zhang:
> > From: Ray Zhang <zhanglei002@gmail.com>
> >
> > Add a new RTE_PTYPE_L2_ETHER_PPPOE and its support in
> > rte_net_get_ptype()
> >
> > Signed-off-by: Ray Zhang <zhanglei002@gmail.com>
> > ---
> >
> > 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'=[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 += 2 * sizeof(*vh);
> >  		hdr_lens->l2_len += 2 * sizeof(*vh);
> >  		proto = vh->eth_proto;
> > +	} else if (proto == rte_cpu_to_be_16(ETHER_TYPE_PPPOE)) {
> > +		const struct pppoe_hdr *ph;
> > +		struct pppoe_hdr ph_copy;
> > +
> > +		pkt_type = RTE_PTYPE_L2_ETHER_PPPOE;
> > +		ph = rte_pktmbuf_read(m, off, sizeof(*ph), &ph_copy);
> > +		if (unlikely(ph == NULL))
> > +			return pkt_type;
> > +
> > +		off += sizeof(*ph);
> > +		hdr_lens->l2_len += sizeof(*ph);
> > +		if (ph->code != 0) /* Not Seesion Data */
> > +			return pkt_type;
> > +		if (ph->proto == rte_cpu_to_be_16(0x21))
> > +			proto = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
> > +		else if (ph->proto == rte_cpu_to_be_16(0x57))
> > +			proto = rte_cpu_to_be_16(ETHER_TYPE_IPv6);
> > +		else
> > +			return pkt_type;
> >  	}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-05-17 12:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07  9:59 [dpdk-dev] [PATCH] net: support PPPOE in software packet type parser skytap
2017-04-07 10:12 ` Thomas Monjalon
2017-04-07 10:26 ` [dpdk-dev] [PATCH v1] " Ray Zhang
2017-05-16 20:47   ` Thomas Monjalon
2017-05-17 12:20     ` Chilikin, Andrey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).