[05/10] app/testpmd: support IPv6 fragment extension item

Message ID a09aadb5f015a61e4e8551d091dbb833cb579263.1601474841.git.dekelp@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series support match on L3 fragmented packets |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Dekel Peled Sept. 30, 2020, 2:10 p.m. UTC
rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch updates testpmd CLI to support the new item and its fields.

To match on fragmented IPv6 packets, this item is added to pattern:
... ipv6 / ipv6_frag_ext ...

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
  

Comments

Ori Kam Sept. 30, 2020, 2:56 p.m. UTC | #1
> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Wednesday, September 30, 2020 5:10 PM
> Cc: dev@dpdk.org
> Subject: [PATCH 05/10] app/testpmd: support IPv6 fragment extension item
> 
> rte_flow update, following RFC [1], added to ethdev the rte_flow item
> ipv6_frag_ext.
> This patch updates testpmd CLI to support the new item and its fields.
> 
> To match on fragmented IPv6 packets, this item is added to pattern:
> ... ipv6 / ipv6_frag_ext ...
> 
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmails.dpd
> k.org%2Farchives%2Fdev%2F2020-
> March%2F160255.html&amp;data=02%7C01%7Corika%40nvidia.com%7C1effc
> aa06bc943080a7408d8654aec04%7C43083d15727340c1b7db39efd9ccc17a%7C
> 0%7C1%7C637370719741604850&amp;sdata=zgkbW7cwAMc9gKHeCvtDhQvFB
> c5605SqbfMF6hO3iPU%3D&amp;reserved=0
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---
>  app/test-pmd/cmdline_flow.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 55cc30f..ef166e3 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -193,6 +193,9 @@ enum index {
>  	ITEM_ARP_ETH_IPV4_TPA,
>  	ITEM_IPV6_EXT,
>  	ITEM_IPV6_EXT_NEXT_HDR,
> +	ITEM_IPV6_FRAG_EXT,
> +	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
> +	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
>  	ITEM_ICMP6,
>  	ITEM_ICMP6_TYPE,
>  	ITEM_ICMP6_CODE,
> @@ -784,6 +787,7 @@ struct parse_action_priv {
>  	ITEM_VXLAN_GPE,
>  	ITEM_ARP_ETH_IPV4,
>  	ITEM_IPV6_EXT,
> +	ITEM_IPV6_FRAG_EXT,
>  	ITEM_ICMP6,
>  	ITEM_ICMP6_ND_NS,
>  	ITEM_ICMP6_ND_NA,
> @@ -1003,6 +1007,13 @@ struct parse_action_priv {
>  	ZERO,
>  };
> 
> +static const enum index item_ipv6_frag_ext[] = {
> +	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
> +	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
> +	ITEM_NEXT,
> +	ZERO,
> +};
> +
>  static const enum index item_icmp6[] = {
>  	ITEM_ICMP6_TYPE,
>  	ITEM_ICMP6_CODE,
> @@ -2560,6 +2571,30 @@ static int comp_set_raw_index(struct context *,
> const struct token *,
>  		.args = ARGS(ARGS_ENTRY_HTON(struct
> rte_flow_item_ipv6_ext,
>  					     next_hdr)),
>  	},
> +	[ITEM_IPV6_FRAG_EXT] = {
> +		.name = "ipv6_frag_ext",
> +		.help = "match presence of IPv6 fragment extension header",
> +		.priv = PRIV_ITEM(IPV6_FRAG_EXT,
> +				sizeof(struct rte_flow_item_ipv6_frag_ext)),
> +		.next = NEXT(item_ipv6_frag_ext),
> +		.call = parse_vc,
> +	},
> +	[ITEM_IPV6_FRAG_EXT_NEXT_HDR] = {
> +		.name = "next_hdr",
> +		.help = "next header",
> +		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
> +			     item_param),
> +		.args = ARGS(ARGS_ENTRY(struct
> rte_flow_item_ipv6_frag_ext,
> +					hdr.next_header)),
> +	},
> +	[ITEM_IPV6_FRAG_EXT_FRAG_DATA] = {
> +		.name = "frag_data",
> +		.help = "Fragment flags and offset",
> +		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
> +			     item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct
> rte_flow_item_ipv6_frag_ext,
> +					     hdr.frag_data)),
> +	},
>  	[ITEM_ICMP6] = {
>  		.name = "icmp6",
>  		.help = "match any ICMPv6 header",
> --
> 1.8.3.1

Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori
  

Patch

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 55cc30f..ef166e3 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -193,6 +193,9 @@  enum index {
 	ITEM_ARP_ETH_IPV4_TPA,
 	ITEM_IPV6_EXT,
 	ITEM_IPV6_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT,
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
 	ITEM_ICMP6,
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -784,6 +787,7 @@  struct parse_action_priv {
 	ITEM_VXLAN_GPE,
 	ITEM_ARP_ETH_IPV4,
 	ITEM_IPV6_EXT,
+	ITEM_IPV6_FRAG_EXT,
 	ITEM_ICMP6,
 	ITEM_ICMP6_ND_NS,
 	ITEM_ICMP6_ND_NA,
@@ -1003,6 +1007,13 @@  struct parse_action_priv {
 	ZERO,
 };
 
+static const enum index item_ipv6_frag_ext[] = {
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_icmp6[] = {
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -2560,6 +2571,30 @@  static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_ext,
 					     next_hdr)),
 	},
+	[ITEM_IPV6_FRAG_EXT] = {
+		.name = "ipv6_frag_ext",
+		.help = "match presence of IPv6 fragment extension header",
+		.priv = PRIV_ITEM(IPV6_FRAG_EXT,
+				sizeof(struct rte_flow_item_ipv6_frag_ext)),
+		.next = NEXT(item_ipv6_frag_ext),
+		.call = parse_vc,
+	},
+	[ITEM_IPV6_FRAG_EXT_NEXT_HDR] = {
+		.name = "next_hdr",
+		.help = "next header",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_ipv6_frag_ext,
+					hdr.next_header)),
+	},
+	[ITEM_IPV6_FRAG_EXT_FRAG_DATA] = {
+		.name = "frag_data",
+		.help = "Fragment flags and offset",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_frag_ext,
+					     hdr.frag_data)),
+	},
 	[ITEM_ICMP6] = {
 		.name = "icmp6",
 		.help = "match any ICMPv6 header",