[PATCH v3 5/7] net/mlx5/hws: bwc - go through all the resized matchers
Maayan Kashani
mkashani at nvidia.com
Mon Jun 3 12:56:32 CEST 2024
From: Yevgeny Kliteynik <kliteyn at nvidia.com>
When destroying resizable matcher, we iterate through the list
of previous src matchers and free all their action_ste resources.
Now that we're supporting growing action template sizes, we also
need to support a case when each new dst matcher that we resize
into might have bigger max_ste.
This includes a case where old matchers in the list would have
max_ste 0, while they've been resized into a matcher that has
max_ste > 0.
Signed-off-by: Yevgeny Kliteynik <kliteyn at nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr_matcher.c | 23 +++++++++++++----------
drivers/net/mlx5/hws/mlx5dr_matcher.h | 1 +
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index aa5ab96d23..6a939eb031 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -724,6 +724,7 @@ mlx5dr_matcher_resize_init(struct mlx5dr_matcher *src_matcher)
return rte_errno;
}
+ resize_data->max_stes = src_matcher->action_ste.max_stes;
resize_data->ste = src_matcher->action_ste.ste;
resize_data->stc = src_matcher->action_ste.stc;
resize_data->action_ste_rtc_0 = src_matcher->action_ste.rtc_0;
@@ -752,23 +753,25 @@ mlx5dr_matcher_resize_uninit(struct mlx5dr_matcher *matcher)
{
struct mlx5dr_matcher_resize_data *resize_data;
- if (!mlx5dr_matcher_is_resizable(matcher) ||
- !matcher->action_ste.max_stes)
+ if (!mlx5dr_matcher_is_resizable(matcher))
return;
while (!LIST_EMPTY(&matcher->resize_data)) {
resize_data = LIST_FIRST(&matcher->resize_data);
LIST_REMOVE(resize_data, next);
- mlx5dr_action_free_single_stc(matcher->tbl->ctx,
- matcher->tbl->type,
- &resize_data->stc);
+ if (resize_data->max_stes) {
+ mlx5dr_action_free_single_stc(matcher->tbl->ctx,
+ matcher->tbl->type,
+ &resize_data->stc);
+
+ if (matcher->tbl->type == MLX5DR_TABLE_TYPE_FDB)
+ mlx5dr_cmd_destroy_obj(resize_data->action_ste_rtc_1);
+ mlx5dr_cmd_destroy_obj(resize_data->action_ste_rtc_0);
+ if (resize_data->action_ste_pool)
+ mlx5dr_pool_destroy(resize_data->action_ste_pool);
+ }
- if (matcher->tbl->type == MLX5DR_TABLE_TYPE_FDB)
- mlx5dr_cmd_destroy_obj(resize_data->action_ste_rtc_1);
- mlx5dr_cmd_destroy_obj(resize_data->action_ste_rtc_0);
- if (resize_data->action_ste_pool)
- mlx5dr_pool_destroy(resize_data->action_ste_pool);
simple_free(resize_data);
}
}
diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.h b/drivers/net/mlx5/hws/mlx5dr_matcher.h
index caff403a38..ca6a5298d9 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.h
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.h
@@ -67,6 +67,7 @@ struct mlx5dr_matcher_resize_data {
struct mlx5dr_devx_obj *action_ste_rtc_0;
struct mlx5dr_devx_obj *action_ste_rtc_1;
struct mlx5dr_pool *action_ste_pool;
+ uint8_t max_stes;
LIST_ENTRY(mlx5dr_matcher_resize_data) next;
};
--
2.25.1
More information about the dev
mailing list