Thread (13 messages) 13 messages, 2 authors, 2020-12-14

Re: [PATCH net-next v4 3/3] net: add sysfs attribute to control napi threaded mode

From: Wei Wang <hidden>
Date: 2020-12-14 18:04:27

On Sat, Dec 12, 2020 at 2:59 PM Jakub Kicinski [off-list ref] wrote:
On Tue,  8 Dec 2020 16:54:44 -0800 Wei Wang wrote:
quoted
+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)
quoted
+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;
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help