Commit 04447185 authored by Paolo Abeni's avatar Paolo Abeni

Merge branch 'devlink-warn-about-existing-entities-during-reload-reinit'

Jiri Pirko says:

====================
devlink: warn about existing entities during reload-reinit

Recently there has been a couple of attempts from drivers to block
devlink reload in certain situations. Turned out, the drivers do not
properly tear down ports and related netdevs during reload.

To address this, add couple of checks to be done during devlink reload
reinit action. Also, extend documentation to be more explicit.
====================

Link: https://lore.kernel.org/r/20231128115255.773377-1-jiri@resnulli.usSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents e3517426 9b2348e2
...@@ -22,8 +22,17 @@ By default ``driver_reinit`` action is selected. ...@@ -22,8 +22,17 @@ By default ``driver_reinit`` action is selected.
* - ``driver-reinit`` * - ``driver-reinit``
- Devlink driver entities re-initialization, including applying - Devlink driver entities re-initialization, including applying
new values to devlink entities which are used during driver new values to devlink entities which are used during driver
load such as ``devlink-params`` in configuration mode load which are:
``driverinit`` or ``devlink-resources``
* ``devlink-params`` in configuration mode ``driverinit``
* ``devlink-resources``
Other devlink entities may stay over the re-initialization:
* ``devlink-health-reporter``
* ``devlink-region``
The rest of the devlink entities have to be removed and readded.
* - ``fw_activate`` * - ``fw_activate``
- Firmware activate. Activates new firmware if such image is stored and - Firmware activate. Activates new firmware if such image is stored and
pending activation. If no limitation specified this action may involve pending activation. If no limitation specified this action may involve
......
...@@ -425,6 +425,18 @@ static void devlink_reload_netns_change(struct devlink *devlink, ...@@ -425,6 +425,18 @@ static void devlink_reload_netns_change(struct devlink *devlink,
devlink_rel_nested_in_notify(devlink); devlink_rel_nested_in_notify(devlink);
} }
static void devlink_reload_reinit_sanity_check(struct devlink *devlink)
{
WARN_ON(!list_empty(&devlink->trap_policer_list));
WARN_ON(!list_empty(&devlink->trap_group_list));
WARN_ON(!list_empty(&devlink->trap_list));
WARN_ON(!list_empty(&devlink->dpipe_table_list));
WARN_ON(!list_empty(&devlink->sb_list));
WARN_ON(!list_empty(&devlink->rate_list));
WARN_ON(!list_empty(&devlink->linecard_list));
WARN_ON(!xa_empty(&devlink->ports));
}
int devlink_reload(struct devlink *devlink, struct net *dest_net, int devlink_reload(struct devlink *devlink, struct net *dest_net,
enum devlink_reload_action action, enum devlink_reload_action action,
enum devlink_reload_limit limit, enum devlink_reload_limit limit,
...@@ -452,8 +464,10 @@ int devlink_reload(struct devlink *devlink, struct net *dest_net, ...@@ -452,8 +464,10 @@ int devlink_reload(struct devlink *devlink, struct net *dest_net,
if (dest_net && !net_eq(dest_net, curr_net)) if (dest_net && !net_eq(dest_net, curr_net))
devlink_reload_netns_change(devlink, curr_net, dest_net); devlink_reload_netns_change(devlink, curr_net, dest_net);
if (action == DEVLINK_RELOAD_ACTION_DRIVER_REINIT) if (action == DEVLINK_RELOAD_ACTION_DRIVER_REINIT) {
devlink_params_driverinit_load_new(devlink); devlink_params_driverinit_load_new(devlink);
devlink_reload_reinit_sanity_check(devlink);
}
err = devlink->ops->reload_up(devlink, action, limit, actions_performed, extack); err = devlink->ops->reload_up(devlink, action, limit, actions_performed, extack);
devlink_reload_failed_set(devlink, !!err); devlink_reload_failed_set(devlink, !!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