mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 11:03:43 +02:00
net/mlx5: Push common deletion code into mlx5_sf_del()
Don't call the same functions for SF deletion on multiple places. Instead, introduce a helper mlx5_sf_del() and move the code there. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Shay Drory <shayd@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
a65362f2be
commit
a3cc822bea
|
|
@ -364,13 +364,20 @@ static void mlx5_sf_dealloc(struct mlx5_sf_table *table, struct mlx5_sf *sf)
|
|||
mutex_unlock(&table->sf_state_lock);
|
||||
}
|
||||
|
||||
static void mlx5_sf_del(struct mlx5_sf_table *table, struct mlx5_sf *sf)
|
||||
{
|
||||
struct mlx5_eswitch *esw = table->dev->priv.eswitch;
|
||||
|
||||
mlx5_eswitch_unload_sf_vport(esw, sf->hw_fn_id);
|
||||
mlx5_sf_dealloc(table, sf);
|
||||
}
|
||||
|
||||
int mlx5_devlink_sf_port_del(struct devlink *devlink,
|
||||
struct devlink_port *dl_port,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct mlx5_core_dev *dev = devlink_priv(devlink);
|
||||
struct mlx5_sf *sf = mlx5_sf_by_dl_port(dl_port);
|
||||
struct mlx5_eswitch *esw = dev->priv.eswitch;
|
||||
struct mlx5_sf_table *table;
|
||||
|
||||
table = mlx5_sf_table_try_get(dev);
|
||||
|
|
@ -380,8 +387,7 @@ int mlx5_devlink_sf_port_del(struct devlink *devlink,
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
mlx5_eswitch_unload_sf_vport(esw, sf->hw_fn_id);
|
||||
mlx5_sf_dealloc(table, sf);
|
||||
mlx5_sf_del(table, sf);
|
||||
mlx5_sf_table_put(table);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -439,17 +445,14 @@ static void mlx5_sf_table_enable(struct mlx5_sf_table *table)
|
|||
|
||||
static void mlx5_sf_del_all(struct mlx5_sf_table *table)
|
||||
{
|
||||
struct mlx5_eswitch *esw = table->dev->priv.eswitch;
|
||||
unsigned long index;
|
||||
struct mlx5_sf *sf;
|
||||
|
||||
/* At this point, no new user commands can start and no vhca event can
|
||||
* arrive. It is safe to destroy all user created SFs.
|
||||
*/
|
||||
xa_for_each(&table->function_ids, index, sf) {
|
||||
mlx5_eswitch_unload_sf_vport(esw, sf->hw_fn_id);
|
||||
mlx5_sf_dealloc(table, sf);
|
||||
}
|
||||
xa_for_each(&table->function_ids, index, sf)
|
||||
mlx5_sf_del(table, sf);
|
||||
}
|
||||
|
||||
static void mlx5_sf_table_disable(struct mlx5_sf_table *table)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user