DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix assert failure in item translation
@ 2022-10-26  2:09 Suanming Mou
  2022-10-26  9:56 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Suanming Mou @ 2022-10-26  2:09 UTC (permalink / raw)
  To: Matan Azrad, Viacheslav Ovsiienko; +Cc: dev, rasland

When HW Steering is enabled, mlx5dr translates flow items using DV
item translation functions to configure flows in root flow table.
Represented port item stores vport metadata tag in thread-local
workspace when translate to DV spec. Due to the thread-local workspace
was not created in HW Steering, it caused an assertion in
mlx5_flow_get_thread_workspace()

This patch adds initialization of thread-local workspace when flow items
are translated to DV spec in HW Steering mode.

Fixes: cfddba76af4f ("net/mlx5: add hardware steering item translation function")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c    |  8 ++------
 drivers/net/mlx5/mlx5_flow.h    |  2 ++
 drivers/net/mlx5/mlx5_flow_dv.c | 20 +++++++++++++-------
 3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 13f7b92d6b..8e7d649d15 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -81,10 +81,6 @@ tunnel_flow_group_to_flow_table(struct rte_eth_dev *dev,
 				uint32_t group, uint32_t *table,
 				struct rte_flow_error *error);
 
-static struct mlx5_flow_workspace *mlx5_flow_push_thread_workspace(void);
-static void mlx5_flow_pop_thread_workspace(void);
-
-
 /** Device flow drivers. */
 extern const struct mlx5_flow_driver_ops mlx5_flow_verbs_drv_ops;
 
@@ -7586,7 +7582,7 @@ flow_alloc_thread_workspace(void)
  *
  * @return pointer to thread specific flow workspace data, NULL on error.
  */
-static struct mlx5_flow_workspace*
+struct mlx5_flow_workspace*
 mlx5_flow_push_thread_workspace(void)
 {
 	struct mlx5_flow_workspace *curr;
@@ -7623,7 +7619,7 @@ mlx5_flow_push_thread_workspace(void)
  *
  * @return pointer to thread specific flow workspace data, NULL on error.
  */
-static void
+void
 mlx5_flow_pop_thread_workspace(void)
 {
 	struct mlx5_flow_workspace *data = mlx5_flow_get_thread_workspace();
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 85d2fd219d..da9b65d8fe 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -1920,6 +1920,8 @@ struct mlx5_flow_driver_ops {
 
 /* mlx5_flow.c */
 
+struct mlx5_flow_workspace *mlx5_flow_push_thread_workspace(void);
+void mlx5_flow_pop_thread_workspace(void);
 struct mlx5_flow_workspace *mlx5_flow_get_thread_workspace(void);
 __extension__
 struct flow_grp_info {
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index f65407bd52..1e52278191 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -13499,6 +13499,7 @@ flow_dv_translate_items_hws(const struct rte_flow_item *items,
 			    uint8_t *match_criteria,
 			    struct rte_flow_error *error)
 {
+	struct mlx5_flow_workspace *flow_wks = mlx5_flow_push_thread_workspace();
 	struct mlx5_flow_rss_desc rss_desc = { .level = attr->rss_level };
 	struct rte_flow_attr rattr = {
 		.group = attr->group,
@@ -13515,17 +13516,20 @@ flow_dv_translate_items_hws(const struct rte_flow_item *items,
 		.attr = &rattr,
 		.rss_desc = &rss_desc,
 	};
-	int ret;
+	int ret = 0;
 
+	RTE_SET_USED(flow_wks);
 	for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
-		if (!mlx5_flow_os_item_supported(items->type))
-			return rte_flow_error_set(error, ENOTSUP,
-						  RTE_FLOW_ERROR_TYPE_ITEM,
-						  NULL, "item not supported");
+		if (!mlx5_flow_os_item_supported(items->type)) {
+			ret = rte_flow_error_set(error, ENOTSUP,
+						 RTE_FLOW_ERROR_TYPE_ITEM,
+						 NULL, "item not supported");
+			goto exit;
+		}
 		ret = flow_dv_translate_items(&rte_eth_devices[attr->port_id],
 			items, &wks, key, key_type,  NULL);
 		if (ret)
-			return ret;
+			goto exit;
 	}
 	if (wks.item_flags & MLX5_FLOW_ITEM_INTEGRITY) {
 		flow_dv_translate_item_integrity_post(key,
@@ -13569,7 +13573,9 @@ flow_dv_translate_items_hws(const struct rte_flow_item *items,
 		*match_criteria = flow_dv_matcher_enable(key);
 	if (item_flags)
 		*item_flags = wks.item_flags;
-	return 0;
+exit:
+	mlx5_flow_pop_thread_workspace();
+	return ret;
 }
 
 /**
-- 
2.25.1


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

* RE: [PATCH] net/mlx5: fix assert failure in item translation
  2022-10-26  2:09 [PATCH] net/mlx5: fix assert failure in item translation Suanming Mou
@ 2022-10-26  9:56 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2022-10-26  9:56 UTC (permalink / raw)
  To: Suanming Mou, Matan Azrad, Slava Ovsiienko; +Cc: dev

Hi,

> -----Original Message-----
> From: Suanming Mou <suanmingm@nvidia.com>
> Sent: Wednesday, October 26, 2022 5:09 AM
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Subject: [PATCH] net/mlx5: fix assert failure in item translation
> 
> When HW Steering is enabled, mlx5dr translates flow items using DV
> item translation functions to configure flows in root flow table.
> Represented port item stores vport metadata tag in thread-local
> workspace when translate to DV spec. Due to the thread-local workspace
> was not created in HW Steering, it caused an assertion in
> mlx5_flow_get_thread_workspace()
> 
> This patch adds initialization of thread-local workspace when flow items
> are translated to DV spec in HW Steering mode.
> 
> Fixes: cfddba76af4f ("net/mlx5: add hardware steering item translation
> function")
> 
> Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Squashed into relevant commit in next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2022-10-26  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-26  2:09 [PATCH] net/mlx5: fix assert failure in item translation Suanming Mou
2022-10-26  9:56 ` Raslan Darawsheh

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