mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
net/mlx5: E-Switch, Refactor offloads flow steering init/cleanup
E-switch offloads mode initialize/cleanup multiple steering related entities (flow table/group). Refactor these operations to internal helper functions for better block design. This patch doesn't change any functionality. Signed-off-by: Bodong Wang <bodong@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
cbc44e76bf
commit
eca8cc3895
@ -1404,7 +1404,7 @@ static void esw_offloads_devcom_cleanup(struct mlx5_eswitch *esw)
|
||||
mlx5_devcom_unregister_component(devcom, MLX5_DEVCOM_ESW_OFFLOADS);
|
||||
}
|
||||
|
||||
int esw_offloads_init(struct mlx5_eswitch *esw, int nvports)
|
||||
static int esw_offloads_steering_init(struct mlx5_eswitch *esw, int nvports)
|
||||
{
|
||||
int err;
|
||||
|
||||
@ -1422,6 +1422,34 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int nvports)
|
||||
if (err)
|
||||
goto create_fg_err;
|
||||
|
||||
return 0;
|
||||
|
||||
create_fg_err:
|
||||
esw_destroy_offloads_table(esw);
|
||||
|
||||
create_ft_err:
|
||||
esw_destroy_offloads_fdb_tables(esw);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void esw_offloads_steering_cleanup(struct mlx5_eswitch *esw)
|
||||
{
|
||||
esw_destroy_vport_rx_group(esw);
|
||||
esw_destroy_offloads_table(esw);
|
||||
esw_destroy_offloads_fdb_tables(esw);
|
||||
}
|
||||
|
||||
int esw_offloads_init(struct mlx5_eswitch *esw, int nvports)
|
||||
{
|
||||
int err;
|
||||
|
||||
mutex_init(&esw->fdb_table.offloads.fdb_prio_lock);
|
||||
|
||||
err = esw_offloads_steering_init(esw, nvports);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = esw_offloads_load_reps(esw, nvports);
|
||||
if (err)
|
||||
goto err_reps;
|
||||
@ -1430,14 +1458,7 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int nvports)
|
||||
return 0;
|
||||
|
||||
err_reps:
|
||||
esw_destroy_vport_rx_group(esw);
|
||||
|
||||
create_fg_err:
|
||||
esw_destroy_offloads_table(esw);
|
||||
|
||||
create_ft_err:
|
||||
esw_destroy_offloads_fdb_tables(esw);
|
||||
|
||||
esw_offloads_steering_cleanup(esw);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1464,9 +1485,7 @@ void esw_offloads_cleanup(struct mlx5_eswitch *esw, int nvports)
|
||||
{
|
||||
esw_offloads_devcom_cleanup(esw);
|
||||
esw_offloads_unload_reps(esw, nvports);
|
||||
esw_destroy_vport_rx_group(esw);
|
||||
esw_destroy_offloads_table(esw);
|
||||
esw_destroy_offloads_fdb_tables(esw);
|
||||
esw_offloads_steering_cleanup(esw);
|
||||
}
|
||||
|
||||
static int esw_mode_from_devlink(u16 mode, u16 *mlx5_mode)
|
||||
|
Loading…
Reference in New Issue
Block a user