[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c0e2a287-4dc6-71b7-aed7-ec7243018078@gmail.com>
Date:   Wed, 8 Dec 2021 17:47:02 -0700
From:   David Ahern <dsahern@...il.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     Lahav Schlesinger <lschlesinger@...venets.com>,
        netdev@...r.kernel.org, nikolay@...dia.com
Subject: Re: [PATCH net-next v5] rtnetlink: Support fine-grained netdevice
 bulk deletion
On 12/8/21 5:45 PM, Jakub Kicinski wrote:
> On Wed, 8 Dec 2021 17:18:48 -0700 David Ahern wrote:
>> On 12/8/21 5:04 PM, Jakub Kicinski wrote:
>>>> I think marking the dev's and then using a delete loop is going to be
>>>> the better approach - avoid the sort and duplicate problem. I use that
>>>> approach for nexthop deletes:
>>>>
>>>> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/net/ipv4/nexthop.c#n1849
>>>>
>>>> Find a hole in net_device struct in an area used only for control path
>>>> and add 'bool grp_delete' (or a 1-bit hole). Mark the devices on pass
>>>> and delete them on another.  
>>>
>>> If we want to keep state in the netdev itself we can probably piggy
>>> back on dev->unreg_list. It should be initialized to empty and not
>>> touched unless device goes thru unregister.
>>
>> isn't that used when the delink function calls unregister_netdevice_queue?
> 
> Sure but all the validation is before we start calling delink, so
> doesn't matter?
> 
> list to_kill, queued;
> 
> for_each_attr(nest) {
> 	...
> 
> 	dev = get_by_index(nla_get_s32(..));
> 	if (!dev)
> 		goto cleanup;
> 	if (!list_empty(&dev->unreg_list))
> 		goto cleanup;
> 	...
> 
> 	list_add(&to_kill, &dev->unreg_list);
> }
> 
> for_each_entry_safe(to_kill) {
> 	list_del_init(&dev->unreg_list);
sure my mental model was walking the list and not doing that part. :-)
> 	->dellink(dev, queued);
> }
> 
> unreg_many(queued);
> 
> return
> 
> cleanup:
> 	for_each_entry_safe(to_kill) {
> 		list_del_init(&dev->unreg_list);
> 	}
> 
> No?
> 
Powered by blists - more mailing lists
 
