net/mlx5: Fix return value when searching for existing flow group
authorPatrisious Haddad <phaddad@nvidia.com>
Tue, 10 Jun 2025 15:15:08 +0000 (18:15 +0300)
committerJakub Kicinski <kuba@kernel.org>
Wed, 11 Jun 2025 21:41:09 +0000 (14:41 -0700)
When attempting to add a rule to an existing flow group, if a matching
flow group exists but is not active, the error code returned should be
EAGAIN, so that the rule can be added to the matching flow group once
it is active, rather than ENOENT, which indicates that no matching
flow group was found.

Fixes: bd71b08ec2ee ("net/mlx5: Support multiple updates of steering rules in parallel")
Signed-off-by: Gavi Teitz <gavi@nvidia.com>
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Link: https://patch.msgid.link/20250610151514.1094735-4-mbloch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

index 23a7e8e7adfabe2c8a7ac4fe2b219182550cec26..a8046200d376d3b99f57b815cefbad14507700b1 100644 (file)
@@ -2228,6 +2228,7 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
        struct mlx5_flow_handle *rule;
        struct match_list *iter;
        bool take_write = false;
+       bool try_again = false;
        struct fs_fte *fte;
        u64  version = 0;
        int err;
@@ -2292,6 +2293,7 @@ skip_search:
                nested_down_write_ref_node(&g->node, FS_LOCK_PARENT);
 
                if (!g->node.active) {
+                       try_again = true;
                        up_write_ref_node(&g->node, false);
                        continue;
                }
@@ -2313,7 +2315,8 @@ skip_search:
                        tree_put_node(&fte->node, false);
                return rule;
        }
-       rule = ERR_PTR(-ENOENT);
+       err = try_again ? -EAGAIN : -ENOENT;
+       rule = ERR_PTR(err);
 out:
        kmem_cache_free(steering->ftes_cache, fte);
        return rule;