DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] ethdev: add PFCP header to flow API
@ 2020-02-20  4:02 Xiao Zhang
  2020-03-03  8:48 ` Ori Kam
  2020-03-06  6:39 ` [dpdk-dev] [v2] " Xiao Zhang
  0 siblings, 2 replies; 6+ messages in thread
From: Xiao Zhang @ 2020-02-20  4:02 UTC (permalink / raw)
  To: dev; +Cc: arybchenko, ferruh.yigit, Xiao Zhang

This patch adds the new flow item RTE_FLOW_ITEM_TYPE_PFCP to flow API to
match a PFCP header.
Add sample PFCP rules for testpmd guide. Since Session Endpoint
Identifier (SEID) only will be present in PFCP Session header and PFCP
Session headers shall be identified when the S field is equal to 1, when
create rules for PFCP Session header with certain SEID the S field need
be set 1.

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
 app/test-pmd/cmdline_flow.c                 | 37 +++++++++++++++++++++++++++++
 doc/guides/prog_guide/rte_flow.rst          | 11 +++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 20 ++++++++++++++++
 lib/librte_ethdev/rte_flow.c                |  1 +
 lib/librte_ethdev/rte_flow.h                | 31 ++++++++++++++++++++++++
 5 files changed, 100 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index c2cc4c5..0b735cd 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -220,6 +220,9 @@ enum index {
 	ITEM_L2TPV3OIP_SESSION_ID,
 	ITEM_ESP,
 	ITEM_ESP_SPI,
+	ITEM_PFCP,
+	ITEM_PFCP_S_FIELD,
+	ITEM_PFCP_SEID,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -768,6 +771,7 @@ static const enum index next_item[] = {
 	ITEM_TAG,
 	ITEM_L2TPV3OIP,
 	ITEM_ESP,
+	ITEM_PFCP,
 	END_SET,
 	ZERO,
 };
@@ -1046,6 +1050,13 @@ static const enum index item_esp[] = {
 	ZERO,
 };
 
+static const enum index item_pfcp[] = {
+	ITEM_PFCP_S_FIELD,
+	ITEM_PFCP_SEID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2699,6 +2710,26 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
 				hdr.spi)),
 	},
+	[ITEM_PFCP] = {
+		.name = "pfcp",
+		.help = "match pfcp header",
+		.priv = PRIV_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
+		.next = NEXT(item_pfcp),
+		.call = parse_vc,
+	},
+	[ITEM_PFCP_S_FIELD] = {
+		.name = "s_field",
+		.help = "S field",
+		.next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp,
+				s_field)),
+	},
+	[ITEM_PFCP_SEID] = {
+		.name = "seid",
+		.help = "session endpoint identifier",
+		.next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp, seid)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6444,6 +6475,9 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
+	case RTE_FLOW_ITEM_TYPE_PFCP:
+		mask = &rte_flow_item_pfcp_mask;
+		break;
 	default:
 		break;
 	}
@@ -6541,6 +6575,9 @@ cmd_set_raw_parsed(const struct buffer *in)
 			size = sizeof(struct rte_flow_item_esp);
 			proto = 0x32;
 			break;
+		case RTE_FLOW_ITEM_TYPE_PFCP:
+			size = sizeof(struct rte_flow_item_pfcp);
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 371819e..2851cee 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1344,6 +1344,17 @@ Matches a L2TPv3 over IP header.
 - ``session_id``: L2TPv3 over IP session identifier.
 - Default ``mask`` matches session_id only.
 
+Item: ``PFCP``
+^^^^^^^^^^^^
+
+Matches a PFCP Header.
+
+- ``s_field``: S field.
+- ``msg_type``: message type.
+- ``msg_len``: message length.
+- ``seid``: session endpoint identifier.
+- Default ``mask`` matches s_field and seid.
+
 Actions
 ~~~~~~~
 
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 5103ff9..3d05d5f 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3987,6 +3987,11 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
 
+- ``pfcp``: match PFCP header.
+
+  - ``s_field {unsigned}``: S field.
+  - ``seid {unsigned}``: session endpoint identifier.
+
 Actions list
 ^^^^^^^^^^^^
 
@@ -4822,6 +4827,21 @@ ESP rules can be created by the following commands::
  testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
         actions queue index 3 / end
 
+Sample PFCP rules
+~~~~~~~~~~~~~~~~
+
+PFCP rules can be created by the following commands(s_field need to be 1
+if seid is set)::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end
+        actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1
+        seid is 1 / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end
+        actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
+        seid is 1 / end actions queue index 3 / end
+
 BPF Functions
 --------------
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 885a7ff..a5ac1c7 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -94,6 +94,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
 	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 	MK_FLOW_ITEM(L2TPV3OIP, sizeof(struct rte_flow_item_l2tpv3oip)),
+	MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
 };
 
 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 5625dc4..9addf1c 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -520,6 +520,13 @@ enum rte_flow_item_type {
 	 */
 	RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
 
+	/**
+	 * Matches PFCP Header.
+	 * See struct rte_flow_item_pfcp.
+	 *
+	 */
+	RTE_FLOW_ITEM_TYPE_PFCP,
+
 };
 
 /**
@@ -1509,6 +1516,30 @@ static const struct rte_flow_item_ah rte_flow_item_ah_mask = {
 #endif
 
 /**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ITEM_TYPE_PFCP
+ *
+ * Match PFCP Header
+ *
+ */
+struct rte_flow_item_pfcp {
+	uint8_t s_field;
+	uint8_t msg_type;
+	uint16_t msg_len;
+	uint64_t seid;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */
+#ifndef __cplusplus
+static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
+	.s_field = 0x01,
+	.seid = 0xffffffffffffffff,
+};
+#endif
+
+/**
  * Matching pattern item definition.
  *
  * A pattern is formed by stacking items starting from the lowest protocol
-- 
2.7.4


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

* Re: [dpdk-dev] ethdev: add PFCP header to flow API
  2020-02-20  4:02 [dpdk-dev] ethdev: add PFCP header to flow API Xiao Zhang
@ 2020-03-03  8:48 ` Ori Kam
  2020-03-06  6:48   ` Zhang, Xiao
  2020-03-06  6:39 ` [dpdk-dev] [v2] " Xiao Zhang
  1 sibling, 1 reply; 6+ messages in thread
From: Ori Kam @ 2020-03-03  8:48 UTC (permalink / raw)
  To: Xiao Zhang, dev; +Cc: arybchenko, ferruh.yigit

Hi Xiao,

Sorry for delayed response.

Thanks,
Ori

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xiao Zhang
> Sent: Thursday, February 20, 2020 6:02 AM
> To: dev@dpdk.org
> Cc: arybchenko@solarflare.com; ferruh.yigit@intel.com; Xiao Zhang
> <xiao.zhang@intel.com>
> Subject: [dpdk-dev] ethdev: add PFCP header to flow API
> 
> This patch adds the new flow item RTE_FLOW_ITEM_TYPE_PFCP to flow API to
> match a PFCP header.
> Add sample PFCP rules for testpmd guide. Since Session Endpoint
> Identifier (SEID) only will be present in PFCP Session header and PFCP
> Session headers shall be identified when the S field is equal to 1, when
> create rules for PFCP Session header with certain SEID the S field need
> be set 1.
> 
> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> ---
>  app/test-pmd/cmdline_flow.c                 | 37
> +++++++++++++++++++++++++++++
>  doc/guides/prog_guide/rte_flow.rst          | 11 +++++++++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 20 ++++++++++++++++
>  lib/librte_ethdev/rte_flow.c                |  1 +
>  lib/librte_ethdev/rte_flow.h                | 31 ++++++++++++++++++++++++
>  5 files changed, 100 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index c2cc4c5..0b735cd 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -220,6 +220,9 @@ enum index {
>  	ITEM_L2TPV3OIP_SESSION_ID,
>  	ITEM_ESP,
>  	ITEM_ESP_SPI,
> +	ITEM_PFCP,
> +	ITEM_PFCP_S_FIELD,
> +	ITEM_PFCP_SEID,
> 
>  	/* Validate/create actions. */
>  	ACTIONS,
> @@ -768,6 +771,7 @@ static const enum index next_item[] = {
>  	ITEM_TAG,
>  	ITEM_L2TPV3OIP,
>  	ITEM_ESP,
> +	ITEM_PFCP,
>  	END_SET,
>  	ZERO,
>  };
> @@ -1046,6 +1050,13 @@ static const enum index item_esp[] = {
>  	ZERO,
>  };
> 
> +static const enum index item_pfcp[] = {
> +	ITEM_PFCP_S_FIELD,
> +	ITEM_PFCP_SEID,
> +	ITEM_NEXT,
> +	ZERO,
> +};
> +
>  static const enum index next_set_raw[] = {
>  	SET_RAW_INDEX,
>  	ITEM_ETH,
> @@ -2699,6 +2710,26 @@ static const struct token token_list[] = {
>  		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
>  				hdr.spi)),
>  	},
> +	[ITEM_PFCP] = {
> +		.name = "pfcp",
> +		.help = "match pfcp header",
> +		.priv = PRIV_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
> +		.next = NEXT(item_pfcp),
> +		.call = parse_vc,
> +	},
> +	[ITEM_PFCP_S_FIELD] = {
> +		.name = "s_field",
> +		.help = "S field",
> +		.next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED),
> item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp,
> +				s_field)),
> +	},
> +	[ITEM_PFCP_SEID] = {
> +		.name = "seid",
> +		.help = "session endpoint identifier",
> +		.next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED),
> item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp,
> seid)),
> +	},
>  	/* Validate/create actions. */
>  	[ACTIONS] = {
>  		.name = "actions",
> @@ -6444,6 +6475,9 @@ flow_item_default_mask(const struct rte_flow_item
> *item)
>  	case RTE_FLOW_ITEM_TYPE_ESP:
>  		mask = &rte_flow_item_esp_mask;
>  		break;
> +	case RTE_FLOW_ITEM_TYPE_PFCP:
> +		mask = &rte_flow_item_pfcp_mask;
> +		break;
>  	default:
>  		break;
>  	}
> @@ -6541,6 +6575,9 @@ cmd_set_raw_parsed(const struct buffer *in)
>  			size = sizeof(struct rte_flow_item_esp);
>  			proto = 0x32;
>  			break;
> +		case RTE_FLOW_ITEM_TYPE_PFCP:
> +			size = sizeof(struct rte_flow_item_pfcp);
> +			break;
>  		default:
>  			printf("Error - Not supported item\n");
>  			*total_size = 0;
> diff --git a/doc/guides/prog_guide/rte_flow.rst
> b/doc/guides/prog_guide/rte_flow.rst
> index 371819e..2851cee 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -1344,6 +1344,17 @@ Matches a L2TPv3 over IP header.
>  - ``session_id``: L2TPv3 over IP session identifier.
>  - Default ``mask`` matches session_id only.
> 
> +Item: ``PFCP``
> +^^^^^^^^^^^^
> +
> +Matches a PFCP Header.
> +
> +- ``s_field``: S field.
> +- ``msg_type``: message type.
> +- ``msg_len``: message length.
> +- ``seid``: session endpoint identifier.
> +- Default ``mask`` matches s_field and seid.
> +
>  Actions
>  ~~~~~~~
> 
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 5103ff9..3d05d5f 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -3987,6 +3987,11 @@ This section lists supported pattern items and their
> attributes, if any.
> 
>    - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
> 
> +- ``pfcp``: match PFCP header.
> +
> +  - ``s_field {unsigned}``: S field.
> +  - ``seid {unsigned}``: session endpoint identifier.
> +
>  Actions list
>  ^^^^^^^^^^^^
> 
> @@ -4822,6 +4827,21 @@ ESP rules can be created by the following
> commands::
>   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
>          actions queue index 3 / end
> 
> +Sample PFCP rules
> +~~~~~~~~~~~~~~~~
> +
> +PFCP rules can be created by the following commands(s_field need to be 1
> +if seid is set)::
> +
> + testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end
> +        actions queue index 3 / end
> + testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1
> +        seid is 1 / end actions queue index 3 / end
> + testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end
> +        actions queue index 3 / end
> + testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
> +        seid is 1 / end actions queue index 3 / end
> +
>  BPF Functions
>  --------------
> 
> diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
> index 885a7ff..a5ac1c7 100644
> --- a/lib/librte_ethdev/rte_flow.c
> +++ b/lib/librte_ethdev/rte_flow.c
> @@ -94,6 +94,7 @@ static const struct rte_flow_desc_data
> rte_flow_desc_item[] = {
>  	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
>  	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
>  	MK_FLOW_ITEM(L2TPV3OIP, sizeof(struct rte_flow_item_l2tpv3oip)),
> +	MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
>  };
> 
>  /** Generate flow_action[] entry. */
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 5625dc4..9addf1c 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -520,6 +520,13 @@ enum rte_flow_item_type {
>  	 */
>  	RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
> 
> +	/**
> +	 * Matches PFCP Header.
> +	 * See struct rte_flow_item_pfcp.
> +	 *
> +	 */
> +	RTE_FLOW_ITEM_TYPE_PFCP,
> +
>  };
> 
>  /**
> @@ -1509,6 +1516,30 @@ static const struct rte_flow_item_ah
> rte_flow_item_ah_mask = {
>  #endif
> 
>  /**
> + * @warning
> + * @b EXPERIMENTAL: this structure may change without prior notice
> + *
> + * RTE_FLOW_ITEM_TYPE_PFCP
> + *
> + * Match PFCP Header
> + *
> + */
> +struct rte_flow_item_pfcp {
> +	uint8_t s_field;
> +	uint8_t msg_type;
> +	uint16_t msg_len;
> +	uint64_t seid;
> +};

I think this should be in BE format.

> +
> +/** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */
> +#ifndef __cplusplus
> +static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
> +	.s_field = 0x01,
> +	.seid = 0xffffffffffffffff,
> +};
> +#endif
> +
> +/**
>   * Matching pattern item definition.
>   *
>   * A pattern is formed by stacking items starting from the lowest protocol
> --
> 2.7.4


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

* [dpdk-dev] [v2] ethdev: add PFCP header to flow API
  2020-02-20  4:02 [dpdk-dev] ethdev: add PFCP header to flow API Xiao Zhang
  2020-03-03  8:48 ` Ori Kam
@ 2020-03-06  6:39 ` Xiao Zhang
  2020-03-09 16:31   ` Ori Kam
  1 sibling, 1 reply; 6+ messages in thread
From: Xiao Zhang @ 2020-03-06  6:39 UTC (permalink / raw)
  To: dev; +Cc: orika, ferruh.yigit, Xiao Zhang

This patch adds the new flow item RTE_FLOW_ITEM_TYPE_PFCP to flow API to
match a PFCP header.
Add sample PFCP rules for testpmd guide. Since Session Endpoint
Identifier (SEID) only will be present in PFCP Session header and PFCP
Session headers shall be identified when the S field is equal to 1, when
create rules for PFCP Session header with certain SEID the S field need
be set 1.

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
v2 - change type of msg_len and seid to BE format.
---
 app/test-pmd/cmdline_flow.c                 | 37 +++++++++++++++++++++++++++++
 doc/guides/prog_guide/rte_flow.rst          | 11 +++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 20 ++++++++++++++++
 lib/librte_ethdev/rte_flow.c                |  1 +
 lib/librte_ethdev/rte_flow.h                | 31 ++++++++++++++++++++++++
 5 files changed, 100 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index c2cc4c5..0b735cd 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -220,6 +220,9 @@ enum index {
 	ITEM_L2TPV3OIP_SESSION_ID,
 	ITEM_ESP,
 	ITEM_ESP_SPI,
+	ITEM_PFCP,
+	ITEM_PFCP_S_FIELD,
+	ITEM_PFCP_SEID,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -768,6 +771,7 @@ static const enum index next_item[] = {
 	ITEM_TAG,
 	ITEM_L2TPV3OIP,
 	ITEM_ESP,
+	ITEM_PFCP,
 	END_SET,
 	ZERO,
 };
@@ -1046,6 +1050,13 @@ static const enum index item_esp[] = {
 	ZERO,
 };
 
+static const enum index item_pfcp[] = {
+	ITEM_PFCP_S_FIELD,
+	ITEM_PFCP_SEID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_set_raw[] = {
 	SET_RAW_INDEX,
 	ITEM_ETH,
@@ -2699,6 +2710,26 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
 				hdr.spi)),
 	},
+	[ITEM_PFCP] = {
+		.name = "pfcp",
+		.help = "match pfcp header",
+		.priv = PRIV_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
+		.next = NEXT(item_pfcp),
+		.call = parse_vc,
+	},
+	[ITEM_PFCP_S_FIELD] = {
+		.name = "s_field",
+		.help = "S field",
+		.next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp,
+				s_field)),
+	},
+	[ITEM_PFCP_SEID] = {
+		.name = "seid",
+		.help = "session endpoint identifier",
+		.next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp, seid)),
+	},
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6444,6 +6475,9 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
+	case RTE_FLOW_ITEM_TYPE_PFCP:
+		mask = &rte_flow_item_pfcp_mask;
+		break;
 	default:
 		break;
 	}
@@ -6541,6 +6575,9 @@ cmd_set_raw_parsed(const struct buffer *in)
 			size = sizeof(struct rte_flow_item_esp);
 			proto = 0x32;
 			break;
+		case RTE_FLOW_ITEM_TYPE_PFCP:
+			size = sizeof(struct rte_flow_item_pfcp);
+			break;
 		default:
 			printf("Error - Not supported item\n");
 			*total_size = 0;
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 371819e..2851cee 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1344,6 +1344,17 @@ Matches a L2TPv3 over IP header.
 - ``session_id``: L2TPv3 over IP session identifier.
 - Default ``mask`` matches session_id only.
 
+Item: ``PFCP``
+^^^^^^^^^^^^
+
+Matches a PFCP Header.
+
+- ``s_field``: S field.
+- ``msg_type``: message type.
+- ``msg_len``: message length.
+- ``seid``: session endpoint identifier.
+- Default ``mask`` matches s_field and seid.
+
 Actions
 ~~~~~~~
 
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 5103ff9..3d05d5f 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3987,6 +3987,11 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
 
+- ``pfcp``: match PFCP header.
+
+  - ``s_field {unsigned}``: S field.
+  - ``seid {unsigned}``: session endpoint identifier.
+
 Actions list
 ^^^^^^^^^^^^
 
@@ -4822,6 +4827,21 @@ ESP rules can be created by the following commands::
  testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
         actions queue index 3 / end
 
+Sample PFCP rules
+~~~~~~~~~~~~~~~~
+
+PFCP rules can be created by the following commands(s_field need to be 1
+if seid is set)::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end
+        actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1
+        seid is 1 / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end
+        actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
+        seid is 1 / end actions queue index 3 / end
+
 BPF Functions
 --------------
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 885a7ff..a5ac1c7 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -94,6 +94,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
 	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
 	MK_FLOW_ITEM(L2TPV3OIP, sizeof(struct rte_flow_item_l2tpv3oip)),
+	MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
 };
 
 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 5625dc4..b43238b 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -520,6 +520,13 @@ enum rte_flow_item_type {
 	 */
 	RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
 
+	/**
+	 * Matches PFCP Header.
+	 * See struct rte_flow_item_pfcp.
+	 *
+	 */
+	RTE_FLOW_ITEM_TYPE_PFCP,
+
 };
 
 /**
@@ -1509,6 +1516,30 @@ static const struct rte_flow_item_ah rte_flow_item_ah_mask = {
 #endif
 
 /**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ITEM_TYPE_PFCP
+ *
+ * Match PFCP Header
+ *
+ */
+struct rte_flow_item_pfcp {
+	uint8_t s_field;
+	uint8_t msg_type;
+	rte_be16_t msg_len;
+	rte_be64_t seid;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */
+#ifndef __cplusplus
+static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
+	.s_field = 0x01,
+	.seid = RTE_BE64(0xffffffffffffffff),
+};
+#endif
+
+/**
  * Matching pattern item definition.
  *
  * A pattern is formed by stacking items starting from the lowest protocol
-- 
2.7.4


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

* Re: [dpdk-dev] ethdev: add PFCP header to flow API
  2020-03-03  8:48 ` Ori Kam
@ 2020-03-06  6:48   ` Zhang, Xiao
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Xiao @ 2020-03-06  6:48 UTC (permalink / raw)
  To: Ori Kam, dev; +Cc: arybchenko, Yigit, Ferruh



> -----Original Message-----
> From: Ori Kam [mailto:orika@mellanox.com]
> Sent: Tuesday, March 3, 2020 4:49 PM
> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> Cc: arybchenko@solarflare.com; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: RE: [dpdk-dev] ethdev: add PFCP header to flow API
> 
> Hi Xiao,
> 
> Sorry for delayed response.
> 
> Thanks,
> Ori
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Xiao Zhang
> > Sent: Thursday, February 20, 2020 6:02 AM
> > To: dev@dpdk.org
> > Cc: arybchenko@solarflare.com; ferruh.yigit@intel.com; Xiao Zhang
> > <xiao.zhang@intel.com>
> > Subject: [dpdk-dev] ethdev: add PFCP header to flow API
> >
> > This patch adds the new flow item RTE_FLOW_ITEM_TYPE_PFCP to flow API
> > to match a PFCP header.
> > Add sample PFCP rules for testpmd guide. Since Session Endpoint
> > Identifier (SEID) only will be present in PFCP Session header and PFCP
> > Session headers shall be identified when the S field is equal to 1,
> > when create rules for PFCP Session header with certain SEID the S
> > field need be set 1.
> >
> > Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> > ---
> >  app/test-pmd/cmdline_flow.c                 | 37
> > +++++++++++++++++++++++++++++
> >  doc/guides/prog_guide/rte_flow.rst          | 11 +++++++++
> >  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 20 ++++++++++++++++
> >  lib/librte_ethdev/rte_flow.c                |  1 +
> >  lib/librte_ethdev/rte_flow.h                | 31 ++++++++++++++++++++++++
> >  5 files changed, 100 insertions(+)
> >
> > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> > index c2cc4c5..0b735cd 100644
> > --- a/app/test-pmd/cmdline_flow.c
> > +++ b/app/test-pmd/cmdline_flow.c
> > @@ -220,6 +220,9 @@ enum index {
> >  	ITEM_L2TPV3OIP_SESSION_ID,
> >  	ITEM_ESP,
> >  	ITEM_ESP_SPI,
> > +	ITEM_PFCP,
> > +	ITEM_PFCP_S_FIELD,
> > +	ITEM_PFCP_SEID,
> >
> >  	/* Validate/create actions. */
> >  	ACTIONS,
> > @@ -768,6 +771,7 @@ static const enum index next_item[] = {
> >  	ITEM_TAG,
> >  	ITEM_L2TPV3OIP,
> >  	ITEM_ESP,
> > +	ITEM_PFCP,
> >  	END_SET,
> >  	ZERO,
> >  };
> > @@ -1046,6 +1050,13 @@ static const enum index item_esp[] = {
> >  	ZERO,
> >  };
> >
> > +static const enum index item_pfcp[] = {
> > +	ITEM_PFCP_S_FIELD,
> > +	ITEM_PFCP_SEID,
> > +	ITEM_NEXT,
> > +	ZERO,
> > +};
> > +
> >  static const enum index next_set_raw[] = {
> >  	SET_RAW_INDEX,
> >  	ITEM_ETH,
> > @@ -2699,6 +2710,26 @@ static const struct token token_list[] = {
> >  		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
> >  				hdr.spi)),
> >  	},
> > +	[ITEM_PFCP] = {
> > +		.name = "pfcp",
> > +		.help = "match pfcp header",
> > +		.priv = PRIV_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
> > +		.next = NEXT(item_pfcp),
> > +		.call = parse_vc,
> > +	},
> > +	[ITEM_PFCP_S_FIELD] = {
> > +		.name = "s_field",
> > +		.help = "S field",
> > +		.next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED),
> > item_param),
> > +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp,
> > +				s_field)),
> > +	},
> > +	[ITEM_PFCP_SEID] = {
> > +		.name = "seid",
> > +		.help = "session endpoint identifier",
> > +		.next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED),
> > item_param),
> > +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp,
> > seid)),
> > +	},
> >  	/* Validate/create actions. */
> >  	[ACTIONS] = {
> >  		.name = "actions",
> > @@ -6444,6 +6475,9 @@ flow_item_default_mask(const struct
> > rte_flow_item
> > *item)
> >  	case RTE_FLOW_ITEM_TYPE_ESP:
> >  		mask = &rte_flow_item_esp_mask;
> >  		break;
> > +	case RTE_FLOW_ITEM_TYPE_PFCP:
> > +		mask = &rte_flow_item_pfcp_mask;
> > +		break;
> >  	default:
> >  		break;
> >  	}
> > @@ -6541,6 +6575,9 @@ cmd_set_raw_parsed(const struct buffer *in)
> >  			size = sizeof(struct rte_flow_item_esp);
> >  			proto = 0x32;
> >  			break;
> > +		case RTE_FLOW_ITEM_TYPE_PFCP:
> > +			size = sizeof(struct rte_flow_item_pfcp);
> > +			break;
> >  		default:
> >  			printf("Error - Not supported item\n");
> >  			*total_size = 0;
> > diff --git a/doc/guides/prog_guide/rte_flow.rst
> > b/doc/guides/prog_guide/rte_flow.rst
> > index 371819e..2851cee 100644
> > --- a/doc/guides/prog_guide/rte_flow.rst
> > +++ b/doc/guides/prog_guide/rte_flow.rst
> > @@ -1344,6 +1344,17 @@ Matches a L2TPv3 over IP header.
> >  - ``session_id``: L2TPv3 over IP session identifier.
> >  - Default ``mask`` matches session_id only.
> >
> > +Item: ``PFCP``
> > +^^^^^^^^^^^^
> > +
> > +Matches a PFCP Header.
> > +
> > +- ``s_field``: S field.
> > +- ``msg_type``: message type.
> > +- ``msg_len``: message length.
> > +- ``seid``: session endpoint identifier.
> > +- Default ``mask`` matches s_field and seid.
> > +
> >  Actions
> >  ~~~~~~~
> >
> > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > index 5103ff9..3d05d5f 100644
> > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > @@ -3987,6 +3987,11 @@ This section lists supported pattern items and
> > their attributes, if any.
> >
> >    - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
> >
> > +- ``pfcp``: match PFCP header.
> > +
> > +  - ``s_field {unsigned}``: S field.
> > +  - ``seid {unsigned}``: session endpoint identifier.
> > +
> >  Actions list
> >  ^^^^^^^^^^^^
> >
> > @@ -4822,6 +4827,21 @@ ESP rules can be created by the following
> > commands::
> >   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
> >          actions queue index 3 / end
> >
> > +Sample PFCP rules
> > +~~~~~~~~~~~~~~~~
> > +
> > +PFCP rules can be created by the following commands(s_field need to
> > +be 1 if seid is set)::
> > +
> > + testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is
> > + testpmd> 0 / end
> > +        actions queue index 3 / end
> > + testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is
> > + testpmd> 1
> > +        seid is 1 / end actions queue index 3 / end
> > + testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is
> > + testpmd> 0 / end
> > +        actions queue index 3 / end
> > + testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is
> > + testpmd> 1
> > +        seid is 1 / end actions queue index 3 / end
> > +
> >  BPF Functions
> >  --------------
> >
> > diff --git a/lib/librte_ethdev/rte_flow.c
> > b/lib/librte_ethdev/rte_flow.c index 885a7ff..a5ac1c7 100644
> > --- a/lib/librte_ethdev/rte_flow.c
> > +++ b/lib/librte_ethdev/rte_flow.c
> > @@ -94,6 +94,7 @@ static const struct rte_flow_desc_data
> > rte_flow_desc_item[] = {
> >  	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
> >  	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
> >  	MK_FLOW_ITEM(L2TPV3OIP, sizeof(struct rte_flow_item_l2tpv3oip)),
> > +	MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
> >  };
> >
> >  /** Generate flow_action[] entry. */
> > diff --git a/lib/librte_ethdev/rte_flow.h
> > b/lib/librte_ethdev/rte_flow.h index 5625dc4..9addf1c 100644
> > --- a/lib/librte_ethdev/rte_flow.h
> > +++ b/lib/librte_ethdev/rte_flow.h
> > @@ -520,6 +520,13 @@ enum rte_flow_item_type {
> >  	 */
> >  	RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
> >
> > +	/**
> > +	 * Matches PFCP Header.
> > +	 * See struct rte_flow_item_pfcp.
> > +	 *
> > +	 */
> > +	RTE_FLOW_ITEM_TYPE_PFCP,
> > +
> >  };
> >
> >  /**
> > @@ -1509,6 +1516,30 @@ static const struct rte_flow_item_ah
> > rte_flow_item_ah_mask = {  #endif
> >
> >  /**
> > + * @warning
> > + * @b EXPERIMENTAL: this structure may change without prior notice
> > + *
> > + * RTE_FLOW_ITEM_TYPE_PFCP
> > + *
> > + * Match PFCP Header
> > + *
> > + */
> > +struct rte_flow_item_pfcp {
> > +	uint8_t s_field;
> > +	uint8_t msg_type;
> > +	uint16_t msg_len;
> > +	uint64_t seid;
> > +};
> 
> I think this should be in BE format.

Yes, I changed the type to BE format in v2 patch. Thanks for reviewing.

> 
> > +
> > +/** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */ #ifndef __cplusplus
> > +static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
> > +	.s_field = 0x01,
> > +	.seid = 0xffffffffffffffff,
> > +};
> > +#endif
> > +
> > +/**
> >   * Matching pattern item definition.
> >   *
> >   * A pattern is formed by stacking items starting from the lowest
> > protocol
> > --
> > 2.7.4


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

* Re: [dpdk-dev] [v2] ethdev: add PFCP header to flow API
  2020-03-06  6:39 ` [dpdk-dev] [v2] " Xiao Zhang
@ 2020-03-09 16:31   ` Ori Kam
  2020-03-10 14:45     ` Ferruh Yigit
  0 siblings, 1 reply; 6+ messages in thread
From: Ori Kam @ 2020-03-09 16:31 UTC (permalink / raw)
  To: Xiao Zhang, dev; +Cc: ferruh.yigit



> -----Original Message-----
> From: Xiao Zhang <xiao.zhang@intel.com>
> Sent: Friday, March 6, 2020 8:39 AM
> To: dev@dpdk.org
> Cc: Ori Kam <orika@mellanox.com>; ferruh.yigit@intel.com; Xiao Zhang
> <xiao.zhang@intel.com>
> Subject: [v2] ethdev: add PFCP header to flow API
> 
> This patch adds the new flow item RTE_FLOW_ITEM_TYPE_PFCP to flow API to
> match a PFCP header.
> Add sample PFCP rules for testpmd guide. Since Session Endpoint
> Identifier (SEID) only will be present in PFCP Session header and PFCP
> Session headers shall be identified when the S field is equal to 1, when
> create rules for PFCP Session header with certain SEID the S field need
> be set 1.
> 
> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> ---
> v2 - change type of msg_len and seid to BE format.
> ---
>  app/test-pmd/cmdline_flow.c                 | 37
> +++++++++++++++++++++++++++++
>  doc/guides/prog_guide/rte_flow.rst          | 11 +++++++++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst | 20 ++++++++++++++++
>  lib/librte_ethdev/rte_flow.c                |  1 +
>  lib/librte_ethdev/rte_flow.h                | 31 ++++++++++++++++++++++++
>  5 files changed, 100 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index c2cc4c5..0b735cd 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -220,6 +220,9 @@ enum index {
>  	ITEM_L2TPV3OIP_SESSION_ID,
>  	ITEM_ESP,
>  	ITEM_ESP_SPI,
> +	ITEM_PFCP,
> +	ITEM_PFCP_S_FIELD,
> +	ITEM_PFCP_SEID,
> 
>  	/* Validate/create actions. */
>  	ACTIONS,
> @@ -768,6 +771,7 @@ static const enum index next_item[] = {
>  	ITEM_TAG,
>  	ITEM_L2TPV3OIP,
>  	ITEM_ESP,
> +	ITEM_PFCP,
>  	END_SET,
>  	ZERO,
>  };
> @@ -1046,6 +1050,13 @@ static const enum index item_esp[] = {
>  	ZERO,
>  };
> 
> +static const enum index item_pfcp[] = {
> +	ITEM_PFCP_S_FIELD,
> +	ITEM_PFCP_SEID,
> +	ITEM_NEXT,
> +	ZERO,
> +};
> +
>  static const enum index next_set_raw[] = {
>  	SET_RAW_INDEX,
>  	ITEM_ETH,
> @@ -2699,6 +2710,26 @@ static const struct token token_list[] = {
>  		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp,
>  				hdr.spi)),
>  	},
> +	[ITEM_PFCP] = {
> +		.name = "pfcp",
> +		.help = "match pfcp header",
> +		.priv = PRIV_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
> +		.next = NEXT(item_pfcp),
> +		.call = parse_vc,
> +	},
> +	[ITEM_PFCP_S_FIELD] = {
> +		.name = "s_field",
> +		.help = "S field",
> +		.next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED),
> item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp,
> +				s_field)),
> +	},
> +	[ITEM_PFCP_SEID] = {
> +		.name = "seid",
> +		.help = "session endpoint identifier",
> +		.next = NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED),
> item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp,
> seid)),
> +	},
>  	/* Validate/create actions. */
>  	[ACTIONS] = {
>  		.name = "actions",
> @@ -6444,6 +6475,9 @@ flow_item_default_mask(const struct rte_flow_item
> *item)
>  	case RTE_FLOW_ITEM_TYPE_ESP:
>  		mask = &rte_flow_item_esp_mask;
>  		break;
> +	case RTE_FLOW_ITEM_TYPE_PFCP:
> +		mask = &rte_flow_item_pfcp_mask;
> +		break;
>  	default:
>  		break;
>  	}
> @@ -6541,6 +6575,9 @@ cmd_set_raw_parsed(const struct buffer *in)
>  			size = sizeof(struct rte_flow_item_esp);
>  			proto = 0x32;
>  			break;
> +		case RTE_FLOW_ITEM_TYPE_PFCP:
> +			size = sizeof(struct rte_flow_item_pfcp);
> +			break;
>  		default:
>  			printf("Error - Not supported item\n");
>  			*total_size = 0;
> diff --git a/doc/guides/prog_guide/rte_flow.rst
> b/doc/guides/prog_guide/rte_flow.rst
> index 371819e..2851cee 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -1344,6 +1344,17 @@ Matches a L2TPv3 over IP header.
>  - ``session_id``: L2TPv3 over IP session identifier.
>  - Default ``mask`` matches session_id only.
> 
> +Item: ``PFCP``
> +^^^^^^^^^^^^
> +
> +Matches a PFCP Header.
> +
> +- ``s_field``: S field.
> +- ``msg_type``: message type.
> +- ``msg_len``: message length.
> +- ``seid``: session endpoint identifier.
> +- Default ``mask`` matches s_field and seid.
> +
>  Actions
>  ~~~~~~~
> 
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index 5103ff9..3d05d5f 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -3987,6 +3987,11 @@ This section lists supported pattern items and their
> attributes, if any.
> 
>    - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
> 
> +- ``pfcp``: match PFCP header.
> +
> +  - ``s_field {unsigned}``: S field.
> +  - ``seid {unsigned}``: session endpoint identifier.
> +
>  Actions list
>  ^^^^^^^^^^^^
> 
> @@ -4822,6 +4827,21 @@ ESP rules can be created by the following
> commands::
>   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
>          actions queue index 3 / end
> 
> +Sample PFCP rules
> +~~~~~~~~~~~~~~~~
> +
> +PFCP rules can be created by the following commands(s_field need to be 1
> +if seid is set)::
> +
> + testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end
> +        actions queue index 3 / end
> + testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1
> +        seid is 1 / end actions queue index 3 / end
> + testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end
> +        actions queue index 3 / end
> + testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
> +        seid is 1 / end actions queue index 3 / end
> +
>  BPF Functions
>  --------------
> 
> diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
> index 885a7ff..a5ac1c7 100644
> --- a/lib/librte_ethdev/rte_flow.c
> +++ b/lib/librte_ethdev/rte_flow.c
> @@ -94,6 +94,7 @@ static const struct rte_flow_desc_data
> rte_flow_desc_item[] = {
>  	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
>  	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
>  	MK_FLOW_ITEM(L2TPV3OIP, sizeof(struct rte_flow_item_l2tpv3oip)),
> +	MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
>  };
> 
>  /** Generate flow_action[] entry. */
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 5625dc4..b43238b 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -520,6 +520,13 @@ enum rte_flow_item_type {
>  	 */
>  	RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
> 
> +	/**
> +	 * Matches PFCP Header.
> +	 * See struct rte_flow_item_pfcp.
> +	 *
> +	 */
> +	RTE_FLOW_ITEM_TYPE_PFCP,
> +
>  };
> 
>  /**
> @@ -1509,6 +1516,30 @@ static const struct rte_flow_item_ah
> rte_flow_item_ah_mask = {
>  #endif
> 
>  /**
> + * @warning
> + * @b EXPERIMENTAL: this structure may change without prior notice
> + *
> + * RTE_FLOW_ITEM_TYPE_PFCP
> + *
> + * Match PFCP Header
> + *
> + */
> +struct rte_flow_item_pfcp {
> +	uint8_t s_field;
> +	uint8_t msg_type;
> +	rte_be16_t msg_len;
> +	rte_be64_t seid;
> +};
> +
> +/** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */
> +#ifndef __cplusplus
> +static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
> +	.s_field = 0x01,
> +	.seid = RTE_BE64(0xffffffffffffffff),
> +};
> +#endif
> +
> +/**
>   * Matching pattern item definition.
>   *
>   * A pattern is formed by stacking items starting from the lowest protocol
> --
> 2.7.4

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


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

* Re: [dpdk-dev] [v2] ethdev: add PFCP header to flow API
  2020-03-09 16:31   ` Ori Kam
@ 2020-03-10 14:45     ` Ferruh Yigit
  0 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2020-03-10 14:45 UTC (permalink / raw)
  To: Ori Kam, Xiao Zhang, dev

On 3/9/2020 4:31 PM, Ori Kam wrote:
> 
> 
>> -----Original Message-----
>> From: Xiao Zhang <xiao.zhang@intel.com>
>> Sent: Friday, March 6, 2020 8:39 AM
>> To: dev@dpdk.org
>> Cc: Ori Kam <orika@mellanox.com>; ferruh.yigit@intel.com; Xiao Zhang
>> <xiao.zhang@intel.com>
>> Subject: [v2] ethdev: add PFCP header to flow API
>>
>> This patch adds the new flow item RTE_FLOW_ITEM_TYPE_PFCP to flow API to
>> match a PFCP header.
>> Add sample PFCP rules for testpmd guide. Since Session Endpoint
>> Identifier (SEID) only will be present in PFCP Session header and PFCP
>> Session headers shall be identified when the S field is equal to 1, when
>> create rules for PFCP Session header with certain SEID the S field need
>> be set 1.
>>
>> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> 
> Acked-by: Ori Kam <orika@mellanox.com>
> 

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

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

end of thread, other threads:[~2020-03-10 14:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-20  4:02 [dpdk-dev] ethdev: add PFCP header to flow API Xiao Zhang
2020-03-03  8:48 ` Ori Kam
2020-03-06  6:48   ` Zhang, Xiao
2020-03-06  6:39 ` [dpdk-dev] [v2] " Xiao Zhang
2020-03-09 16:31   ` Ori Kam
2020-03-10 14:45     ` Ferruh Yigit

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