提交 a131315a 编写于 作者: J Jiri Pirko 提交者: David S. Miller

devlink: send objects notifications during devlink reload

Currently, the notifications are only sent for params. People who
introduced other objects forgot to add the reload notifications here.

To make sure all notifications happen according to existing comment,
benefit from existence of devlink_notify_register/unregister() helpers
and use them in reload code.
Signed-off-by: NJiri Pirko <jiri@nvidia.com>
Reviewed-by: NJacob Keller <jacob.e.keller@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7d7e9169
...@@ -4230,36 +4230,20 @@ static struct net *devlink_netns_get(struct sk_buff *skb, ...@@ -4230,36 +4230,20 @@ static struct net *devlink_netns_get(struct sk_buff *skb,
return net; return net;
} }
static void devlink_param_notify(struct devlink *devlink,
unsigned int port_index,
struct devlink_param_item *param_item,
enum devlink_command cmd);
static void devlink_reload_netns_change(struct devlink *devlink, static void devlink_reload_netns_change(struct devlink *devlink,
struct net *curr_net, struct net *curr_net,
struct net *dest_net) struct net *dest_net)
{ {
struct devlink_param_item *param_item;
/* Userspace needs to be notified about devlink objects /* Userspace needs to be notified about devlink objects
* removed from original and entering new network namespace. * removed from original and entering new network namespace.
* The rest of the devlink objects are re-created during * The rest of the devlink objects are re-created during
* reload process so the notifications are generated separatelly. * reload process so the notifications are generated separatelly.
*/ */
devlink_notify_unregister(devlink);
list_for_each_entry(param_item, &devlink->param_list, list)
devlink_param_notify(devlink, 0, param_item,
DEVLINK_CMD_PARAM_DEL);
devlink_notify(devlink, DEVLINK_CMD_DEL);
move_netdevice_notifier_net(curr_net, dest_net, move_netdevice_notifier_net(curr_net, dest_net,
&devlink->netdevice_nb); &devlink->netdevice_nb);
write_pnet(&devlink->_net, dest_net); write_pnet(&devlink->_net, dest_net);
devlink_notify_register(devlink);
devlink_notify(devlink, DEVLINK_CMD_NEW);
list_for_each_entry(param_item, &devlink->param_list, list)
devlink_param_notify(devlink, 0, param_item,
DEVLINK_CMD_PARAM_NEW);
} }
static void devlink_reload_failed_set(struct devlink *devlink, static void devlink_reload_failed_set(struct devlink *devlink,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册