[01/10] net/mlx5/hws: check the rule status on rule update

Message ID 20231031122512.434686-2-getelson@nvidia.com (mailing list archive)
State Rejected, archived
Delegated to: Raslan Darawsheh
Series net/mlx5/hws: IPSEC reparse submission |


Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Gregory Etelson Oct. 31, 2023, 12:25 p.m. UTC
  From: Itamar Gozlan <igozlan@nvidia.com>

Only allow rule updates for rules with their status value equal to
Otherwise, the rule may be in an unstable stage like deleting and
this will result in a faulty unexpected scenario.

Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
 drivers/net/mlx5/hws/mlx5dr_rule.c | 6 ++++++
 1 file changed, 6 insertions(+)


diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index 980a99b226..70d5c19e1f 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -756,6 +756,12 @@  int mlx5dr_rule_action_update(struct mlx5dr_rule *rule_handle,
 	if (mlx5dr_rule_enqueue_precheck(matcher->tbl->ctx, attr))
 		return -rte_errno;
+	if (rule_handle->status != MLX5DR_RULE_STATUS_CREATED) {
+		DR_LOG(ERR, "Current rule status does not allow update");
+		rte_errno = EBUSY;
+		return -rte_errno;
+	}
 	ret = mlx5dr_rule_create_hws(rule_handle,