All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net/mlx5/hws: fix rule resize status check
@ 2024-03-21 14:24 Yevgeny Kliteynik
  2024-03-21 14:24 ` [PATCH 2/2] net/mlx5/hws: fix port ID for root table Yevgeny Kliteynik
  2024-03-24 22:12 ` [PATCH 1/2] net/mlx5/hws: fix rule resize status check Thomas Monjalon
  0 siblings, 2 replies; 4+ messages in thread
From: Yevgeny Kliteynik @ 2024-03-21 14:24 UTC (permalink / raw)
  To: kliteyn, viacheslavo, thomas, suanmingm, Dariusz Sosnowski,
	Ori Kam, Matan Azrad
  Cc: dev, valex, igozlan, erezsh

The check to detect if a rule is in resize was done incorrectly,
this can lead to an incorrect function call upon completion for
rules which are not in resize (move).
Since the resize_info is in a union we cannot rely only on the
pointer value but also need to make sure the matcher is in resize
process, this assures us the resize info is valid.

Fixes: 762feceb8294 ("net/mlx5/hws: support resizable matchers")

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_rule.c | 7 +++++++
 drivers/net/mlx5/hws/mlx5dr_rule.h | 6 +-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index f14e1e6ecd..784f614d87 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -350,6 +350,13 @@ static void mlx5dr_rule_move_init(struct mlx5dr_rule *rule,
 	rule->resize_info->state = MLX5DR_RULE_RESIZE_STATE_WRITING;
 }
 
+bool mlx5dr_rule_move_in_progress(struct mlx5dr_rule *rule)
+{
+	return mlx5dr_matcher_is_in_resize(rule->matcher) &&
+	       rule->resize_info &&
+	       rule->resize_info->state != MLX5DR_RULE_RESIZE_STATE_IDLE;
+}
+
 static int mlx5dr_rule_create_hws_fw_wqe(struct mlx5dr_rule *rule,
 					 struct mlx5dr_rule_attr *attr,
 					 uint8_t mt_idx,
diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.h b/drivers/net/mlx5/hws/mlx5dr_rule.h
index 07adf9c5ad..dffaec1c0f 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.h
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.h
@@ -72,10 +72,6 @@ int mlx5dr_rule_move_hws_remove(struct mlx5dr_rule *rule,
 int mlx5dr_rule_move_hws_add(struct mlx5dr_rule *rule,
 			     struct mlx5dr_rule_attr *attr);
 
-static inline bool mlx5dr_rule_move_in_progress(struct mlx5dr_rule *rule)
-{
-	return rule->resize_info &&
-	       rule->resize_info->state != MLX5DR_RULE_RESIZE_STATE_IDLE;
-}
+bool mlx5dr_rule_move_in_progress(struct mlx5dr_rule *rule);
 
 #endif /* MLX5DR_RULE_H_ */
-- 
2.27.0


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

end of thread, other threads:[~2024-03-24 22:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-21 14:24 [PATCH 1/2] net/mlx5/hws: fix rule resize status check Yevgeny Kliteynik
2024-03-21 14:24 ` [PATCH 2/2] net/mlx5/hws: fix port ID for root table Yevgeny Kliteynik
2024-03-21 14:48   ` [PATCH v2] " Yevgeny Kliteynik
2024-03-24 22:12 ` [PATCH 1/2] net/mlx5/hws: fix rule resize status check Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.