Commit 84c7af63 authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed

net/mlx5: Do not hold group lock while allocating FTE in software

FTE memory allocation using alloc_fte() doesn't have any dependency
on the flow group.
Hence, do not hold flow group lock while performing alloc_fte().
This helps to reduce contention of flow group lock.
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Reviewed-by: default avatarDaniel Jurgens <danielj@mellanox.com>
Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent ae2741e2
......@@ -1814,6 +1814,13 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
return rule;
}
fte = alloc_fte(ft, spec, flow_act);
if (IS_ERR(fte)) {
up_write_ref_node(&ft->node, false);
err = PTR_ERR(fte);
goto err_alloc_fte;
}
nested_down_write_ref_node(&g->node, FS_LOCK_PARENT);
up_write_ref_node(&ft->node, false);
......@@ -1821,17 +1828,9 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
if (err)
goto err_release_fg;
fte = alloc_fte(ft, spec, flow_act);
if (IS_ERR(fte)) {
err = PTR_ERR(fte);
goto err_release_fg;
}
err = insert_fte(g, fte);
if (err) {
kmem_cache_free(steering->ftes_cache, fte);
if (err)
goto err_release_fg;
}
nested_down_write_ref_node(&fte->node, FS_LOCK_CHILD);
up_write_ref_node(&g->node, false);
......@@ -1843,6 +1842,8 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
err_release_fg:
up_write_ref_node(&g->node, false);
kmem_cache_free(steering->ftes_cache, fte);
err_alloc_fte:
tree_put_node(&g->node, false);
return ERR_PTR(err);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment