[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEA6p_Bwd=Zodzp3H6vjrmGjtPvQWCmj9efsb1QX2mHEtj50JQ@mail.gmail.com>
Date: Mon, 14 Dec 2020 10:02:01 -0800
From: Wei Wang <weiwan@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: David Miller <davem@...emloft.net>,
Linux Kernel Network Developers <netdev@...r.kernel.org>,
Paolo Abeni <pabeni@...hat.com>,
Hannes Frederic Sowa <hannes@...essinduktion.org>,
Eric Dumazet <edumazet@...gle.com>,
Felix Fietkau <nbd@....name>, Hillf Danton <hdanton@...a.com>
Subject: Re: [PATCH net-next v4 3/3] net: add sysfs attribute to control napi
threaded mode
On Sat, Dec 12, 2020 at 2:59 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Tue, 8 Dec 2020 16:54:44 -0800 Wei Wang wrote:
> > +static void dev_disable_threaded_all(struct net_device *dev)
> > +{
> > + struct napi_struct *napi;
> > +
> > + list_for_each_entry(napi, &dev->napi_list, dev_list)
> > + napi_set_threaded(napi, false);
> > +}
>
> This is an implementation detail which should be hidden in dev.c IMHO.
> Since the sysfs knob is just a device global on/off the iteration over
> napis and all is best hidden away.
OK. Will move it.
>
> (sorry about the delayed review BTW, hope we can do a minor revision
> and still hit 5.12)
>
> > +static int modify_napi_threaded(struct net_device *dev, unsigned long val)
> > +{
> > + struct napi_struct *napi;
> > + int ret;
> > +
> > + if (list_empty(&dev->napi_list))
> > + return -EOPNOTSUPP;
> > +
> > + list_for_each_entry(napi, &dev->napi_list, dev_list) {
> > + ret = napi_set_threaded(napi, !!val);
> > + if (ret) {
> > + /* Error occurred on one of the napi,
> > + * reset threaded mode on all napi.
> > + */
> > + dev_disable_threaded_all(dev);
> > + break;
> > + }
> > + }
> > +
> > + return ret;
> > +}
Powered by blists - more mailing lists