Re: [PATCH net-next v1 1/2] devlink: Break parameter notification sequence to be before/after unload/load driver

From: Leon Romanovsky
Date: Thu Jul 29 2021 - 10:39:02 EST


On Thu, Jul 29, 2021 at 04:33:58PM +0200, Jiri Pirko wrote:
> Thu, Jul 29, 2021 at 03:17:49PM CEST, leon@xxxxxxxxxx wrote:
> >From: Leon Romanovsky <leonro@xxxxxxxxxx>

<...>

> >+static void devlink_ns_change_notify(struct devlink *devlink,
> >+ struct net *dest_net, struct net *curr_net,
> >+ enum devlink_command cmd, bool new)
>
> Drop the cmd and determine the DEVLINK_CMD_PARAM_NEW/DEL by "new" arg as
> well. I thought I wrote that clearly in my previous review, but
> apparently not, sorry about that.
>
>
>
> > {
> > struct devlink_param_item *param_item;
> >
> >@@ -3812,17 +3813,17 @@ static void devlink_reload_netns_change(struct devlink *devlink,
> > * reload process so the notifications are generated separatelly.
> > */
> >
> >- 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);
> >+ if (!dest_net || net_eq(dest_net, curr_net))
> >+ return;
> >
> >- __devlink_net_set(devlink, dest_net);
> >+ if (new)
> >+ devlink_notify(devlink, DEVLINK_CMD_NEW);
> >
> >- 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);
> >+ devlink_param_notify(devlink, 0, param_item, cmd);
>
> Like this:
> devlink_param_notify(devlink, 0, param_item, new ?
> DEVLINK_CMD_PARAM_NEW ?
> DEVLINK_CMD_PARAM_DEL);

IMHO it is not nice, but will change.

Thanks