Netdev List
 help / color / mirror / Atom feed
From: Lahav Schlesinger <lschlesinger@drivenets.com>
To: David Ahern <dsahern@gmail.com>
Cc: Leon Romanovsky <leon@kernel.org>,
	netdev@vger.kernel.org, kuba@kernel.org
Subject: Re: [PATCH net-next v3] rtnetlink: Support fine-grained netdevice bulk deletion
Date: Mon, 29 Nov 2021 15:53:08 +0200	[thread overview]
Message-ID: <20211129135307.mxtfw6j7v4hdex4f@kgollan-pc> (raw)
In-Reply-To: <09296394-a69a-ee66-0897-c9018185cfde@gmail.com>

On Sun, Nov 28, 2021 at 12:17:30PM -0700, David Ahern wrote:
> CAUTION: External E-Mail - Use caution with links and attachments
>
>
> On 11/28/21 4:43 AM, Leon Romanovsky wrote:
> >>>> +static int rtnl_list_dellink(struct net *net, int *ifindices, int size)
> >>>> +{
> >>>> +     const int num_devices = size / sizeof(int);
> >>>> +     struct net_device **dev_list;
> >>>> +     LIST_HEAD(list_kill);
> >>>> +     int i, ret;
> >>>> +
> >>>> +     if (size <= 0 || size % sizeof(int))
> >>>> +             return -EINVAL;
> >>>> +
> >>>> +     dev_list = kmalloc_array(num_devices, sizeof(*dev_list), GFP_KERNEL);
> >>>> +     if (!dev_list)
> >>>> +             return -ENOMEM;
> >>>> +
> >>>> +     for (i = 0; i < num_devices; i++) {
> >>>> +             const struct rtnl_link_ops *ops;
> >>>> +             struct net_device *dev;
> >>>> +
> >>>> +             ret = -ENODEV;
> >>>> +             dev = __dev_get_by_index(net, ifindices[i]);
> >>>> +             if (!dev)
> >>>> +                     goto out_free;
> >>>> +
> >>>> +             ret = -EOPNOTSUPP;
> >>>> +             ops = dev->rtnl_link_ops;
> >>>> +             if (!ops || !ops->dellink)
> >>>> +                     goto out_free;
> >>>
> >>> I'm just curious, how does user know that specific device doesn't
> >>> have ->delink implementation? It is important to know because you
> >>> are failing whole batch deletion. At least for single delink, users
> >>> have chance to skip "failed" one and continue.
> >>>
> >>> Thanks
> >>
> >> Hi Leon, I don't see any immediate way users can get this information.
> >> I do think that failing the whole request is better than silently
> >> ignoring such devices.
> >
> > I don't have any preference here, probably "fail all" is the easiest
> > solution here.
>
> Since there is no API to say which devices can not be deleted failing
> the group delete because 1 is say a physical device is going to be
> frustrating for users. I think the better approach is to delete what you
> can and set extack message to 'Some devices can not be deleted.'
>

Hi David, while I also don't have any strong preference here, my
reasoning for failing the whole request if one device can't be deleted
was so it will share the behaviour we currently have with group deletion.
If you're okay with this asymmetry I'll send a V4.

  reply	other threads:[~2021-11-29 13:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25 16:51 [PATCH net-next v3] rtnetlink: Support fine-grained netdevice bulk deletion Lahav Schlesinger
2021-11-28  7:33 ` Leon Romanovsky
2021-11-28 11:13   ` Lahav Schlesinger
2021-11-28 11:43     ` Leon Romanovsky
2021-11-28 19:17       ` David Ahern
2021-11-29 13:53         ` Lahav Schlesinger [this message]
2021-11-29 15:30           ` David Ahern
2021-11-29 18:10             ` Jakub Kicinski
2021-11-29 19:14               ` David Ahern
2021-11-30  8:04               ` Nicolas Dichtel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211129135307.mxtfw6j7v4hdex4f@kgollan-pc \
    --to=lschlesinger@drivenets.com \
    --cc=dsahern@gmail.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox