[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAO7SqHDZfxMHv4JE5x7QbuJaBAPiH1MUed5RkHwvMWDRtkLQaw@mail.gmail.com>
Date: Wed, 3 Feb 2016 17:26:04 -0800
From: Salam Noureddine <noureddine@...sta.com>
To: Julian Anastasov <ja@....bg>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jiri Pirko <jiri@...lanox.com>,
Alexei Starovoitov <ast@...mgrid.com>,
Daniel Borkmann <daniel@...earbox.net>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 2/4] net: dev: add batching to net_device notifiers
On Wed, Feb 3, 2016 at 12:08 AM, Julian Anastasov <ja@....bg> wrote:
> Aha, I see, it is after NETDEV_UNREGISTER but may be
> the above loop should be changed to two loops so that
> NETDEV_UNREGISTER_BATCH is called exactly after all
> NETDEV_UNREGISTER and before all dev_*_flush and
> ndo_uninit calls to avoid any risks. I mean:
>
> synchronize_net();
>
> First part of loop:
>
> list_for_each_entry(dev, head, unreg_list) {
> /* Shutdown queueing discipline. */
> dev_shutdown(dev);
>
> /* Notify protocols, that we are about to destroy
> this device. They should clean all the things.
> */
> call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
> }
>
> This is the same NETDEV_UNREGISTER_BATCH logic:
>
> + list_for_each_entry(dev, head, unreg_list) {
> + net_add_event_list(&net_head, dev_net(dev));
> + }
> + list_for_each_entry_safe(net, net_tmp, &net_head, event_list) {
> + call_netdevice_notifiers(NETDEV_UNREGISTER_BATCH,
> + net->loopback_dev);
> + net_del_event_list(net);
> + }
>
> Second part of the loop:
>
> list_for_each_entry(dev, head, unreg_list) {
> struct sk_buff *skb = NULL;
>
> if (!dev->rtnl_link_ops ||
> ...
>
> Regards
>
> --
> Julian Anastasov <ja@....bg>
You're right. It is probably safer to organize the code the way you said.
Will change that, Thanks!
Salam
Powered by blists - more mailing lists