Skip to contentSkip to conversation

ethdev: fast path async flow API

PATCH Superseded Dariusz Sosnowski 4 participants 16 messages Jan 30, 2024 – Feb 7, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethdev: fast path async flow API

This patch reworks the async flow API functions called in data path, to reduce the overhead during flow operations at the library level. Main source of the overhead was indirection and checks done while ethdev library was fetching rte_flow_ops from a given driver.

This patch introduces rte_flow_fp_ops struct which holds callbacks to driver's implementation of fast path async flow API functions. Each driver implementing these functions must populate flow_fp_ops field inside rte_eth_dev structure with a reference to its own implementation.
By default, ethdev library provides dummy callbacks with implementations returning ENOSYS.
Such design provides a few assumptions:

- rte_flow_fp_ops struct for given port is always available.
- Each callback is either:
- Default provided by library.
- Set up by driver.

As a result, no checks for availability of the implementation are needed at library level in data path.
Any library-level validation checks in async flow API are compiled if and only if RTE_FLOW_DEBUG macro is defined.

These changes apply only to the following API functions:

- rte_flow_async_create()
- rte_flow_async_create_by_index()
- rte_flow_async_actions_update()
- rte_flow_async_destroy()
- rte_flow_push()
- rte_flow_pull()
- rte_flow_async_action_handle_create()
- rte_flow_async_action_handle_destroy()
- rte_flow_async_action_handle_update()
- rte_flow_async_action_handle_query()
- rte_flow_async_action_handle_query_update()
- rte_flow_async_action_list_handle_create()
- rte_flow_async_action_list_handle_destroy()
- rte_flow_async_action_list_handle_query_update()

This patch also adjusts the mlx5 PMD to the introduced flow API changes.

---
 doc/guides/rel_notes/release_24_03.rst |  37 ++
 drivers/net/mlx5/mlx5_flow.c           | 608 +------------------------
 drivers/net/mlx5/mlx5_flow_hw.c        |  24 +
 lib/ethdev/ethdev_driver.c             |   4 +
 lib/ethdev/ethdev_driver.h             |   4 +
 lib/ethdev/rte_flow.c                  | 518 ++++++++++++++++-----
 lib/ethdev/rte_flow_driver.h           | 277 ++++++-----
 lib/ethdev/version.map                 |   2 +
 8 files changed, 634 insertions(+), 840 deletions(-)
doc/guides/rel_notes/release_24_03.rst +37 -0
index 84d3144215..55e7d57096 100644
@@ -106,6 +106,43 @@ API Changes
 
 * gso: ``rte_gso_segment`` now returns -ENOTSUP for unknown protocols.
 
+* ethdev: PMDs implementing asynchronous flow operations are required to provide relevant functions
+  implementation through ``rte_flow_fp_ops`` struct, instead of ``rte_flow_ops`` struct.
+  Pointer to device-dependent ``rte_flow_fp_ops`` should be provided to ``rte_eth_dev.flow_fp_ops``.
+  This change applies to the following API functions:
+
+   * ``rte_flow_async_create``
+   * ``rte_flow_async_create_by_index``
+   * ``rte_flow_async_actions_update``
+   * ``rte_flow_async_destroy``
+   * ``rte_flow_push``
+   * ``rte_flow_pull``
+   * ``rte_flow_async_action_handle_create``
+   * ``rte_flow_async_action_handle_destroy``
+   * ``rte_flow_async_action_handle_update``
+   * ``rte_flow_async_action_handle_query``
+   * ``rte_flow_async_action_handle_query_update``
+   * ``rte_flow_async_action_list_handle_create``
+   * ``rte_flow_async_action_list_handle_destroy``
+   * ``rte_flow_async_action_list_handle_query_update``
+
+* ethdev: Removed the following fields from ``rte_flow_ops`` struct:
+
+   * ``async_create``
+   * ``async_create_by_index``
+   * ``async_actions_update``
+   * ``async_destroy``
+   * ``push``
+   * ``pull``
+   * ``async_action_handle_create``
+   * ``async_action_handle_destroy``
+   * ``async_action_handle_update``
+   * ``async_action_handle_query``
+   * ``async_action_handle_query_update``
+   * ``async_action_list_handle_create``
+   * ``async_action_list_handle_destroy``
+   * ``async_action_list_handle_query_update``
+
 
 ABI Changes
 -----------
drivers/net/mlx5/mlx5_flow.c +1 -607

659 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow_hw.c +24 -0
index da873ae2e2..6f0659fa52 100644
@@ -3,6 +3,7 @@
  */
 
 #include <rte_flow.h>
+#include <rte_flow_driver.h>
 
 #include <mlx5_malloc.h>
 
@@ -14,6 +15,9 @@
 #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
 #include "mlx5_hws_cnt.h"
 
+/** Fast path async flow API functions. */
+static struct rte_flow_fp_ops mlx5_flow_hw_fp_ops;
+
 /* The maximum actions support in the flow. */
 #define MLX5_HW_MAX_ACTS 16
 
@@ -9543,6 +9547,7 @@ flow_hw_configure(struct rte_eth_dev *dev,
 		mlx5_free(_queue_attr);
 	if (port_attr->flags & RTE_FLOW_PORT_FLAG_STRICT_QUEUE)
 		priv->hws_strict_queue = 1;
+	dev->flow_fp_ops = &mlx5_flow_hw_fp_ops;
 	return 0;
 err:
 	if (priv->hws_ctpool) {
@@ -9617,6 +9622,7 @@ flow_hw_resource_release(struct rte_eth_dev *dev)
 
 	if (!priv->dr_ctx)
 		return;
+	dev->flow_fp_ops = &rte_flow_fp_default_ops;
 	flow_hw_rxq_flag_set(dev, false);
 	flow_hw_flush_all_ctrl_flows(dev);
 	flow_hw_cleanup_tx_repr_tagging(dev);
@@ -12993,3 +12999,21 @@ mlx5_reformat_action_destroy(struct rte_eth_dev *dev,
 	return 0;
 }
 #endif
+
+static struct rte_flow_fp_ops mlx5_flow_hw_fp_ops = {
+	.async_create = flow_hw_async_flow_create,
+	.async_create_by_index = flow_hw_async_flow_create_by_index,
+	.async_actions_update = flow_hw_async_flow_update,
+	.async_destroy = flow_hw_async_flow_destroy,
+	.push = flow_hw_push,
+	.pull = flow_hw_pull,
+	.async_action_handle_create = flow_hw_action_handle_create,
+	.async_action_handle_destroy = flow_hw_action_handle_destroy,
+	.async_action_handle_update = flow_hw_action_handle_update,
+	.async_action_handle_query = flow_hw_action_handle_query,
+	.async_action_handle_query_update = flow_hw_async_action_handle_query_update,
+	.async_action_list_handle_create = flow_hw_async_action_list_handle_create,
+	.async_action_list_handle_destroy = flow_hw_async_action_list_handle_destroy,
+	.async_action_list_handle_query_update =
+		flow_hw_async_action_list_handle_query_update,
+};
lib/ethdev/ethdev_driver.c +4 -0
index bd917a15fc..34909a3018 100644
@@ -10,6 +10,7 @@
 
 #include "ethdev_driver.h"
 #include "ethdev_private.h"
+#include "rte_flow_driver.h"
 
 /**
  * A set of values to describe the possible states of a switch domain.
@@ -110,6 +111,7 @@ rte_eth_dev_allocate(const char *name)
 	}
 
 	eth_dev = eth_dev_get(port_id);
+	eth_dev->flow_fp_ops = &rte_flow_fp_default_ops;
 	strlcpy(eth_dev->data->name, name, sizeof(eth_dev->data->name));
 	eth_dev->data->port_id = port_id;
 	eth_dev->data->backer_port_id = RTE_MAX_ETHPORTS;
@@ -245,6 +247,8 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
 
 	eth_dev_fp_ops_reset(rte_eth_fp_ops + eth_dev->data->port_id);
 
+	eth_dev->flow_fp_ops = &rte_flow_fp_default_ops;
+
 	rte_spinlock_lock(rte_mcfg_ethdev_get_lock());
 
 	eth_dev->state = RTE_ETH_DEV_UNUSED;
lib/ethdev/ethdev_driver.h +4 -0
index f05f68a67c..2dfa8e238b 100644
@@ -73,6 +73,10 @@ struct rte_eth_dev {
 	struct rte_eth_dev_data *data;
 	void *process_private; /**< Pointer to per-process device data */
 	const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
+	/**
+	 * Fast path flow API functions exported by PMD.
+	 */
+	const struct rte_flow_fp_ops *flow_fp_ops;
 	struct rte_device *device; /**< Backing device */
 	struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
 
lib/ethdev/rte_flow.c +403 -115

636 lines not on this page · raw message

lib/ethdev/rte_flow_driver.h +159 -118

301 lines not on this page · raw message

lib/ethdev/version.map +2 -0
index a050baab0f..61e38a9f00 100644
@@ -348,4 +348,6 @@ INTERNAL {
 	rte_eth_representor_id_get;
 	rte_eth_switch_domain_alloc;
 	rte_eth_switch_domain_free;
+
+	rte_flow_fp_default_ops;
 };
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 ethdev: fast path async flow API

This patch reworks the async flow API functions called in data path, to reduce the overhead during flow operations at the library level. Main source of the overhead was indirection and checks done while ethdev library was fetching rte_flow_ops from a given driver.

This patch introduces rte_flow_fp_ops struct which holds callbacks to driver's implementation of fast path async flow API functions. Each driver implementing these functions must populate flow_fp_ops field inside rte_eth_dev structure with a reference to its own implementation.
By default, ethdev library provides dummy callbacks with implementations returning ENOSYS.
Such design provides a few assumptions:

- rte_flow_fp_ops struct for given port is always available.
- Each callback is either:
- Default provided by library.
- Set up by driver.

As a result, no checks for availability of the implementation are needed at library level in data path.
Any library-level validation checks in async flow API are compiled if and only if RTE_FLOW_DEBUG macro is defined.

These changes apply only to the following API functions:

- rte_flow_async_create()
- rte_flow_async_create_by_index()
- rte_flow_async_actions_update()
- rte_flow_async_destroy()
- rte_flow_push()
- rte_flow_pull()
- rte_flow_async_action_handle_create()
- rte_flow_async_action_handle_destroy()
- rte_flow_async_action_handle_update()
- rte_flow_async_action_handle_query()
- rte_flow_async_action_handle_query_update()
- rte_flow_async_action_list_handle_create()
- rte_flow_async_action_list_handle_destroy()
- rte_flow_async_action_list_handle_query_update()

This patch also adjusts the mlx5 PMD to the introduced flow API changes.

---
v2:
- Fixed mlx5 PMD build issue with older versions of rdma-core.

---
 doc/guides/rel_notes/release_24_03.rst |  37 ++
 drivers/net/mlx5/mlx5_flow.c           | 608 +------------------------
 drivers/net/mlx5/mlx5_flow_hw.c        |  25 +
 lib/ethdev/ethdev_driver.c             |   4 +
 lib/ethdev/ethdev_driver.h             |   4 +
 lib/ethdev/rte_flow.c                  | 518 ++++++++++++++++-----
 lib/ethdev/rte_flow_driver.h           | 277 ++++++-----
 lib/ethdev/version.map                 |   2 +
 8 files changed, 635 insertions(+), 840 deletions(-)
doc/guides/rel_notes/release_24_03.rst +37 -0
index 84d3144215..55e7d57096 100644
@@ -106,6 +106,43 @@ API Changes
 
 * gso: ``rte_gso_segment`` now returns -ENOTSUP for unknown protocols.
 
+* ethdev: PMDs implementing asynchronous flow operations are required to provide relevant functions
+  implementation through ``rte_flow_fp_ops`` struct, instead of ``rte_flow_ops`` struct.
+  Pointer to device-dependent ``rte_flow_fp_ops`` should be provided to ``rte_eth_dev.flow_fp_ops``.
+  This change applies to the following API functions:
+
+   * ``rte_flow_async_create``
+   * ``rte_flow_async_create_by_index``
+   * ``rte_flow_async_actions_update``
+   * ``rte_flow_async_destroy``
+   * ``rte_flow_push``
+   * ``rte_flow_pull``
+   * ``rte_flow_async_action_handle_create``
+   * ``rte_flow_async_action_handle_destroy``
+   * ``rte_flow_async_action_handle_update``
+   * ``rte_flow_async_action_handle_query``
+   * ``rte_flow_async_action_handle_query_update``
+   * ``rte_flow_async_action_list_handle_create``
+   * ``rte_flow_async_action_list_handle_destroy``
+   * ``rte_flow_async_action_list_handle_query_update``
+
+* ethdev: Removed the following fields from ``rte_flow_ops`` struct:
+
+   * ``async_create``
+   * ``async_create_by_index``
+   * ``async_actions_update``
+   * ``async_destroy``
+   * ``push``
+   * ``pull``
+   * ``async_action_handle_create``
+   * ``async_action_handle_destroy``
+   * ``async_action_handle_update``
+   * ``async_action_handle_query``
+   * ``async_action_handle_query_update``
+   * ``async_action_list_handle_create``
+   * ``async_action_list_handle_destroy``
+   * ``async_action_list_handle_query_update``
+
 
 ABI Changes
 -----------
drivers/net/mlx5/mlx5_flow.c +1 -607

659 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow_hw.c +25 -0
index da873ae2e2..c65ebfbba2 100644
@@ -3,6 +3,7 @@
  */
 
 #include <rte_flow.h>
+#include <rte_flow_driver.h>
 
 #include <mlx5_malloc.h>
 
@@ -14,6 +15,9 @@
 #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
 #include "mlx5_hws_cnt.h"
 
+/** Fast path async flow API functions. */
+static struct rte_flow_fp_ops mlx5_flow_hw_fp_ops;
+
 /* The maximum actions support in the flow. */
 #define MLX5_HW_MAX_ACTS 16
 
@@ -9543,6 +9547,7 @@ flow_hw_configure(struct rte_eth_dev *dev,
 		mlx5_free(_queue_attr);
 	if (port_attr->flags & RTE_FLOW_PORT_FLAG_STRICT_QUEUE)
 		priv->hws_strict_queue = 1;
+	dev->flow_fp_ops = &mlx5_flow_hw_fp_ops;
 	return 0;
 err:
 	if (priv->hws_ctpool) {
@@ -9617,6 +9622,7 @@ flow_hw_resource_release(struct rte_eth_dev *dev)
 
 	if (!priv->dr_ctx)
 		return;
+	dev->flow_fp_ops = &rte_flow_fp_default_ops;
 	flow_hw_rxq_flag_set(dev, false);
 	flow_hw_flush_all_ctrl_flows(dev);
 	flow_hw_cleanup_tx_repr_tagging(dev);
@@ -12992,4 +12998,23 @@ mlx5_reformat_action_destroy(struct rte_eth_dev *dev,
 	mlx5_free(handle);
 	return 0;
 }
+
+static struct rte_flow_fp_ops mlx5_flow_hw_fp_ops = {
+	.async_create = flow_hw_async_flow_create,
+	.async_create_by_index = flow_hw_async_flow_create_by_index,
+	.async_actions_update = flow_hw_async_flow_update,
+	.async_destroy = flow_hw_async_flow_destroy,
+	.push = flow_hw_push,
+	.pull = flow_hw_pull,
+	.async_action_handle_create = flow_hw_action_handle_create,
+	.async_action_handle_destroy = flow_hw_action_handle_destroy,
+	.async_action_handle_update = flow_hw_action_handle_update,
+	.async_action_handle_query = flow_hw_action_handle_query,
+	.async_action_handle_query_update = flow_hw_async_action_handle_query_update,
+	.async_action_list_handle_create = flow_hw_async_action_list_handle_create,
+	.async_action_list_handle_destroy = flow_hw_async_action_list_handle_destroy,
+	.async_action_list_handle_query_update =
+		flow_hw_async_action_list_handle_query_update,
+};
+
 #endif
lib/ethdev/ethdev_driver.c +4 -0
index bd917a15fc..34909a3018 100644
@@ -10,6 +10,7 @@
 
 #include "ethdev_driver.h"
 #include "ethdev_private.h"
+#include "rte_flow_driver.h"
 
 /**
  * A set of values to describe the possible states of a switch domain.
@@ -110,6 +111,7 @@ rte_eth_dev_allocate(const char *name)
 	}
 
 	eth_dev = eth_dev_get(port_id);
+	eth_dev->flow_fp_ops = &rte_flow_fp_default_ops;
 	strlcpy(eth_dev->data->name, name, sizeof(eth_dev->data->name));
 	eth_dev->data->port_id = port_id;
 	eth_dev->data->backer_port_id = RTE_MAX_ETHPORTS;
@@ -245,6 +247,8 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
 
 	eth_dev_fp_ops_reset(rte_eth_fp_ops + eth_dev->data->port_id);
 
+	eth_dev->flow_fp_ops = &rte_flow_fp_default_ops;
+
 	rte_spinlock_lock(rte_mcfg_ethdev_get_lock());
 
 	eth_dev->state = RTE_ETH_DEV_UNUSED;
lib/ethdev/ethdev_driver.h +4 -0
index f05f68a67c..2dfa8e238b 100644
@@ -73,6 +73,10 @@ struct rte_eth_dev {
 	struct rte_eth_dev_data *data;
 	void *process_private; /**< Pointer to per-process device data */
 	const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
+	/**
+	 * Fast path flow API functions exported by PMD.
+	 */
+	const struct rte_flow_fp_ops *flow_fp_ops;
 	struct rte_device *device; /**< Backing device */
 	struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
 
lib/ethdev/rte_flow.c +403 -115

636 lines not on this page · raw message

lib/ethdev/rte_flow_driver.h +159 -118

301 lines not on this page · raw message

lib/ethdev/version.map +2 -0
index a050baab0f..61e38a9f00 100644
@@ -348,4 +348,6 @@ INTERNAL {
 	rte_eth_representor_id_get;
 	rte_eth_switch_domain_alloc;
 	rte_eth_switch_domain_free;
+
+	rte_flow_fp_default_ops;
 };
Signature · 1 line
2.25.1
Acked-by on v2 1/1
#2 lore raw

Hi Draiusz,

Quoted 45 lines

-----Original Message-----
From: Dariusz Sosnowski <[email protected]>
Sent: Wednesday, January 31, 2024 11:35 AM

This patch reworks the async flow API functions called in data path, to reduce the overhead during flow operations at the library level. Main source of the overhead was indirection and checks done while ethdev library was fetching rte_flow_ops from a given driver.

This patch introduces rte_flow_fp_ops struct which holds callbacks to driver's implementation of fast path async flow API functions. Each driver implementing these functions must populate flow_fp_ops field inside rte_eth_dev structure with a reference to its own implementation.
By default, ethdev library provides dummy callbacks with implementations returning ENOSYS.
Such design provides a few assumptions:

- rte_flow_fp_ops struct for given port is always available.
- Each callback is either:
- Default provided by library.
- Set up by driver.

As a result, no checks for availability of the implementation are needed at library level in data path.
Any library-level validation checks in async flow API are compiled if and only if RTE_FLOW_DEBUG macro is defined.

These changes apply only to the following API functions:

- rte_flow_async_create()
- rte_flow_async_create_by_index()
- rte_flow_async_actions_update()
- rte_flow_async_destroy()
- rte_flow_push()
- rte_flow_pull()
- rte_flow_async_action_handle_create()
- rte_flow_async_action_handle_destroy()
- rte_flow_async_action_handle_update()
- rte_flow_async_action_handle_query()
- rte_flow_async_action_handle_query_update()
- rte_flow_async_action_list_handle_create()
- rte_flow_async_action_list_handle_destroy()
- rte_flow_async_action_list_handle_query_update()

Quoted 7 lines

This patch also adjusts the mlx5 PMD to the introduced flow API changes.

---
v2:
- Fixed mlx5 PMD build issue with older versions of rdma-core.
---

Best,
Ori

#3 lore raw
In reply to Dariusz Sosnowski

31/01/2024 10:35, Dariusz Sosnowski:

Quoted 14 lines

This patch reworks the async flow API functions called in data path, to reduce the overhead during flow operations at the library level. Main source of the overhead was indirection and checks done while ethdev library was fetching rte_flow_ops from a given driver.

This patch introduces rte_flow_fp_ops struct which holds callbacks to driver's implementation of fast path async flow API functions. Each driver implementing these functions must populate flow_fp_ops field inside rte_eth_dev structure with a reference to its own implementation.
By default, ethdev library provides dummy callbacks with implementations returning ENOSYS.
Such design provides a few assumptions:

Quoted 4 lines

- rte_flow_fp_ops struct for given port is always available.
- Each callback is either:
- Default provided by library.
- Set up by driver.

It looks similar to what was done in the commit c87d435a4d79 ("ethdev: copy fast-path API into separate structure") right?
Maybe worth to mention in the commit log.

Quoted 4 lines

As a result, no checks for availability of the implementation are needed at library level in data path.
Any library-level validation checks in async flow API are compiled if and only if RTE_FLOW_DEBUG macro is defined.

How are we supposed to enable RTE_FLOW_DEBUG?
May it be enabled automatically if other debug option is globally enabled?

One comment on the code style: please compare pointers explicitly with NULL instead of considering them as boolean.

#4 lore raw
Quoted 25 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, February 5, 2024 12:08
To: Dariusz Sosnowski <[email protected]>
Cc: Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; [email protected]
Subject: Re: [PATCH v2] ethdev: fast path async flow API

31/01/2024 10:35, Dariusz Sosnowski:

Quoted 14 lines

This patch reworks the async flow API functions called in data path, to reduce the overhead during flow operations at the library level. Main source of the overhead was indirection and checks done while ethdev library was fetching rte_flow_ops from a given driver.

This patch introduces rte_flow_fp_ops struct which holds callbacks to driver's implementation of fast path async flow API functions. Each driver implementing these functions must populate flow_fp_ops field inside rte_eth_dev structure with a reference to its own implementation.
By default, ethdev library provides dummy callbacks with implementations returning ENOSYS.
Such design provides a few assumptions:

Quoted 8 lines
Quoted 4 lines

- rte_flow_fp_ops struct for given port is always available.
- Each callback is either:
- Default provided by library.
- Set up by driver.

It looks similar to what was done in the commit
c87d435a4d79 ("ethdev: copy fast-path API into separate structure") right? Maybe worth to mention in the commit log.

Right, proposed design is based on what happens in Rx/Tx datapath. I think it's worth mentioning the commit. I'll add a reference in v3.

Quoted 6 lines
Quoted 4 lines

As a result, no checks for availability of the implementation are needed at library level in data path.
Any library-level validation checks in async flow API are compiled if and only if RTE_FLOW_DEBUG macro is defined.

How are we supposed to enable RTE_FLOW_DEBUG?

I should document it, but the idea was that it must be explicitly enabled during build, by adding -c_args=-DRTE_FLOW_DEBUG to meson options.

Do you think doc/guides/nics/build_and_test.rst is a good place to document this option? It would be documented alongside RTE_ETHDEV_DEBUG_RX and RTE_ETHDEV_DEBUG_TX.

Quoted 1 line

May it be enabled automatically if other debug option is globally enabled?

Do you mean that if buildtype is defined as debug, then RTE_FLOW_DEBUG is defined automatically? I think that's a good idea.

Quoted 2 lines

One comment on the code style: please compare pointers explicitly with NULL instead of considering them as boolean.

Ok. I'll fix it and I'll send v3.

Best regards,
Dariusz Sosnowski

#5 lore raw

05/02/2024 14:14, Dariusz Sosnowski:

Quoted 7 lines

From: Thomas Monjalon <[email protected]>

Quoted 6 lines

31/01/2024 10:35, Dariusz Sosnowski:

Quoted 4 lines

As a result, no checks for availability of the implementation are needed at library level in data path.
Any library-level validation checks in async flow API are compiled if and only if RTE_FLOW_DEBUG macro is defined.

Quoted 6 lines
Quoted 1 line

How are we supposed to enable RTE_FLOW_DEBUG?

I should document it, but the idea was that it must be explicitly enabled during build, by adding -c_args=-DRTE_FLOW_DEBUG to meson options.

Do you think doc/guides/nics/build_and_test.rst is a good place to document this option?

Yes

Quoted 5 lines

It would be documented alongside RTE_ETHDEV_DEBUG_RX and RTE_ETHDEV_DEBUG_TX.

Quoted 1 line

May it be enabled automatically if other debug option is globally enabled?

Do you mean that if buildtype is defined as debug, then RTE_FLOW_DEBUG is defined automatically?

Yes

Quoted 1 line

I think that's a good idea.

Another way of enabling it is to check
#if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG

#6 lore raw
Quoted 38 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, February 5, 2024 15:03
To: Dariusz Sosnowski <[email protected]>
Cc: Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; [email protected]
Subject: Re: [PATCH v2] ethdev: fast path async flow API

External email: Use caution opening links or attachments

05/02/2024 14:14, Dariusz Sosnowski:

Quoted 11 lines

From: Thomas Monjalon <[email protected]>

Quoted 7 lines

31/01/2024 10:35, Dariusz Sosnowski:

Quoted 4 lines

As a result, no checks for availability of the implementation are needed at library level in data path.
Any library-level validation checks in async flow API are compiled if and only if RTE_FLOW_DEBUG macro is defined.

How are we supposed to enable RTE_FLOW_DEBUG?

I should document it, but the idea was that it must be explicitly enabled during build, by adding -c_args=-DRTE_FLOW_DEBUG to meson

options.

Quoted 2 lines

Do you think doc/guides/nics/build_and_test.rst is a good place to

document this option?

Yes

Quoted 1 line

It would be documented alongside RTE_ETHDEV_DEBUG_RX and

RTE_ETHDEV_DEBUG_TX.

Quoted 4 lines
Quoted 2 lines

May it be enabled automatically if other debug option is globally enabled?

Do you mean that if buildtype is defined as debug, then RTE_FLOW_DEBUG

Quoted 8 lines

is defined automatically?

Yes

Quoted 1 line

I think that's a good idea.

Another way of enabling it is to check
#if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG

I think that defining RTE_FLOW_DEBUG based on buildtype would be more appropriate, since the code under RTE_FLOW_DEBUG is not responsible for any additional logging or tracing. It rather serves as basic checks for all async flow API functions.

Best regards,
Dariusz Sosnowski

#7 lore raw

PATCH v3 1/1 ethdev: fast path async flow API

In reply to Dariusz Sosnowski

This patch reworks the async flow API functions called in data path, to reduce the overhead during flow operations at the library level. Main source of the overhead was indirection and checks done while ethdev library was fetching rte_flow_ops from a given driver.

This patch introduces rte_flow_fp_ops struct which holds callbacks to driver's implementation of fast path async flow API functions. Each driver implementing these functions must populate flow_fp_ops field inside rte_eth_dev structure with a reference to its own implementation.
By default, ethdev library provides dummy callbacks with implementations returning ENOSYS.
Such design provides a few assumptions:

- rte_flow_fp_ops struct for given port is always available.
- Each callback is either:
- Default provided by library.
- Set up by driver.

As a result, no checks for availability of the implementation are needed at library level in data path.
Any library-level validation checks in async flow API are compiled if and only if RTE_FLOW_DEBUG macro is defined.

This design was based on changes in ethdev library introduced in [1].

These changes apply only to the following API functions:

- rte_flow_async_create()
- rte_flow_async_create_by_index()
- rte_flow_async_actions_update()
- rte_flow_async_destroy()
- rte_flow_push()
- rte_flow_pull()
- rte_flow_async_action_handle_create()
- rte_flow_async_action_handle_destroy()
- rte_flow_async_action_handle_update()
- rte_flow_async_action_handle_query()
- rte_flow_async_action_handle_query_update()
- rte_flow_async_action_list_handle_create()
- rte_flow_async_action_list_handle_destroy()
- rte_flow_async_action_list_handle_query_update()

This patch also adjusts the mlx5 PMD to the introduced flow API changes.

[1]
commit c87d435a4d79 ("ethdev: copy fast-path API into separate structure")

---
v3:
- Documented RTE_FLOW_DEBUG build option.
- Enabled RTE_FLOW_DEBUG automatically on debug builds.
- Fixed pointer checks to compare against NULL explicitly.

v2:
- Fixed mlx5 PMD build issue with older versions of rdma-core.

---
 doc/guides/nics/build_and_test.rst     |   9 +-
 doc/guides/rel_notes/release_24_03.rst |  37 ++
 drivers/net/mlx5/mlx5_flow.c           | 608 +------------------------
 drivers/net/mlx5/mlx5_flow_hw.c        |  25 +
 lib/ethdev/ethdev_driver.c             |   4 +
 lib/ethdev/ethdev_driver.h             |   4 +
 lib/ethdev/meson.build                 |   4 +
 lib/ethdev/rte_flow.c                  | 519 ++++++++++++++++-----
 lib/ethdev/rte_flow_driver.h           | 277 ++++++-----
 lib/ethdev/version.map                 |   2 +
 10 files changed, 647 insertions(+), 842 deletions(-)
doc/guides/nics/build_and_test.rst +7 -2
index e8b29c2277..453fa74b39 100644
@@ -36,11 +36,16 @@ The ethdev layer supports below build options for debug purpose:
 
   Build with debug code on Tx path.
 
+- ``RTE_FLOW_DEBUG`` (default **disabled**; enabled automatically on debug builds)
+
+  Build with debug code in asynchronous flow APIs.
+
 .. Note::
 
-   The ethdev library use above options to wrap debug code to trace invalid parameters
+   The ethdev library uses above options to wrap debug code to trace invalid parameters
    on data path APIs, so performance downgrade is expected when enabling those options.
-   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path.
+   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path
+   and in asynchronous flow APIs implementation.
 
 Running testpmd in Linux
 ------------------------
doc/guides/rel_notes/release_24_03.rst +37 -0
index 6f8ad27808..b62330b8b1 100644
@@ -86,6 +86,43 @@ API Changes
 
 * gso: ``rte_gso_segment`` now returns -ENOTSUP for unknown protocols.
 
+* ethdev: PMDs implementing asynchronous flow operations are required to provide relevant functions
+  implementation through ``rte_flow_fp_ops`` struct, instead of ``rte_flow_ops`` struct.
+  Pointer to device-dependent ``rte_flow_fp_ops`` should be provided to ``rte_eth_dev.flow_fp_ops``.
+  This change applies to the following API functions:
+
+   * ``rte_flow_async_create``
+   * ``rte_flow_async_create_by_index``
+   * ``rte_flow_async_actions_update``
+   * ``rte_flow_async_destroy``
+   * ``rte_flow_push``
+   * ``rte_flow_pull``
+   * ``rte_flow_async_action_handle_create``
+   * ``rte_flow_async_action_handle_destroy``
+   * ``rte_flow_async_action_handle_update``
+   * ``rte_flow_async_action_handle_query``
+   * ``rte_flow_async_action_handle_query_update``
+   * ``rte_flow_async_action_list_handle_create``
+   * ``rte_flow_async_action_list_handle_destroy``
+   * ``rte_flow_async_action_list_handle_query_update``
+
+* ethdev: Removed the following fields from ``rte_flow_ops`` struct:
+
+   * ``async_create``
+   * ``async_create_by_index``
+   * ``async_actions_update``
+   * ``async_destroy``
+   * ``push``
+   * ``pull``
+   * ``async_action_handle_create``
+   * ``async_action_handle_destroy``
+   * ``async_action_handle_update``
+   * ``async_action_handle_query``
+   * ``async_action_handle_query_update``
+   * ``async_action_list_handle_create``
+   * ``async_action_list_handle_destroy``
+   * ``async_action_list_handle_query_update``
+
 
 ABI Changes
 -----------
drivers/net/mlx5/mlx5_flow.c +1 -607

659 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow_hw.c +25 -0
index da873ae2e2..c65ebfbba2 100644
@@ -3,6 +3,7 @@
  */
 
 #include <rte_flow.h>
+#include <rte_flow_driver.h>
 
 #include <mlx5_malloc.h>
 
@@ -14,6 +15,9 @@
 #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
 #include "mlx5_hws_cnt.h"
 
+/** Fast path async flow API functions. */
+static struct rte_flow_fp_ops mlx5_flow_hw_fp_ops;
+
 /* The maximum actions support in the flow. */
 #define MLX5_HW_MAX_ACTS 16
 
@@ -9543,6 +9547,7 @@ flow_hw_configure(struct rte_eth_dev *dev,
 		mlx5_free(_queue_attr);
 	if (port_attr->flags & RTE_FLOW_PORT_FLAG_STRICT_QUEUE)
 		priv->hws_strict_queue = 1;
+	dev->flow_fp_ops = &mlx5_flow_hw_fp_ops;
 	return 0;
 err:
 	if (priv->hws_ctpool) {
@@ -9617,6 +9622,7 @@ flow_hw_resource_release(struct rte_eth_dev *dev)
 
 	if (!priv->dr_ctx)
 		return;
+	dev->flow_fp_ops = &rte_flow_fp_default_ops;
 	flow_hw_rxq_flag_set(dev, false);
 	flow_hw_flush_all_ctrl_flows(dev);
 	flow_hw_cleanup_tx_repr_tagging(dev);
@@ -12992,4 +12998,23 @@ mlx5_reformat_action_destroy(struct rte_eth_dev *dev,
 	mlx5_free(handle);
 	return 0;
 }
+
+static struct rte_flow_fp_ops mlx5_flow_hw_fp_ops = {
+	.async_create = flow_hw_async_flow_create,
+	.async_create_by_index = flow_hw_async_flow_create_by_index,
+	.async_actions_update = flow_hw_async_flow_update,
+	.async_destroy = flow_hw_async_flow_destroy,
+	.push = flow_hw_push,
+	.pull = flow_hw_pull,
+	.async_action_handle_create = flow_hw_action_handle_create,
+	.async_action_handle_destroy = flow_hw_action_handle_destroy,
+	.async_action_handle_update = flow_hw_action_handle_update,
+	.async_action_handle_query = flow_hw_action_handle_query,
+	.async_action_handle_query_update = flow_hw_async_action_handle_query_update,
+	.async_action_list_handle_create = flow_hw_async_action_list_handle_create,
+	.async_action_list_handle_destroy = flow_hw_async_action_list_handle_destroy,
+	.async_action_list_handle_query_update =
+		flow_hw_async_action_list_handle_query_update,
+};
+
 #endif
lib/ethdev/ethdev_driver.c +4 -0
index bd917a15fc..34909a3018 100644
@@ -10,6 +10,7 @@
 
 #include "ethdev_driver.h"
 #include "ethdev_private.h"
+#include "rte_flow_driver.h"
 
 /**
  * A set of values to describe the possible states of a switch domain.
@@ -110,6 +111,7 @@ rte_eth_dev_allocate(const char *name)
 	}
 
 	eth_dev = eth_dev_get(port_id);
+	eth_dev->flow_fp_ops = &rte_flow_fp_default_ops;
 	strlcpy(eth_dev->data->name, name, sizeof(eth_dev->data->name));
 	eth_dev->data->port_id = port_id;
 	eth_dev->data->backer_port_id = RTE_MAX_ETHPORTS;
@@ -245,6 +247,8 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
 
 	eth_dev_fp_ops_reset(rte_eth_fp_ops + eth_dev->data->port_id);
 
+	eth_dev->flow_fp_ops = &rte_flow_fp_default_ops;
+
 	rte_spinlock_lock(rte_mcfg_ethdev_get_lock());
 
 	eth_dev->state = RTE_ETH_DEV_UNUSED;
lib/ethdev/ethdev_driver.h +4 -0
index b482cd12bb..b2e879ae1d 100644
@@ -71,6 +71,10 @@ struct rte_eth_dev {
 	struct rte_eth_dev_data *data;
 	void *process_private; /**< Pointer to per-process device data */
 	const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
+	/**
+	 * Fast path flow API functions exported by PMD.
+	 */
+	const struct rte_flow_fp_ops *flow_fp_ops;
 	struct rte_device *device; /**< Backing device */
 	struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
 
lib/ethdev/meson.build +4 -0
index 3497aa1548..b8859de11b 100644
@@ -49,3 +49,7 @@ deps += ['net', 'kvargs', 'meter', 'telemetry']
 if is_freebsd
     annotate_locks = false
 endif
+
+if get_option('buildtype').contains('debug')
+    cflags += ['-DRTE_FLOW_DEBUG']
+endif
lib/ethdev/rte_flow.c +404 -115

637 lines not on this page · raw message

lib/ethdev/rte_flow_driver.h +159 -118

301 lines not on this page · raw message

lib/ethdev/version.map +2 -0
index 5c4917c020..a8758084f6 100644
@@ -345,4 +345,6 @@ INTERNAL {
 	rte_eth_representor_id_get;
 	rte_eth_switch_domain_alloc;
 	rte_eth_switch_domain_free;
+
+	rte_flow_fp_default_ops;
 };

--
2.25.1

Acked-by on v3 1/1
#8 lore raw

06/02/2024 18:36, Dariusz Sosnowski:

Quoted 4 lines
doc/guides/nics/build_and_test.rst +2 -0
+- ``RTE_FLOW_DEBUG`` (default **disabled**; enabled automatically on debug builds)
+

doc/guides/nics/build_and_test.rst The ethdev layer supports below build options for debug purpose: · line 48

Quoted 10 lines
doc/guides/nics/build_and_test.rst +5 -2
+  Build with debug code in asynchronous flow APIs.
+
 .. Note::
 
-   The ethdev library use above options to wrap debug code to trace invalid parameters
+   The ethdev library uses above options to wrap debug code to trace invalid parameters
    on data path APIs, so performance downgrade is expected when enabling those options.
-   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path.
+   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path
+   and in asynchronous flow APIs implementation.

Good

doc/guides/rel_notes/release_24_03.rst API Changes · line 91

Quoted 5 lines
doc/guides/rel_notes/release_24_03.rst +3 -0
+* ethdev: PMDs implementing asynchronous flow operations are required to provide relevant functions
+  implementation through ``rte_flow_fp_ops`` struct, instead of ``rte_flow_ops`` struct.
+  Pointer to device-dependent ``rte_flow_fp_ops`` should be provided to ``rte_eth_dev.flow_fp_ops``.

That's a change only for the driver.
If there is no change for the application, it should not appear in the release notes. BTW, API means Application Programming Interface :)

Quoted 33 lines
doc/guides/rel_notes/release_24_03.rst +33 -0
+  This change applies to the following API functions:
+
+   * ``rte_flow_async_create``
+   * ``rte_flow_async_create_by_index``
+   * ``rte_flow_async_actions_update``
+   * ``rte_flow_async_destroy``
+   * ``rte_flow_push``
+   * ``rte_flow_pull``
+   * ``rte_flow_async_action_handle_create``
+   * ``rte_flow_async_action_handle_destroy``
+   * ``rte_flow_async_action_handle_update``
+   * ``rte_flow_async_action_handle_query``
+   * ``rte_flow_async_action_handle_query_update``
+   * ``rte_flow_async_action_list_handle_create``
+   * ``rte_flow_async_action_list_handle_destroy``
+   * ``rte_flow_async_action_list_handle_query_update``
+
+* ethdev: Removed the following fields from ``rte_flow_ops`` struct:
+
+   * ``async_create``
+   * ``async_create_by_index``
+   * ``async_actions_update``
+   * ``async_destroy``
+   * ``push``
+   * ``pull``
+   * ``async_action_handle_create``
+   * ``async_action_handle_destroy``
+   * ``async_action_handle_update``
+   * ``async_action_handle_query``
+   * ``async_action_handle_query_update``
+   * ``async_action_list_handle_create``
+   * ``async_action_list_handle_destroy``
+   * ``async_action_list_handle_query_update``

[...]

lib/ethdev/ethdev_driver.h struct rte_eth_dev { · line 76

Quoted 9 lines
lib/ethdev/ethdev_driver.h +3 -0
@@ -71,6 +71,10 @@ struct rte_eth_dev {
 	struct rte_eth_dev_data *data;
 	void *process_private; /**< Pointer to per-process device data */
 	const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
+	/**
+	 * Fast path flow API functions exported by PMD.
+	 */

This comment may be on one single line.

lib/ethdev/meson.build deps += ['net', 'kvargs', 'meter', 'telemetry'] · line 55

Quoted 9 lines
lib/ethdev/ethdev_driver.h +1 -0
+	const struct rte_flow_fp_ops *flow_fp_ops;
 	struct rte_device *device; /**< Backing device */
 	struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
 
lib/ethdev/meson.build +3 -0
+if get_option('buildtype').contains('debug')
+    cflags += ['-DRTE_FLOW_DEBUG']
+endif

This looks OK.

Acked-by Applied
#9 lore raw
Quoted 87 lines · Thomas Monjalon

06/02/2024 18:36, Dariusz Sosnowski:

Quoted 4 lines
doc/guides/nics/build_and_test.rst +2 -0
+- ``RTE_FLOW_DEBUG`` (default **disabled**; enabled automatically on debug builds)
+

doc/guides/nics/build_and_test.rst The ethdev layer supports below build options for debug purpose: · line 48

Quoted 10 lines
doc/guides/nics/build_and_test.rst +5 -2
+  Build with debug code in asynchronous flow APIs.
+
 .. Note::
 
-   The ethdev library use above options to wrap debug code to trace invalid parameters
+   The ethdev library uses above options to wrap debug code to trace invalid parameters
    on data path APIs, so performance downgrade is expected when enabling those options.
-   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path.
+   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path
+   and in asynchronous flow APIs implementation.

Good

doc/guides/rel_notes/release_24_03.rst API Changes · line 91

Quoted 5 lines
doc/guides/rel_notes/release_24_03.rst +3 -0
+* ethdev: PMDs implementing asynchronous flow operations are required to provide relevant functions
+  implementation through ``rte_flow_fp_ops`` struct, instead of ``rte_flow_ops`` struct.
+  Pointer to device-dependent ``rte_flow_fp_ops`` should be provided to ``rte_eth_dev.flow_fp_ops``.

That's a change only for the driver.
If there is no change for the application, it should not appear in the release notes. BTW, API means Application Programming Interface :)

Quoted 33 lines
doc/guides/rel_notes/release_24_03.rst +33 -0
+  This change applies to the following API functions:
+
+   * ``rte_flow_async_create``
+   * ``rte_flow_async_create_by_index``
+   * ``rte_flow_async_actions_update``
+   * ``rte_flow_async_destroy``
+   * ``rte_flow_push``
+   * ``rte_flow_pull``
+   * ``rte_flow_async_action_handle_create``
+   * ``rte_flow_async_action_handle_destroy``
+   * ``rte_flow_async_action_handle_update``
+   * ``rte_flow_async_action_handle_query``
+   * ``rte_flow_async_action_handle_query_update``
+   * ``rte_flow_async_action_list_handle_create``
+   * ``rte_flow_async_action_list_handle_destroy``
+   * ``rte_flow_async_action_list_handle_query_update``
+
+* ethdev: Removed the following fields from ``rte_flow_ops`` struct:
+
+   * ``async_create``
+   * ``async_create_by_index``
+   * ``async_actions_update``
+   * ``async_destroy``
+   * ``push``
+   * ``pull``
+   * ``async_action_handle_create``
+   * ``async_action_handle_destroy``
+   * ``async_action_handle_update``
+   * ``async_action_handle_query``
+   * ``async_action_handle_query_update``
+   * ``async_action_list_handle_create``
+   * ``async_action_list_handle_destroy``
+   * ``async_action_list_handle_query_update``

[...]

lib/ethdev/ethdev_driver.h struct rte_eth_dev { · line 76

Quoted 9 lines
lib/ethdev/ethdev_driver.h +3 -0
@@ -71,6 +71,10 @@ struct rte_eth_dev {
 	struct rte_eth_dev_data *data;
 	void *process_private; /**< Pointer to per-process device data */
 	const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
+	/**
+	 * Fast path flow API functions exported by PMD.
+	 */

This comment may be on one single line.

lib/ethdev/meson.build deps += ['net', 'kvargs', 'meter', 'telemetry'] · line 55

Quoted 9 lines
lib/ethdev/ethdev_driver.h +1 -0
+	const struct rte_flow_fp_ops *flow_fp_ops;
 	struct rte_device *device; /**< Backing device */
 	struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
 
lib/ethdev/meson.build +3 -0
+if get_option('buildtype').contains('debug')
+    cflags += ['-DRTE_FLOW_DEBUG']
+endif

This looks OK.

Quoted 3 lines

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

#10 lore raw

07/02/2024 01:57, Ferruh Yigit:

Quoted 88 lines · Thomas Monjalon
Quoted 87 lines

06/02/2024 18:36, Dariusz Sosnowski:

Quoted 4 lines
doc/guides/nics/build_and_test.rst +2 -0
+- ``RTE_FLOW_DEBUG`` (default **disabled**; enabled automatically on debug builds)
+

doc/guides/nics/build_and_test.rst The ethdev layer supports below build options for debug purpose: · line 48

Quoted 10 lines
doc/guides/nics/build_and_test.rst +5 -2
+  Build with debug code in asynchronous flow APIs.
+
 .. Note::
 
-   The ethdev library use above options to wrap debug code to trace invalid parameters
+   The ethdev library uses above options to wrap debug code to trace invalid parameters
    on data path APIs, so performance downgrade is expected when enabling those options.
-   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path.
+   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path
+   and in asynchronous flow APIs implementation.

Good

doc/guides/rel_notes/release_24_03.rst API Changes · line 91

Quoted 5 lines
doc/guides/rel_notes/release_24_03.rst +3 -0
+* ethdev: PMDs implementing asynchronous flow operations are required to provide relevant functions
+  implementation through ``rte_flow_fp_ops`` struct, instead of ``rte_flow_ops`` struct.
+  Pointer to device-dependent ``rte_flow_fp_ops`` should be provided to ``rte_eth_dev.flow_fp_ops``.

That's a change only for the driver.
If there is no change for the application, it should not appear in the release notes. BTW, API means Application Programming Interface :)

Quoted 33 lines
doc/guides/rel_notes/release_24_03.rst +33 -0
+  This change applies to the following API functions:
+
+   * ``rte_flow_async_create``
+   * ``rte_flow_async_create_by_index``
+   * ``rte_flow_async_actions_update``
+   * ``rte_flow_async_destroy``
+   * ``rte_flow_push``
+   * ``rte_flow_pull``
+   * ``rte_flow_async_action_handle_create``
+   * ``rte_flow_async_action_handle_destroy``
+   * ``rte_flow_async_action_handle_update``
+   * ``rte_flow_async_action_handle_query``
+   * ``rte_flow_async_action_handle_query_update``
+   * ``rte_flow_async_action_list_handle_create``
+   * ``rte_flow_async_action_list_handle_destroy``
+   * ``rte_flow_async_action_list_handle_query_update``
+
+* ethdev: Removed the following fields from ``rte_flow_ops`` struct:
+
+   * ``async_create``
+   * ``async_create_by_index``
+   * ``async_actions_update``
+   * ``async_destroy``
+   * ``push``
+   * ``pull``
+   * ``async_action_handle_create``
+   * ``async_action_handle_destroy``
+   * ``async_action_handle_update``
+   * ``async_action_handle_query``
+   * ``async_action_handle_query_update``
+   * ``async_action_list_handle_create``
+   * ``async_action_list_handle_destroy``
+   * ``async_action_list_handle_query_update``

[...]

lib/ethdev/ethdev_driver.h struct rte_eth_dev { · line 76

Quoted 9 lines
lib/ethdev/ethdev_driver.h +3 -0
@@ -71,6 +71,10 @@ struct rte_eth_dev {
 	struct rte_eth_dev_data *data;
 	void *process_private; /**< Pointer to per-process device data */
 	const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
+	/**
+	 * Fast path flow API functions exported by PMD.
+	 */

This comment may be on one single line.

lib/ethdev/meson.build deps += ['net', 'kvargs', 'meter', 'telemetry'] · line 55

Quoted 9 lines
lib/ethdev/ethdev_driver.h +1 -0
+	const struct rte_flow_fp_ops *flow_fp_ops;
 	struct rte_device *device; /**< Backing device */
 	struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
 
lib/ethdev/meson.build +3 -0
+if get_option('buildtype').contains('debug')
+    cflags += ['-DRTE_FLOW_DEBUG']
+endif

This looks OK.

Quoted 7 lines
Quoted 3 lines

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

Ferruh, I was expecting a new version.
Did you address yourself the comments above?

#11 lore raw
Quoted 93 lines · Thomas Monjalon

07/02/2024 01:57, Ferruh Yigit:

Quoted 92 lines · Thomas Monjalon
Quoted 90 lines

06/02/2024 18:36, Dariusz Sosnowski:

Quoted 4 lines
doc/guides/nics/build_and_test.rst +2 -0
+- ``RTE_FLOW_DEBUG`` (default **disabled**; enabled automatically on debug builds)
+

doc/guides/nics/build_and_test.rst The ethdev layer supports below build options for debug purpose: · line 48

Quoted 10 lines
doc/guides/nics/build_and_test.rst +5 -2
+  Build with debug code in asynchronous flow APIs.
+
 .. Note::
 
-   The ethdev library use above options to wrap debug code to trace invalid parameters
+   The ethdev library uses above options to wrap debug code to trace invalid parameters
    on data path APIs, so performance downgrade is expected when enabling those options.
-   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path.
+   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path
+   and in asynchronous flow APIs implementation.

Good

doc/guides/rel_notes/release_24_03.rst API Changes · line 91

Quoted 5 lines
doc/guides/rel_notes/release_24_03.rst +3 -0
+* ethdev: PMDs implementing asynchronous flow operations are required to provide relevant functions
+  implementation through ``rte_flow_fp_ops`` struct, instead of ``rte_flow_ops`` struct.
+  Pointer to device-dependent ``rte_flow_fp_ops`` should be provided to ``rte_eth_dev.flow_fp_ops``.

That's a change only for the driver.
If there is no change for the application, it should not appear in the release notes. BTW, API means Application Programming Interface :)

Quoted 33 lines
doc/guides/rel_notes/release_24_03.rst +33 -0
+  This change applies to the following API functions:
+
+   * ``rte_flow_async_create``
+   * ``rte_flow_async_create_by_index``
+   * ``rte_flow_async_actions_update``
+   * ``rte_flow_async_destroy``
+   * ``rte_flow_push``
+   * ``rte_flow_pull``
+   * ``rte_flow_async_action_handle_create``
+   * ``rte_flow_async_action_handle_destroy``
+   * ``rte_flow_async_action_handle_update``
+   * ``rte_flow_async_action_handle_query``
+   * ``rte_flow_async_action_handle_query_update``
+   * ``rte_flow_async_action_list_handle_create``
+   * ``rte_flow_async_action_list_handle_destroy``
+   * ``rte_flow_async_action_list_handle_query_update``
+
+* ethdev: Removed the following fields from ``rte_flow_ops`` struct:
+
+   * ``async_create``
+   * ``async_create_by_index``
+   * ``async_actions_update``
+   * ``async_destroy``
+   * ``push``
+   * ``pull``
+   * ``async_action_handle_create``
+   * ``async_action_handle_destroy``
+   * ``async_action_handle_update``
+   * ``async_action_handle_query``
+   * ``async_action_handle_query_update``
+   * ``async_action_list_handle_create``
+   * ``async_action_list_handle_destroy``
+   * ``async_action_list_handle_query_update``

[...]

lib/ethdev/ethdev_driver.h struct rte_eth_dev { · line 76

Quoted 9 lines
lib/ethdev/ethdev_driver.h +3 -0
@@ -71,6 +71,10 @@ struct rte_eth_dev {
 	struct rte_eth_dev_data *data;
 	void *process_private; /**< Pointer to per-process device data */
 	const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
+	/**
+	 * Fast path flow API functions exported by PMD.
+	 */

This comment may be on one single line.

lib/ethdev/meson.build deps += ['net', 'kvargs', 'meter', 'telemetry'] · line 55

Quoted 9 lines
lib/ethdev/ethdev_driver.h +1 -0
+	const struct rte_flow_fp_ops *flow_fp_ops;
 	struct rte_device *device; /**< Backing device */
 	struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
 
lib/ethdev/meson.build +3 -0
+if get_option('buildtype').contains('debug')
+    cflags += ['-DRTE_FLOW_DEBUG']
+endif

This looks OK.

Quoted 8 lines
Quoted 3 lines

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

Ferruh, I was expecting a new version.
Did you address yourself the comments above?

No, I missed the comment, if it is simple I can apply in next-net, let me sync with Dariusz.

#12 lore raw
Quoted 98 lines · Ferruh Yigit
Quoted 97 lines · Thomas Monjalon

07/02/2024 01:57, Ferruh Yigit:

Quoted 95 lines · Thomas Monjalon
Quoted 87 lines

06/02/2024 18:36, Dariusz Sosnowski:

Quoted 4 lines
doc/guides/nics/build_and_test.rst +2 -0
+- ``RTE_FLOW_DEBUG`` (default **disabled**; enabled automatically on debug builds)
+

doc/guides/nics/build_and_test.rst The ethdev layer supports below build options for debug purpose: · line 48

Quoted 10 lines
doc/guides/nics/build_and_test.rst +5 -2
+  Build with debug code in asynchronous flow APIs.
+
 .. Note::
 
-   The ethdev library use above options to wrap debug code to trace invalid parameters
+   The ethdev library uses above options to wrap debug code to trace invalid parameters
    on data path APIs, so performance downgrade is expected when enabling those options.
-   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path.
+   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path
+   and in asynchronous flow APIs implementation.

Good

doc/guides/rel_notes/release_24_03.rst API Changes · line 91

Quoted 5 lines
doc/guides/rel_notes/release_24_03.rst +3 -0
+* ethdev: PMDs implementing asynchronous flow operations are required to provide relevant functions
+  implementation through ``rte_flow_fp_ops`` struct, instead of ``rte_flow_ops`` struct.
+  Pointer to device-dependent ``rte_flow_fp_ops`` should be provided to ``rte_eth_dev.flow_fp_ops``.

That's a change only for the driver.
If there is no change for the application, it should not appear in the release notes. BTW, API means Application Programming Interface :)

Quoted 33 lines
doc/guides/rel_notes/release_24_03.rst +33 -0
+  This change applies to the following API functions:
+
+   * ``rte_flow_async_create``
+   * ``rte_flow_async_create_by_index``
+   * ``rte_flow_async_actions_update``
+   * ``rte_flow_async_destroy``
+   * ``rte_flow_push``
+   * ``rte_flow_pull``
+   * ``rte_flow_async_action_handle_create``
+   * ``rte_flow_async_action_handle_destroy``
+   * ``rte_flow_async_action_handle_update``
+   * ``rte_flow_async_action_handle_query``
+   * ``rte_flow_async_action_handle_query_update``
+   * ``rte_flow_async_action_list_handle_create``
+   * ``rte_flow_async_action_list_handle_destroy``
+   * ``rte_flow_async_action_list_handle_query_update``
+
+* ethdev: Removed the following fields from ``rte_flow_ops`` struct:
+
+   * ``async_create``
+   * ``async_create_by_index``
+   * ``async_actions_update``
+   * ``async_destroy``
+   * ``push``
+   * ``pull``
+   * ``async_action_handle_create``
+   * ``async_action_handle_destroy``
+   * ``async_action_handle_update``
+   * ``async_action_handle_query``
+   * ``async_action_handle_query_update``
+   * ``async_action_list_handle_create``
+   * ``async_action_list_handle_destroy``
+   * ``async_action_list_handle_query_update``

[...]

lib/ethdev/ethdev_driver.h struct rte_eth_dev { · line 76

Quoted 9 lines
lib/ethdev/ethdev_driver.h +3 -0
@@ -71,6 +71,10 @@ struct rte_eth_dev {
 	struct rte_eth_dev_data *data;
 	void *process_private; /**< Pointer to per-process device data */
 	const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
+	/**
+	 * Fast path flow API functions exported by PMD.
+	 */

This comment may be on one single line.

lib/ethdev/meson.build deps += ['net', 'kvargs', 'meter', 'telemetry'] · line 55

Quoted 9 lines
lib/ethdev/ethdev_driver.h +1 -0
+	const struct rte_flow_fp_ops *flow_fp_ops;
 	struct rte_device *device; /**< Backing device */
 	struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
 
lib/ethdev/meson.build +3 -0
+if get_option('buildtype').contains('debug')
+    cflags += ['-DRTE_FLOW_DEBUG']
+endif

This looks OK.

Quoted 3 lines

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

Quoted 8 lines
Quoted 4 lines

Ferruh, I was expecting a new version.
Did you address yourself the comments above?

No, I missed the comment, if it is simple I can apply in next-net, let me sync with Dariusz.

As we synced with Dariusz, there is no good place to document ethdev-drivers interfaces in the release notes.

Also this release there were more ethdev-drivers interface changes, around get_ptype(), but those also not documented in the release notes, so will remove these ones too.

But for further release notes, @Thomas, @John, what do you think to add a new section (or sub-section) for "internal interface" ?? (device abstraction - drivers) interface changes?

#13 lore raw
Quoted 108 lines · Ferruh Yigit
Quoted 98 lines · Ferruh Yigit
Quoted 97 lines · Thomas Monjalon

07/02/2024 01:57, Ferruh Yigit:

Quoted 95 lines · Thomas Monjalon
Quoted 87 lines

06/02/2024 18:36, Dariusz Sosnowski:

Quoted 4 lines
doc/guides/nics/build_and_test.rst +2 -0
+- ``RTE_FLOW_DEBUG`` (default **disabled**; enabled automatically on debug builds)
+

doc/guides/nics/build_and_test.rst The ethdev layer supports below build options for debug purpose: · line 48

Quoted 10 lines
doc/guides/nics/build_and_test.rst +5 -2
+  Build with debug code in asynchronous flow APIs.
+
 .. Note::
 
-   The ethdev library use above options to wrap debug code to trace invalid parameters
+   The ethdev library uses above options to wrap debug code to trace invalid parameters
    on data path APIs, so performance downgrade is expected when enabling those options.
-   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path.
+   Each PMD can decide to reuse them to wrap their own debug code in the Rx/Tx path
+   and in asynchronous flow APIs implementation.

Good

doc/guides/rel_notes/release_24_03.rst API Changes · line 91

Quoted 5 lines
doc/guides/rel_notes/release_24_03.rst +3 -0
+* ethdev: PMDs implementing asynchronous flow operations are required to provide relevant functions
+  implementation through ``rte_flow_fp_ops`` struct, instead of ``rte_flow_ops`` struct.
+  Pointer to device-dependent ``rte_flow_fp_ops`` should be provided to ``rte_eth_dev.flow_fp_ops``.

That's a change only for the driver.
If there is no change for the application, it should not appear in the release notes. BTW, API means Application Programming Interface :)

Quoted 33 lines
doc/guides/rel_notes/release_24_03.rst +33 -0
+  This change applies to the following API functions:
+
+   * ``rte_flow_async_create``
+   * ``rte_flow_async_create_by_index``
+   * ``rte_flow_async_actions_update``
+   * ``rte_flow_async_destroy``
+   * ``rte_flow_push``
+   * ``rte_flow_pull``
+   * ``rte_flow_async_action_handle_create``
+   * ``rte_flow_async_action_handle_destroy``
+   * ``rte_flow_async_action_handle_update``
+   * ``rte_flow_async_action_handle_query``
+   * ``rte_flow_async_action_handle_query_update``
+   * ``rte_flow_async_action_list_handle_create``
+   * ``rte_flow_async_action_list_handle_destroy``
+   * ``rte_flow_async_action_list_handle_query_update``
+
+* ethdev: Removed the following fields from ``rte_flow_ops`` struct:
+
+   * ``async_create``
+   * ``async_create_by_index``
+   * ``async_actions_update``
+   * ``async_destroy``
+   * ``push``
+   * ``pull``
+   * ``async_action_handle_create``
+   * ``async_action_handle_destroy``
+   * ``async_action_handle_update``
+   * ``async_action_handle_query``
+   * ``async_action_handle_query_update``
+   * ``async_action_list_handle_create``
+   * ``async_action_list_handle_destroy``
+   * ``async_action_list_handle_query_update``

[...]

lib/ethdev/ethdev_driver.h struct rte_eth_dev { · line 76

Quoted 9 lines
lib/ethdev/ethdev_driver.h +3 -0
@@ -71,6 +71,10 @@ struct rte_eth_dev {
 	struct rte_eth_dev_data *data;
 	void *process_private; /**< Pointer to per-process device data */
 	const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
+	/**
+	 * Fast path flow API functions exported by PMD.
+	 */

This comment may be on one single line.

lib/ethdev/meson.build deps += ['net', 'kvargs', 'meter', 'telemetry'] · line 55

Quoted 9 lines
lib/ethdev/ethdev_driver.h +1 -0
+	const struct rte_flow_fp_ops *flow_fp_ops;
 	struct rte_device *device; /**< Backing device */
 	struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
 
lib/ethdev/meson.build +3 -0
+if get_option('buildtype').contains('debug')
+    cflags += ['-DRTE_FLOW_DEBUG']
+endif

This looks OK.

Quoted 3 lines

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

Quoted 8 lines
Quoted 4 lines

Ferruh, I was expecting a new version.
Did you address yourself the comments above?

No, I missed the comment, if it is simple I can apply in next-net, let me sync with Dariusz.

Quoted 7 lines

As we synced with Dariusz, there is no good place to document ethdev-drivers interfaces in the release notes.

Also this release there were more ethdev-drivers interface changes, around get_ptype(), but those also not documented in the release notes, so will remove these ones too.

Dariusz, I did the changes in next-net, can you please double check them:
https://git.dpdk.org/next/dpdk-next-net/commit/?h=main&id=23f1ee71a9c332210aaa5b1ec51160938b5fc50b

#14 lore raw
Quoted 138 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, February 7, 2024 12:54
To: NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Dariusz Sosnowski <[email protected]>; Mcnamara, John <[email protected]>
Cc: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Andrew Rybchenko <[email protected]>; [email protected]
Subject: Re: [PATCH v3] ethdev: fast path async flow API

External email: Use caution opening links or attachments

Quoted 14 lines · Ferruh Yigit
Quoted 13 lines · Ferruh Yigit
Quoted 12 lines · Thomas Monjalon

07/02/2024 01:57, Ferruh Yigit:

Quoted 11 lines · Thomas Monjalon
Quoted 10 lines

06/02/2024 18:36, Dariusz Sosnowski:

Quoted 9 lines
doc/guides/nics/build_and_test.rst +5 -0
+- ``RTE_FLOW_DEBUG`` (default **disabled**; enabled
+automatically on debug builds)
+
+  Build with debug code in asynchronous flow APIs.
+
 .. Note::
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

- The ethdev library use above options to wrap debug code to trace

invalid parameters

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

+ The ethdev library uses above options to wrap debug code to
+ trace invalid parameters
on data path APIs, so performance downgrade is expected when

enabling those options.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

- Each PMD can decide to reuse them to wrap their own debug code

in the Rx/Tx path.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ Each PMD can decide to reuse them to wrap their own debug code

in the Rx/Tx path

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 1 line

+ and in asynchronous flow APIs implementation.

Good

doc/guides/rel_notes/release_24_03.rst

Quoted 5 lines
doc/guides/rel_notes/release_24_03.rst +3 -0
+* ethdev: PMDs implementing asynchronous flow operations are
+required to provide relevant functions
+  implementation through ``rte_flow_fp_ops`` struct, instead of

``rte_flow_ops`` struct.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ Pointer to device-dependent ``rte_flow_fp_ops`` should be provided

to ``rte_eth_dev.flow_fp_ops``.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

That's a change only for the driver.
If there is no change for the application, it should not appear in the

release notes.

Quoted 82 lines
Quoted 70 lines
Quoted 70 lines
Quoted 69 lines
Quoted 55 lines

BTW, API means Application Programming Interface :)

Quoted 33 lines
doc/guides/rel_notes/release_24_03.rst +33 -0
+  This change applies to the following API functions:
+
+   * ``rte_flow_async_create``
+   * ``rte_flow_async_create_by_index``
+   * ``rte_flow_async_actions_update``
+   * ``rte_flow_async_destroy``
+   * ``rte_flow_push``
+   * ``rte_flow_pull``
+   * ``rte_flow_async_action_handle_create``
+   * ``rte_flow_async_action_handle_destroy``
+   * ``rte_flow_async_action_handle_update``
+   * ``rte_flow_async_action_handle_query``
+   * ``rte_flow_async_action_handle_query_update``
+   * ``rte_flow_async_action_list_handle_create``
+   * ``rte_flow_async_action_list_handle_destroy``
+   * ``rte_flow_async_action_list_handle_query_update``
+
+* ethdev: Removed the following fields from ``rte_flow_ops`` struct:
+
+   * ``async_create``
+   * ``async_create_by_index``
+   * ``async_actions_update``
+   * ``async_destroy``
+   * ``push``
+   * ``pull``
+   * ``async_action_handle_create``
+   * ``async_action_handle_destroy``
+   * ``async_action_handle_update``
+   * ``async_action_handle_query``
+   * ``async_action_handle_query_update``
+   * ``async_action_list_handle_create``
+   * ``async_action_list_handle_destroy``
+   * ``async_action_list_handle_query_update``

[...]

lib/ethdev/ethdev_driver.h

Quoted 10 lines
lib/ethdev/ethdev_driver.h +0 -0
@@ -71,6 +71,10 @@ struct rte_eth_dev {
         struct rte_eth_dev_data *data;
         void *process_private; /**< Pointer to per-process device data */
         const struct eth_dev_ops *dev_ops; /**< Functions

exported by PMD */

lib/ethdev/ethdev_driver.h +3 -0
+        /**
+         * Fast path flow API functions exported by PMD.
+         */

This comment may be on one single line.

Quoted 4 lines

+ const struct rte_flow_fp_ops *flow_fp_ops;
struct rte_device *device; /**< Backing device */ struct rte_intr_handle *intr_handle; /**< Device
interrupt handle */

Quoted 10 lines

lib/ethdev/meson.build

Quoted 4 lines
lib/ethdev/meson.build +2 -0
+if get_option('buildtype').contains('debug')
+    cflags += ['-DRTE_FLOW_DEBUG'] endif

This looks OK.

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

Quoted 8 lines
Quoted 4 lines

Ferruh, I was expecting a new version.
Did you address yourself the comments above?

No, I missed the comment, if it is simple I can apply in next-net, let me sync with Dariusz.

As we synced with Dariusz, there is no good place to document ethdev-drivers interfaces in the release notes.

Quoted 8 lines
Quoted 4 lines

Also this release there were more ethdev-drivers interface changes, around get_ptype(), but those also not documented in the release notes, so will remove these ones too.

Dariusz, I did the changes in next-net, can you please double check them:
https://git.dpdk.org/next/dpdk-next-
net/commit/?h=main&id=23f1ee71a9c332210aaa5b1ec51160938b5fc50b

Looks good. Thank you applying the changes.

Best regards,
Dariusz Sosnowski

#15 lore raw
In reply to Ferruh Yigit

07/02/2024 11:56, Ferruh Yigit:

Quoted 11 lines

As we synced with Dariusz, there is no good place to document ethdev-drivers interfaces in the release notes.

Also this release there were more ethdev-drivers interface changes, around get_ptype(), but those also not documented in the release notes, so will remove these ones too.

But for further release notes, @Thomas, @John, what do you think to add a new section (or sub-section) for "internal interface" ?? (device abstraction - drivers) interface changes?

When a driver interface is changed, the drivers are updated accordingly. If it's a driver addition, then we need to follow-up with drivers maintainers. Adding a new section in the release notes for driver interface changes is possible but means more work. I'm afraid a lot of changes won't be described, so I'm not sure of the value of such incomplete doc.