DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH] ethdev: add HIGIG2 key field to flow API
@ 2019-10-14  4:29 kirankumark
  2019-10-14  7:08 ` Andrew Rybchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: kirankumark @ 2019-10-14  4:29 UTC (permalink / raw)
  To: Adrien Mazarguil, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
  Cc: dev, ajit.khaparde, Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

Add new rte_flow_item_higig2_hdr in order to match higig2 header.
It is a layer 2.5 protocol and used in broadcom switches.
Header format is based on the following document.
http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
 doc/guides/prog_guide/rte_flow.rst |  8 ++++
 lib/librte_ethdev/rte_flow.c       |  1 +
 lib/librte_ethdev/rte_flow.h       | 77 ++++++++++++++++++++++++++++++
 3 files changed, 86 insertions(+)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 1c837ff13..71365b159 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1290,6 +1290,14 @@ Matches a IP Authentication Header (RFC 4302).
 - Default ``mask`` matches spi.
 
 
+Item: ``HIGIG2``
+^^^^^^^^^^^^^^^^^
+
+Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
+broadcom switches.
+
+- Default ``mask`` matches classification and vlan.
+
 Actions
 ~~~~~~~
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 81a85b995..ca0f68016 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
 	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 };
 
 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index bcfc06cdc..59e37f714 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -491,6 +491,12 @@ enum rte_flow_item_type {
 	 *
 	 */
 	RTE_FLOW_ITEM_TYPE_AH,
+
+	/**
+	 * Matches a HIGIG header.
+	 * see struct rte_flow_item_higig2_hdr.
+	 */
+	RTE_FLOW_ITEM_TYPE_HIGIG2,
 };
 
 /**
@@ -515,6 +521,77 @@ static const struct rte_flow_item_any rte_flow_item_any_mask = {
 };
 #endif
 
+/**
+ * RTE_FLOW_ITEM_TYPE_HIGIG2
+ * Matches higig2 header.
+ */
+struct rte_higig2_frc {
+	uint32_t ksop:8;
+	uint32_t resv:3;
+	uint32_t mcst:1;
+	uint32_t tc:4;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t dp:2;
+	uint32_t resv1:3;
+	uint32_t ppd_type:3;
+} __attribute__((packed));
+
+struct rte_higig2_ppt_type0 {
+	uint32_t dst_t:1;
+	uint32_t dst_tgid:3;
+	uint32_t ingress_tagged:1;
+	uint32_t mirror_only:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror:1;
+	uint32_t res:2;
+	uint32_t l3:1;
+	uint32_t label_present:1;
+	uint32_t vc_label2:4;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t pfm:2;
+	uint32_t src_t:1;
+	uint32_t res1:2;
+	uint32_t opcode:3;
+	uint32_t hdr_ext_len:3;
+	uint32_t res2:5;
+} __attribute__((packed));
+
+struct rte_higig2_ppt_type1 {
+	uint32_t classification:16;
+	uint32_t resv:16;
+	uint32_t vid:16;
+	uint32_t pfm:2;
+	uint32_t src_t:1;
+	uint32_t resv1:2;
+	uint32_t opcode:3;
+	uint32_t hdr_ext_len:3;
+	uint32_t resv2:5;
+} __attribute__((packed));
+
+RTE_STD_C11
+struct rte_flow_item_higig2_hdr {
+	struct rte_higig2_frc fcr;
+	union {
+		struct rte_higig2_ppt_type0 ppt0;
+		struct rte_higig2_ppt_type1 ppt1;
+	};
+} __attribute__((packed));
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
+#ifndef __cplusplus
+static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
+	.ppt1.classification = 0xffff,
+	.ppt1.vid = 0xfff,
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_VF
  *
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API
  2019-10-14  4:29 [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API kirankumark
@ 2019-10-14  7:08 ` Andrew Rybchenko
  2019-10-15  4:23   ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda
  2019-10-15  6:20 ` [dpdk-dev] " kirankumark
  2019-10-15 16:47 ` [dpdk-dev] [PATCH] " Stephen Hemminger
  2 siblings, 1 reply; 31+ messages in thread
From: Andrew Rybchenko @ 2019-10-14  7:08 UTC (permalink / raw)
  To: kirankumark, Adrien Mazarguil, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Ferruh Yigit
  Cc: dev, ajit.khaparde

On 10/14/19 7:29 AM, kirankumark@marvell.com wrote:
> From: Kiran Kumar K <kirankumark@marvell.com>
>
> Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> It is a layer 2.5 protocol and used in broadcom switches.
> Header format is based on the following document.
> http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf
>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> ---
>   doc/guides/prog_guide/rte_flow.rst |  8 ++++
>   lib/librte_ethdev/rte_flow.c       |  1 +
>   lib/librte_ethdev/rte_flow.h       | 77 ++++++++++++++++++++++++++++++

As far as I remember support in testpmd is a must requirement
to add new RTE flow API feature.

>   3 files changed, 86 insertions(+)
>
> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index 1c837ff13..71365b159 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -1290,6 +1290,14 @@ Matches a IP Authentication Header (RFC 4302).
>   - Default ``mask`` matches spi.
>   
>   
> +Item: ``HIGIG2``
> +^^^^^^^^^^^^^^^^^
> +
> +Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
> +broadcom switches.
> +
> +- Default ``mask`` matches classification and vlan.
> +


Right now there is one empty line between items and two between
the last item and actions. It should be preserved.

>   Actions
>   ~~~~~~~
>   
> diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
> index 81a85b995..ca0f68016 100644
> --- a/lib/librte_ethdev/rte_flow.c
> +++ b/lib/librte_ethdev/rte_flow.c
> @@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
>   	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
>   	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
>   	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
> +	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
>   };
>   
>   /** Generate flow_action[] entry. */
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index bcfc06cdc..59e37f714 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -491,6 +491,12 @@ enum rte_flow_item_type {
>   	 *
>   	 */
>   	RTE_FLOW_ITEM_TYPE_AH,
> +
> +	/**
> +	 * Matches a HIGIG header.
> +	 * see struct rte_flow_item_higig2_hdr.
> +	 */
> +	RTE_FLOW_ITEM_TYPE_HIGIG2,
>   };
>   
>   /**
> @@ -515,6 +521,77 @@ static const struct rte_flow_item_any rte_flow_item_any_mask = {
>   };
>   #endif
>   
> +/**
> + * RTE_FLOW_ITEM_TYPE_HIGIG2
> + * Matches higig2 header.
> + */
> +struct rte_higig2_frc {
> +	uint32_t ksop:8;
> +	uint32_t resv:3;
> +	uint32_t mcst:1;
> +	uint32_t tc:4;
> +	uint32_t dst_modid:8;
> +	uint32_t dst_pid:8;
> +	uint32_t src_modid:8;
> +	uint32_t src_pid:8;
> +	uint32_t lbid:8;
> +	uint32_t dp:2;
> +	uint32_t resv1:3;
> +	uint32_t ppd_type:3;
> +} __attribute__((packed));
> +
> +struct rte_higig2_ppt_type0 {
> +	uint32_t dst_t:1;
> +	uint32_t dst_tgid:3;
> +	uint32_t ingress_tagged:1;
> +	uint32_t mirror_only:1;
> +	uint32_t mirror_done:1;
> +	uint32_t mirror:1;
> +	uint32_t res:2;
> +	uint32_t l3:1;
> +	uint32_t label_present:1;
> +	uint32_t vc_label2:4;
> +	uint32_t vc_label1:8;
> +	uint32_t vc_label0:8;
> +	uint32_t vid_high:8;
> +	uint32_t vid_low:8;
> +	uint32_t pfm:2;
> +	uint32_t src_t:1;
> +	uint32_t res1:2;
> +	uint32_t opcode:3;
> +	uint32_t hdr_ext_len:3;
> +	uint32_t res2:5;
> +} __attribute__((packed));
> +
> +struct rte_higig2_ppt_type1 {
> +	uint32_t classification:16;
> +	uint32_t resv:16;
> +	uint32_t vid:16;
> +	uint32_t pfm:2;
> +	uint32_t src_t:1;
> +	uint32_t resv1:2;
> +	uint32_t opcode:3;
> +	uint32_t hdr_ext_len:3;
> +	uint32_t resv2:5;
> +} __attribute__((packed));
> +

Usage of bit fields in network headers require
big/little endian handling. See lib/librte_net/rte_gre.h
Also other network protocol headers are defined in
lib/librte_net.

> +RTE_STD_C11
> +struct rte_flow_item_higig2_hdr {
> +	struct rte_higig2_frc fcr;
> +	union {
> +		struct rte_higig2_ppt_type0 ppt0;
> +		struct rte_higig2_ppt_type1 ppt1;
> +	};
> +} __attribute__((packed));
> +
> +/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
> +#ifndef __cplusplus
> +static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
> +	.ppt1.classification = 0xffff,
> +	.ppt1.vid = 0xfff,
> +};

It would be useful to see default mask choice motivation.

> +#endif
> +
>   /**
>    * RTE_FLOW_ITEM_TYPE_VF
>    *


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

* Re: [dpdk-dev] [EXT] Re: [PATCH] ethdev: add HIGIG2 key field to flow API
  2019-10-14  7:08 ` Andrew Rybchenko
@ 2019-10-15  4:23   ` Kiran Kumar Kokkilagadda
  0 siblings, 0 replies; 31+ messages in thread
From: Kiran Kumar Kokkilagadda @ 2019-10-15  4:23 UTC (permalink / raw)
  To: Andrew Rybchenko, Adrien Mazarguil, John McNamara,
	Marko Kovacevic, Thomas Monjalon, Ferruh Yigit
  Cc: dev, ajit.khaparde



-----Original Message-----
From: Andrew Rybchenko <arybchenko@solarflare.com> 
Sent: Monday, October 14, 2019 12:38 PM
To: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>; Adrien Mazarguil <adrien.mazarguil@6wind.com>; John McNamara <john.mcnamara@intel.com>; Marko Kovacevic <marko.kovacevic@intel.com>; Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org; ajit.khaparde@broadcom.com
Subject: [EXT] Re: [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API

External Email

----------------------------------------------------------------------
On 10/14/19 7:29 AM, kirankumark@marvell.com wrote:

> From: Kiran Kumar K <kirankumark@marvell.com>

>

> Add new rte_flow_item_higig2_hdr in order to match higig2 header.

> It is a layer 2.5 protocol and used in broadcom switches.

> Header format is based on the following document.

> https://urldefense.proofpoint.com/v2/url?u=http-3A__read.pudn.com_downloads558_doc_comm_2301468_HiGig-5Fprotocol.pdf&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=owEKckYY4FTmil1Z6oBURwkTThyuRbLAY9LdfiaT6HA&m=E--ycNQdWbQ_5bNBEDLQHwLS3axpOnsTIAtUe290BPU&s=IDtfzPnjppslgp0Wrkv_TGxl1wIqDspU6jNzC3LKciM&e= 

>

> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>

> ---

>   doc/guides/prog_guide/rte_flow.rst |  8 ++++

>   lib/librte_ethdev/rte_flow.c       |  1 +

>   lib/librte_ethdev/rte_flow.h       | 77 ++++++++++++++++++++++++++++++



As far as I remember support in testpmd is a must requirement

to add new RTE flow API feature.

>> Will add support to parse this item in testpmd, Will be adding basic fields/ non bitmap fields to parse, like classification and vid. 

>   3 files changed, 86 insertions(+)

>

> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst

> index 1c837ff13..71365b159 100644

> --- a/doc/guides/prog_guide/rte_flow.rst

> +++ b/doc/guides/prog_guide/rte_flow.rst

> @@ -1290,6 +1290,14 @@ Matches a IP Authentication Header (RFC 4302).

>   - Default ``mask`` matches spi.

>   

>   

> +Item: ``HIGIG2``

> +^^^^^^^^^^^^^^^^^

> +

> +Matches a HIGIG2 header field. It is layer 2.5 protocol and used in

> +broadcom switches.

> +

> +- Default ``mask`` matches classification and vlan.

> +





Right now there is one empty line between items and two between

the last item and actions. It should be preserved.

>> Ack, Will add this change.


>   Actions

>   ~~~~~~~

>   

> diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c

> index 81a85b995..ca0f68016 100644

> --- a/lib/librte_ethdev/rte_flow.c

> +++ b/lib/librte_ethdev/rte_flow.c

> @@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {

>   	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),

>   	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),

>   	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),

> +	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),

>   };

>   

>   /** Generate flow_action[] entry. */

> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h

> index bcfc06cdc..59e37f714 100644

> --- a/lib/librte_ethdev/rte_flow.h

> +++ b/lib/librte_ethdev/rte_flow.h

> @@ -491,6 +491,12 @@ enum rte_flow_item_type {

>   	 *

>   	 */

>   	RTE_FLOW_ITEM_TYPE_AH,

> +

> +	/**

> +	 * Matches a HIGIG header.

> +	 * see struct rte_flow_item_higig2_hdr.

> +	 */

> +	RTE_FLOW_ITEM_TYPE_HIGIG2,

>   };

>   

>   /**

> @@ -515,6 +521,77 @@ static const struct rte_flow_item_any rte_flow_item_any_mask = {

>   };

>   #endif

>   

> +/**

> + * RTE_FLOW_ITEM_TYPE_HIGIG2

> + * Matches higig2 header.

> + */

> +struct rte_higig2_frc {

> +	uint32_t ksop:8;

> +	uint32_t resv:3;

> +	uint32_t mcst:1;

> +	uint32_t tc:4;

> +	uint32_t dst_modid:8;

> +	uint32_t dst_pid:8;

> +	uint32_t src_modid:8;

> +	uint32_t src_pid:8;

> +	uint32_t lbid:8;

> +	uint32_t dp:2;

> +	uint32_t resv1:3;

> +	uint32_t ppd_type:3;

> +} __attribute__((packed));

> +

> +struct rte_higig2_ppt_type0 {

> +	uint32_t dst_t:1;

> +	uint32_t dst_tgid:3;

> +	uint32_t ingress_tagged:1;

> +	uint32_t mirror_only:1;

> +	uint32_t mirror_done:1;

> +	uint32_t mirror:1;

> +	uint32_t res:2;

> +	uint32_t l3:1;

> +	uint32_t label_present:1;

> +	uint32_t vc_label2:4;

> +	uint32_t vc_label1:8;

> +	uint32_t vc_label0:8;

> +	uint32_t vid_high:8;

> +	uint32_t vid_low:8;

> +	uint32_t pfm:2;

> +	uint32_t src_t:1;

> +	uint32_t res1:2;

> +	uint32_t opcode:3;

> +	uint32_t hdr_ext_len:3;

> +	uint32_t res2:5;

> +} __attribute__((packed));

> +

> +struct rte_higig2_ppt_type1 {

> +	uint32_t classification:16;

> +	uint32_t resv:16;

> +	uint32_t vid:16;

> +	uint32_t pfm:2;

> +	uint32_t src_t:1;

> +	uint32_t resv1:2;

> +	uint32_t opcode:3;

> +	uint32_t hdr_ext_len:3;

> +	uint32_t resv2:5;

> +} __attribute__((packed));

> +



Usage of bit fields in network headers require

big/little endian handling. See lib/librte_net/rte_gre.h

Also other network protocol headers are defined in

lib/librte_net.

>> Will move the header to new file lib/librte_net/rte_higig.h

> +RTE_STD_C11

> +struct rte_flow_item_higig2_hdr {

> +	struct rte_higig2_frc fcr;

> +	union {

> +		struct rte_higig2_ppt_type0 ppt0;

> +		struct rte_higig2_ppt_type1 ppt1;

> +	};

> +} __attribute__((packed));

> +

> +/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */

> +#ifndef __cplusplus

> +static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {

> +	.ppt1.classification = 0xffff,

> +	.ppt1.vid = 0xfff,

> +};



It would be useful to see default mask choice motivation.

>> Most of the use case scenarios we have, the traffic will be scattered based on classification and vid fields, so added these 2 fields as default mask.


> +#endif

> +

>   /**

>    * RTE_FLOW_ITEM_TYPE_VF

>    *




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

* [dpdk-dev]  [PATCH] ethdev: add HIGIG2 key field to flow API
  2019-10-14  4:29 [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API kirankumark
  2019-10-14  7:08 ` Andrew Rybchenko
@ 2019-10-15  6:20 ` kirankumark
  2019-10-15  6:27   ` Jerin Jacob
  2019-10-15  8:32   ` [dpdk-dev] [PATCH v3] " kirankumark
  2019-10-15 16:47 ` [dpdk-dev] [PATCH] " Stephen Hemminger
  2 siblings, 2 replies; 31+ messages in thread
From: kirankumark @ 2019-10-15  6:20 UTC (permalink / raw)
  To: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde, Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

Add new rte_flow_item_higig2_hdr in order to match higig2 header.
It is a layer 2.5 protocol and used in broadcom switches.
Header format is based on the following document.
http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---

V2 Changes:
* Added support in testpmd to parse the higig2 item
* Moved the higig2 header to new file
* Added indentation in doc

 app/test-pmd/cmdline_flow.c        |  33 +++++++
 doc/guides/prog_guide/rte_flow.rst |   8 ++
 lib/librte_ethdev/rte_flow.c       |   1 +
 lib/librte_ethdev/rte_flow.h       |   7 ++
 lib/librte_net/Makefile            |   2 +-
 lib/librte_net/rte_higig.h         | 138 +++++++++++++++++++++++++++++
 6 files changed, 188 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_net/rte_higig.h

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b26b8bfe2..8d6c354fa 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -203,6 +203,9 @@ enum index {
 	ITEM_PPPOED,
 	ITEM_PPPOE_SEID,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,

 	/* Validate/create actions. */
 	ACTIONS,
@@ -675,6 +678,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOES,
 	ITEM_PPPOED,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
 	END_SET,
 	ZERO,
 };
@@ -939,6 +943,13 @@ static const enum index item_pppoe_proto_id[] = {
 	ZERO,
 };

+static const enum index item_higig2[] = {
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -2419,6 +2430,28 @@ static const struct token token_list[] = {
 		.next = NEXT(item_pppoe_proto_id),
 		.call = parse_vc,
 	},
+	[ITEM_HIGIG2] = {
+		.name = "higig2",
+		.help = "matches higig2 header",
+		.priv = PRIV_ITEM(HIGIG2,
+				sizeof(struct rte_flow_item_higig2_hdr)),
+		.next = NEXT(item_higig2),
+		.call = parse_vc,
+	},
+	[ITEM_HIGIG2_CLASSIFICATION] = {
+		.name = "classification",
+		.help = "matches classification of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					ppt1.classification)),
+	},
+	[ITEM_HIGIG2_VID] = {
+		.name = "vid",
+		.help = "matches vid of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					ppt1.vid)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 1c837ff13..a47266c67 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302).
 - ``seq_num``: counter value increased by 1 on each packet sent.
 - Default ``mask`` matches spi.

+Item: ``HIGIG2``
+^^^^^^^^^^^^^^^^^
+
+Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
+broadcom switches.
+
+- Default ``mask`` matches classification and vlan.
+

 Actions
 ~~~~~~~
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 81a85b995..ca0f68016 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
 	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 };

 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index bcfc06cdc..79f160df0 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -27,6 +27,7 @@
 #include <rte_udp.h>
 #include <rte_byteorder.h>
 #include <rte_esp.h>
+#include <rte_higig.h>

 #ifdef __cplusplus
 extern "C" {
@@ -491,6 +492,12 @@ enum rte_flow_item_type {
 	 *
 	 */
 	RTE_FLOW_ITEM_TYPE_AH,
+
+	/**
+	 * Matches a HIGIG header.
+	 * see struct rte_flow_item_higig2_hdr.
+	 */
+	RTE_FLOW_ITEM_TYPE_HIGIG2,
 };

 /**
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 1244c9fd5..62735a5f9 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -21,6 +21,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
new file mode 100644
index 000000000..121c0a850
--- /dev/null
+++ b/lib/librte_net/rte_higig.h
@@ -0,0 +1,138 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2016 6WIND S.A.
+ */
+
+#ifndef _RTE_HIGIG2_H_
+#define _RTE_HIGIG2_H_
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * RTE_FLOW_ITEM_TYPE_HIGIG2
+ * Matches higig2 header.
+ */
+struct rte_higig2_frc {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t ksop:8;
+	uint32_t tc:4;
+	uint32_t mcst:1;
+	uint32_t resv:3;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t ppd_type:3;
+	uint32_t resv1:3;
+	uint32_t dp:2;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t ksop:8;
+	uint32_t resv:3;
+	uint32_t mcst:1;
+	uint32_t tc:4;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t dp:2;
+	uint32_t resv1:3;
+	uint32_t ppd_type:3;
+#endif
+} __attribute__((packed));
+
+struct rte_higig2_ppt_type0 {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t mirror:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror_only:1;
+	uint32_t ingress_tagged:1;
+	uint32_t dst_tgid:3;
+	uint32_t dst_t:1;
+	uint32_t vc_label2:4;
+	uint32_t label_present:1;
+	uint32_t l3:1;
+	uint32_t res:2;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t opcode:3;
+	uint32_t res1:2;
+	uint32_t src_t:1;
+	uint32_t pfm:2;
+	uint32_t res2:5;
+	uint32_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t dst_t:1;
+	uint32_t dst_tgid:3;
+	uint32_t ingress_tagged:1;
+	uint32_t mirror_only:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror:1;
+	uint32_t res:2;
+	uint32_t l3:1;
+	uint32_t label_present:1;
+	uint32_t vc_label2:4;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t pfm:2;
+	uint32_t src_t:1;
+	uint32_t res1:2;
+	uint32_t opcode:3;
+	uint32_t hdr_ext_len:3;
+	uint32_t res2:5;
+#endif
+} __attribute__((packed));
+
+struct rte_higig2_ppt_type1 {
+	uint16_t classification;
+	uint16_t resv;
+	uint16_t vid;
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint16_t opcode:3;
+	uint16_t resv1:2;
+	uint16_t src_t:1;
+	uint16_t pfm:2;
+	uint16_t resv2:5;
+	uint16_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint16_t pfm:2;
+	uint16_t src_t:1;
+	uint16_t resv1:2;
+	uint16_t opcode:3;
+	uint16_t hdr_ext_len:3;
+	uint16_t resv2:5;
+#endif
+} __attribute__((packed));
+
+RTE_STD_C11
+struct rte_flow_item_higig2_hdr {
+	struct rte_higig2_frc fcr;
+	union {
+		struct rte_higig2_ppt_type0 ppt0;
+		struct rte_higig2_ppt_type1 ppt1;
+	};
+} __attribute__((packed));
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
+#ifndef __cplusplus
+static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
+	.ppt1.classification = 0xffff,
+	.ppt1.vid = 0xfff,
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_HIGIG2_H_ */
--
2.17.1


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

* Re: [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API
  2019-10-15  6:20 ` [dpdk-dev] " kirankumark
@ 2019-10-15  6:27   ` Jerin Jacob
  2019-10-15  6:57     ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda
  2019-10-15  8:22     ` [dpdk-dev] " Ananyev, Konstantin
  2019-10-15  8:32   ` [dpdk-dev] [PATCH v3] " kirankumark
  1 sibling, 2 replies; 31+ messages in thread
From: Jerin Jacob @ 2019-10-15  6:27 UTC (permalink / raw)
  To: Kiran Kumar K
  Cc: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz, dpdk-dev, Ajit Khaparde

On Tue, Oct 15, 2019 at 11:51 AM <kirankumark@marvell.com> wrote:
>
> From: Kiran Kumar K <kirankumark@marvell.com>
>
> Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> It is a layer 2.5 protocol and used in broadcom switches.
> Header format is based on the following document.
> http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf
>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> ---
>
> V2 Changes:
> * Added support in testpmd to parse the higig2 item
> * Moved the higig2 header to new file
> * Added indentation in doc
>

>
>  include $(RTE_SDK)/mk/rte.lib.mk
> diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
> new file mode 100644
> index 000000000..121c0a850
> --- /dev/null
> +++ b/lib/librte_net/rte_higig.h
> @@ -0,0 +1,138 @@
> +
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright 2016 6WIND S.A.

Copy and paste error.

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

* Re: [dpdk-dev] [EXT] Re: [PATCH] ethdev: add HIGIG2 key field to flow API
  2019-10-15  6:27   ` Jerin Jacob
@ 2019-10-15  6:57     ` Kiran Kumar Kokkilagadda
  2019-10-15  8:22     ` [dpdk-dev] " Ananyev, Konstantin
  1 sibling, 0 replies; 31+ messages in thread
From: Kiran Kumar Kokkilagadda @ 2019-10-15  6:57 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz, dpdk-dev, Ajit Khaparde



> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Tuesday, October 15, 2019 11:57 AM
> To: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>
> Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Wenzhuo Lu
> <wenzhuo.lu@intel.com>; Jingjing Wu <jingjing.wu@intel.com>; Bernard
> Iremonger <bernard.iremonger@intel.com>; John McNamara
> <john.mcnamara@intel.com>; Marko Kovacevic <marko.kovacevic@intel.com>;
> Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit
> <ferruh.yigit@intel.com>; Andrew Rybchenko <arybchenko@solarflare.com>;
> Olivier Matz <olivier.matz@6wind.com>; dpdk-dev <dev@dpdk.org>; Ajit
> Khaparde <ajit.khaparde@broadcom.com>
> Subject: [EXT] Re: [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Tue, Oct 15, 2019 at 11:51 AM <kirankumark@marvell.com> wrote:
> 
> >
> 
> > From: Kiran Kumar K <kirankumark@marvell.com>
> 
> >
> 
> > Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> 
> > It is a layer 2.5 protocol and used in broadcom switches.
> 
> > Header format is based on the following document.
> 
> > https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__read.pudn.com_downloads558_doc_comm_2301468_HiGig-
> 5Fprotocol.pdf&d=DwIBaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=owEKckYY4FTmil1
> Z6oBURwkTThyuRbLAY9LdfiaT6HA&m=kbv0TGqV_dyrvJzNCIfrjTjIAgmu6mgNlOL
> jUHoUDtk&s=2HV-LJRoSlEnhpQ2fYyq0qul2PeVtgHyWI3H75vbrbc&e=
> 
> >
> 
> > Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> 
> > ---
> 
> >
> 
> > V2 Changes:
> 
> > * Added support in testpmd to parse the higig2 item
> 
> > * Moved the higig2 header to new file
> 
> > * Added indentation in doc
> 
> >
> 
> 
> 
> >
> 
> >  include $(RTE_SDK)/mk/rte.lib.mk
> 
> > diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
> 
> > new file mode 100644
> 
> > index 000000000..121c0a850
> 
> > --- /dev/null
> 
> > +++ b/lib/librte_net/rte_higig.h
> 
> > @@ -0,0 +1,138 @@
> 
> > +
> 
> > +/* SPDX-License-Identifier: BSD-3-Clause
> 
> > + * Copyright 2016 6WIND S.A.
> 
> 
> 
> Copy and paste error.

Will fix in V3.



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

* Re: [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API
  2019-10-15  6:27   ` Jerin Jacob
  2019-10-15  6:57     ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda
@ 2019-10-15  8:22     ` Ananyev, Konstantin
  1 sibling, 0 replies; 31+ messages in thread
From: Ananyev, Konstantin @ 2019-10-15  8:22 UTC (permalink / raw)
  To: Jerin Jacob, Kiran Kumar K
  Cc: Adrien Mazarguil, Lu, Wenzhuo, Wu, Jingjing, Iremonger, Bernard,
	Mcnamara, John, Kovacevic, Marko, Thomas Monjalon, Yigit, Ferruh,
	Andrew Rybchenko, Olivier Matz, dpdk-dev, Ajit Khaparde



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob
> Sent: Tuesday, October 15, 2019 7:27 AM
> To: Kiran Kumar K <kirankumark@marvell.com>
> Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Iremonger, Bernard <bernard.iremonger@intel.com>; Mcnamara, John <john.mcnamara@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew Rybchenko
> <arybchenko@solarflare.com>; Olivier Matz <olivier.matz@6wind.com>; dpdk-dev <dev@dpdk.org>; Ajit Khaparde
> <ajit.khaparde@broadcom.com>
> Subject: Re: [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API
> 
> On Tue, Oct 15, 2019 at 11:51 AM <kirankumark@marvell.com> wrote:
> >
> > From: Kiran Kumar K <kirankumark@marvell.com>
> >
> > Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> > It is a layer 2.5 protocol and used in broadcom switches.
> > Header format is based on the following document.
> > http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf
> >
> > Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> > ---
> >
> > V2 Changes:

If it is a v2, then I think it has to be reflected in subject, i.e:
[PATCH v2] ....

> > * Added support in testpmd to parse the higig2 item
> > * Moved the higig2 header to new file
> > * Added indentation in doc
> >
> 
> >
> >  include $(RTE_SDK)/mk/rte.lib.mk
> > diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
> > new file mode 100644
> > index 000000000..121c0a850
> > --- /dev/null
> > +++ b/lib/librte_net/rte_higig.h
> > @@ -0,0 +1,138 @@
> > +
> > +/* SPDX-License-Identifier: BSD-3-Clause
> > + * Copyright 2016 6WIND S.A.
> 
> Copy and paste error.

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

* [dpdk-dev]  [PATCH v3] ethdev: add HIGIG2 key field to flow API
  2019-10-15  6:20 ` [dpdk-dev] " kirankumark
  2019-10-15  6:27   ` Jerin Jacob
@ 2019-10-15  8:32   ` kirankumark
  2019-10-17  4:15     ` [dpdk-dev] [PATCH v4] " kirankumark
  1 sibling, 1 reply; 31+ messages in thread
From: kirankumark @ 2019-10-15  8:32 UTC (permalink / raw)
  To: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde, Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

Add new rte_flow_item_higig2_hdr in order to match higig2 header.
It is a layer 2.5 protocol and used in broadcom switches.
Header format is based on the following document.
http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
V3 Changes:
* Fixed Copyright header
* Fixed version info in the subject

V2 Changes:
* Added support in testpmd to parse the higig2 item
* Moved the higig2 header to new file
* Added indentation in doc

 app/test-pmd/cmdline_flow.c        |  33 +++++++
 doc/guides/prog_guide/rte_flow.rst |   8 ++
 lib/librte_ethdev/rte_flow.c       |   1 +
 lib/librte_ethdev/rte_flow.h       |   7 ++
 lib/librte_net/Makefile            |   2 +-
 lib/librte_net/rte_higig.h         | 138 +++++++++++++++++++++++++++++
 6 files changed, 188 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_net/rte_higig.h

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b26b8bfe2..8d6c354fa 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -203,6 +203,9 @@ enum index {
 	ITEM_PPPOED,
 	ITEM_PPPOE_SEID,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,

 	/* Validate/create actions. */
 	ACTIONS,
@@ -675,6 +678,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOES,
 	ITEM_PPPOED,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
 	END_SET,
 	ZERO,
 };
@@ -939,6 +943,13 @@ static const enum index item_pppoe_proto_id[] = {
 	ZERO,
 };

+static const enum index item_higig2[] = {
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -2419,6 +2430,28 @@ static const struct token token_list[] = {
 		.next = NEXT(item_pppoe_proto_id),
 		.call = parse_vc,
 	},
+	[ITEM_HIGIG2] = {
+		.name = "higig2",
+		.help = "matches higig2 header",
+		.priv = PRIV_ITEM(HIGIG2,
+				sizeof(struct rte_flow_item_higig2_hdr)),
+		.next = NEXT(item_higig2),
+		.call = parse_vc,
+	},
+	[ITEM_HIGIG2_CLASSIFICATION] = {
+		.name = "classification",
+		.help = "matches classification of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					ppt1.classification)),
+	},
+	[ITEM_HIGIG2_VID] = {
+		.name = "vid",
+		.help = "matches vid of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					ppt1.vid)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 1c837ff13..a47266c67 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302).
 - ``seq_num``: counter value increased by 1 on each packet sent.
 - Default ``mask`` matches spi.

+Item: ``HIGIG2``
+^^^^^^^^^^^^^^^^^
+
+Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
+broadcom switches.
+
+- Default ``mask`` matches classification and vlan.
+

 Actions
 ~~~~~~~
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 81a85b995..ca0f68016 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
 	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 };

 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index bcfc06cdc..79f160df0 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -27,6 +27,7 @@
 #include <rte_udp.h>
 #include <rte_byteorder.h>
 #include <rte_esp.h>
+#include <rte_higig.h>

 #ifdef __cplusplus
 extern "C" {
@@ -491,6 +492,12 @@ enum rte_flow_item_type {
 	 *
 	 */
 	RTE_FLOW_ITEM_TYPE_AH,
+
+	/**
+	 * Matches a HIGIG header.
+	 * see struct rte_flow_item_higig2_hdr.
+	 */
+	RTE_FLOW_ITEM_TYPE_HIGIG2,
 };

 /**
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 1244c9fd5..62735a5f9 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -21,6 +21,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
new file mode 100644
index 000000000..0c52e0daa
--- /dev/null
+++ b/lib/librte_net/rte_higig.h
@@ -0,0 +1,138 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _RTE_HIGIG2_H_
+#define _RTE_HIGIG2_H_
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * RTE_FLOW_ITEM_TYPE_HIGIG2
+ * Matches higig2 header.
+ */
+struct rte_higig2_frc {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t ksop:8;
+	uint32_t tc:4;
+	uint32_t mcst:1;
+	uint32_t resv:3;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t ppd_type:3;
+	uint32_t resv1:3;
+	uint32_t dp:2;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t ksop:8;
+	uint32_t resv:3;
+	uint32_t mcst:1;
+	uint32_t tc:4;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t dp:2;
+	uint32_t resv1:3;
+	uint32_t ppd_type:3;
+#endif
+} __attribute__((packed));
+
+struct rte_higig2_ppt_type0 {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t mirror:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror_only:1;
+	uint32_t ingress_tagged:1;
+	uint32_t dst_tgid:3;
+	uint32_t dst_t:1;
+	uint32_t vc_label2:4;
+	uint32_t label_present:1;
+	uint32_t l3:1;
+	uint32_t res:2;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t opcode:3;
+	uint32_t res1:2;
+	uint32_t src_t:1;
+	uint32_t pfm:2;
+	uint32_t res2:5;
+	uint32_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t dst_t:1;
+	uint32_t dst_tgid:3;
+	uint32_t ingress_tagged:1;
+	uint32_t mirror_only:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror:1;
+	uint32_t res:2;
+	uint32_t l3:1;
+	uint32_t label_present:1;
+	uint32_t vc_label2:4;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t pfm:2;
+	uint32_t src_t:1;
+	uint32_t res1:2;
+	uint32_t opcode:3;
+	uint32_t hdr_ext_len:3;
+	uint32_t res2:5;
+#endif
+} __attribute__((packed));
+
+struct rte_higig2_ppt_type1 {
+	uint16_t classification;
+	uint16_t resv;
+	uint16_t vid;
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint16_t opcode:3;
+	uint16_t resv1:2;
+	uint16_t src_t:1;
+	uint16_t pfm1:2;
+	uint16_t resv2:5;
+	uint16_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint16_t pfm1:2;
+	uint16_t src_t:1;
+	uint16_t resv1:2;
+	uint16_t opcode:3;
+	uint16_t hdr_ext_len:3;
+	uint16_t resv2:5;
+#endif
+} __attribute__((packed));
+
+RTE_STD_C11
+struct rte_flow_item_higig2_hdr {
+	struct rte_higig2_frc fcr;
+	union {
+		struct rte_higig2_ppt_type0 ppt0;
+		struct rte_higig2_ppt_type1 ppt1;
+	};
+} __attribute__((packed));
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
+#ifndef __cplusplus
+static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
+	.ppt1.classification = 0xffff,
+	.ppt1.vid = 0xfff,
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_HIGIG2_H_ */
--
2.17.1


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

* Re: [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API
  2019-10-14  4:29 [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API kirankumark
  2019-10-14  7:08 ` Andrew Rybchenko
  2019-10-15  6:20 ` [dpdk-dev] " kirankumark
@ 2019-10-15 16:47 ` Stephen Hemminger
  2019-10-16  3:14   ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda
  2 siblings, 1 reply; 31+ messages in thread
From: Stephen Hemminger @ 2019-10-15 16:47 UTC (permalink / raw)
  To: kirankumark
  Cc: Adrien Mazarguil, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, dev,
	ajit.khaparde

On Mon, 14 Oct 2019 09:59:56 +0530
<kirankumark@marvell.com> wrote:

> +/**
> + * RTE_FLOW_ITEM_TYPE_HIGIG2
> + * Matches higig2 header.
> + */
> +struct rte_higig2_frc {
> +	uint32_t ksop:8;
> +	uint32_t resv:3;
> +	uint32_t mcst:1;
> +	uint32_t tc:4;
> +	uint32_t dst_modid:8;
> +	uint32_t dst_pid:8;
> +	uint32_t src_modid:8;
> +	uint32_t src_pid:8;
> +	uint32_t lbid:8;
> +	uint32_t dp:2;
> +	uint32_t resv1:3;
> +	uint32_t ppd_type:3;
> +} __attribute__((packed));
> +
> +struct rte_higig2_ppt_type0 {
> +	uint32_t dst_t:1;
> +	uint32_t dst_tgid:3;
> +	uint32_t ingress_tagged:1;
> +	uint32_t mirror_only:1;
> +	uint32_t mirror_done:1;
> +	uint32_t mirror:1;
> +	uint32_t res:2;
> +	uint32_t l3:1;
> +	uint32_t label_present:1;
> +	uint32_t vc_label2:4;
> +	uint32_t vc_label1:8;
> +	uint32_t vc_label0:8;
> +	uint32_t vid_high:8;
> +	uint32_t vid_low:8;
> +	uint32_t pfm:2;
> +	uint32_t src_t:1;
> +	uint32_t res1:2;
> +	uint32_t opcode:3;
> +	uint32_t hdr_ext_len:3;
> +	uint32_t res2:5;
> +} __attribute__((packed));
> +
> +struct rte_higig2_ppt_type1 {
> +	uint32_t classification:16;
> +	uint32_t resv:16;
> +	uint32_t vid:16;
> +	uint32_t pfm:2;
> +	uint32_t src_t:1;
> +	uint32_t resv1:2;
> +	uint32_t opcode:3;
> +	uint32_t hdr_ext_len:3;
> +	uint32_t resv2:5;
> +} __attribute__((packed));
> +
> +RTE_STD_C11
> +struct rte_flow_item_higig2_hdr {
> +	struct rte_higig2_frc fcr;
> +	union {
> +		struct rte_higig2_ppt_type0 ppt0;
> +		struct rte_higig2_ppt_type1 ppt1;
> +	};
> +} __attribute__((packed));
> +
> +/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
> +#ifndef __cplusplus
> +static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
> +	.ppt1.classification = 0xffff,
> +	.ppt1.vid = 0xfff,
> +};
> +#endif
> +

Why do all these structures have to be packed. They are all uint32.

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

* Re: [dpdk-dev] [EXT] Re: [PATCH] ethdev: add HIGIG2 key field to flow API
  2019-10-15 16:47 ` [dpdk-dev] [PATCH] " Stephen Hemminger
@ 2019-10-16  3:14   ` Kiran Kumar Kokkilagadda
  0 siblings, 0 replies; 31+ messages in thread
From: Kiran Kumar Kokkilagadda @ 2019-10-16  3:14 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Adrien Mazarguil, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, dev,
	ajit.khaparde



> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Tuesday, October 15, 2019 10:17 PM
> To: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>
> Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; John McNamara
> <john.mcnamara@intel.com>; Marko Kovacevic <marko.kovacevic@intel.com>;
> Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit
> <ferruh.yigit@intel.com>; Andrew Rybchenko <arybchenko@solarflare.com>;
> dev@dpdk.org; ajit.khaparde@broadcom.com
> Subject: [EXT] Re: [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Mon, 14 Oct 2019 09:59:56 +0530
> <kirankumark@marvell.com> wrote:
> 
> > +/**
> > + * RTE_FLOW_ITEM_TYPE_HIGIG2
> > + * Matches higig2 header.
> > + */
> > +struct rte_higig2_frc {
> > +	uint32_t ksop:8;
> > +	uint32_t resv:3;
> > +	uint32_t mcst:1;
> > +	uint32_t tc:4;
> > +	uint32_t dst_modid:8;
> > +	uint32_t dst_pid:8;
> > +	uint32_t src_modid:8;
> > +	uint32_t src_pid:8;
> > +	uint32_t lbid:8;
> > +	uint32_t dp:2;
> > +	uint32_t resv1:3;
> > +	uint32_t ppd_type:3;
> > +} __attribute__((packed));
> > +
> > +struct rte_higig2_ppt_type0 {
> > +	uint32_t dst_t:1;
> > +	uint32_t dst_tgid:3;
> > +	uint32_t ingress_tagged:1;
> > +	uint32_t mirror_only:1;
> > +	uint32_t mirror_done:1;
> > +	uint32_t mirror:1;
> > +	uint32_t res:2;
> > +	uint32_t l3:1;
> > +	uint32_t label_present:1;
> > +	uint32_t vc_label2:4;
> > +	uint32_t vc_label1:8;
> > +	uint32_t vc_label0:8;
> > +	uint32_t vid_high:8;
> > +	uint32_t vid_low:8;
> > +	uint32_t pfm:2;
> > +	uint32_t src_t:1;
> > +	uint32_t res1:2;
> > +	uint32_t opcode:3;
> > +	uint32_t hdr_ext_len:3;
> > +	uint32_t res2:5;
> > +} __attribute__((packed));
> > +
> > +struct rte_higig2_ppt_type1 {
> > +	uint32_t classification:16;
> > +	uint32_t resv:16;
> > +	uint32_t vid:16;
> > +	uint32_t pfm:2;
> > +	uint32_t src_t:1;
> > +	uint32_t resv1:2;
> > +	uint32_t opcode:3;
> > +	uint32_t hdr_ext_len:3;
> > +	uint32_t resv2:5;
> > +} __attribute__((packed));
> > +
> > +RTE_STD_C11
> > +struct rte_flow_item_higig2_hdr {
> > +	struct rte_higig2_frc fcr;
> > +	union {
> > +		struct rte_higig2_ppt_type0 ppt0;
> > +		struct rte_higig2_ppt_type1 ppt1;
> > +	};
> > +} __attribute__((packed));
> > +
> > +/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */ #ifndef
> > +__cplusplus static const struct rte_flow_item_higig2_hdr
> > +rte_flow_item_higig2_hdr_mask = {
> > +	.ppt1.classification = 0xffff,
> > +	.ppt1.vid = 0xfff,
> > +};
> > +#endif
> > +
> 
> Why do all these structures have to be packed. They are all uint32.
Will fix in V4.


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

* [dpdk-dev]  [PATCH v4] ethdev: add HIGIG2 key field to flow API
  2019-10-15  8:32   ` [dpdk-dev] [PATCH v3] " kirankumark
@ 2019-10-17  4:15     ` kirankumark
  2019-10-17  9:08       ` Andrew Rybchenko
  2019-10-18  4:13       ` [dpdk-dev] [PATCH v5] " kirankumark
  0 siblings, 2 replies; 31+ messages in thread
From: kirankumark @ 2019-10-17  4:15 UTC (permalink / raw)
  To: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde, Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

Add new rte_flow_item_higig2_hdr in order to match higig2 header.
It is a layer 2.5 protocol and used in broadcom switches.
Header format is based on the following document.
http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
V4 Changes:
* Removed packed attribute

V3 Changes:
* Fixed Copyright header
* Fixed version info in the subject

V2 Changes:
* Added support in testpmd to parse the higig2 item
* Moved the higig2 header to new file
* Added indentation in doc

 app/test-pmd/cmdline_flow.c        |  33 +++++++
 doc/guides/prog_guide/rte_flow.rst |   8 ++
 lib/librte_ethdev/rte_flow.c       |   1 +
 lib/librte_ethdev/rte_flow.h       |   7 ++
 lib/librte_net/Makefile            |   2 +-
 lib/librte_net/rte_higig.h         | 138 +++++++++++++++++++++++++++++
 6 files changed, 188 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_net/rte_higig.h

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b26b8bfe2..8d6c354fa 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -203,6 +203,9 @@ enum index {
 	ITEM_PPPOED,
 	ITEM_PPPOE_SEID,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,

 	/* Validate/create actions. */
 	ACTIONS,
@@ -675,6 +678,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOES,
 	ITEM_PPPOED,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
 	END_SET,
 	ZERO,
 };
@@ -939,6 +943,13 @@ static const enum index item_pppoe_proto_id[] = {
 	ZERO,
 };

+static const enum index item_higig2[] = {
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -2419,6 +2430,28 @@ static const struct token token_list[] = {
 		.next = NEXT(item_pppoe_proto_id),
 		.call = parse_vc,
 	},
+	[ITEM_HIGIG2] = {
+		.name = "higig2",
+		.help = "matches higig2 header",
+		.priv = PRIV_ITEM(HIGIG2,
+				sizeof(struct rte_flow_item_higig2_hdr)),
+		.next = NEXT(item_higig2),
+		.call = parse_vc,
+	},
+	[ITEM_HIGIG2_CLASSIFICATION] = {
+		.name = "classification",
+		.help = "matches classification of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					ppt1.classification)),
+	},
+	[ITEM_HIGIG2_VID] = {
+		.name = "vid",
+		.help = "matches vid of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					ppt1.vid)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 1c837ff13..a47266c67 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302).
 - ``seq_num``: counter value increased by 1 on each packet sent.
 - Default ``mask`` matches spi.

+Item: ``HIGIG2``
+^^^^^^^^^^^^^^^^^
+
+Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
+broadcom switches.
+
+- Default ``mask`` matches classification and vlan.
+

 Actions
 ~~~~~~~
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 81a85b995..ca0f68016 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
 	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 };

 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index bcfc06cdc..79f160df0 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -27,6 +27,7 @@
 #include <rte_udp.h>
 #include <rte_byteorder.h>
 #include <rte_esp.h>
+#include <rte_higig.h>

 #ifdef __cplusplus
 extern "C" {
@@ -491,6 +492,12 @@ enum rte_flow_item_type {
 	 *
 	 */
 	RTE_FLOW_ITEM_TYPE_AH,
+
+	/**
+	 * Matches a HIGIG header.
+	 * see struct rte_flow_item_higig2_hdr.
+	 */
+	RTE_FLOW_ITEM_TYPE_HIGIG2,
 };

 /**
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 1244c9fd5..62735a5f9 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -21,6 +21,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
new file mode 100644
index 000000000..220cee827
--- /dev/null
+++ b/lib/librte_net/rte_higig.h
@@ -0,0 +1,138 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _RTE_HIGIG2_H_
+#define _RTE_HIGIG2_H_
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * RTE_FLOW_ITEM_TYPE_HIGIG2
+ * Matches higig2 header.
+ */
+struct rte_higig2_frc {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t ksop:8;
+	uint32_t tc:4;
+	uint32_t mcst:1;
+	uint32_t resv:3;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t ppd_type:3;
+	uint32_t resv1:3;
+	uint32_t dp:2;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t ksop:8;
+	uint32_t resv:3;
+	uint32_t mcst:1;
+	uint32_t tc:4;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t dp:2;
+	uint32_t resv1:3;
+	uint32_t ppd_type:3;
+#endif
+};
+
+struct rte_higig2_ppt_type0 {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t mirror:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror_only:1;
+	uint32_t ingress_tagged:1;
+	uint32_t dst_tgid:3;
+	uint32_t dst_t:1;
+	uint32_t vc_label2:4;
+	uint32_t label_present:1;
+	uint32_t l3:1;
+	uint32_t res:2;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t opcode:3;
+	uint32_t res1:2;
+	uint32_t src_t:1;
+	uint32_t pfm:2;
+	uint32_t res2:5;
+	uint32_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t dst_t:1;
+	uint32_t dst_tgid:3;
+	uint32_t ingress_tagged:1;
+	uint32_t mirror_only:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror:1;
+	uint32_t res:2;
+	uint32_t l3:1;
+	uint32_t label_present:1;
+	uint32_t vc_label2:4;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t pfm:2;
+	uint32_t src_t:1;
+	uint32_t res1:2;
+	uint32_t opcode:3;
+	uint32_t hdr_ext_len:3;
+	uint32_t res2:5;
+#endif
+};
+
+struct rte_higig2_ppt_type1 {
+	uint16_t classification;
+	uint16_t resv;
+	uint16_t vid;
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint16_t opcode:3;
+	uint16_t resv1:2;
+	uint16_t src_t:1;
+	uint16_t pfm:2;
+	uint16_t resv2:5;
+	uint16_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint16_t pfm:2;
+	uint16_t src_t:1;
+	uint16_t resv1:2;
+	uint16_t opcode:3;
+	uint16_t hdr_ext_len:3;
+	uint16_t resv2:5;
+#endif
+};
+
+RTE_STD_C11
+struct rte_flow_item_higig2_hdr {
+	struct rte_higig2_frc fcr;
+	union {
+		struct rte_higig2_ppt_type0 ppt0;
+		struct rte_higig2_ppt_type1 ppt1;
+	};
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
+#ifndef __cplusplus
+static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
+	.ppt1.classification = 0xffff,
+	.ppt1.vid = 0xfff,
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_HIGIG2_H_ */
--
2.17.1


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

* Re: [dpdk-dev] [PATCH v4] ethdev: add HIGIG2 key field to flow API
  2019-10-17  4:15     ` [dpdk-dev] [PATCH v4] " kirankumark
@ 2019-10-17  9:08       ` Andrew Rybchenko
  2019-10-18  4:13       ` [dpdk-dev] [PATCH v5] " kirankumark
  1 sibling, 0 replies; 31+ messages in thread
From: Andrew Rybchenko @ 2019-10-17  9:08 UTC (permalink / raw)
  To: kirankumark, Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu,
	Bernard Iremonger, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Ferruh Yigit, Olivier Matz
  Cc: dev, ajit.khaparde

On 10/17/19 7:15 AM, kirankumark@marvell.com wrote:
> From: Kiran Kumar K <kirankumark@marvell.com>
>
> Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> It is a layer 2.5 protocol and used in broadcom switches.

broadcom -> Broadcom

> Header format is based on the following document.
> http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf
>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> ---
> V4 Changes:
> * Removed packed attribute
>
> V3 Changes:
> * Fixed Copyright header
> * Fixed version info in the subject
>
> V2 Changes:
> * Added support in testpmd to parse the higig2 item
> * Moved the higig2 header to new file
> * Added indentation in doc
>
>   app/test-pmd/cmdline_flow.c        |  33 +++++++
>   doc/guides/prog_guide/rte_flow.rst |   8 ++
>   lib/librte_ethdev/rte_flow.c       |   1 +
>   lib/librte_ethdev/rte_flow.h       |   7 ++
>   lib/librte_net/Makefile            |   2 +-
>   lib/librte_net/rte_higig.h         | 138 +++++++++++++++++++++++++++++

meson.build should be updated as well

[snip]

> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index 1c837ff13..a47266c67 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302).
>   - ``seq_num``: counter value increased by 1 on each packet sent.
>   - Default ``mask`` matches spi.
>
> +Item: ``HIGIG2``
> +^^^^^^^^^^^^^^^^^
> +
> +Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
> +broadcom switches.

broadcom -> Broadcom

[snip]

> diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
> new file mode 100644
> index 000000000..220cee827
> --- /dev/null
> +++ b/lib/librte_net/rte_higig.h
> @@ -0,0 +1,138 @@
> +
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2019 Marvell International Ltd.
> + */
> +
> +#ifndef _RTE_HIGIG2_H_
> +#define _RTE_HIGIG2_H_

It is inconsistent vs header name. Should be _RTE_HIGIG_H_.

> +
> +#include <stdint.h>
> +#include <rte_byteorder.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/**
> + * RTE_FLOW_ITEM_TYPE_HIGIG2
> + * Matches higig2 header.
> + */
> +struct rte_higig2_frc {
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> +	uint32_t ksop:8;
> +	uint32_t tc:4;
> +	uint32_t mcst:1;
> +	uint32_t resv:3;
> +	uint32_t dst_modid:8;
> +	uint32_t dst_pid:8;
> +	uint32_t src_modid:8;
> +	uint32_t src_pid:8;
> +	uint32_t lbid:8;
> +	uint32_t ppd_type:3;
> +	uint32_t resv1:3;
> +	uint32_t dp:2;
> +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> +	uint32_t ksop:8;
> +	uint32_t resv:3;
> +	uint32_t mcst:1;
> +	uint32_t tc:4;
> +	uint32_t dst_modid:8;
> +	uint32_t dst_pid:8;
> +	uint32_t src_modid:8;
> +	uint32_t src_pid:8;
> +	uint32_t lbid:8;
> +	uint32_t dp:2;
> +	uint32_t resv1:3;
> +	uint32_t ppd_type:3;
> +#endif
> +};
> +
> +struct rte_higig2_ppt_type0 {
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> +	uint32_t mirror:1;
> +	uint32_t mirror_done:1;
> +	uint32_t mirror_only:1;
> +	uint32_t ingress_tagged:1;
> +	uint32_t dst_tgid:3;
> +	uint32_t dst_t:1;
> +	uint32_t vc_label2:4;
> +	uint32_t label_present:1;
> +	uint32_t l3:1;
> +	uint32_t res:2;
> +	uint32_t vc_label1:8;
> +	uint32_t vc_label0:8;
> +	uint32_t vid_high:8;
> +	uint32_t vid_low:8;
> +	uint32_t opcode:3;
> +	uint32_t res1:2;
> +	uint32_t src_t:1;
> +	uint32_t pfm:2;
> +	uint32_t res2:5;
> +	uint32_t hdr_ext_len:3;
> +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> +	uint32_t dst_t:1;
> +	uint32_t dst_tgid:3;
> +	uint32_t ingress_tagged:1;
> +	uint32_t mirror_only:1;
> +	uint32_t mirror_done:1;
> +	uint32_t mirror:1;
> +	uint32_t res:2;
> +	uint32_t l3:1;
> +	uint32_t label_present:1;
> +	uint32_t vc_label2:4;
> +	uint32_t vc_label1:8;
> +	uint32_t vc_label0:8;
> +	uint32_t vid_high:8;
> +	uint32_t vid_low:8;
> +	uint32_t pfm:2;
> +	uint32_t src_t:1;
> +	uint32_t res1:2;
> +	uint32_t opcode:3;
> +	uint32_t hdr_ext_len:3;
> +	uint32_t res2:5;
> +#endif
> +};
> +
> +struct rte_higig2_ppt_type1 {
> +	uint16_t classification;
> +	uint16_t resv;
> +	uint16_t vid;
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> +	uint16_t opcode:3;
> +	uint16_t resv1:2;
> +	uint16_t src_t:1;
> +	uint16_t pfm:2;
> +	uint16_t resv2:5;
> +	uint16_t hdr_ext_len:3;
> +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> +	uint16_t pfm:2;
> +	uint16_t src_t:1;
> +	uint16_t resv1:2;
> +	uint16_t opcode:3;
> +	uint16_t hdr_ext_len:3;
> +	uint16_t resv2:5;
> +#endif
> +};
> +
> +RTE_STD_C11
> +struct rte_flow_item_higig2_hdr {
> +	struct rte_higig2_frc fcr;
> +	union {
> +		struct rte_higig2_ppt_type0 ppt0;
> +		struct rte_higig2_ppt_type1 ppt1;
> +	};
> +};
> +
> +/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
> +#ifndef __cplusplus
> +static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
> +	.ppt1.classification = 0xffff,
> +	.ppt1.vid = 0xfff,
> +};
> +#endif
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* RTE_HIGIG2_H_ */

Inconsistent as well.


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

* [dpdk-dev]  [PATCH v5] ethdev: add HIGIG2 key field to flow API
  2019-10-17  4:15     ` [dpdk-dev] [PATCH v4] " kirankumark
  2019-10-17  9:08       ` Andrew Rybchenko
@ 2019-10-18  4:13       ` kirankumark
  2019-10-18  7:36         ` Andrew Rybchenko
                           ` (2 more replies)
  1 sibling, 3 replies; 31+ messages in thread
From: kirankumark @ 2019-10-18  4:13 UTC (permalink / raw)
  To: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde, Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

Add new rte_flow_item_higig2_hdr in order to match higig2 header.
It is a layer 2.5 protocol and used in Broadcom switches.
Header format is based on the following document.
http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
V5 changes:
* Changed broadcom to Broadcom
* Changed RTE_HIGIG2_H to RTE_HIGIG_H
* Fixed meson build

V4 Changes:
* Removed packed attribute

V3 Changes:
* Fixed Copyright header
* Fixed version info in the subject

V2 Changes:
* Added support in testpmd to parse the higig2 item
* Moved the higig2 header to new file
* Added indentation in doc

 app/test-pmd/cmdline_flow.c        |  33 +++++++
 doc/guides/prog_guide/rte_flow.rst |   8 ++
 lib/librte_ethdev/rte_flow.c       |   1 +
 lib/librte_ethdev/rte_flow.h       |   7 ++
 lib/librte_net/Makefile            |   2 +-
 lib/librte_net/meson.build         |   3 +-
 lib/librte_net/rte_higig.h         | 138 +++++++++++++++++++++++++++++
 7 files changed, 190 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_net/rte_higig.h

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b26b8bfe2..8d6c354fa 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -203,6 +203,9 @@ enum index {
 	ITEM_PPPOED,
 	ITEM_PPPOE_SEID,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,

 	/* Validate/create actions. */
 	ACTIONS,
@@ -675,6 +678,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOES,
 	ITEM_PPPOED,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
 	END_SET,
 	ZERO,
 };
@@ -939,6 +943,13 @@ static const enum index item_pppoe_proto_id[] = {
 	ZERO,
 };

+static const enum index item_higig2[] = {
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -2419,6 +2430,28 @@ static const struct token token_list[] = {
 		.next = NEXT(item_pppoe_proto_id),
 		.call = parse_vc,
 	},
+	[ITEM_HIGIG2] = {
+		.name = "higig2",
+		.help = "matches higig2 header",
+		.priv = PRIV_ITEM(HIGIG2,
+				sizeof(struct rte_flow_item_higig2_hdr)),
+		.next = NEXT(item_higig2),
+		.call = parse_vc,
+	},
+	[ITEM_HIGIG2_CLASSIFICATION] = {
+		.name = "classification",
+		.help = "matches classification of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					ppt1.classification)),
+	},
+	[ITEM_HIGIG2_VID] = {
+		.name = "vid",
+		.help = "matches vid of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					ppt1.vid)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 1c837ff13..6e6d44df2 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302).
 - ``seq_num``: counter value increased by 1 on each packet sent.
 - Default ``mask`` matches spi.

+Item: ``HIGIG2``
+^^^^^^^^^^^^^^^^^
+
+Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
+Broadcom switches.
+
+- Default ``mask`` matches classification and vlan.
+

 Actions
 ~~~~~~~
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 81a85b995..ca0f68016 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
 	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 };

 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index bcfc06cdc..79f160df0 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -27,6 +27,7 @@
 #include <rte_udp.h>
 #include <rte_byteorder.h>
 #include <rte_esp.h>
+#include <rte_higig.h>

 #ifdef __cplusplus
 extern "C" {
@@ -491,6 +492,12 @@ enum rte_flow_item_type {
 	 *
 	 */
 	RTE_FLOW_ITEM_TYPE_AH,
+
+	/**
+	 * Matches a HIGIG header.
+	 * see struct rte_flow_item_higig2_hdr.
+	 */
+	RTE_FLOW_ITEM_TYPE_HIGIG2,
 };

 /**
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 1244c9fd5..62735a5f9 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -21,6 +21,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build
index 868a93fd6..c52c34592 100644
--- a/lib/librte_net/meson.build
+++ b/lib/librte_net/meson.build
@@ -14,7 +14,8 @@ headers = files('rte_ip.h',
 	'rte_gre.h',
 	'rte_net.h',
 	'rte_net_crc.h',
-	'rte_mpls.h')
+	'rte_mpls.h',
+	'rte_higig.h')

 sources = files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.c')
 deps += ['mbuf']
diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
new file mode 100644
index 000000000..7c0dec449
--- /dev/null
+++ b/lib/librte_net/rte_higig.h
@@ -0,0 +1,138 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _RTE_HIGIG_H_
+#define _RTE_HIGIG_H_
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * RTE_FLOW_ITEM_TYPE_HIGIG2
+ * Matches higig2 header.
+ */
+struct rte_higig2_frc {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t ksop:8;
+	uint32_t tc:4;
+	uint32_t mcst:1;
+	uint32_t resv:3;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t ppd_type:3;
+	uint32_t resv1:3;
+	uint32_t dp:2;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t ksop:8;
+	uint32_t resv:3;
+	uint32_t mcst:1;
+	uint32_t tc:4;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t dp:2;
+	uint32_t resv1:3;
+	uint32_t ppd_type:3;
+#endif
+};
+
+struct rte_higig2_ppt_type0 {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t mirror:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror_only:1;
+	uint32_t ingress_tagged:1;
+	uint32_t dst_tgid:3;
+	uint32_t dst_t:1;
+	uint32_t vc_label2:4;
+	uint32_t label_present:1;
+	uint32_t l3:1;
+	uint32_t res:2;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t opcode:3;
+	uint32_t res1:2;
+	uint32_t src_t:1;
+	uint32_t pfm:2;
+	uint32_t res2:5;
+	uint32_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t dst_t:1;
+	uint32_t dst_tgid:3;
+	uint32_t ingress_tagged:1;
+	uint32_t mirror_only:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror:1;
+	uint32_t res:2;
+	uint32_t l3:1;
+	uint32_t label_present:1;
+	uint32_t vc_label2:4;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t pfm:2;
+	uint32_t src_t:1;
+	uint32_t res1:2;
+	uint32_t opcode:3;
+	uint32_t hdr_ext_len:3;
+	uint32_t res2:5;
+#endif
+};
+
+struct rte_higig2_ppt_type1 {
+	uint16_t classification;
+	uint16_t resv;
+	uint16_t vid;
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint16_t opcode:3;
+	uint16_t resv1:2;
+	uint16_t src_t:1;
+	uint16_t pfm:2;
+	uint16_t resv2:5;
+	uint16_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint16_t pfm:2;
+	uint16_t src_t:1;
+	uint16_t resv1:2;
+	uint16_t opcode:3;
+	uint16_t hdr_ext_len:3;
+	uint16_t resv2:5;
+#endif
+};
+
+RTE_STD_C11
+struct rte_flow_item_higig2_hdr {
+	struct rte_higig2_frc fcr;
+	union {
+		struct rte_higig2_ppt_type0 ppt0;
+		struct rte_higig2_ppt_type1 ppt1;
+	};
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
+#ifndef __cplusplus
+static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
+	.ppt1.classification = 0xffff,
+	.ppt1.vid = 0xfff,
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_HIGIG_H_ */
--
2.17.1


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

* Re: [dpdk-dev] [PATCH v5] ethdev: add HIGIG2 key field to flow API
  2019-10-18  4:13       ` [dpdk-dev] [PATCH v5] " kirankumark
@ 2019-10-18  7:36         ` Andrew Rybchenko
  2019-10-18 17:36         ` Ferruh Yigit
  2019-10-19  4:56         ` [dpdk-dev] [PATCH v6] " kirankumark
  2 siblings, 0 replies; 31+ messages in thread
From: Andrew Rybchenko @ 2019-10-18  7:36 UTC (permalink / raw)
  To: kirankumark, Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu,
	Bernard Iremonger, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Ferruh Yigit, Olivier Matz
  Cc: dev, ajit.khaparde

On 10/18/19 7:13 AM, kirankumark@marvell.com wrote:
> From: Kiran Kumar K <kirankumark@marvell.com>
>
> Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> It is a layer 2.5 protocol and used in Broadcom switches.
> Header format is based on the following document.
> http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf
>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>

Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>


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

* Re: [dpdk-dev] [PATCH v5] ethdev: add HIGIG2 key field to flow API
  2019-10-18  4:13       ` [dpdk-dev] [PATCH v5] " kirankumark
  2019-10-18  7:36         ` Andrew Rybchenko
@ 2019-10-18 17:36         ` Ferruh Yigit
  2019-10-19  4:51           ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda
  2019-10-19  4:56         ` [dpdk-dev] [PATCH v6] " kirankumark
  2 siblings, 1 reply; 31+ messages in thread
From: Ferruh Yigit @ 2019-10-18 17:36 UTC (permalink / raw)
  To: kirankumark, Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu,
	Bernard Iremonger, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde

On 10/18/2019 5:13 AM, kirankumark@marvell.com wrote:
> From: Kiran Kumar K <kirankumark@marvell.com>
> 
> Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> It is a layer 2.5 protocol and used in Broadcom switches.
> Header format is based on the following document.
> http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf

+1 to have protocol documentation, but what is 'pudn.com'? Is it kind of
download site? Isn't there any official web site for the protocol?

> 
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> ---
> V5 changes:
> * Changed broadcom to Broadcom
> * Changed RTE_HIGIG2_H to RTE_HIGIG_H
> * Fixed meson build
> 
> V4 Changes:
> * Removed packed attribute
> 
> V3 Changes:
> * Fixed Copyright header
> * Fixed version info in the subject
> 
> V2 Changes:
> * Added support in testpmd to parse the higig2 item
> * Moved the higig2 header to new file
> * Added indentation in doc
> 
>  app/test-pmd/cmdline_flow.c        |  33 +++++++
>  doc/guides/prog_guide/rte_flow.rst |   8 ++
>  lib/librte_ethdev/rte_flow.c       |   1 +
>  lib/librte_ethdev/rte_flow.h       |   7 ++
>  lib/librte_net/Makefile            |   2 +-
>  lib/librte_net/meson.build         |   3 +-
>  lib/librte_net/rte_higig.h         | 138 +++++++++++++++++++++++++++++

'lib/librte_net/' maintainer is Olivier, so by default new file maintainer will
be Olivier, it is good to get his ack to confirm this before merging patch.

Also can you please update "doc/api/doxy-api-index.md" to add new 'rte_higig.h'
file so that it can be part of our API documentation.

btw, 'rte_gre.h' & 'rte_mpls.h' are seems missing in API documentation, another
patch to add them would be nice if possible.

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v5] ethdev: add HIGIG2 key field to flow API
  2019-10-18 17:36         ` Ferruh Yigit
@ 2019-10-19  4:51           ` Kiran Kumar Kokkilagadda
  0 siblings, 0 replies; 31+ messages in thread
From: Kiran Kumar Kokkilagadda @ 2019-10-19  4:51 UTC (permalink / raw)
  To: Ferruh Yigit, Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu,
	Bernard Iremonger, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde



> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Friday, October 18, 2019 11:06 PM
> To: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>; Adrien Mazarguil
> <adrien.mazarguil@6wind.com>; Wenzhuo Lu <wenzhuo.lu@intel.com>;
> Jingjing Wu <jingjing.wu@intel.com>; Bernard Iremonger
> <bernard.iremonger@intel.com>; John McNamara
> <john.mcnamara@intel.com>; Marko Kovacevic <marko.kovacevic@intel.com>;
> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
> <arybchenko@solarflare.com>; Olivier Matz <olivier.matz@6wind.com>
> Cc: dev@dpdk.org; ajit.khaparde@broadcom.com
> Subject: [EXT] Re: [dpdk-dev] [PATCH v5] ethdev: add HIGIG2 key field to flow
> API
> 
> External Email
> 
> ----------------------------------------------------------------------
> On 10/18/2019 5:13 AM, kirankumark@marvell.com wrote:
> 
> > From: Kiran Kumar K <kirankumark@marvell.com>
> 
> >
> 
> > Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> 
> > It is a layer 2.5 protocol and used in Broadcom switches.
> 
> > Header format is based on the following document.
> 
> > https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__read.pudn.com_downloads558_doc_comm_2301468_HiGig-
> 5Fprotocol.pdf&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=owEKckYY4FTmil
> 1Z6oBURwkTThyuRbLAY9LdfiaT6HA&m=QfogB8qcVeClwPxCAkPab3S-
> eGGVwAH1QH3LGdaNa4U&s=8ADdrFBPBhaij7nUt6QRpmlHoVBc2sPtE8egdS58d
> w8&e=
> 
> 
> 
> +1 to have protocol documentation, but what is 'pudn.com'? Is it kind of
> 
> download site? Isn't there any official web site for the protocol?
> 
> 
There is no official doc available for this protocol. This is the only place we find the public doc.
> 
> >
> 
> > Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> 
> > ---
> 
> > V5 changes:
> 
> > * Changed broadcom to Broadcom
> 
> > * Changed RTE_HIGIG2_H to RTE_HIGIG_H
> 
> > * Fixed meson build
> 
> >
> 
> > V4 Changes:
> 
> > * Removed packed attribute
> 
> >
> 
> > V3 Changes:
> 
> > * Fixed Copyright header
> 
> > * Fixed version info in the subject
> 
> >
> 
> > V2 Changes:
> 
> > * Added support in testpmd to parse the higig2 item
> 
> > * Moved the higig2 header to new file
> 
> > * Added indentation in doc
> 
> >
> 
> >  app/test-pmd/cmdline_flow.c        |  33 +++++++
> 
> >  doc/guides/prog_guide/rte_flow.rst |   8 ++
> 
> >  lib/librte_ethdev/rte_flow.c       |   1 +
> 
> >  lib/librte_ethdev/rte_flow.h       |   7 ++
> 
> >  lib/librte_net/Makefile            |   2 +-
> 
> >  lib/librte_net/meson.build         |   3 +-
> 
> >  lib/librte_net/rte_higig.h         | 138 +++++++++++++++++++++++++++++
> 
> 
> 
> 'lib/librte_net/' maintainer is Olivier, so by default new file maintainer will
> 
> be Olivier, it is good to get his ack to confirm this before merging patch.
> 
> 
> 
> Also can you please update "doc/api/doxy-api-index.md" to add new
> 'rte_higig.h'
> 
> file so that it can be part of our API documentation.
> 
Will update and send v6.
> 
> 
> btw, 'rte_gre.h' & 'rte_mpls.h' are seems missing in API documentation, another
> 
> patch to add them would be nice if possible.


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

* [dpdk-dev]  [PATCH v6] ethdev: add HIGIG2 key field to flow API
  2019-10-18  4:13       ` [dpdk-dev] [PATCH v5] " kirankumark
  2019-10-18  7:36         ` Andrew Rybchenko
  2019-10-18 17:36         ` Ferruh Yigit
@ 2019-10-19  4:56         ` kirankumark
  2019-10-19  9:47           ` Jerin Jacob
  2019-10-20  4:52           ` [dpdk-dev] [PATCH v7] " kirankumark
  2 siblings, 2 replies; 31+ messages in thread
From: kirankumark @ 2019-10-19  4:56 UTC (permalink / raw)
  To: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde, Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

Add new rte_flow_item_higig2_hdr in order to match higig2 header.
It is a layer 2.5 protocol and used in Broadcom switches.
Header format is based on the following document.
http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
V6 changes:
* Updated doxy-api

V5 changes:
* Changed broadcom to Broadcom
* Changed RTE_HIGIG2_H to RTE_HIGIG_H
* Fixed meson build

V4 Changes:
* Removed packed attribute

V3 Changes:
* Fixed Copyright header
* Fixed version info in the subject

V2 Changes:
* Added support in testpmd to parse the higig2 item
* Moved the higig2 header to new file
* Added indentation in doc

 app/test-pmd/cmdline_flow.c        |  33 +++++++
 doc/api/doxy-api-index.md          |   3 +-
 doc/guides/prog_guide/rte_flow.rst |   8 ++
 lib/librte_ethdev/rte_flow.c       |   1 +
 lib/librte_ethdev/rte_flow.h       |   7 ++
 lib/librte_net/Makefile            |   2 +-
 lib/librte_net/meson.build         |   3 +-
 lib/librte_net/rte_higig.h         | 138 +++++++++++++++++++++++++++++
 8 files changed, 192 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_net/rte_higig.h

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b26b8bfe2..8d6c354fa 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -203,6 +203,9 @@ enum index {
 	ITEM_PPPOED,
 	ITEM_PPPOE_SEID,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,

 	/* Validate/create actions. */
 	ACTIONS,
@@ -675,6 +678,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOES,
 	ITEM_PPPOED,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
 	END_SET,
 	ZERO,
 };
@@ -939,6 +943,13 @@ static const enum index item_pppoe_proto_id[] = {
 	ZERO,
 };

+static const enum index item_higig2[] = {
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -2419,6 +2430,28 @@ static const struct token token_list[] = {
 		.next = NEXT(item_pppoe_proto_id),
 		.call = parse_vc,
 	},
+	[ITEM_HIGIG2] = {
+		.name = "higig2",
+		.help = "matches higig2 header",
+		.priv = PRIV_ITEM(HIGIG2,
+				sizeof(struct rte_flow_item_higig2_hdr)),
+		.next = NEXT(item_higig2),
+		.call = parse_vc,
+	},
+	[ITEM_HIGIG2_CLASSIFICATION] = {
+		.name = "classification",
+		.help = "matches classification of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					ppt1.classification)),
+	},
+	[ITEM_HIGIG2_VID] = {
+		.name = "vid",
+		.help = "matches vid of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					ppt1.vid)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 6c2d888ee..c52b54e55 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -101,7 +101,8 @@ The public API headers are grouped by topics:
   [GSO]                (@ref rte_gso.h),
   [frag/reass]         (@ref rte_ip_frag.h),
   [LPM IPv4 route]     (@ref rte_lpm.h),
-  [LPM IPv6 route]     (@ref rte_lpm6.h)
+  [LPM IPv6 route]     (@ref rte_lpm6.h),
+  [HIGIG]              (@ref rte_higig.h)

 - **QoS**:
   [metering]           (@ref rte_meter.h),
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 1c837ff13..6e6d44df2 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302).
 - ``seq_num``: counter value increased by 1 on each packet sent.
 - Default ``mask`` matches spi.

+Item: ``HIGIG2``
+^^^^^^^^^^^^^^^^^
+
+Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
+Broadcom switches.
+
+- Default ``mask`` matches classification and vlan.
+

 Actions
 ~~~~~~~
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 81a85b995..ca0f68016 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
 	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 };

 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index bcfc06cdc..79f160df0 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -27,6 +27,7 @@
 #include <rte_udp.h>
 #include <rte_byteorder.h>
 #include <rte_esp.h>
+#include <rte_higig.h>

 #ifdef __cplusplus
 extern "C" {
@@ -491,6 +492,12 @@ enum rte_flow_item_type {
 	 *
 	 */
 	RTE_FLOW_ITEM_TYPE_AH,
+
+	/**
+	 * Matches a HIGIG header.
+	 * see struct rte_flow_item_higig2_hdr.
+	 */
+	RTE_FLOW_ITEM_TYPE_HIGIG2,
 };

 /**
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 1244c9fd5..62735a5f9 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -21,6 +21,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build
index 868a93fd6..c52c34592 100644
--- a/lib/librte_net/meson.build
+++ b/lib/librte_net/meson.build
@@ -14,7 +14,8 @@ headers = files('rte_ip.h',
 	'rte_gre.h',
 	'rte_net.h',
 	'rte_net_crc.h',
-	'rte_mpls.h')
+	'rte_mpls.h',
+	'rte_higig.h')

 sources = files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.c')
 deps += ['mbuf']
diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
new file mode 100644
index 000000000..7c0dec449
--- /dev/null
+++ b/lib/librte_net/rte_higig.h
@@ -0,0 +1,138 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _RTE_HIGIG_H_
+#define _RTE_HIGIG_H_
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * RTE_FLOW_ITEM_TYPE_HIGIG2
+ * Matches higig2 header.
+ */
+struct rte_higig2_frc {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t ksop:8;
+	uint32_t tc:4;
+	uint32_t mcst:1;
+	uint32_t resv:3;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t ppd_type:3;
+	uint32_t resv1:3;
+	uint32_t dp:2;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t ksop:8;
+	uint32_t resv:3;
+	uint32_t mcst:1;
+	uint32_t tc:4;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t dp:2;
+	uint32_t resv1:3;
+	uint32_t ppd_type:3;
+#endif
+};
+
+struct rte_higig2_ppt_type0 {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t mirror:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror_only:1;
+	uint32_t ingress_tagged:1;
+	uint32_t dst_tgid:3;
+	uint32_t dst_t:1;
+	uint32_t vc_label2:4;
+	uint32_t label_present:1;
+	uint32_t l3:1;
+	uint32_t res:2;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t opcode:3;
+	uint32_t res1:2;
+	uint32_t src_t:1;
+	uint32_t pfm:2;
+	uint32_t res2:5;
+	uint32_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t dst_t:1;
+	uint32_t dst_tgid:3;
+	uint32_t ingress_tagged:1;
+	uint32_t mirror_only:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror:1;
+	uint32_t res:2;
+	uint32_t l3:1;
+	uint32_t label_present:1;
+	uint32_t vc_label2:4;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t pfm:2;
+	uint32_t src_t:1;
+	uint32_t res1:2;
+	uint32_t opcode:3;
+	uint32_t hdr_ext_len:3;
+	uint32_t res2:5;
+#endif
+};
+
+struct rte_higig2_ppt_type1 {
+	uint16_t classification;
+	uint16_t resv;
+	uint16_t vid;
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint16_t opcode:3;
+	uint16_t resv1:2;
+	uint16_t src_t:1;
+	uint16_t pfm:2;
+	uint16_t resv2:5;
+	uint16_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint16_t pfm:2;
+	uint16_t src_t:1;
+	uint16_t resv1:2;
+	uint16_t opcode:3;
+	uint16_t hdr_ext_len:3;
+	uint16_t resv2:5;
+#endif
+};
+
+RTE_STD_C11
+struct rte_flow_item_higig2_hdr {
+	struct rte_higig2_frc fcr;
+	union {
+		struct rte_higig2_ppt_type0 ppt0;
+		struct rte_higig2_ppt_type1 ppt1;
+	};
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
+#ifndef __cplusplus
+static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
+	.ppt1.classification = 0xffff,
+	.ppt1.vid = 0xfff,
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_HIGIG_H_ */
--
2.17.1


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

* Re: [dpdk-dev] [PATCH v6] ethdev: add HIGIG2 key field to flow API
  2019-10-19  4:56         ` [dpdk-dev] [PATCH v6] " kirankumark
@ 2019-10-19  9:47           ` Jerin Jacob
  2019-10-20  4:52           ` [dpdk-dev] [PATCH v7] " kirankumark
  1 sibling, 0 replies; 31+ messages in thread
From: Jerin Jacob @ 2019-10-19  9:47 UTC (permalink / raw)
  To: Kiran Kumar K
  Cc: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz, dpdk-dev, Ajit Khaparde

On Sat, Oct 19, 2019 at 10:27 AM <kirankumark@marvell.com> wrote:
>
> From: Kiran Kumar K <kirankumark@marvell.com>
>
> Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> It is a layer 2.5 protocol and used in Broadcom switches.
> Header format is based on the following document.
> http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf
>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>

> index 000000000..7c0dec449
> --- /dev/null
> +++ b/lib/librte_net/rte_higig.h
> @@ -0,0 +1,138 @@

[snip]

> +/**
> + * RTE_FLOW_ITEM_TYPE_HIGIG2
> + * Matches higig2 header.
> + */

rte_higig.h is a generic file, it should not have any reference to rte_flow

Doxygen comment could be "higig2 frc header"

> +struct rte_higig2_frc {
> +};

Missing doxygen comments here.

> +struct rte_higig2_ppt_type0 {
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN

> +#endif
> +};

Missing Doxygen comments here.

> +struct rte_higig2_ppt_type1 {
> +#endif
> +};
> +

Missing Doxygen comments here.

> +RTE_STD_C11
> +struct rte_flow_item_higig2_hdr {

Change to rte_higig2_hdr and see below.

> +       struct rte_higig2_frc fcr;
> +       union {
> +               struct rte_higig2_ppt_type0 ppt0;
> +               struct rte_higig2_ppt_type1 ppt1;
> +       };
> +};

> +/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
> +#ifndef __cplusplus
> +static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
> +       .ppt1.classification = 0xffff,
> +       .ppt1.vid = 0xfff,
> +};
> +#endif

move this to rte_flow.h and add the following rte_flow.h so that
rte_higig.h is standalone it can be used for other purposes other than
rte_flow.

/**
 * RTE_FLOW_ITEM_TYPE_HIGIG2.
 *
 * Matches higig2 header.
 */
struct rte_flow_item_higig2_hdr {
        struct rte_higig2_hdr hdr; /**< Higig2 header definition. */
};

See rte_flow_item_tcp and rte_tcp_hdr as reference usage.

> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* RTE_HIGIG_H_ */
> --
> 2.17.1
>

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

* [dpdk-dev]  [PATCH v7] ethdev: add HIGIG2 key field to flow API
  2019-10-19  4:56         ` [dpdk-dev] [PATCH v6] " kirankumark
  2019-10-19  9:47           ` Jerin Jacob
@ 2019-10-20  4:52           ` kirankumark
  2019-10-20 13:56             ` Jerin Jacob
  2019-10-21  3:52             ` [dpdk-dev] [PATCH v8] " kirankumark
  1 sibling, 2 replies; 31+ messages in thread
From: kirankumark @ 2019-10-20  4:52 UTC (permalink / raw)
  To: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde, Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

Add new rte_flow_item_higig2_hdr in order to match higig2 header.
It is a layer 2.5 protocol and used in Broadcom switches.
Header format is based on the following document.
http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
V7 changes:
* Added doxygen comments
* Moved rte_flow specific code to rte_flow.h

V6 changes:
* Updated doxy-api

V5 changes:
* Changed broadcom to Broadcom
* Changed RTE_HIGIG2_H to RTE_HIGIG_H
* Fixed meson build

V4 Changes:
* Removed packed attribute

V3 Changes:
* Fixed Copyright header
* Fixed version info in the subject

V2 Changes:
* Added support in testpmd to parse the higig2 item
* Moved the higig2 header to new file
* Added indentation in doc

 app/test-pmd/cmdline_flow.c        |  33 +++++++
 doc/api/doxy-api-index.md          |   3 +-
 doc/guides/prog_guide/rte_flow.rst |   8 ++
 lib/librte_ethdev/rte_flow.c       |   1 +
 lib/librte_ethdev/rte_flow.h       |  27 ++++++
 lib/librte_net/Makefile            |   2 +-
 lib/librte_net/meson.build         |   3 +-
 lib/librte_net/rte_higig.h         | 144 +++++++++++++++++++++++++++++
 8 files changed, 218 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_net/rte_higig.h

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b26b8bfe2..970bdef1d 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -203,6 +203,9 @@ enum index {
 	ITEM_PPPOED,
 	ITEM_PPPOE_SEID,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,

 	/* Validate/create actions. */
 	ACTIONS,
@@ -675,6 +678,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOES,
 	ITEM_PPPOED,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
 	END_SET,
 	ZERO,
 };
@@ -939,6 +943,13 @@ static const enum index item_pppoe_proto_id[] = {
 	ZERO,
 };

+static const enum index item_higig2[] = {
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -2419,6 +2430,28 @@ static const struct token token_list[] = {
 		.next = NEXT(item_pppoe_proto_id),
 		.call = parse_vc,
 	},
+	[ITEM_HIGIG2] = {
+		.name = "higig2",
+		.help = "matches higig2 header",
+		.priv = PRIV_ITEM(HIGIG2,
+				sizeof(struct rte_flow_item_higig2_hdr)),
+		.next = NEXT(item_higig2),
+		.call = parse_vc,
+	},
+	[ITEM_HIGIG2_CLASSIFICATION] = {
+		.name = "classification",
+		.help = "matches classification of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					hdr.ppt1.classification)),
+	},
+	[ITEM_HIGIG2_VID] = {
+		.name = "vid",
+		.help = "matches vid of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					hdr.ppt1.vid)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 6c2d888ee..c52b54e55 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -101,7 +101,8 @@ The public API headers are grouped by topics:
   [GSO]                (@ref rte_gso.h),
   [frag/reass]         (@ref rte_ip_frag.h),
   [LPM IPv4 route]     (@ref rte_lpm.h),
-  [LPM IPv6 route]     (@ref rte_lpm6.h)
+  [LPM IPv6 route]     (@ref rte_lpm6.h),
+  [HIGIG]              (@ref rte_higig.h)

 - **QoS**:
   [metering]           (@ref rte_meter.h),
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 1c837ff13..6e6d44df2 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302).
 - ``seq_num``: counter value increased by 1 on each packet sent.
 - Default ``mask`` matches spi.

+Item: ``HIGIG2``
+^^^^^^^^^^^^^^^^^
+
+Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
+Broadcom switches.
+
+- Default ``mask`` matches classification and vlan.
+

 Actions
 ~~~~~~~
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 81a85b995..ca0f68016 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
 	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 };

 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index bcfc06cdc..536d0f280 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -27,6 +27,7 @@
 #include <rte_udp.h>
 #include <rte_byteorder.h>
 #include <rte_esp.h>
+#include <rte_higig.h>

 #ifdef __cplusplus
 extern "C" {
@@ -491,8 +492,34 @@ enum rte_flow_item_type {
 	 *
 	 */
 	RTE_FLOW_ITEM_TYPE_AH,
+
+	/**
+	 * Matches a HIGIG header.
+	 * see struct rte_flow_item_higig2_hdr.
+	 */
+	RTE_FLOW_ITEM_TYPE_HIGIG2,
 };

+/**
+ *
+ * RTE_FLOW_ITEM_TYPE_HIGIG2
+ * Matches higig2 header
+ */
+RTE_STD_C11
+struct rte_flow_item_higig2_hdr {
+	struct rte_higig2_hdr hdr;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
+#ifndef __cplusplus
+static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
+	.hdr = {
+		.ppt1.classification = 0xffff,
+		.ppt1.vid = 0xfff,
+	},
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_ANY
  *
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 1244c9fd5..62735a5f9 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -21,6 +21,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build
index 868a93fd6..c52c34592 100644
--- a/lib/librte_net/meson.build
+++ b/lib/librte_net/meson.build
@@ -14,7 +14,8 @@ headers = files('rte_ip.h',
 	'rte_gre.h',
 	'rte_net.h',
 	'rte_net_crc.h',
-	'rte_mpls.h')
+	'rte_mpls.h',
+	'rte_higig.h')

 sources = files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.c')
 deps += ['mbuf']
diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
new file mode 100644
index 000000000..a56267473
--- /dev/null
+++ b/lib/librte_net/rte_higig.h
@@ -0,0 +1,144 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _RTE_HIGIG_H_
+#define _RTE_HIGIG_H_
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *
+ * higig2 frc header.
+ */
+struct rte_higig2_frc {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t ksop:8;
+	uint32_t tc:4;
+	uint32_t mcst:1;
+	uint32_t resv:3;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t ppd_type:3;
+	uint32_t resv1:3;
+	uint32_t dp:2;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t ksop:8;
+	uint32_t resv:3;
+	uint32_t mcst:1;
+	uint32_t tc:4;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t dp:2;
+	uint32_t resv1:3;
+	uint32_t ppd_type:3;
+#endif
+};
+
+
+/**
+ *
+ * higig2 ppt type0 header
+ */
+struct rte_higig2_ppt_type0 {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t mirror:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror_only:1;
+	uint32_t ingress_tagged:1;
+	uint32_t dst_tgid:3;
+	uint32_t dst_t:1;
+	uint32_t vc_label2:4;
+	uint32_t label_present:1;
+	uint32_t l3:1;
+	uint32_t res:2;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t opcode:3;
+	uint32_t res1:2;
+	uint32_t src_t:1;
+	uint32_t pfm:2;
+	uint32_t res2:5;
+	uint32_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t dst_t:1;
+	uint32_t dst_tgid:3;
+	uint32_t ingress_tagged:1;
+	uint32_t mirror_only:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror:1;
+	uint32_t res:2;
+	uint32_t l3:1;
+	uint32_t label_present:1;
+	uint32_t vc_label2:4;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t pfm:2;
+	uint32_t src_t:1;
+	uint32_t res1:2;
+	uint32_t opcode:3;
+	uint32_t hdr_ext_len:3;
+	uint32_t res2:5;
+#endif
+};
+
+
+/**
+ *
+ * higig2 ppt type1 header.
+ */
+struct rte_higig2_ppt_type1 {
+	uint16_t classification;
+	uint16_t resv;
+	uint16_t vid;
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint16_t opcode:3;
+	uint16_t resv1:2;
+	uint16_t src_t:1;
+	uint16_t pfm:2;
+	uint16_t resv2:5;
+	uint16_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint16_t pfm:2;
+	uint16_t src_t:1;
+	uint16_t resv1:2;
+	uint16_t opcode:3;
+	uint16_t hdr_ext_len:3;
+	uint16_t resv2:5;
+#endif
+};
+
+/**
+ *
+ * higig2 header
+ */
+RTE_STD_C11
+struct rte_higig2_hdr {
+	struct rte_higig2_frc fcr;
+	union {
+		struct rte_higig2_ppt_type0 ppt0;
+		struct rte_higig2_ppt_type1 ppt1;
+	};
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_HIGIG_H_ */
--
2.17.1


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

* Re: [dpdk-dev] [PATCH v7] ethdev: add HIGIG2 key field to flow API
  2019-10-20  4:52           ` [dpdk-dev] [PATCH v7] " kirankumark
@ 2019-10-20 13:56             ` Jerin Jacob
  2019-10-21  3:52             ` [dpdk-dev] [PATCH v8] " kirankumark
  1 sibling, 0 replies; 31+ messages in thread
From: Jerin Jacob @ 2019-10-20 13:56 UTC (permalink / raw)
  To: Kiran Kumar K
  Cc: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz, dpdk-dev, Ajit Khaparde

On Sun, Oct 20, 2019 at 10:22 AM <kirankumark@marvell.com> wrote:
>
> From: Kiran Kumar K <kirankumark@marvell.com>
>
> Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> It is a layer 2.5 protocol and used in Broadcom switches.
> Header format is based on the following document.
> http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf
>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>

The old 4.8.5 compiler doesn't like "opcode" under two structures with
the anonymous union.

http://mails.dpdk.org/archives/test-report/2019-October/103432.html

Probably one can change to "opc" or something like that.

With 4.8.5 compiler fix,
Acked-by: Jerin Jacob <jerinj@marvell.com>

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

* [dpdk-dev]  [PATCH v8] ethdev: add HIGIG2 key field to flow API
  2019-10-20  4:52           ` [dpdk-dev] [PATCH v7] " kirankumark
  2019-10-20 13:56             ` Jerin Jacob
@ 2019-10-21  3:52             ` kirankumark
  2019-10-21  9:16               ` [dpdk-dev] [PATCH v9] " kirankumark
  1 sibling, 1 reply; 31+ messages in thread
From: kirankumark @ 2019-10-21  3:52 UTC (permalink / raw)
  To: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde, Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

Add new rte_flow_item_higig2_hdr in order to match higig2 header.
It is a layer 2.5 protocol and used in Broadcom switches.
Header format is based on the following document.
http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
V8 Changes:
* Fixed gcc 4.8 compile issue

V7 changes:
* Added doxygen comments
* Moved rte_flow specific code to rte_flow.h

V6 changes:
* Updated doxy-api

V5 changes:
* Changed broadcom to Broadcom
* Changed RTE_HIGIG2_H to RTE_HIGIG_H
* Fixed meson build

V4 Changes:
* Removed packed attribute

V3 Changes:
* Fixed Copyright header
* Fixed version info in the subject

V2 Changes:
* Added support in testpmd to parse the higig2 item
* Moved the higig2 header to new file
* Added indentation in doc

 app/test-pmd/cmdline_flow.c        |  33 +++++++
 doc/api/doxy-api-index.md          |   3 +-
 doc/guides/prog_guide/rte_flow.rst |   8 ++
 lib/librte_ethdev/rte_flow.c       |   1 +
 lib/librte_ethdev/rte_flow.h       |  27 ++++++
 lib/librte_net/Makefile            |   2 +-
 lib/librte_net/meson.build         |   3 +-
 lib/librte_net/rte_higig.h         | 144 +++++++++++++++++++++++++++++
 8 files changed, 218 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_net/rte_higig.h

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b26b8bfe2..970bdef1d 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -203,6 +203,9 @@ enum index {
 	ITEM_PPPOED,
 	ITEM_PPPOE_SEID,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,

 	/* Validate/create actions. */
 	ACTIONS,
@@ -675,6 +678,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOES,
 	ITEM_PPPOED,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
 	END_SET,
 	ZERO,
 };
@@ -939,6 +943,13 @@ static const enum index item_pppoe_proto_id[] = {
 	ZERO,
 };

+static const enum index item_higig2[] = {
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -2419,6 +2430,28 @@ static const struct token token_list[] = {
 		.next = NEXT(item_pppoe_proto_id),
 		.call = parse_vc,
 	},
+	[ITEM_HIGIG2] = {
+		.name = "higig2",
+		.help = "matches higig2 header",
+		.priv = PRIV_ITEM(HIGIG2,
+				sizeof(struct rte_flow_item_higig2_hdr)),
+		.next = NEXT(item_higig2),
+		.call = parse_vc,
+	},
+	[ITEM_HIGIG2_CLASSIFICATION] = {
+		.name = "classification",
+		.help = "matches classification of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					hdr.ppt1.classification)),
+	},
+	[ITEM_HIGIG2_VID] = {
+		.name = "vid",
+		.help = "matches vid of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					hdr.ppt1.vid)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 6c2d888ee..c52b54e55 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -101,7 +101,8 @@ The public API headers are grouped by topics:
   [GSO]                (@ref rte_gso.h),
   [frag/reass]         (@ref rte_ip_frag.h),
   [LPM IPv4 route]     (@ref rte_lpm.h),
-  [LPM IPv6 route]     (@ref rte_lpm6.h)
+  [LPM IPv6 route]     (@ref rte_lpm6.h),
+  [HIGIG]              (@ref rte_higig.h)

 - **QoS**:
   [metering]           (@ref rte_meter.h),
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 1c837ff13..6e6d44df2 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302).
 - ``seq_num``: counter value increased by 1 on each packet sent.
 - Default ``mask`` matches spi.

+Item: ``HIGIG2``
+^^^^^^^^^^^^^^^^^
+
+Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
+Broadcom switches.
+
+- Default ``mask`` matches classification and vlan.
+

 Actions
 ~~~~~~~
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 81a85b995..ca0f68016 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
 	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 };

 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index bcfc06cdc..536d0f280 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -27,6 +27,7 @@
 #include <rte_udp.h>
 #include <rte_byteorder.h>
 #include <rte_esp.h>
+#include <rte_higig.h>

 #ifdef __cplusplus
 extern "C" {
@@ -491,8 +492,34 @@ enum rte_flow_item_type {
 	 *
 	 */
 	RTE_FLOW_ITEM_TYPE_AH,
+
+	/**
+	 * Matches a HIGIG header.
+	 * see struct rte_flow_item_higig2_hdr.
+	 */
+	RTE_FLOW_ITEM_TYPE_HIGIG2,
 };

+/**
+ *
+ * RTE_FLOW_ITEM_TYPE_HIGIG2
+ * Matches higig2 header
+ */
+RTE_STD_C11
+struct rte_flow_item_higig2_hdr {
+	struct rte_higig2_hdr hdr;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
+#ifndef __cplusplus
+static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
+	.hdr = {
+		.ppt1.classification = 0xffff,
+		.ppt1.vid = 0xfff,
+	},
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_ANY
  *
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 1244c9fd5..62735a5f9 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -21,6 +21,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build
index 868a93fd6..c52c34592 100644
--- a/lib/librte_net/meson.build
+++ b/lib/librte_net/meson.build
@@ -14,7 +14,8 @@ headers = files('rte_ip.h',
 	'rte_gre.h',
 	'rte_net.h',
 	'rte_net_crc.h',
-	'rte_mpls.h')
+	'rte_mpls.h',
+	'rte_higig.h')

 sources = files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.c')
 deps += ['mbuf']
diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
new file mode 100644
index 000000000..525e48557
--- /dev/null
+++ b/lib/librte_net/rte_higig.h
@@ -0,0 +1,144 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _RTE_HIGIG_H_
+#define _RTE_HIGIG_H_
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *
+ * higig2 frc header.
+ */
+struct rte_higig2_frc {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t ksop:8;
+	uint32_t tc:4;
+	uint32_t mcst:1;
+	uint32_t resv:3;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t ppd_type:3;
+	uint32_t resv1:3;
+	uint32_t dp:2;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t ksop:8;
+	uint32_t resv:3;
+	uint32_t mcst:1;
+	uint32_t tc:4;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t dp:2;
+	uint32_t resv1:3;
+	uint32_t ppd_type:3;
+#endif
+};
+
+
+/**
+ *
+ * higig2 ppt type0 header
+ */
+struct rte_higig2_ppt_type0 {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t mirror:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror_only:1;
+	uint32_t ingress_tagged:1;
+	uint32_t dst_tgid:3;
+	uint32_t dst_t:1;
+	uint32_t vc_label2:4;
+	uint32_t label_present:1;
+	uint32_t l3:1;
+	uint32_t res:2;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t opc:3;
+	uint32_t res1:2;
+	uint32_t srce_t:1;
+	uint32_t pf:2;
+	uint32_t res2:5;
+	uint32_t hdr_ext_length:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t dst_t:1;
+	uint32_t dst_tgid:3;
+	uint32_t ingress_tagged:1;
+	uint32_t mirror_only:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror:1;
+	uint32_t res:2;
+	uint32_t l3:1;
+	uint32_t label_present:1;
+	uint32_t vc_label2:4;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t pf:2;
+	uint32_t srce_t:1;
+	uint32_t res1:2;
+	uint32_t opc:3;
+	uint32_t hdr_ext_length:3;
+	uint32_t res2:5;
+#endif
+};
+
+
+/**
+ *
+ * higig2 ppt type1 header.
+ */
+struct rte_higig2_ppt_type1 {
+	uint16_t classification;
+	uint16_t resv;
+	uint16_t vid;
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint16_t opcode:3;
+	uint16_t resv1:2;
+	uint16_t src_t:1;
+	uint16_t pfm:2;
+	uint16_t resv2:5;
+	uint16_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint16_t pfm:2;
+	uint16_t src_t:1;
+	uint16_t resv1:2;
+	uint16_t opcode:3;
+	uint16_t hdr_ext_len:3;
+	uint16_t resv2:5;
+#endif
+};
+
+/**
+ *
+ * higig2 header
+ */
+RTE_STD_C11
+struct rte_higig2_hdr {
+	struct rte_higig2_frc fcr;
+	union {
+		struct rte_higig2_ppt_type0 ppt0;
+		struct rte_higig2_ppt_type1 ppt1;
+	};
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_HIGIG_H_ */
--
2.17.1


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

* [dpdk-dev]  [PATCH v9] ethdev: add HIGIG2 key field to flow API
  2019-10-21  3:52             ` [dpdk-dev] [PATCH v8] " kirankumark
@ 2019-10-21  9:16               ` kirankumark
  2019-10-21 16:48                 ` Olivier Matz
  2019-10-22  4:16                 ` [dpdk-dev] [PATCH v10] " kirankumark
  0 siblings, 2 replies; 31+ messages in thread
From: kirankumark @ 2019-10-21  9:16 UTC (permalink / raw)
  To: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde, Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

Add new rte_flow_item_higig2_hdr in order to match higig2 header.
It is a layer 2.5 protocol and used in Broadcom switches.
Header format is based on the following document.
http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
V9 Changes:
* Fix gcc 4.8 compile issue

V8 Changes:
* Fixed gcc 4.8 compile issue

V7 changes:
* Added doxygen comments
* Moved rte_flow specific code to rte_flow.h

V6 changes:
* Updated doxy-api

V5 changes:
* Changed broadcom to Broadcom
* Changed RTE_HIGIG2_H to RTE_HIGIG_H
* Fixed meson build

V4 Changes:
* Removed packed attribute

V3 Changes:
* Fixed Copyright header
* Fixed version info in the subject

V2 Changes:
* Added support in testpmd to parse the higig2 item
* Moved the higig2 header to new file
* Added indentation in doc

 app/test-pmd/cmdline_flow.c        |  33 +++++++
 doc/api/doxy-api-index.md          |   3 +-
 doc/guides/prog_guide/rte_flow.rst |   8 ++
 lib/librte_ethdev/rte_flow.c       |   1 +
 lib/librte_ethdev/rte_flow.h       |  29 ++++++
 lib/librte_net/Makefile            |   2 +-
 lib/librte_net/meson.build         |   3 +-
 lib/librte_net/rte_higig.h         | 144 +++++++++++++++++++++++++++++
 8 files changed, 220 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_net/rte_higig.h

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b26b8bfe2..970bdef1d 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -203,6 +203,9 @@ enum index {
 	ITEM_PPPOED,
 	ITEM_PPPOE_SEID,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,

 	/* Validate/create actions. */
 	ACTIONS,
@@ -675,6 +678,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOES,
 	ITEM_PPPOED,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
 	END_SET,
 	ZERO,
 };
@@ -939,6 +943,13 @@ static const enum index item_pppoe_proto_id[] = {
 	ZERO,
 };

+static const enum index item_higig2[] = {
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -2419,6 +2430,28 @@ static const struct token token_list[] = {
 		.next = NEXT(item_pppoe_proto_id),
 		.call = parse_vc,
 	},
+	[ITEM_HIGIG2] = {
+		.name = "higig2",
+		.help = "matches higig2 header",
+		.priv = PRIV_ITEM(HIGIG2,
+				sizeof(struct rte_flow_item_higig2_hdr)),
+		.next = NEXT(item_higig2),
+		.call = parse_vc,
+	},
+	[ITEM_HIGIG2_CLASSIFICATION] = {
+		.name = "classification",
+		.help = "matches classification of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					hdr.ppt1.classification)),
+	},
+	[ITEM_HIGIG2_VID] = {
+		.name = "vid",
+		.help = "matches vid of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					hdr.ppt1.vid)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 6c2d888ee..c52b54e55 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -101,7 +101,8 @@ The public API headers are grouped by topics:
   [GSO]                (@ref rte_gso.h),
   [frag/reass]         (@ref rte_ip_frag.h),
   [LPM IPv4 route]     (@ref rte_lpm.h),
-  [LPM IPv6 route]     (@ref rte_lpm6.h)
+  [LPM IPv6 route]     (@ref rte_lpm6.h),
+  [HIGIG]              (@ref rte_higig.h)

 - **QoS**:
   [metering]           (@ref rte_meter.h),
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 1c837ff13..6e6d44df2 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302).
 - ``seq_num``: counter value increased by 1 on each packet sent.
 - Default ``mask`` matches spi.

+Item: ``HIGIG2``
+^^^^^^^^^^^^^^^^^
+
+Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
+Broadcom switches.
+
+- Default ``mask`` matches classification and vlan.
+

 Actions
 ~~~~~~~
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 81a85b995..ca0f68016 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
 	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 };

 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index bcfc06cdc..4fee10559 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -27,6 +27,7 @@
 #include <rte_udp.h>
 #include <rte_byteorder.h>
 #include <rte_esp.h>
+#include <rte_higig.h>

 #ifdef __cplusplus
 extern "C" {
@@ -491,8 +492,36 @@ enum rte_flow_item_type {
 	 *
 	 */
 	RTE_FLOW_ITEM_TYPE_AH,
+
+	/**
+	 * Matches a HIGIG header.
+	 * see struct rte_flow_item_higig2_hdr.
+	 */
+	RTE_FLOW_ITEM_TYPE_HIGIG2,
 };

+/**
+ *
+ * RTE_FLOW_ITEM_TYPE_HIGIG2
+ * Matches higig2 header
+ */
+RTE_STD_C11
+struct rte_flow_item_higig2_hdr {
+	struct rte_higig2_hdr hdr;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
+#ifndef __cplusplus
+static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
+	.hdr = {
+		.ppt1 = {
+			.classification = 0xffff,
+			.vid = 0xfff,
+		},
+	},
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_ANY
  *
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 1244c9fd5..62735a5f9 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -21,6 +21,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build
index 868a93fd6..c52c34592 100644
--- a/lib/librte_net/meson.build
+++ b/lib/librte_net/meson.build
@@ -14,7 +14,8 @@ headers = files('rte_ip.h',
 	'rte_gre.h',
 	'rte_net.h',
 	'rte_net_crc.h',
-	'rte_mpls.h')
+	'rte_mpls.h',
+	'rte_higig.h')

 sources = files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.c')
 deps += ['mbuf']
diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
new file mode 100644
index 000000000..4847448df
--- /dev/null
+++ b/lib/librte_net/rte_higig.h
@@ -0,0 +1,144 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _RTE_HIGIG_H_
+#define _RTE_HIGIG_H_
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *
+ * higig2 frc header.
+ */
+struct rte_higig2_frc {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t ksop:8;
+	uint32_t tc:4;
+	uint32_t mcst:1;
+	uint32_t resv:3;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t ppd_type:3;
+	uint32_t resv1:3;
+	uint32_t dp:2;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t ksop:8;
+	uint32_t resv:3;
+	uint32_t mcst:1;
+	uint32_t tc:4;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t dp:2;
+	uint32_t resv1:3;
+	uint32_t ppd_type:3;
+#endif
+};
+
+
+/**
+ *
+ * higig2 ppt type0 header
+ */
+struct rte_higig2_ppt_type0 {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t mirror:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror_only:1;
+	uint32_t ingress_tagged:1;
+	uint32_t dst_tgid:3;
+	uint32_t dst_t:1;
+	uint32_t vc_label2:4;
+	uint32_t label_present:1;
+	uint32_t l3:1;
+	uint32_t res:2;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t opc:3;
+	uint32_t res1:2;
+	uint32_t srce_t:1;
+	uint32_t pf:2;
+	uint32_t res2:5;
+	uint32_t hdr_ext_length:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t dst_t:1;
+	uint32_t dst_tgid:3;
+	uint32_t ingress_tagged:1;
+	uint32_t mirror_only:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror:1;
+	uint32_t res:2;
+	uint32_t l3:1;
+	uint32_t label_present:1;
+	uint32_t vc_label2:4;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t pf:2;
+	uint32_t srce_t:1;
+	uint32_t res1:2;
+	uint32_t opc:3;
+	uint32_t hdr_ext_length:3;
+	uint32_t res2:5;
+#endif
+};
+
+
+/**
+ *
+ * higig2 ppt type1 header.
+ */
+struct rte_higig2_ppt_type1 {
+	uint16_t classification;
+	uint16_t resv;
+	uint16_t vid;
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t opcode:3;
+	uint32_t resv1:2;
+	uint32_t src_t:1;
+	uint32_t pfm:2;
+	uint32_t resv2:5;
+	uint32_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t pfm:2;
+	uint32_t src_t:1;
+	uint32_t resv1:2;
+	uint32_t opcode:3;
+	uint32_t hdr_ext_len:3;
+	uint32_t resv2:5;
+#endif
+};
+
+/**
+ *
+ * higig2 header
+ */
+RTE_STD_C11
+struct rte_higig2_hdr {
+	struct rte_higig2_frc fcr;
+	union {
+		struct rte_higig2_ppt_type0 ppt0;
+		struct rte_higig2_ppt_type1 ppt1;
+	};
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_HIGIG_H_ */
--
2.17.1


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

* Re: [dpdk-dev] [PATCH v9] ethdev: add HIGIG2 key field to flow API
  2019-10-21  9:16               ` [dpdk-dev] [PATCH v9] " kirankumark
@ 2019-10-21 16:48                 ` Olivier Matz
  2019-10-22  4:16                 ` [dpdk-dev] [PATCH v10] " kirankumark
  1 sibling, 0 replies; 31+ messages in thread
From: Olivier Matz @ 2019-10-21 16:48 UTC (permalink / raw)
  To: kirankumark
  Cc: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, dev, ajit.khaparde

Hi,

On Mon, Oct 21, 2019 at 02:46:17PM +0530, kirankumark@marvell.com wrote:
> From: Kiran Kumar K <kirankumark@marvell.com>
> 
> Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> It is a layer 2.5 protocol and used in Broadcom switches.
> Header format is based on the following document.
> http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf
> 
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
> V9 Changes:
> * Fix gcc 4.8 compile issue
> 
> V8 Changes:
> * Fixed gcc 4.8 compile issue
> 
> V7 changes:
> * Added doxygen comments
> * Moved rte_flow specific code to rte_flow.h
> 
> V6 changes:
> * Updated doxy-api
> 
> V5 changes:
> * Changed broadcom to Broadcom
> * Changed RTE_HIGIG2_H to RTE_HIGIG_H
> * Fixed meson build
> 
> V4 Changes:
> * Removed packed attribute
> 
> V3 Changes:
> * Fixed Copyright header
> * Fixed version info in the subject
> 
> V2 Changes:
> * Added support in testpmd to parse the higig2 item
> * Moved the higig2 header to new file
> * Added indentation in doc
> 
>  app/test-pmd/cmdline_flow.c        |  33 +++++++
>  doc/api/doxy-api-index.md          |   3 +-
>  doc/guides/prog_guide/rte_flow.rst |   8 ++
>  lib/librte_ethdev/rte_flow.c       |   1 +
>  lib/librte_ethdev/rte_flow.h       |  29 ++++++
>  lib/librte_net/Makefile            |   2 +-
>  lib/librte_net/meson.build         |   3 +-
>  lib/librte_net/rte_higig.h         | 144 +++++++++++++++++++++++++++++
>  8 files changed, 220 insertions(+), 3 deletions(-)
>  create mode 100644 lib/librte_net/rte_higig.h
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index b26b8bfe2..970bdef1d 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -203,6 +203,9 @@ enum index {
>  	ITEM_PPPOED,
>  	ITEM_PPPOE_SEID,
>  	ITEM_PPPOE_PROTO_ID,
> +	ITEM_HIGIG2,
> +	ITEM_HIGIG2_CLASSIFICATION,
> +	ITEM_HIGIG2_VID,
> 
>  	/* Validate/create actions. */
>  	ACTIONS,
> @@ -675,6 +678,7 @@ static const enum index next_item[] = {
>  	ITEM_PPPOES,
>  	ITEM_PPPOED,
>  	ITEM_PPPOE_PROTO_ID,
> +	ITEM_HIGIG2,
>  	END_SET,
>  	ZERO,
>  };
> @@ -939,6 +943,13 @@ static const enum index item_pppoe_proto_id[] = {
>  	ZERO,
>  };
> 
> +static const enum index item_higig2[] = {
> +	ITEM_HIGIG2_CLASSIFICATION,
> +	ITEM_HIGIG2_VID,
> +	ITEM_NEXT,
> +	ZERO,
> +};
> +
>  static const enum index next_action[] = {
>  	ACTION_END,
>  	ACTION_VOID,
> @@ -2419,6 +2430,28 @@ static const struct token token_list[] = {
>  		.next = NEXT(item_pppoe_proto_id),
>  		.call = parse_vc,
>  	},
> +	[ITEM_HIGIG2] = {
> +		.name = "higig2",
> +		.help = "matches higig2 header",
> +		.priv = PRIV_ITEM(HIGIG2,
> +				sizeof(struct rte_flow_item_higig2_hdr)),
> +		.next = NEXT(item_higig2),
> +		.call = parse_vc,
> +	},
> +	[ITEM_HIGIG2_CLASSIFICATION] = {
> +		.name = "classification",
> +		.help = "matches classification of higig2 header",
> +		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
> +					hdr.ppt1.classification)),
> +	},
> +	[ITEM_HIGIG2_VID] = {
> +		.name = "vid",
> +		.help = "matches vid of higig2 header",
> +		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
> +					hdr.ppt1.vid)),
> +	},
>  	/* Validate/create actions. */
>  	[ACTIONS] = {
>  		.name = "actions",
> diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
> index 6c2d888ee..c52b54e55 100644
> --- a/doc/api/doxy-api-index.md
> +++ b/doc/api/doxy-api-index.md
> @@ -101,7 +101,8 @@ The public API headers are grouped by topics:
>    [GSO]                (@ref rte_gso.h),
>    [frag/reass]         (@ref rte_ip_frag.h),
>    [LPM IPv4 route]     (@ref rte_lpm.h),
> -  [LPM IPv6 route]     (@ref rte_lpm6.h)
> +  [LPM IPv6 route]     (@ref rte_lpm6.h),
> +  [HIGIG]              (@ref rte_higig.h)
> 
>  - **QoS**:
>    [metering]           (@ref rte_meter.h),
> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index 1c837ff13..6e6d44df2 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302).
>  - ``seq_num``: counter value increased by 1 on each packet sent.
>  - Default ``mask`` matches spi.
> 
> +Item: ``HIGIG2``
> +^^^^^^^^^^^^^^^^^
> +
> +Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
> +Broadcom switches.
> +
> +- Default ``mask`` matches classification and vlan.
> +
> 
>  Actions
>  ~~~~~~~
> diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
> index 81a85b995..ca0f68016 100644
> --- a/lib/librte_ethdev/rte_flow.c
> +++ b/lib/librte_ethdev/rte_flow.c
> @@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
>  	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
>  	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
>  	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
> +	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
>  };
> 
>  /** Generate flow_action[] entry. */
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index bcfc06cdc..4fee10559 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -27,6 +27,7 @@
>  #include <rte_udp.h>
>  #include <rte_byteorder.h>
>  #include <rte_esp.h>
> +#include <rte_higig.h>
> 
>  #ifdef __cplusplus
>  extern "C" {
> @@ -491,8 +492,36 @@ enum rte_flow_item_type {
>  	 *
>  	 */
>  	RTE_FLOW_ITEM_TYPE_AH,
> +
> +	/**
> +	 * Matches a HIGIG header.
> +	 * see struct rte_flow_item_higig2_hdr.
> +	 */
> +	RTE_FLOW_ITEM_TYPE_HIGIG2,
>  };
> 
> +/**
> + *
> + * RTE_FLOW_ITEM_TYPE_HIGIG2
> + * Matches higig2 header
> + */
> +RTE_STD_C11
> +struct rte_flow_item_higig2_hdr {
> +	struct rte_higig2_hdr hdr;
> +};
> +
> +/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
> +#ifndef __cplusplus
> +static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
> +	.hdr = {
> +		.ppt1 = {
> +			.classification = 0xffff,
> +			.vid = 0xfff,
> +		},
> +	},
> +};
> +#endif
> +
>  /**
>   * RTE_FLOW_ITEM_TYPE_ANY
>   *
> diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
> index 1244c9fd5..62735a5f9 100644
> --- a/lib/librte_net/Makefile
> +++ b/lib/librte_net/Makefile
> @@ -21,6 +21,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
>  SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
>  SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
>  SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
> -SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
> +SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h
> 
>  include $(RTE_SDK)/mk/rte.lib.mk
> diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build
> index 868a93fd6..c52c34592 100644
> --- a/lib/librte_net/meson.build
> +++ b/lib/librte_net/meson.build
> @@ -14,7 +14,8 @@ headers = files('rte_ip.h',
>  	'rte_gre.h',
>  	'rte_net.h',
>  	'rte_net_crc.h',
> -	'rte_mpls.h')
> +	'rte_mpls.h',
> +	'rte_higig.h')
> 
>  sources = files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.c')
>  deps += ['mbuf']
> diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
> new file mode 100644
> index 000000000..4847448df
> --- /dev/null
> +++ b/lib/librte_net/rte_higig.h
> @@ -0,0 +1,144 @@
> +
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2019 Marvell International Ltd.
> + */
> +
> +#ifndef _RTE_HIGIG_H_
> +#define _RTE_HIGIG_H_
> +
> +#include <stdint.h>
> +#include <rte_byteorder.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/**
> + *
> + * higig2 frc header.
> + */
> +struct rte_higig2_frc {
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> +	uint32_t ksop:8;
> +	uint32_t tc:4;
> +	uint32_t mcst:1;
> +	uint32_t resv:3;
> +	uint32_t dst_modid:8;
> +	uint32_t dst_pid:8;
> +	uint32_t src_modid:8;
> +	uint32_t src_pid:8;
> +	uint32_t lbid:8;
> +	uint32_t ppd_type:3;
> +	uint32_t resv1:3;
> +	uint32_t dp:2;
> +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> +	uint32_t ksop:8;
> +	uint32_t resv:3;
> +	uint32_t mcst:1;
> +	uint32_t tc:4;
> +	uint32_t dst_modid:8;
> +	uint32_t dst_pid:8;
> +	uint32_t src_modid:8;
> +	uint32_t src_pid:8;
> +	uint32_t lbid:8;
> +	uint32_t dp:2;
> +	uint32_t resv1:3;
> +	uint32_t ppd_type:3;
> +#endif
> +};
> +
> +
> +/**
> + *
> + * higig2 ppt type0 header
> + */
> +struct rte_higig2_ppt_type0 {
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> +	uint32_t mirror:1;
> +	uint32_t mirror_done:1;
> +	uint32_t mirror_only:1;
> +	uint32_t ingress_tagged:1;
> +	uint32_t dst_tgid:3;
> +	uint32_t dst_t:1;
> +	uint32_t vc_label2:4;
> +	uint32_t label_present:1;
> +	uint32_t l3:1;
> +	uint32_t res:2;
> +	uint32_t vc_label1:8;
> +	uint32_t vc_label0:8;
> +	uint32_t vid_high:8;
> +	uint32_t vid_low:8;
> +	uint32_t opc:3;
> +	uint32_t res1:2;
> +	uint32_t srce_t:1;
> +	uint32_t pf:2;
> +	uint32_t res2:5;
> +	uint32_t hdr_ext_length:3;
> +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> +	uint32_t dst_t:1;
> +	uint32_t dst_tgid:3;
> +	uint32_t ingress_tagged:1;
> +	uint32_t mirror_only:1;
> +	uint32_t mirror_done:1;
> +	uint32_t mirror:1;
> +	uint32_t res:2;
> +	uint32_t l3:1;
> +	uint32_t label_present:1;
> +	uint32_t vc_label2:4;
> +	uint32_t vc_label1:8;
> +	uint32_t vc_label0:8;
> +	uint32_t vid_high:8;
> +	uint32_t vid_low:8;
> +	uint32_t pf:2;
> +	uint32_t srce_t:1;
> +	uint32_t res1:2;
> +	uint32_t opc:3;
> +	uint32_t hdr_ext_length:3;
> +	uint32_t res2:5;
> +#endif
> +};
> +
> +
> +/**
> + *
> + * higig2 ppt type1 header.
> + */
> +struct rte_higig2_ppt_type1 {
> +	uint16_t classification;
> +	uint16_t resv;
> +	uint16_t vid;
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> +	uint32_t opcode:3;
> +	uint32_t resv1:2;
> +	uint32_t src_t:1;
> +	uint32_t pfm:2;
> +	uint32_t resv2:5;
> +	uint32_t hdr_ext_len:3;
> +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> +	uint32_t pfm:2;
> +	uint32_t src_t:1;
> +	uint32_t resv1:2;
> +	uint32_t opcode:3;
> +	uint32_t hdr_ext_len:3;
> +	uint32_t resv2:5;
> +#endif
> +};


I don't know this protocol, but the output of pahole for this struct
(little endian version) is:

struct rte_higig2_ppt_type1 {
	uint16_t                   classification;       /*     0     2 */
	uint16_t                   resv;                 /*     2     2 */
	uint16_t                   vid;                  /*     4     2 */

	/* Bitfield combined with previous fields */

	uint32_t                   opcode:3;             /*     4:13  4 */
	uint32_t                   resv1:2;              /*     4:11  4 */
	uint32_t                   src_t:1;              /*     4:10  4 */
	uint32_t                   pfm:2;                /*     4: 8  4 */
	uint32_t                   resv2:5;              /*     4: 3  4 */
	uint32_t                   hdr_ext_len:3;        /*     4: 0  4 */

	/* size: 8, cachelines: 1, members: 9 */
	/* bit_padding: 16 bits */
	/* last cacheline: 8 bytes */
};

There is a 16 bits padding at the end, is it expected?

Apart from this comment:
Acked-by: Olivier Matz <olivier.matz@6wind.com>

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

* [dpdk-dev]  [PATCH v10] ethdev: add HIGIG2 key field to flow API
  2019-10-21  9:16               ` [dpdk-dev] [PATCH v9] " kirankumark
  2019-10-21 16:48                 ` Olivier Matz
@ 2019-10-22  4:16                 ` kirankumark
  2019-10-22  9:19                   ` Ferruh Yigit
  2019-10-23 22:04                   ` [dpdk-dev] " Thomas Monjalon
  1 sibling, 2 replies; 31+ messages in thread
From: kirankumark @ 2019-10-22  4:16 UTC (permalink / raw)
  To: Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu, Bernard Iremonger,
	John McNamara, Marko Kovacevic, Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde, Kiran Kumar K

From: Kiran Kumar K <kirankumark@marvell.com>

Add new rte_flow_item_higig2_hdr in order to match higig2 header.
It is a layer 2.5 protocol and used in Broadcom switches.
Header format is based on the following document.
http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
V10 Changes:
* Avoid structure padding

V9 Changes:
* Fix gcc 4.8 compile issue

V8 Changes:
* Fixed gcc 4.8 compile issue

V7 changes:
* Added doxygen comments
* Moved rte_flow specific code to rte_flow.h

V6 changes:
* Updated doxy-api

V5 changes:
* Changed broadcom to Broadcom
* Changed RTE_HIGIG2_H to RTE_HIGIG_H
* Fixed meson build

V4 Changes:
* Removed packed attribute

V3 Changes:
* Fixed Copyright header
* Fixed version info in the subject

V2 Changes:
* Added support in testpmd to parse the higig2 item
* Moved the higig2 header to new file
* Added indentation in doc

 app/test-pmd/cmdline_flow.c        |  33 +++++++
 doc/api/doxy-api-index.md          |   3 +-
 doc/guides/prog_guide/rte_flow.rst |   8 ++
 lib/librte_ethdev/rte_flow.c       |   1 +
 lib/librte_ethdev/rte_flow.h       |  29 ++++++
 lib/librte_net/Makefile            |   2 +-
 lib/librte_net/meson.build         |   3 +-
 lib/librte_net/rte_higig.h         | 145 +++++++++++++++++++++++++++++
 8 files changed, 221 insertions(+), 3 deletions(-)
 create mode 100644 lib/librte_net/rte_higig.h

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b26b8bfe2..970bdef1d 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -203,6 +203,9 @@ enum index {
 	ITEM_PPPOED,
 	ITEM_PPPOE_SEID,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,

 	/* Validate/create actions. */
 	ACTIONS,
@@ -675,6 +678,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOES,
 	ITEM_PPPOED,
 	ITEM_PPPOE_PROTO_ID,
+	ITEM_HIGIG2,
 	END_SET,
 	ZERO,
 };
@@ -939,6 +943,13 @@ static const enum index item_pppoe_proto_id[] = {
 	ZERO,
 };

+static const enum index item_higig2[] = {
+	ITEM_HIGIG2_CLASSIFICATION,
+	ITEM_HIGIG2_VID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -2419,6 +2430,28 @@ static const struct token token_list[] = {
 		.next = NEXT(item_pppoe_proto_id),
 		.call = parse_vc,
 	},
+	[ITEM_HIGIG2] = {
+		.name = "higig2",
+		.help = "matches higig2 header",
+		.priv = PRIV_ITEM(HIGIG2,
+				sizeof(struct rte_flow_item_higig2_hdr)),
+		.next = NEXT(item_higig2),
+		.call = parse_vc,
+	},
+	[ITEM_HIGIG2_CLASSIFICATION] = {
+		.name = "classification",
+		.help = "matches classification of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					hdr.ppt1.classification)),
+	},
+	[ITEM_HIGIG2_VID] = {
+		.name = "vid",
+		.help = "matches vid of higig2 header",
+		.next = NEXT(item_higig2, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_higig2_hdr,
+					hdr.ppt1.vid)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 6c2d888ee..c52b54e55 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -101,7 +101,8 @@ The public API headers are grouped by topics:
   [GSO]                (@ref rte_gso.h),
   [frag/reass]         (@ref rte_ip_frag.h),
   [LPM IPv4 route]     (@ref rte_lpm.h),
-  [LPM IPv6 route]     (@ref rte_lpm6.h)
+  [LPM IPv6 route]     (@ref rte_lpm6.h),
+  [HIGIG]              (@ref rte_higig.h)

 - **QoS**:
   [metering]           (@ref rte_meter.h),
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 1c837ff13..6e6d44df2 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1289,6 +1289,14 @@ Matches a IP Authentication Header (RFC 4302).
 - ``seq_num``: counter value increased by 1 on each packet sent.
 - Default ``mask`` matches spi.

+Item: ``HIGIG2``
+^^^^^^^^^^^^^^^^^
+
+Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
+Broadcom switches.
+
+- Default ``mask`` matches classification and vlan.
+

 Actions
 ~~~~~~~
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 81a85b995..ca0f68016 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -83,6 +83,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(NSH, sizeof(struct rte_flow_item_nsh)),
 	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
+	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 };

 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index bcfc06cdc..4fee10559 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -27,6 +27,7 @@
 #include <rte_udp.h>
 #include <rte_byteorder.h>
 #include <rte_esp.h>
+#include <rte_higig.h>

 #ifdef __cplusplus
 extern "C" {
@@ -491,8 +492,36 @@ enum rte_flow_item_type {
 	 *
 	 */
 	RTE_FLOW_ITEM_TYPE_AH,
+
+	/**
+	 * Matches a HIGIG header.
+	 * see struct rte_flow_item_higig2_hdr.
+	 */
+	RTE_FLOW_ITEM_TYPE_HIGIG2,
 };

+/**
+ *
+ * RTE_FLOW_ITEM_TYPE_HIGIG2
+ * Matches higig2 header
+ */
+RTE_STD_C11
+struct rte_flow_item_higig2_hdr {
+	struct rte_higig2_hdr hdr;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
+#ifndef __cplusplus
+static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
+	.hdr = {
+		.ppt1 = {
+			.classification = 0xffff,
+			.vid = 0xfff,
+		},
+	},
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_ANY
  *
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 1244c9fd5..62735a5f9 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -21,6 +21,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h rte_higig.h

 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/meson.build b/lib/librte_net/meson.build
index 868a93fd6..c52c34592 100644
--- a/lib/librte_net/meson.build
+++ b/lib/librte_net/meson.build
@@ -14,7 +14,8 @@ headers = files('rte_ip.h',
 	'rte_gre.h',
 	'rte_net.h',
 	'rte_net_crc.h',
-	'rte_mpls.h')
+	'rte_mpls.h',
+	'rte_higig.h')

 sources = files('rte_arp.c', 'rte_ether.c', 'rte_net.c', 'rte_net_crc.c')
 deps += ['mbuf']
diff --git a/lib/librte_net/rte_higig.h b/lib/librte_net/rte_higig.h
new file mode 100644
index 000000000..44df66676
--- /dev/null
+++ b/lib/librte_net/rte_higig.h
@@ -0,0 +1,145 @@
+
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2019 Marvell International Ltd.
+ */
+
+#ifndef _RTE_HIGIG_H_
+#define _RTE_HIGIG_H_
+
+#include <stdint.h>
+#include <rte_byteorder.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *
+ * higig2 frc header.
+ */
+struct rte_higig2_frc {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t ksop:8;
+	uint32_t tc:4;
+	uint32_t mcst:1;
+	uint32_t resv:3;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t ppd_type:3;
+	uint32_t resv1:3;
+	uint32_t dp:2;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t ksop:8;
+	uint32_t resv:3;
+	uint32_t mcst:1;
+	uint32_t tc:4;
+	uint32_t dst_modid:8;
+	uint32_t dst_pid:8;
+	uint32_t src_modid:8;
+	uint32_t src_pid:8;
+	uint32_t lbid:8;
+	uint32_t dp:2;
+	uint32_t resv1:3;
+	uint32_t ppd_type:3;
+#endif
+};
+
+
+/**
+ *
+ * higig2 ppt type0 header
+ */
+struct rte_higig2_ppt_type0 {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint32_t mirror:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror_only:1;
+	uint32_t ingress_tagged:1;
+	uint32_t dst_tgid:3;
+	uint32_t dst_t:1;
+	uint32_t vc_label2:4;
+	uint32_t label_present:1;
+	uint32_t l3:1;
+	uint32_t res:2;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t opc:3;
+	uint32_t res1:2;
+	uint32_t srce_t:1;
+	uint32_t pf:2;
+	uint32_t res2:5;
+	uint32_t hdr_ext_length:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint32_t dst_t:1;
+	uint32_t dst_tgid:3;
+	uint32_t ingress_tagged:1;
+	uint32_t mirror_only:1;
+	uint32_t mirror_done:1;
+	uint32_t mirror:1;
+	uint32_t res:2;
+	uint32_t l3:1;
+	uint32_t label_present:1;
+	uint32_t vc_label2:4;
+	uint32_t vc_label1:8;
+	uint32_t vc_label0:8;
+	uint32_t vid_high:8;
+	uint32_t vid_low:8;
+	uint32_t pf:2;
+	uint32_t srce_t:1;
+	uint32_t res1:2;
+	uint32_t opc:3;
+	uint32_t hdr_ext_length:3;
+	uint32_t res2:5;
+#endif
+};
+
+
+/**
+ *
+ * higig2 ppt type1 header.
+ */
+RTE_STD_C11
+struct rte_higig2_ppt_type1 {
+	uint16_t classification;
+	uint16_t resv;
+	uint16_t vid;
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+	uint16_t opcode:3;
+	uint16_t resv1:2;
+	uint16_t src_t:1;
+	uint16_t pfm:2;
+	uint16_t resv2:5;
+	uint16_t hdr_ext_len:3;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+	uint16_t pfm:2;
+	uint16_t src_t:1;
+	uint16_t resv1:2;
+	uint16_t opcode:3;
+	uint16_t hdr_ext_len:3;
+	uint16_t resv2:5;
+#endif
+};
+
+/**
+ *
+ * higig2 header
+ */
+RTE_STD_C11
+struct rte_higig2_hdr {
+	struct rte_higig2_frc fcr;
+	union {
+		struct rte_higig2_ppt_type0 ppt0;
+		struct rte_higig2_ppt_type1 ppt1;
+	};
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_HIGIG_H_ */
--
2.17.1


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

* Re: [dpdk-dev] [PATCH v10] ethdev: add HIGIG2 key field to flow API
  2019-10-22  4:16                 ` [dpdk-dev] [PATCH v10] " kirankumark
@ 2019-10-22  9:19                   ` Ferruh Yigit
  2019-10-23 10:50                     ` Raslan Darawsheh
  2019-10-23 22:04                   ` [dpdk-dev] " Thomas Monjalon
  1 sibling, 1 reply; 31+ messages in thread
From: Ferruh Yigit @ 2019-10-22  9:19 UTC (permalink / raw)
  To: kirankumark, Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu,
	Bernard Iremonger, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde

On 10/22/2019 5:16 AM, kirankumark@marvell.com wrote:
> From: Kiran Kumar K <kirankumark@marvell.com>
> 
> Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> It is a layer 2.5 protocol and used in Broadcom switches.
> Header format is based on the following document.
> http://read.pudn.com/downloads558/doc/comm/2301468/HiGig_protocol.pdf
> 
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Applied to dpdk-next-net/master, thanks.

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

* Re: [dpdk-dev] [PATCH v10] ethdev: add HIGIG2 key field to flow API
  2019-10-22  9:19                   ` Ferruh Yigit
@ 2019-10-23 10:50                     ` Raslan Darawsheh
  2019-10-23 11:39                       ` Olivier Matz
  0 siblings, 1 reply; 31+ messages in thread
From: Raslan Darawsheh @ 2019-10-23 10:50 UTC (permalink / raw)
  To: Ferruh Yigit, kirankumark, Adrien Mazarguil, Wenzhuo Lu,
	Jingjing Wu, Bernard Iremonger, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Andrew Rybchenko, Olivier Matz
  Cc: dev, ajit.khaparde

Hi,

This patch broke the compilation of MLX5 PMD in debug mode:

                 from /root/dpdk/x86_64-native-linux-gcc/include/rte_ethdev_driver.h:18,
                 from /root/dpdk/drivers/net/mlx5/mlx5_mp.c:11:
/root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:112:2: error: type of bit-field 'opcode' is a GCC extension [-Werror=pedantic]
  uint16_t opcode:3;
  ^
/root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:113:2: error: type of bit-field 'resv1' is a GCC extension [-Werror=pedantic]
  uint16_t resv1:2;
  ^
/root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:114:2: error: type of bit-field 'src_t' is a GCC extension [-Werror=pedantic]
  uint16_t src_t:1;
  ^
/root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:115:2: error: type of bit-field 'pfm' is a GCC extension [-Werror=pedantic]
  uint16_t pfm:2;
  ^
/root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:116:2: error: type of bit-field 'resv2' is a GCC extension [-Werror=pedantic]
  uint16_t resv2:5;
  ^
/root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:117:2: error: type of bit-field 'hdr_ext_len' is a GCC extension [-Werror=pedantic]
  uint16_t hdr_ext_len:3;

and this is with gcc 4.8.5 

Kindest regards,
Raslan Darawsheh

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Ferruh Yigit
> Sent: Tuesday, October 22, 2019 12:20 PM
> To: kirankumark@marvell.com; Adrien Mazarguil
> <adrien.mazarguil@6wind.com>; Wenzhuo Lu <wenzhuo.lu@intel.com>;
> Jingjing Wu <jingjing.wu@intel.com>; Bernard Iremonger
> <bernard.iremonger@intel.com>; John McNamara
> <john.mcnamara@intel.com>; Marko Kovacevic
> <marko.kovacevic@intel.com>; Thomas Monjalon <thomas@monjalon.net>;
> Andrew Rybchenko <arybchenko@solarflare.com>; Olivier Matz
> <olivier.matz@6wind.com>
> Cc: dev@dpdk.org; ajit.khaparde@broadcom.com
> Subject: Re: [dpdk-dev] [PATCH v10] ethdev: add HIGIG2 key field to flow
> API
> 
> On 10/22/2019 5:16 AM, kirankumark@marvell.com wrote:
> > From: Kiran Kumar K <kirankumark@marvell.com>
> >
> > Add new rte_flow_item_higig2_hdr in order to match higig2 header.
> > It is a layer 2.5 protocol and used in Broadcom switches.
> > Header format is based on the following document.
> >
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fread.p
> udn.com%2Fdownloads558%2Fdoc%2Fcomm%2F2301468%2FHiGig_protocol
> .pdf&amp;data=02%7C01%7Crasland%40mellanox.com%7C316c5935a21b41ff
> 8e5708d756d10626%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C1%7C6
> 37073328075459541&amp;sdata=3sL1lSFraI2KMD6UAJj%2FP2cFwloEflX1vNCY
> lv%2B4fG4%3D&amp;reserved=0
> >
> > Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> > Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
> > Acked-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Applied to dpdk-next-net/master, thanks.

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

* Re: [dpdk-dev] [PATCH v10] ethdev: add HIGIG2 key field to flow API
  2019-10-23 10:50                     ` Raslan Darawsheh
@ 2019-10-23 11:39                       ` Olivier Matz
  2019-10-23 11:43                         ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda
  0 siblings, 1 reply; 31+ messages in thread
From: Olivier Matz @ 2019-10-23 11:39 UTC (permalink / raw)
  To: Raslan Darawsheh
  Cc: Ferruh Yigit, kirankumark, Adrien Mazarguil, Wenzhuo Lu,
	Jingjing Wu, Bernard Iremonger, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Andrew Rybchenko, dev, ajit.khaparde

Hi,

On Wed, Oct 23, 2019 at 10:50:52AM +0000, Raslan Darawsheh wrote:
> Hi,
> 
> This patch broke the compilation of MLX5 PMD in debug mode:
> 
>                  from /root/dpdk/x86_64-native-linux-gcc/include/rte_ethdev_driver.h:18,
>                  from /root/dpdk/drivers/net/mlx5/mlx5_mp.c:11:
> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:112:2: error: type of bit-field 'opcode' is a GCC extension [-Werror=pedantic]
>   uint16_t opcode:3;
>   ^
> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:113:2: error: type of bit-field 'resv1' is a GCC extension [-Werror=pedantic]
>   uint16_t resv1:2;
>   ^
> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:114:2: error: type of bit-field 'src_t' is a GCC extension [-Werror=pedantic]
>   uint16_t src_t:1;
>   ^
> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:115:2: error: type of bit-field 'pfm' is a GCC extension [-Werror=pedantic]
>   uint16_t pfm:2;
>   ^
> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:116:2: error: type of bit-field 'resv2' is a GCC extension [-Werror=pedantic]
>   uint16_t resv2:5;
>   ^
> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:117:2: error: type of bit-field 'hdr_ext_len' is a GCC extension [-Werror=pedantic]
>   uint16_t hdr_ext_len:3;
> 
> and this is with gcc 4.8.5 

From https://stackoverflow.com/questions/10906238/warning-when-using-bitfield-with-unsigned-char
it seems that it is allowed in c99, so I guess it's a gcc 4.8 bug.

Adding __extension__ above the struct solves the warnings, I suggest to
add it.


Olivier

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

* Re: [dpdk-dev] [EXT] Re: [PATCH v10] ethdev: add HIGIG2 key field to flow API
  2019-10-23 11:39                       ` Olivier Matz
@ 2019-10-23 11:43                         ` Kiran Kumar Kokkilagadda
  2019-10-23 14:04                           ` Olivier Matz
  0 siblings, 1 reply; 31+ messages in thread
From: Kiran Kumar Kokkilagadda @ 2019-10-23 11:43 UTC (permalink / raw)
  To: Olivier Matz, Raslan Darawsheh
  Cc: Ferruh Yigit, Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu,
	Bernard Iremonger, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Andrew Rybchenko, dev, ajit.khaparde

> -----Original Message-----
> From: Olivier Matz <olivier.matz@6wind.com>
> Sent: Wednesday, October 23, 2019 5:09 PM
> To: Raslan Darawsheh <rasland@mellanox.com>
> Cc: Ferruh Yigit <ferruh.yigit@intel.com>; Kiran Kumar Kokkilagadda
> <kirankumark@marvell.com>; Adrien Mazarguil
> <adrien.mazarguil@6wind.com>; Wenzhuo Lu <wenzhuo.lu@intel.com>;
> Jingjing Wu <jingjing.wu@intel.com>; Bernard Iremonger
> <bernard.iremonger@intel.com>; John McNamara
> <john.mcnamara@intel.com>; Marko Kovacevic <marko.kovacevic@intel.com>;
> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
> <arybchenko@solarflare.com>; dev@dpdk.org; ajit.khaparde@broadcom.com
> Subject: [EXT] Re: [dpdk-dev] [PATCH v10] ethdev: add HIGIG2 key field to flow
> API
> 
> External Email
> 
> ----------------------------------------------------------------------
> Hi,
> 
> 
> 
> On Wed, Oct 23, 2019 at 10:50:52AM +0000, Raslan Darawsheh wrote:
> 
> > Hi,
> 
> >
> 
> > This patch broke the compilation of MLX5 PMD in debug mode:
> 
> >
> 
> >                  from /root/dpdk/x86_64-native-linux-
> gcc/include/rte_ethdev_driver.h:18,
> 
> >                  from /root/dpdk/drivers/net/mlx5/mlx5_mp.c:11:
> 
> > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:112:2: error: type of
> bit-field 'opcode' is a GCC extension [-Werror=pedantic]
> 
> >   uint16_t opcode:3;
> 
> >   ^
> 
> > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:113:2: error: type of
> bit-field 'resv1' is a GCC extension [-Werror=pedantic]
> 
> >   uint16_t resv1:2;
> 
> >   ^
> 
> > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:114:2: error: type of
> bit-field 'src_t' is a GCC extension [-Werror=pedantic]
> 
> >   uint16_t src_t:1;
> 
> >   ^
> 
> > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:115:2: error: type of
> bit-field 'pfm' is a GCC extension [-Werror=pedantic]
> 
> >   uint16_t pfm:2;
> 
> >   ^
> 
> > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:116:2: error: type of
> bit-field 'resv2' is a GCC extension [-Werror=pedantic]
> 
> >   uint16_t resv2:5;
> 
> >   ^
> 
> > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:117:2: error: type of
> bit-field 'hdr_ext_len' is a GCC extension [-Werror=pedantic]
> 
> >   uint16_t hdr_ext_len:3;
> 
> >
> 
> > and this is with gcc 4.8.5
> 
> 
> 
> From https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__stackoverflow.com_questions_10906238_warning-2Dwhen-2Dusing-
> 2Dbitfield-2Dwith-2Dunsigned-
> 2Dchar&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=owEKckYY4FTmil1Z6oBUR
> wkTThyuRbLAY9LdfiaT6HA&m=GZ-
> 6cngPycaUlGJT20VEOf9oTcp5PMwk7j1JV1vAQfs&s=SCg5yVPS4zZa8GSn9bl_eUtI
> vBmoDzi35PspWUttIUY&e=
> 
> it seems that it is allowed in c99, so I guess it's a gcc 4.8 bug.
> 
> 
> 
> Adding __extension__ above the struct solves the warnings, I suggest to
> 
> add it.

/**
 *
 * higig2 ppt type1 header.
 */
RTE_STD_C11
struct rte_higig2_ppt_type1 {
        uint16_t classification;
        uint16_t resv;
        uint16_t vid;
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
        uint16_t opcode:3;
        uint16_t resv1:2;
        uint16_t src_t:1;
        uint16_t pfm:2;
        uint16_t resv2:5;
        uint16_t hdr_ext_len:3;
#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
        uint16_t pfm:2;
        uint16_t src_t:1;
        uint16_t resv1:2;
        uint16_t opcode:3;
        uint16_t hdr_ext_len:3;
        uint16_t resv2:5;
#endif
};

I have already added it. RTE_STD_C11 , this is a macro for __extension__. 
/** C extension macro for environments lacking C11 features. */
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
#define RTE_STD_C11 __extension__
#else
#define RTE_STD_C11
#endif

> 
> 
> 
> 
> 
> Olivier


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

* Re: [dpdk-dev] [EXT] Re: [PATCH v10] ethdev: add HIGIG2 key field to flow API
  2019-10-23 11:43                         ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda
@ 2019-10-23 14:04                           ` Olivier Matz
  2019-10-23 14:14                             ` Ferruh Yigit
  0 siblings, 1 reply; 31+ messages in thread
From: Olivier Matz @ 2019-10-23 14:04 UTC (permalink / raw)
  To: Kiran Kumar Kokkilagadda
  Cc: Raslan Darawsheh, Ferruh Yigit, Adrien Mazarguil, Wenzhuo Lu,
	Jingjing Wu, Bernard Iremonger, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Andrew Rybchenko, dev, ajit.khaparde

On Wed, Oct 23, 2019 at 11:43:58AM +0000, Kiran Kumar Kokkilagadda wrote:
> > -----Original Message-----
> > From: Olivier Matz <olivier.matz@6wind.com>
> > Sent: Wednesday, October 23, 2019 5:09 PM
> > To: Raslan Darawsheh <rasland@mellanox.com>
> > Cc: Ferruh Yigit <ferruh.yigit@intel.com>; Kiran Kumar Kokkilagadda
> > <kirankumark@marvell.com>; Adrien Mazarguil
> > <adrien.mazarguil@6wind.com>; Wenzhuo Lu <wenzhuo.lu@intel.com>;
> > Jingjing Wu <jingjing.wu@intel.com>; Bernard Iremonger
> > <bernard.iremonger@intel.com>; John McNamara
> > <john.mcnamara@intel.com>; Marko Kovacevic <marko.kovacevic@intel.com>;
> > Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
> > <arybchenko@solarflare.com>; dev@dpdk.org; ajit.khaparde@broadcom.com
> > Subject: [EXT] Re: [dpdk-dev] [PATCH v10] ethdev: add HIGIG2 key field to flow
> > API
> > 
> > External Email
> > 
> > ----------------------------------------------------------------------
> > Hi,
> > 
> > 
> > 
> > On Wed, Oct 23, 2019 at 10:50:52AM +0000, Raslan Darawsheh wrote:
> > 
> > > Hi,
> > 
> > >
> > 
> > > This patch broke the compilation of MLX5 PMD in debug mode:
> > 
> > >
> > 
> > >                  from /root/dpdk/x86_64-native-linux-
> > gcc/include/rte_ethdev_driver.h:18,
> > 
> > >                  from /root/dpdk/drivers/net/mlx5/mlx5_mp.c:11:
> > 
> > > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:112:2: error: type of
> > bit-field 'opcode' is a GCC extension [-Werror=pedantic]
> > 
> > >   uint16_t opcode:3;
> > 
> > >   ^
> > 
> > > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:113:2: error: type of
> > bit-field 'resv1' is a GCC extension [-Werror=pedantic]
> > 
> > >   uint16_t resv1:2;
> > 
> > >   ^
> > 
> > > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:114:2: error: type of
> > bit-field 'src_t' is a GCC extension [-Werror=pedantic]
> > 
> > >   uint16_t src_t:1;
> > 
> > >   ^
> > 
> > > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:115:2: error: type of
> > bit-field 'pfm' is a GCC extension [-Werror=pedantic]
> > 
> > >   uint16_t pfm:2;
> > 
> > >   ^
> > 
> > > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:116:2: error: type of
> > bit-field 'resv2' is a GCC extension [-Werror=pedantic]
> > 
> > >   uint16_t resv2:5;
> > 
> > >   ^
> > 
> > > /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:117:2: error: type of
> > bit-field 'hdr_ext_len' is a GCC extension [-Werror=pedantic]
> > 
> > >   uint16_t hdr_ext_len:3;
> > 
> > >
> > 
> > > and this is with gcc 4.8.5
> > 
> > 
> > 
> > From https://urldefense.proofpoint.com/v2/url?u=https-
> > 3A__stackoverflow.com_questions_10906238_warning-2Dwhen-2Dusing-
> > 2Dbitfield-2Dwith-2Dunsigned-
> > 2Dchar&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=owEKckYY4FTmil1Z6oBUR
> > wkTThyuRbLAY9LdfiaT6HA&m=GZ-
> > 6cngPycaUlGJT20VEOf9oTcp5PMwk7j1JV1vAQfs&s=SCg5yVPS4zZa8GSn9bl_eUtI
> > vBmoDzi35PspWUttIUY&e=
> > 
> > it seems that it is allowed in c99, so I guess it's a gcc 4.8 bug.
> > 
> > 
> > 
> > Adding __extension__ above the struct solves the warnings, I suggest to
> > 
> > add it.
> 
> /**
>  *
>  * higig2 ppt type1 header.
>  */
> RTE_STD_C11
> struct rte_higig2_ppt_type1 {
>         uint16_t classification;
>         uint16_t resv;
>         uint16_t vid;
> #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
>         uint16_t opcode:3;
>         uint16_t resv1:2;
>         uint16_t src_t:1;
>         uint16_t pfm:2;
>         uint16_t resv2:5;
>         uint16_t hdr_ext_len:3;
> #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
>         uint16_t pfm:2;
>         uint16_t src_t:1;
>         uint16_t resv1:2;
>         uint16_t opcode:3;
>         uint16_t hdr_ext_len:3;
>         uint16_t resv2:5;
> #endif
> };
> 
> I have already added it. RTE_STD_C11 , this is a macro for __extension__. 
> /** C extension macro for environments lacking C11 features. */
> #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
> #define RTE_STD_C11 __extension__
> #else
> #define RTE_STD_C11
> #endif

The __extension__ is only added if compiled for < c11.
But there is apparently a problem with gcc-4.8: even in c11, it does
not support bitfields on u16. See: https://godbolt.org/z/hRIbgg

On gcc-4.9, the problem disappeared: https://godbolt.org/z/kkzz9v

So as a workaround, using __extension__ should work, probably with a short
explanation.


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

* Re: [dpdk-dev] [EXT] Re: [PATCH v10] ethdev: add HIGIG2 key field to flow API
  2019-10-23 14:04                           ` Olivier Matz
@ 2019-10-23 14:14                             ` Ferruh Yigit
  0 siblings, 0 replies; 31+ messages in thread
From: Ferruh Yigit @ 2019-10-23 14:14 UTC (permalink / raw)
  To: Olivier Matz, Kiran Kumar Kokkilagadda
  Cc: Raslan Darawsheh, Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu,
	Bernard Iremonger, John McNamara, Marko Kovacevic,
	Thomas Monjalon, Andrew Rybchenko, dev, ajit.khaparde

On 10/23/2019 3:04 PM, Olivier Matz wrote:
> On Wed, Oct 23, 2019 at 11:43:58AM +0000, Kiran Kumar Kokkilagadda wrote:
>>> -----Original Message-----
>>> From: Olivier Matz <olivier.matz@6wind.com>
>>> Sent: Wednesday, October 23, 2019 5:09 PM
>>> To: Raslan Darawsheh <rasland@mellanox.com>
>>> Cc: Ferruh Yigit <ferruh.yigit@intel.com>; Kiran Kumar Kokkilagadda
>>> <kirankumark@marvell.com>; Adrien Mazarguil
>>> <adrien.mazarguil@6wind.com>; Wenzhuo Lu <wenzhuo.lu@intel.com>;
>>> Jingjing Wu <jingjing.wu@intel.com>; Bernard Iremonger
>>> <bernard.iremonger@intel.com>; John McNamara
>>> <john.mcnamara@intel.com>; Marko Kovacevic <marko.kovacevic@intel.com>;
>>> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
>>> <arybchenko@solarflare.com>; dev@dpdk.org; ajit.khaparde@broadcom.com
>>> Subject: [EXT] Re: [dpdk-dev] [PATCH v10] ethdev: add HIGIG2 key field to flow
>>> API
>>>
>>> External Email
>>>
>>> ----------------------------------------------------------------------
>>> Hi,
>>>
>>>
>>>
>>> On Wed, Oct 23, 2019 at 10:50:52AM +0000, Raslan Darawsheh wrote:
>>>
>>>> Hi,
>>>
>>>>
>>>
>>>> This patch broke the compilation of MLX5 PMD in debug mode:
>>>
>>>>
>>>
>>>>                  from /root/dpdk/x86_64-native-linux-
>>> gcc/include/rte_ethdev_driver.h:18,
>>>
>>>>                  from /root/dpdk/drivers/net/mlx5/mlx5_mp.c:11:
>>>
>>>> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:112:2: error: type of
>>> bit-field 'opcode' is a GCC extension [-Werror=pedantic]
>>>
>>>>   uint16_t opcode:3;
>>>
>>>>   ^
>>>
>>>> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:113:2: error: type of
>>> bit-field 'resv1' is a GCC extension [-Werror=pedantic]
>>>
>>>>   uint16_t resv1:2;
>>>
>>>>   ^
>>>
>>>> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:114:2: error: type of
>>> bit-field 'src_t' is a GCC extension [-Werror=pedantic]
>>>
>>>>   uint16_t src_t:1;
>>>
>>>>   ^
>>>
>>>> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:115:2: error: type of
>>> bit-field 'pfm' is a GCC extension [-Werror=pedantic]
>>>
>>>>   uint16_t pfm:2;
>>>
>>>>   ^
>>>
>>>> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:116:2: error: type of
>>> bit-field 'resv2' is a GCC extension [-Werror=pedantic]
>>>
>>>>   uint16_t resv2:5;
>>>
>>>>   ^
>>>
>>>> /root/dpdk/x86_64-native-linux-gcc/include/rte_higig.h:117:2: error: type of
>>> bit-field 'hdr_ext_len' is a GCC extension [-Werror=pedantic]
>>>
>>>>   uint16_t hdr_ext_len:3;
>>>
>>>>
>>>
>>>> and this is with gcc 4.8.5
>>>
>>>
>>>
>>> From https://urldefense.proofpoint.com/v2/url?u=https-
>>> 3A__stackoverflow.com_questions_10906238_warning-2Dwhen-2Dusing-
>>> 2Dbitfield-2Dwith-2Dunsigned-
>>> 2Dchar&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=owEKckYY4FTmil1Z6oBUR
>>> wkTThyuRbLAY9LdfiaT6HA&m=GZ-
>>> 6cngPycaUlGJT20VEOf9oTcp5PMwk7j1JV1vAQfs&s=SCg5yVPS4zZa8GSn9bl_eUtI
>>> vBmoDzi35PspWUttIUY&e=
>>>
>>> it seems that it is allowed in c99, so I guess it's a gcc 4.8 bug.
>>>
>>>
>>>
>>> Adding __extension__ above the struct solves the warnings, I suggest to
>>>
>>> add it.
>>
>> /**
>>  *
>>  * higig2 ppt type1 header.
>>  */
>> RTE_STD_C11
>> struct rte_higig2_ppt_type1 {
>>         uint16_t classification;
>>         uint16_t resv;
>>         uint16_t vid;
>> #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
>>         uint16_t opcode:3;
>>         uint16_t resv1:2;
>>         uint16_t src_t:1;
>>         uint16_t pfm:2;
>>         uint16_t resv2:5;
>>         uint16_t hdr_ext_len:3;
>> #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
>>         uint16_t pfm:2;
>>         uint16_t src_t:1;
>>         uint16_t resv1:2;
>>         uint16_t opcode:3;
>>         uint16_t hdr_ext_len:3;
>>         uint16_t resv2:5;
>> #endif
>> };
>>
>> I have already added it. RTE_STD_C11 , this is a macro for __extension__. 
>> /** C extension macro for environments lacking C11 features. */
>> #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
>> #define RTE_STD_C11 __extension__
>> #else
>> #define RTE_STD_C11
>> #endif
> 
> The __extension__ is only added if compiled for < c11.
> But there is apparently a problem with gcc-4.8: even in c11, it does
> not support bitfields on u16. See: https://godbolt.org/z/hRIbgg
> 
> On gcc-4.9, the problem disappeared: https://godbolt.org/z/kkzz9v
> 
> So as a workaround, using __extension__ should work, probably with a short
> explanation.
> 

Thanks Olivier, this was also our finding with Raslan and he sent the fix already.
https://patches.dpdk.org/patch/61748/

Also it looks like gcc4.8 thinks this is not c11 standard but extension only for
uint16_t type, structs with uint32_t bit-fieds works as expected.

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

* Re: [dpdk-dev] [PATCH v10] ethdev: add HIGIG2 key field to flow API
  2019-10-22  4:16                 ` [dpdk-dev] [PATCH v10] " kirankumark
  2019-10-22  9:19                   ` Ferruh Yigit
@ 2019-10-23 22:04                   ` Thomas Monjalon
  1 sibling, 0 replies; 31+ messages in thread
From: Thomas Monjalon @ 2019-10-23 22:04 UTC (permalink / raw)
  To: kirankumark
  Cc: dev, Adrien Mazarguil, Wenzhuo Lu, Jingjing Wu,
	Bernard Iremonger, John McNamara, Marko Kovacevic, Ferruh Yigit,
	Andrew Rybchenko, Olivier Matz, ajit.khaparde

22/10/2019 06:16, kirankumark@marvell.com:
> --- a/doc/api/doxy-api-index.md
> +++ b/doc/api/doxy-api-index.md
> @@ -101,7 +101,8 @@ The public API headers are grouped by topics:
>    [GSO]                (@ref rte_gso.h),
>    [frag/reass]         (@ref rte_ip_frag.h),
>    [LPM IPv4 route]     (@ref rte_lpm.h),
> -  [LPM IPv6 route]     (@ref rte_lpm6.h)
> +  [LPM IPv6 route]     (@ref rte_lpm6.h),
> +  [HIGIG]              (@ref rte_higig.h)

Sorry, my comment is a bit late, but I would prefer to see HIGIG earlier in this list.
You say it is a protocol at layer 2.5, so it should be listed probably close to ICMP.
What is your opinion?




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

end of thread, other threads:[~2019-10-23 22:05 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14  4:29 [dpdk-dev] [PATCH] ethdev: add HIGIG2 key field to flow API kirankumark
2019-10-14  7:08 ` Andrew Rybchenko
2019-10-15  4:23   ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda
2019-10-15  6:20 ` [dpdk-dev] " kirankumark
2019-10-15  6:27   ` Jerin Jacob
2019-10-15  6:57     ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda
2019-10-15  8:22     ` [dpdk-dev] " Ananyev, Konstantin
2019-10-15  8:32   ` [dpdk-dev] [PATCH v3] " kirankumark
2019-10-17  4:15     ` [dpdk-dev] [PATCH v4] " kirankumark
2019-10-17  9:08       ` Andrew Rybchenko
2019-10-18  4:13       ` [dpdk-dev] [PATCH v5] " kirankumark
2019-10-18  7:36         ` Andrew Rybchenko
2019-10-18 17:36         ` Ferruh Yigit
2019-10-19  4:51           ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda
2019-10-19  4:56         ` [dpdk-dev] [PATCH v6] " kirankumark
2019-10-19  9:47           ` Jerin Jacob
2019-10-20  4:52           ` [dpdk-dev] [PATCH v7] " kirankumark
2019-10-20 13:56             ` Jerin Jacob
2019-10-21  3:52             ` [dpdk-dev] [PATCH v8] " kirankumark
2019-10-21  9:16               ` [dpdk-dev] [PATCH v9] " kirankumark
2019-10-21 16:48                 ` Olivier Matz
2019-10-22  4:16                 ` [dpdk-dev] [PATCH v10] " kirankumark
2019-10-22  9:19                   ` Ferruh Yigit
2019-10-23 10:50                     ` Raslan Darawsheh
2019-10-23 11:39                       ` Olivier Matz
2019-10-23 11:43                         ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda
2019-10-23 14:04                           ` Olivier Matz
2019-10-23 14:14                             ` Ferruh Yigit
2019-10-23 22:04                   ` [dpdk-dev] " Thomas Monjalon
2019-10-15 16:47 ` [dpdk-dev] [PATCH] " Stephen Hemminger
2019-10-16  3:14   ` [dpdk-dev] [EXT] " Kiran Kumar Kokkilagadda

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).