]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/mlx5: fs, retry insertion to hash table on EBUSY
authorMark Bloch <mbloch@nvidia.com>
Thu, 19 Dec 2024 17:58:35 +0000 (19:58 +0200)
committerJakub Kicinski <kuba@kernel.org>
Mon, 23 Dec 2024 18:34:45 +0000 (10:34 -0800)
When inserting into an rhashtable faster than it can grow, an -EBUSY error
may be encountered. Modify the insertion logic to retry on -EBUSY until
either a successful insertion or a genuine error is returned.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20241219175841.1094544-6-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

index f781f8f169b9a9916fcc0a136869b4c65ba4be47..ae1a5705b26ddeedccbb131689e2f23df6f5e601 100644 (file)
@@ -821,11 +821,17 @@ static int insert_fte(struct mlx5_flow_group *fg, struct fs_fte *fte)
                return index;
 
        fte->index = index + fg->start_index;
+retry_insert:
        ret = rhashtable_insert_fast(&fg->ftes_hash,
                                     &fte->hash,
                                     rhash_fte);
-       if (ret)
+       if (ret) {
+               if (ret == -EBUSY) {
+                       cond_resched();
+                       goto retry_insert;
+               }
                goto err_ida_remove;
+       }
 
        tree_add_node(&fte->node, &fg->node);
        list_add_tail(&fte->node.list, &fg->node.children);