Skip to contentSkip to conversation

net/mlx5: fix shared RSS action update

PATCH In review Andrey Vesnovaty 4 participants 4 messages Nov 22, 2020 – Nov 23, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix shared RSS action update

The shared RSS action update was not operational due to lack of kernel driver support of TIR object modification.
This commit introduces the workaround to support shared RSS action modify using an indirect queue table update instead of touching TIR object directly.
Limitations: the only supported RSS property to update is queues, the rest of the properties ignored.

Fixes d2046c09aa64 ("net/mlx5: support shared action for RSS")
---
 drivers/net/mlx5/mlx5.h         |   8 +-
 drivers/net/mlx5/mlx5_devx.c    |  84 +++++++++++++++--
 drivers/net/mlx5/mlx5_flow.h    |   4 +-
 drivers/net/mlx5/mlx5_flow_dv.c | 103 ++++++++++++---------
 drivers/net/mlx5/mlx5_rxq.c     | 159 +++++++++++++++++++++++++++-----
 drivers/net/mlx5/mlx5_rxtx.h    |   6 ++
 6 files changed, 283 insertions(+), 81 deletions(-)
drivers/net/mlx5/mlx5.h +7 -1
index b0c3a2286d..041240e6fe 100644
@@ -791,6 +791,8 @@ struct mlx5_flow_rss_desc {
 	uint32_t key_len; /**< RSS hash key len. */
 	uint32_t tunnel; /**< Queue in tunnel. */
 	uint32_t shared_rss; /**< Shared RSS index. */
+	struct mlx5_ind_table_obj *ind_tbl;
+	/**< Indirection table for shared RSS hash RX queues. */
 	union {
 		uint16_t *queue; /**< Destination queues. */
 		const uint16_t *const_q; /**< Const pointer convert. */
@@ -830,7 +832,7 @@ struct mlx5_ind_table_obj {
 		struct mlx5_devx_obj *rqt; /* DevX RQT object. */
 	};
 	uint32_t queues_n; /**< Number of queues in the list. */
-	uint16_t queues[]; /**< Queue list. */
+	uint16_t *queues; /**< Queue list. */
 };
 
 /* Hash Rx queue. */
@@ -906,6 +908,10 @@ struct mlx5_obj_ops {
 	void (*rxq_obj_release)(struct mlx5_rxq_obj *rxq_obj);
 	int (*ind_table_new)(struct rte_eth_dev *dev, const unsigned int log_n,
 			     struct mlx5_ind_table_obj *ind_tbl);
+	int (*ind_table_modify)(struct rte_eth_dev *dev,
+				const unsigned int log_n,
+				const uint16_t *queues, const uint32_t queues_n,
+				struct mlx5_ind_table_obj *ind_tbl);
 	void (*ind_table_destroy)(struct mlx5_ind_table_obj *ind_tbl);
 	int (*hrxq_new)(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq,
 			int tunnel __rte_unused);
drivers/net/mlx5/mlx5_devx.c +75 -9

130 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow.h +3 -1
index 088fa21e4d..a249c292e3 100644
@@ -1079,11 +1079,13 @@ struct mlx5_shared_action_rss {
 	uint32_t refcnt; /**< Atomically accessed refcnt. */
 	struct rte_flow_action_rss origin; /**< Original rte RSS action. */
 	uint8_t key[MLX5_RSS_HASH_KEY_LEN]; /**< RSS hash key. */
-	uint16_t *queue; /**< Queue indices to use. */
+	struct mlx5_ind_table_obj *ind_tbl;
+	/**< Hash RX queues (hrxq, hrxq_tunnel fields) indirection table. */
 	uint32_t hrxq[MLX5_RSS_HASH_FIELDS_LEN];
 	/**< Hash RX queue indexes mapped to mlx5_rss_hash_fields */
 	uint32_t hrxq_tunnel[MLX5_RSS_HASH_FIELDS_LEN];
 	/**< Hash RX queue indexes for tunneled RSS */
+	rte_spinlock_t action_rss_sl; /**< Shared RSS action spinlock. */
 };
 
 struct rte_flow_shared_action {
drivers/net/mlx5/mlx5_flow_dv.c +57 -46

182 lines not on this page · raw message

drivers/net/mlx5/mlx5_rxq.c +135 -24

224 lines not on this page · raw message

drivers/net/mlx5/mlx5_rxtx.h +6 -0
index 2988554a90..7989a50403 100644
@@ -352,6 +352,12 @@ struct mlx5_ind_table_obj *mlx5_ind_table_obj_get(struct rte_eth_dev *dev,
 int mlx5_ind_table_obj_release(struct rte_eth_dev *dev,
 			       struct mlx5_ind_table_obj *ind_tbl,
 			       bool standalone);
+int mlx5_ind_table_obj_setup(struct rte_eth_dev *dev,
+			     struct mlx5_ind_table_obj *ind_tbl);
+int mlx5_ind_table_obj_modify(struct rte_eth_dev *dev,
+			      struct mlx5_ind_table_obj *ind_tbl,
+			      uint16_t *queues, const uint32_t queues_n,
+			      bool standalone);
 struct mlx5_cache_entry *mlx5_hrxq_create_cb(struct mlx5_cache_list *list,
 		struct mlx5_cache_entry *entry __rte_unused, void *cb_ctx);
 int mlx5_hrxq_match_cb(struct mlx5_cache_list *list,
Signature · 1 line
2.26.2
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines

-----Original Message-----
From: Andrey Vesnovaty <[email protected]>
Sent: Sunday, November 22, 2020 16:50
To: [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>
Subject: [PATCH] net/mlx5: fix shared RSS action update

The shared RSS action update was not operational due to lack of kernel driver support of TIR object modification.
This commit introduces the workaround to support shared RSS action modify using an indirect queue table update instead of touching TIR object directly.
Limitations: the only supported RSS property to update is queues, the rest of the properties ignored.

Quoted 3 lines
Fixes d2046c09aa64 ("net/mlx5: support shared action for RSS")
#2 lore raw
In reply to Andrey Vesnovaty

Hi,

Quoted 21 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Andrey Vesnovaty
Sent: Sunday, November 22, 2020 4:50 PM
To: [email protected]
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]; Ori Kam <[email protected]>; Slava Ovsiienko <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>
Subject: [dpdk-dev] [PATCH] net/mlx5: fix shared RSS action update

The shared RSS action update was not operational due to lack of kernel driver support of TIR object modification.
This commit introduces the workaround to support shared RSS action modify using an indirect queue table update instead of touching TIR object directly.
Limitations: the only supported RSS property to update is queues, the rest of the properties ignored.

Fixes d2046c09aa64 ("net/mlx5: support shared action for RSS")
Quoted 9 lines
---
 drivers/net/mlx5/mlx5.h         |   8 +-
 drivers/net/mlx5/mlx5_devx.c    |  84 +++++++++++++++--
 drivers/net/mlx5/mlx5_flow.h    |   4 +-
 drivers/net/mlx5/mlx5_flow_dv.c | 103 ++++++++++++---------
 drivers/net/mlx5/mlx5_rxq.c     | 159 +++++++++++++++++++++++++++-----
 drivers/net/mlx5/mlx5_rxtx.h    |   6 ++
 6 files changed, 283 insertions(+), 81 deletions(-)

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

#3 lore raw
In reply to Andrey Vesnovaty
Quoted 21 lines

Subject: [dpdk-dev] [PATCH] net/mlx5: fix shared RSS action update

The shared RSS action update was not operational due to lack of kernel driver support of TIR object modification.
This commit introduces the workaround to support shared RSS action modify using an indirect queue table update instead of touching TIR object directly.
Limitations: the only supported RSS property to update is queues, the rest of the properties ignored.

Fixes d2046c09aa64 ("net/mlx5: support shared action for RSS")
---
 drivers/net/mlx5/mlx5.h         |   8 +-
 drivers/net/mlx5/mlx5_devx.c    |  84 +++++++++++++++--
 drivers/net/mlx5/mlx5_flow.h    |   4 +-
 drivers/net/mlx5/mlx5_flow_dv.c | 103 ++++++++++++---------
 drivers/net/mlx5/mlx5_rxq.c     | 159 +++++++++++++++++++++++++++-----
 drivers/net/mlx5/mlx5_rxtx.h    |   6 ++
 6 files changed, 283 insertions(+), 81 deletions(-)

<snip>

Quoted 8 lines

+11528,14 @@ __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx,

drivers/net/mlx5/mlx5_flow_dv.c +2 -0
 					  RTE_FLOW_ERROR_TYPE_ACTION,
 					  NULL,
 					  "shared rss hrxq has references");
+	queue = shared_rss->ind_tbl->queues;
+	remaining = mlx5_ind_table_obj_release(dev, shared_rss->ind_tbl,

true);

drivers/net/mlx5/mlx5_flow_dv.c __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx, · line 11538

Quoted 6 lines
drivers/net/mlx5/mlx5_flow_dv.c +6 -0
+	if (remaining)
+		return rte_flow_error_set(error, ETOOMANYREFS,
+					  RTE_FLOW_ERROR_TYPE_ACTION,
+					  NULL,
+					  "shared rss indirection table has"
+					  " references");

Please do not use ETOOMANYREFS, the API errno was changed to EBUSY.

drivers/net/mlx5/mlx5_flow_dv.c __flow_dv_action_rss_release(struct rte_eth_dev *dev, uint32_t idx, · line 11541

Quoted 4 lines

if (!__atomic_compare_exchange_n(&shared_rss->refcnt,
&old_refcnt,

drivers/net/mlx5/mlx5_flow_dv.c +0 -0
 					 0, 0, __ATOMIC_ACQUIRE,
 					 __ATOMIC_RELAXED))

</snip>

Quoted 2 lines

--
2.26.2