[dpdk-dev,2/2] app/testpmd: support GENEVE pattern item in flow rules

Message ID 1511166121-743-3-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andrew Rybchenko Nov. 20, 2017, 8:22 a.m. UTC
  From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>

Add the ability to match a VNI field of GENEVE protocol header.

Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test-pmd/cmdline_flow.c                 | 31 +++++++++++++++++++++++++++++
 app/test-pmd/config.c                       |  1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  5 +++++
 3 files changed, 37 insertions(+)
  

Comments

Adrien Mazarguil Nov. 23, 2017, 9:40 a.m. UTC | #1
On Mon, Nov 20, 2017 at 08:22:01AM +0000, Andrew Rybchenko wrote:
> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> 
> Add the ability to match a VNI field of GENEVE protocol header.
> 
> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

Same comments as previously basically, keep the same order as rte_flow.h
after fixing the ABI breakage.

One minor comment below.

> ---
>  app/test-pmd/cmdline_flow.c                 | 31 +++++++++++++++++++++++++++++
>  app/test-pmd/config.c                       |  1 +
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  5 +++++
>  3 files changed, 37 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index df16d2a..cee99f3 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -161,6 +161,9 @@ enum index {
>  	ITEM_SCTP_CKSUM,
>  	ITEM_VXLAN,
>  	ITEM_VXLAN_VNI,
> +	ITEM_GENEVE,
> +	ITEM_GENEVE_VNI,
> +	ITEM_GENEVE_PROTO,
>  	ITEM_E_TAG,
>  	ITEM_E_TAG_GRP_ECID_B,
>  	ITEM_NVGRE,
> @@ -452,6 +455,7 @@ static const enum index next_item[] = {
>  	ITEM_TCP,
>  	ITEM_SCTP,
>  	ITEM_VXLAN,
> +	ITEM_GENEVE,
>  	ITEM_E_TAG,
>  	ITEM_NVGRE,
>  	ITEM_MPLS,
> @@ -573,6 +577,13 @@ static const enum index item_vxlan[] = {
>  	ZERO,
>  };
>  
> +static const enum index item_geneve[] = {
> +	ITEM_GENEVE_VNI,
> +	ITEM_GENEVE_PROTO,
> +	ITEM_NEXT,
> +	ZERO,
> +};
> +
>  static const enum index item_e_tag[] = {
>  	ITEM_E_TAG_GRP_ECID_B,
>  	ITEM_NEXT,
> @@ -1371,6 +1382,26 @@ static const struct token token_list[] = {
>  		.next = NEXT(item_vxlan, NEXT_ENTRY(UNSIGNED), item_param),
>  		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, vni)),
>  	},
> +	[ITEM_GENEVE] = {
> +		.name = "geneve",
> +		.help = "match GENEVE header",
> +		.priv = PRIV_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)),
> +		.next = NEXT(item_geneve),
> +		.call = parse_vc,
> +	},
> +	[ITEM_GENEVE_VNI] = {
> +		.name = "vni",
> +		.help = "Virtual Network Identifier",

How about "virtual network identifier" (all lower caps)?

> +		.next = NEXT(item_geneve, NEXT_ENTRY(UNSIGNED), item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_geneve, vni)),
> +	},
> +	[ITEM_GENEVE_PROTO] = {
> +		.name = "protocol",
> +		.help = "GENEVE protocol type",
> +		.next = NEXT(item_geneve, NEXT_ENTRY(UNSIGNED), item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_geneve,
> +					     protocol)),
> +	},
>  	[ITEM_E_TAG] = {
>  		.name = "e_tag",
>  		.help = "match E-Tag header",
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index cd2ac11..4eda37f 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -965,6 +965,7 @@ static const struct {
>  	MK_FLOW_ITEM(TCP, sizeof(struct rte_flow_item_tcp)),
>  	MK_FLOW_ITEM(SCTP, sizeof(struct rte_flow_item_sctp)),
>  	MK_FLOW_ITEM(VXLAN, sizeof(struct rte_flow_item_vxlan)),
> +	MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)),
>  	MK_FLOW_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)),
>  	MK_FLOW_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)),
>  	MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)),
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 9789139..8c2fd12 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -3083,6 +3083,11 @@ This section lists supported pattern items and their attributes, if any.
>  
>    - ``vni {unsigned}``: VXLAN identifier.
>  
> +- ``geneve``: match GENEVE header.
> +
> +  - ``vni {unsigned}``: virtual network identifier.
> +  - ``protocol {unsigned}``: protocol type.
> +
>  - ``e_tag``: match IEEE 802.1BR E-Tag header.
>  
>    - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
> -- 
> 2.7.4
>
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index df16d2a..cee99f3 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -161,6 +161,9 @@  enum index {
 	ITEM_SCTP_CKSUM,
 	ITEM_VXLAN,
 	ITEM_VXLAN_VNI,
+	ITEM_GENEVE,
+	ITEM_GENEVE_VNI,
+	ITEM_GENEVE_PROTO,
 	ITEM_E_TAG,
 	ITEM_E_TAG_GRP_ECID_B,
 	ITEM_NVGRE,
@@ -452,6 +455,7 @@  static const enum index next_item[] = {
 	ITEM_TCP,
 	ITEM_SCTP,
 	ITEM_VXLAN,
+	ITEM_GENEVE,
 	ITEM_E_TAG,
 	ITEM_NVGRE,
 	ITEM_MPLS,
@@ -573,6 +577,13 @@  static const enum index item_vxlan[] = {
 	ZERO,
 };
 
+static const enum index item_geneve[] = {
+	ITEM_GENEVE_VNI,
+	ITEM_GENEVE_PROTO,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_e_tag[] = {
 	ITEM_E_TAG_GRP_ECID_B,
 	ITEM_NEXT,
@@ -1371,6 +1382,26 @@  static const struct token token_list[] = {
 		.next = NEXT(item_vxlan, NEXT_ENTRY(UNSIGNED), item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, vni)),
 	},
+	[ITEM_GENEVE] = {
+		.name = "geneve",
+		.help = "match GENEVE header",
+		.priv = PRIV_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)),
+		.next = NEXT(item_geneve),
+		.call = parse_vc,
+	},
+	[ITEM_GENEVE_VNI] = {
+		.name = "vni",
+		.help = "Virtual Network Identifier",
+		.next = NEXT(item_geneve, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_geneve, vni)),
+	},
+	[ITEM_GENEVE_PROTO] = {
+		.name = "protocol",
+		.help = "GENEVE protocol type",
+		.next = NEXT(item_geneve, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_geneve,
+					     protocol)),
+	},
 	[ITEM_E_TAG] = {
 		.name = "e_tag",
 		.help = "match E-Tag header",
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cd2ac11..4eda37f 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -965,6 +965,7 @@  static const struct {
 	MK_FLOW_ITEM(TCP, sizeof(struct rte_flow_item_tcp)),
 	MK_FLOW_ITEM(SCTP, sizeof(struct rte_flow_item_sctp)),
 	MK_FLOW_ITEM(VXLAN, sizeof(struct rte_flow_item_vxlan)),
+	MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)),
 	MK_FLOW_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)),
 	MK_FLOW_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)),
 	MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)),
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 9789139..8c2fd12 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3083,6 +3083,11 @@  This section lists supported pattern items and their attributes, if any.
 
   - ``vni {unsigned}``: VXLAN identifier.
 
+- ``geneve``: match GENEVE header.
+
+  - ``vni {unsigned}``: virtual network identifier.
+  - ``protocol {unsigned}``: protocol type.
+
 - ``e_tag``: match IEEE 802.1BR E-Tag header.
 
   - ``grp_ecid_b {unsigned}``: GRP and E-CID base.