[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220106195118.hw2kx5t6l6sem6q3@kgollan-pc>
Date: Thu, 6 Jan 2022 21:51:19 +0200
From: Lahav Schlesinger <lschlesinger@...venets.com>
To: David Ahern <dsahern@...il.com>
Cc: Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <eric.dumazet@...il.com>, netdev@...r.kernel.org,
idosch@...sch.org, nicolas.dichtel@...nd.com, nikolay@...dia.com
Subject: Re: [PATCH net-next v6] rtnetlink: Support fine-grained netdevice
bulk deletion
On Tue, Jan 04, 2022 at 05:19:30PM -0700, David Ahern wrote:
> CAUTION: External E-Mail - Use caution with links and attachments
>
>
> On 1/4/22 2:12 PM, Jakub Kicinski wrote:
> > With the dev->bulk_delete flag and raw array instead of attributes you
> > can go back to the version of the code which stores dev pointers in a
> > temp kmalloc'd array, right?
>
> missed this response ... that should work as well once duplicates are
> caught.
I liked the idea that we can avoid increasing sizeof(struct net_device)
for this feature. In this case I see the final implementation as looking
something like this:
dev_list = kmalloc_array(num_devices, sizeof(*dev_list), GFP_KERNEL);
for (i = 0; i < num_devices; i++) {
dev = __dev_get_by_index(net, ifindices[i]);
...
if (dev->bulk_delete)
goto cleanup;
dev->bulk_delete = 1;
dev_list[i] = dev;
}
for (i = 0; i < num_devices; i++) {
dev = dev_list[i];
dev->rtnl_link_ops->dellink(dev, &list_kill);
dev->bulk_delete = 0;
}
kfree(dev_list);
unregister_netdevice_many(&list_kill);
return 0;
cleanup:
for (j = 0; j < i; j++) {
dev_list[j]->bulk_delete = 0;
}
kfree(dev_list);
Including the explicit checks in rtnl_setlink() __rtnl_newlink() and
rtnl_getlink() for returning an error if IFLA_IFINDEX_LIST is passed.
If it looks okay I'll send a v7.
Powered by blists - more mailing lists