Skip to contentSkip to conversation

net/mlx5: reject flow template API reconfiguration

PATCH In review Dariusz Sosnowski 5 participants 5 messages Feb 25, 2023 – Mar 19, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: reject flow template API reconfiguration

Flow Template API allows rte_flow_configure() to be called more than once, to allow applications to dynamically reconfigure the amount of resources available for flow table and flow rule creation. PMDs can reject the change in configuration and
keep the old configuration.

Before this patch, during Flow Template API reconfiguration in mlx5 PMD, all the allocated resources (HW/FW object pools, flow rules, pattern and actions templates) were released and reallocated according to the new configuration. This however leads to undefined behavior, since all references to templates, flows or indirect actions, which are held by the user, are now invalidated.

This patch changes the reconfiguration behavior. Configuration provided to rte_flow_configure() is stored in port's private data structure. On any subsequent call to rte_flow_configure(), the provided configuration is compared against the stored configuration. If both are equal, rte_flow_configure() reports a success and configuration is unaffected. Otherwise, (-ENOTSUP) is returned.

---
 doc/guides/nics/mlx5.rst        |   3 +
 drivers/net/mlx5/mlx5.h         |   8 +++
 drivers/net/mlx5/mlx5_flow_hw.c | 104 +++++++++++++++++++++++++++++++-
 3 files changed, 112 insertions(+), 3 deletions(-)
doc/guides/nics/mlx5.rst +3 -0
index 6510e74fb9..2fc0399b99 100644
@@ -160,6 +160,9 @@ Limitations
   - Set ``dv_flow_en`` to 2 in order to enable HW steering.
   - Async queue-based ``rte_flow_async`` APIs supported only.
   - NIC ConnectX-5 and before are not supported.
+  - Reconfiguring flow API engine is not supported.
+    Any subsequent call to ``rte_flow_configure()`` with different configuration
+    than initially provided will be rejected with ``-ENOTSUP`` error code.
   - Partial match with item template is not supported.
   - IPv6 5-tuple matching is not supported.
   - With E-Switch enabled, ports which share the E-Switch domain
drivers/net/mlx5/mlx5.h +8 -0
index a766fb408e..7fc75a2535 100644
@@ -1656,6 +1656,13 @@ struct mlx5_hw_ctrl_flow {
 	struct rte_flow *flow;
 };
 
+/* HW Steering port configuration passed to rte_flow_configure(). */
+struct mlx5_flow_hw_attr {
+	struct rte_flow_port_attr port_attr;
+	uint16_t nb_queue;
+	struct rte_flow_queue_attr *queue_attr;
+};
+
 struct mlx5_flow_hw_ctrl_rx;
 
 struct mlx5_priv {
@@ -1763,6 +1770,7 @@ struct mlx5_priv {
 	uint32_t nb_queue; /* HW steering queue number. */
 	struct mlx5_hws_cnt_pool *hws_cpool; /* HW steering's counter pool. */
 	uint32_t hws_mark_refcnt; /* HWS mark action reference counter. */
+	struct mlx5_flow_hw_attr *hw_attr; /* HW Steering port configuration. */
 #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
 	/* Item template list. */
 	LIST_HEAD(flow_hw_itt, rte_flow_pattern_template) flow_hw_itt;
drivers/net/mlx5/mlx5_flow_hw.c +101 -3

135 lines not on this page · raw message

Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 25 lines

-----Original Message-----
From: Dariusz Sosnowski <[email protected]>
Sent: Saturday, 25 February 2023 21:58
Subject: [PATCH] net/mlx5: reject flow template API reconfiguration

Flow Template API allows rte_flow_configure() to be called more than once, to allow applications to dynamically reconfigure the amount of resources available for flow table and flow rule creation. PMDs can reject the change in configuration and
keep the old configuration.

Before this patch, during Flow Template API reconfiguration in mlx5 PMD, all the allocated resources (HW/FW object pools, flow rules, pattern and actions templates) were released and reallocated according to the new configuration. This however leads to undefined behavior, since all references to templates, flows or indirect actions, which are held by the user, are now invalidated.

This patch changes the reconfiguration behavior. Configuration provided to rte_flow_configure() is stored in port's private data structure. On any subsequent call to rte_flow_configure(), the provided configuration is compared against the stored configuration. If both are equal, rte_flow_configure() reports a success and configuration is unaffected. Otherwise, (-ENOTSUP) is returned.

Quoted 2 lines

---

Acked-by on v1 1/1
#2 lore raw
In reply to Dariusz Sosnowski
Quoted 21 lines

-----Original Message-----
From: Dariusz Sosnowski <[email protected]>
Sent: Sunday, February 26, 2023 3:58 AM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]
Subject: [PATCH] net/mlx5: reject flow template API reconfiguration

Flow Template API allows rte_flow_configure() to be called more than once, to allow applications to dynamically reconfigure the amount of resources available for flow table and flow rule creation.
PMDs can reject the change in configuration and keep the old configuration.

Before this patch, during Flow Template API reconfiguration in mlx5 PMD, all the allocated resources (HW/FW object pools, flow rules, pattern and actions templates) were released and reallocated according to the new configuration. This however leads to undefined behavior, since all references to templates, flows or indirect actions, which are held by the user, are now invalidated.

Quoted 8 lines

This patch changes the reconfiguration behavior.
Configuration provided to rte_flow_configure() is stored in port's private data structure. On any subsequent call to rte_flow_configure(), the provided configuration is compared against the stored configuration.
If both are equal, rte_flow_configure() reports a success and configuration is unaffected. Otherwise, (-ENOTSUP) is returned.

Acked-by on v1 1/1
#3 lore raw
In reply to Dariusz Sosnowski

From: Dariusz Sosnowski

Quoted 12 lines

Flow Template API allows rte_flow_configure() to be called more than once, to allow applications to dynamically reconfigure the amount of resources available for flow table and flow rule creation.
PMDs can reject the change in configuration and keep the old configuration.

Before this patch, during Flow Template API reconfiguration in mlx5 PMD, all the allocated resources (HW/FW object pools, flow rules, pattern and actions templates) were released and reallocated according to the new configuration. This however leads to undefined behavior, since all references to templates, flows or indirect actions, which are held by the user, are now invalidated.

Quoted 8 lines

This patch changes the reconfiguration behavior.
Configuration provided to rte_flow_configure() is stored in port's private data structure. On any subsequent call to rte_flow_configure(), the provided configuration is compared against the stored configuration.
If both are equal, rte_flow_configure() reports a success and configuration is unaffected. Otherwise, (-ENOTSUP) is returned.

#4 lore raw
In reply to Dariusz Sosnowski

Hi,

Quoted 19 lines

-----Original Message-----
From: Dariusz Sosnowski <[email protected]>
Sent: Saturday, February 25, 2023 9:58 PM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]
Subject: [PATCH] net/mlx5: reject flow template API reconfiguration

Flow Template API allows rte_flow_configure() to be called more than once, to allow applications to dynamically reconfigure the amount of resources available for flow table and flow rule creation.
PMDs can reject the change in configuration and keep the old configuration.

Before this patch, during Flow Template API reconfiguration in mlx5 PMD, all the allocated resources (HW/FW object pools, flow rules, pattern and actions templates) were released and reallocated according to the new configuration. This however leads to undefined behavior, since all references to templates, flows or indirect actions, which are held by the user, are now invalidated.

Quoted 8 lines

This patch changes the reconfiguration behavior.
Configuration provided to rte_flow_configure() is stored in port's private data structure. On any subsequent call to rte_flow_configure(), the provided configuration is compared against the stored configuration.
If both are equal, rte_flow_configure() reports a success and configuration is unaffected. Otherwise, (-ENOTSUP) is returned.

Patch applied to net-net-mlx,

Kindest regards
Raslan Darawsheh