[PATCH] net/mlx5: fix assert failure in item translation
Suanming Mou
suanmingm at nvidia.com
Wed Oct 26 04:09:13 CEST 2022
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 at nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo at 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
More information about the dev
mailing list