[V2] ethdev: add flow API support for P4-programmable devices

Message ID 20230925123344.3237627-1-cristian.dumitrescu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [V2] ethdev: add flow API support for P4-programmable devices |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Cristian Dumitrescu Sept. 25, 2023, 12:33 p.m. UTC
  This patch introduces the new "program" action type to enable flow API
support for P4-programmable devices.

In the case of P4-programmable devices, the device is initially blank.
The flow items and actions are defined by the user (outside of any
vendor control) through the P4 program, which is typically compiled
into firmware that is loaded on the device at init time. These flow
items and actions are then used during the run-time phase to add flows
on the device.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
Change log:

V2:
-Adjusted field names and improved some comments based on Ori's feedback:
https://mails.dpdk.org/archives/dev/2023-September/277358.html

V1:
-Incorporated the feedback from the DPDK Summit 2023, sincere thanks
to the many colleagues who contributed!
-Based on Ori's suggestion, decided to reuse the existing "flex" flow
item instead of defining a new flow item, so only the new "program"
action type is required.

RFC:
-RFC link: https://mails.dpdk.org/archives/dev/2023-August/273703.html

 lib/ethdev/rte_flow.h | 50 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
  

Comments

Ori Kam Sept. 26, 2023, 9:25 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> Sent: Monday, September 25, 2023 3:34 PM
> Subject: [PATCH V2] ethdev: add flow API support for P4-programmable
> devices
> 
> This patch introduces the new "program" action type to enable flow API
> support for P4-programmable devices.
> 
> In the case of P4-programmable devices, the device is initially blank.
> The flow items and actions are defined by the user (outside of any
> vendor control) through the P4 program, which is typically compiled
> into firmware that is loaded on the device at init time. These flow
> items and actions are then used during the run-time phase to add flows
> on the device.
> 
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
> Change log:
> 
> V2:
> -Adjusted field names and improved some comments based on Ori's
> feedback:
> https://mails.dpdk.org/archives/dev/2023-September/277358.html
> 
> V1:
> -Incorporated the feedback from the DPDK Summit 2023, sincere thanks
> to the many colleagues who contributed!
> -Based on Ori's suggestion, decided to reuse the existing "flex" flow
> item instead of defining a new flow item, so only the new "program"
> action type is required.
> 
> RFC:
> -RFC link: https://mails.dpdk.org/archives/dev/2023-August/273703.html
> 
>  lib/ethdev/rte_flow.h | 50 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index 2ebb76dbc0..fe2bb9c948 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -2981,6 +2981,15 @@ enum rte_flow_action_type {
>  	 * @see struct rte_flow_action_indirect_list
>  	 */
>  	RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
> +
> +	/**
> +	 * Program action. These actions are defined by the program currently
> +	 * loaded on the device. For example, these actions are applicable to
> +	 * devices that can be programmed through the P4 language.
> +	 *
> +	 * @see struct rte_flow_action_prog.
> +	 */
> +	RTE_FLOW_ACTION_TYPE_PROG,
>  };
> 
>  /**
> @@ -4055,6 +4064,48 @@ struct
> rte_flow_indirect_update_flow_meter_mark {
>  	enum rte_color init_color;
>  };
> 
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this structure may change without prior notice.
> + *
> + * Program action argument configuration parameters.
> + *
> + * For each action argument, its *size* must be non-zero and its *value*
> must
> + * point to a valid array of *size* bytes specified in network byte order.
> + *
> + * @see struct rte_flow_action_prog
> + */
> +struct rte_flow_action_prog_argument {
> +	/** Argument name. */
> +	const char *name;
> +	/** Argument size in bytes. */
> +	uint32_t size;
> +	/** Argument value. */
> +	const uint8_t *value;
> +};
> +
> +/**
> + * @warning
> + * @b EXPERIMENTAL: this structure may change without prior notice.
> + *
> + * RTE_FLOW_ACTION_TYPE_PROG
> + *
> + * Program action configuration parameters.
> + *
> + * Each action can have zero or more arguments. When *args_num* is non-
> zero, the
> + * *args* parameter must point to a valid array of *args_num* elements.
> + *
> + * @see RTE_FLOW_ACTION_TYPE_PROG
> + */
> +struct rte_flow_action_prog {
> +	/** Action name. */
> +	const char *name;
> +	/** Number of action arguments. */
> +	uint32_t args_num;
> +	/** Action arguments array. */
> +	const struct rte_flow_action_prog_argument *args;
> +};
> +
>  /* Mbuf dynamic field offset for metadata. */
>  extern int32_t rte_flow_dynf_metadata_offs;
> 
> --
> 2.34.1


Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
  
Ferruh Yigit Sept. 28, 2023, 9:19 a.m. UTC | #2
On 9/26/2023 10:25 AM, Ori Kam wrote:
> Hi,
> 
>> -----Original Message-----
>> From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>> Sent: Monday, September 25, 2023 3:34 PM
>> Subject: [PATCH V2] ethdev: add flow API support for P4-programmable
>> devices
>>
>> This patch introduces the new "program" action type to enable flow API
>> support for P4-programmable devices.
>>
>> In the case of P4-programmable devices, the device is initially blank.
>> The flow items and actions are defined by the user (outside of any
>> vendor control) through the P4 program, which is typically compiled
>> into firmware that is loaded on the device at init time. These flow
>> items and actions are then used during the run-time phase to add flows
>> on the device.
>>
>> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
>> 
> 
> 
> Acked-by: Ori Kam <orika@nvidia.com>
> 
> 

Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>


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

Patch

diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 2ebb76dbc0..fe2bb9c948 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -2981,6 +2981,15 @@  enum rte_flow_action_type {
 	 * @see struct rte_flow_action_indirect_list
 	 */
 	RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
+
+	/**
+	 * Program action. These actions are defined by the program currently
+	 * loaded on the device. For example, these actions are applicable to
+	 * devices that can be programmed through the P4 language.
+	 *
+	 * @see struct rte_flow_action_prog.
+	 */
+	RTE_FLOW_ACTION_TYPE_PROG,
 };
 
 /**
@@ -4055,6 +4064,48 @@  struct rte_flow_indirect_update_flow_meter_mark {
 	enum rte_color init_color;
 };
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice.
+ *
+ * Program action argument configuration parameters.
+ *
+ * For each action argument, its *size* must be non-zero and its *value* must
+ * point to a valid array of *size* bytes specified in network byte order.
+ *
+ * @see struct rte_flow_action_prog
+ */
+struct rte_flow_action_prog_argument {
+	/** Argument name. */
+	const char *name;
+	/** Argument size in bytes. */
+	uint32_t size;
+	/** Argument value. */
+	const uint8_t *value;
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice.
+ *
+ * RTE_FLOW_ACTION_TYPE_PROG
+ *
+ * Program action configuration parameters.
+ *
+ * Each action can have zero or more arguments. When *args_num* is non-zero, the
+ * *args* parameter must point to a valid array of *args_num* elements.
+ *
+ * @see RTE_FLOW_ACTION_TYPE_PROG
+ */
+struct rte_flow_action_prog {
+	/** Action name. */
+	const char *name;
+	/** Number of action arguments. */
+	uint32_t args_num;
+	/** Action arguments array. */
+	const struct rte_flow_action_prog_argument *args;
+};
+
 /* Mbuf dynamic field offset for metadata. */
 extern int32_t rte_flow_dynf_metadata_offs;