mirror of https://gitee.com/openkylin/linux.git
net/mlx5: Add devlink reload
Implement devlink reload for mlx5. Usage example: devlink dev reload pci/0000:06:00.0 Signed-off-by: Michael Guralnik <michaelgur@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
71c6eaebf0
commit
4383cfcc65
|
@ -85,6 +85,22 @@ mlx5_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
|
{
|
||||||
|
struct mlx5_core_dev *dev = devlink_priv(devlink);
|
||||||
|
|
||||||
|
return mlx5_unload_one(dev, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mlx5_devlink_reload_up(struct devlink *devlink,
|
||||||
|
struct netlink_ext_ack *extack)
|
||||||
|
{
|
||||||
|
struct mlx5_core_dev *dev = devlink_priv(devlink);
|
||||||
|
|
||||||
|
return mlx5_load_one(dev, false);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct devlink_ops mlx5_devlink_ops = {
|
static const struct devlink_ops mlx5_devlink_ops = {
|
||||||
#ifdef CONFIG_MLX5_ESWITCH
|
#ifdef CONFIG_MLX5_ESWITCH
|
||||||
.eswitch_mode_set = mlx5_devlink_eswitch_mode_set,
|
.eswitch_mode_set = mlx5_devlink_eswitch_mode_set,
|
||||||
|
@ -96,6 +112,8 @@ static const struct devlink_ops mlx5_devlink_ops = {
|
||||||
#endif
|
#endif
|
||||||
.flash_update = mlx5_devlink_flash_update,
|
.flash_update = mlx5_devlink_flash_update,
|
||||||
.info_get = mlx5_devlink_info_get,
|
.info_get = mlx5_devlink_info_get,
|
||||||
|
.reload_down = mlx5_devlink_reload_down,
|
||||||
|
.reload_up = mlx5_devlink_reload_up,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct devlink *mlx5_devlink_alloc(void)
|
struct devlink *mlx5_devlink_alloc(void)
|
||||||
|
@ -235,6 +253,7 @@ int mlx5_devlink_register(struct devlink *devlink, struct device *dev)
|
||||||
goto params_reg_err;
|
goto params_reg_err;
|
||||||
mlx5_devlink_set_params_init_values(devlink);
|
mlx5_devlink_set_params_init_values(devlink);
|
||||||
devlink_params_publish(devlink);
|
devlink_params_publish(devlink);
|
||||||
|
devlink_reload_enable(devlink);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
params_reg_err:
|
params_reg_err:
|
||||||
|
@ -244,6 +263,7 @@ int mlx5_devlink_register(struct devlink *devlink, struct device *dev)
|
||||||
|
|
||||||
void mlx5_devlink_unregister(struct devlink *devlink)
|
void mlx5_devlink_unregister(struct devlink *devlink)
|
||||||
{
|
{
|
||||||
|
devlink_reload_disable(devlink);
|
||||||
devlink_params_unregister(devlink, mlx5_devlink_params,
|
devlink_params_unregister(devlink, mlx5_devlink_params,
|
||||||
ARRAY_SIZE(mlx5_devlink_params));
|
ARRAY_SIZE(mlx5_devlink_params));
|
||||||
devlink_unregister(devlink);
|
devlink_unregister(devlink);
|
||||||
|
|
|
@ -1168,7 +1168,7 @@ static void mlx5_unload(struct mlx5_core_dev *dev)
|
||||||
mlx5_put_uars_page(dev, dev->priv.uar);
|
mlx5_put_uars_page(dev, dev->priv.uar);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mlx5_load_one(struct mlx5_core_dev *dev, bool boot)
|
int mlx5_load_one(struct mlx5_core_dev *dev, bool boot)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -1226,7 +1226,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, bool boot)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mlx5_unload_one(struct mlx5_core_dev *dev, bool cleanup)
|
int mlx5_unload_one(struct mlx5_core_dev *dev, bool cleanup)
|
||||||
{
|
{
|
||||||
if (cleanup) {
|
if (cleanup) {
|
||||||
mlx5_unregister_device(dev);
|
mlx5_unregister_device(dev);
|
||||||
|
|
|
@ -243,4 +243,7 @@ enum {
|
||||||
|
|
||||||
u8 mlx5_get_nic_state(struct mlx5_core_dev *dev);
|
u8 mlx5_get_nic_state(struct mlx5_core_dev *dev);
|
||||||
void mlx5_set_nic_state(struct mlx5_core_dev *dev, u8 state);
|
void mlx5_set_nic_state(struct mlx5_core_dev *dev, u8 state);
|
||||||
|
|
||||||
|
int mlx5_unload_one(struct mlx5_core_dev *dev, bool cleanup);
|
||||||
|
int mlx5_load_one(struct mlx5_core_dev *dev, bool boot);
|
||||||
#endif /* __MLX5_CORE_H__ */
|
#endif /* __MLX5_CORE_H__ */
|
||||||
|
|
Loading…
Reference in New Issue