net: cache the __dev_alloc_name()
Subsystems (2)
RFC PATCH 1/1 net: cache the __dev_alloc_name()
When a system has around 1000 netdevs, adding the 1001st device becomes very slow. The devlink command to create an SF
$ devlink port add pci/0000:03:00.0 flavour pcisf \
pfnum 0 sfnum 1001
takes around 5 seconds, and Linux perf and flamegraph show 19% of time
spent on __dev_alloc_name() [1].The reason is that devlink first requests for next available "eth%d". And __dev_alloc_name will scan all existing netdev to match on "ethN", set N to a 'inuse' bitmap, and find/return next available number, in our case eth0.
And later on based on udev rule, we renamed it from eth0 to "en3f0pf0sf1001" and with altname below
14: en3f0pf0sf1001: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
altname enp3s0f0npf0sf1001
So eth0 is actually never being used, but as we have 1k "en3f0pf0sfN" devices + 1k altnames, the __dev_alloc_name spends lots of time goint through all existing netdev and try to build the 'inuse' bitmap of pattern 'eth%d'. And the bitmap barely has any bit set, and it rescanes every time.
I want to see if it makes sense to save/cache the result, or is there any way to not go through the 'eth%d' pattern search. The RFC patch adds name_pat (name pattern) hlist and saves the 'inuse' bitmap. It saves pattens, ex: "eth%d", "veth%d", with the bitmap, and lookup before scanning all existing netdevs.
Note: code is working just for quick performance benchmark, and still missing lots of stuff. Using hlist seems to overkill, as I think we only have few patterns
$ git grep alloc_netdev drivers/ net/ | grep %d
1. https://github.com/williamtu/net-next/issues/1
--- include/net/net_namespace.h | 1 + net/core/dev.c | 103 ++++++++++++++++++++++++++++++++++-- net/core/dev.h | 6 +++ 3 files changed, 106 insertions(+), 4 deletions(-)
include/net/net_namespace.h +1 -0
@@ -109,6 +109,7 @@ struct net {struct hlist_head *dev_name_head;struct hlist_head *dev_index_head; +struct hlist_head *dev_name_pat_head;struct xarray dev_by_index;struct raw_notifier_head netdev_chain;
net/core/dev.c +99 -4
170 lines not on this page · raw message
net/core/dev.h +6 -0
@@ -59,6 +59,12 @@ struct netdev_name_node {struct rcu_head rcu; }; +struct netdev_name_pat_node { +struct hlist_node hlist; +char name_pat[IFNAMSIZ ]; +unsigned long *inuse; +}; +int netdev_get_name (struct net *net,char *name,int ifindex);int dev_change_name (struct net_device *dev,const char *newname);
Signature · 1 line
2.34.1
Paolo Abeni
maintainerQuoted 23 lines · William Tu
When a system has around 1000 netdevs, adding the 1001st device becomes very slow. The devlink command to create an SF
$ devlink port add pci/0000:03:00.0 flavour pcisf \ pfnum 0 sfnum 1001 takes around 5 seconds, and Linux perf and flamegraph show 19% of time spent on __dev_alloc_name() [1].The reason is that devlink first requests for next available "eth%d". And
__dev_alloc_namewill scan all existing netdev to match on "ethN", set N to a 'inuse' bitmap, and find/return next available number, in our case eth0.And later on based on udev rule, we renamed it from eth0 to "en3f0pf0sf1001" and with altname below
14: en3f0pf0sf1001: <BROADCAST,MULTICAST,UP,LOWER_UP> ...altname enp3s0f0npf0sf1001So eth0 is actually never being used, but as we have 1k "en3f0pf0sfN" devices + 1k altnames, the
__dev_alloc_namespends lots of time goint through all existing netdev and try to build the 'inuse' bitmap of pattern 'eth%d'. And the bitmap barely has any bit set, and it rescanes every time.
Quoted 5 lines
I want to see if it makes sense to save/cache the result, or is there any way to not go through the 'eth%d' pattern search. The RFC patch adds
name_pat(name pattern) hlist and saves the 'inuse' bitmap. It saves pattens, ex: "eth%d", "veth%d", with the bitmap, and lookup before scanning all existing netdevs.
An alternative heuristic that should be cheap and possibly reasonable could be optimistically check for <name>0..<name><very small int> availability, possibly restricting such attempt at scenarios where the total number of hashed netdevice names is somewhat high.
WDYT?
Cheers,
Paolo
Quoted 37 lines · Paolo Abeni
External email: Use caution opening links or attachments
Quoted 23 lines · William Tu
When a system has around 1000 netdevs, adding the 1001st device becomes very slow. The devlink command to create an SF
$ devlink port add pci/0000:03:00.0 flavour pcisf \ pfnum 0 sfnum 1001 takes around 5 seconds, and Linux perf and flamegraph show 19% of time spent on __dev_alloc_name() [1].The reason is that devlink first requests for next available "eth%d". And
__dev_alloc_namewill scan all existing netdev to match on "ethN", set N to a 'inuse' bitmap, and find/return next available number, in our case eth0.And later on based on udev rule, we renamed it from eth0 to "en3f0pf0sf1001" and with altname below
14: en3f0pf0sf1001: <BROADCAST,MULTICAST,UP,LOWER_UP> ...altname enp3s0f0npf0sf1001So eth0 is actually never being used, but as we have 1k "en3f0pf0sfN" devices + 1k altnames, the
__dev_alloc_namespends lots of time goint through all existing netdev and try to build the 'inuse' bitmap of pattern 'eth%d'. And the bitmap barely has any bit set, and it rescanes every time.Quoted 5 lines
I want to see if it makes sense to save/cache the result, or is there any way to not go through the 'eth%d' pattern search. The RFC patch adds
name_pat(name pattern) hlist and saves the 'inuse' bitmap. It saves pattens, ex: "eth%d", "veth%d", with the bitmap, and lookup before scanning all existing netdevs.An alternative heuristic that should be cheap and possibly reasonable could be optimistically check for <name>0..<name><very small int> availability, possibly restricting such attempt at scenarios where the total number of hashed netdevice names is somewhat high.
Quoted 5 lines
WDYT?
Cheers,
Paolo
Hi Paolo,
Thanks for your suggestion!
I'm not clear with that idea.
The current code has to do a full scan of all netdevs in a list, and the name list is not sorted / ordered. So to get to know, ex: eth0 .. eth10, we still need to do a full scan, find netdev with prefix "eth", and get net available bit 11 (10+1). And in another use case where users doesn't install UDEV rule to rename, the system can actually create eth998, eth999, eth1000....
What if we create prefix map (maybe using xarray)
idx entry=(prefix, bitmap)
--------------------
0 eth, 1111000000...
1 veth, 1000000...
2 can, 11100000...
3 firewire, 00000...
but then we need to unset the bit when device is removed. William
Paolo Abeni
maintainerQuoted 64 lines · William Tu
Quoted 37 lines · Paolo Abeni
External email: Use caution opening links or attachments
Quoted 23 lines · William Tu
When a system has around 1000 netdevs, adding the 1001st device becomes very slow. The devlink command to create an SF
$ devlink port add pci/0000:03:00.0 flavour pcisf \ pfnum 0 sfnum 1001 takes around 5 seconds, and Linux perf and flamegraph show 19% of time spent on __dev_alloc_name() [1].The reason is that devlink first requests for next available "eth%d". And
__dev_alloc_namewill scan all existing netdev to match on "ethN", set N to a 'inuse' bitmap, and find/return next available number, in our case eth0.And later on based on udev rule, we renamed it from eth0 to "en3f0pf0sf1001" and with altname below
14: en3f0pf0sf1001: <BROADCAST,MULTICAST,UP,LOWER_UP> ...altname enp3s0f0npf0sf1001So eth0 is actually never being used, but as we have 1k "en3f0pf0sfN" devices + 1k altnames, the
__dev_alloc_namespends lots of time goint through all existing netdev and try to build the 'inuse' bitmap of pattern 'eth%d'. And the bitmap barely has any bit set, and it rescanes every time.Quoted 5 lines
I want to see if it makes sense to save/cache the result, or is there any way to not go through the 'eth%d' pattern search. The RFC patch adds
name_pat(name pattern) hlist and saves the 'inuse' bitmap. It saves pattens, ex: "eth%d", "veth%d", with the bitmap, and lookup before scanning all existing netdevs.An alternative heuristic that should be cheap and possibly reasonable could be optimistically check for <name>0..<name><very small int> availability, possibly restricting such attempt at scenarios where the total number of hashed netdevice names is somewhat high.
Quoted 5 lines
WDYT?
Cheers,
Paolo
Hi Paolo,
Thanks for your suggestion!
I'm not clear with that idea.The current code has to do a full scan of all netdevs in a list, and the name list is not sorted / ordered. So to get to know, ex: eth0 .. eth10, we still need to do a full scan, find netdev with prefix "eth", and get net available bit 11 (10+1).
And in another use case where users doesn't install UDEV rule to rename, the system can actually create eth998, eth999, eth1000....What if we create prefix map (maybe using xarray)
idx entry=(prefix, bitmap)
--------------------
0 eth, 1111000000...
1 veth, 1000000...
2 can, 11100000...
3 firewire, 00000...
Quoted 2 lines
but then we need to unset the bit when device is removed. William
Sorry for the late reply. I mean something alike the following (completely untested!!!):
---
net/core/dev.c +7 -0
@@ -1109,6 +1109,12 @@ static int __dev_alloc_name(struct net *net, const char *name, char *res)if (!p || p[1 ] !='d' ||strchr (p +2 ,'%' ))return -EINVAL ; +for (i =0 ; i <4 ; ++i) { +snprintf (buf,IFNAMSIZ , name, i); +if (!__dev_get_by_name (net, buf)) + goto found; + } +/* Use one page as a bit array of possible slots */ inuse =bitmap_zalloc (max_netdevices,GFP_ATOMIC );if (!inuse)
@@ -1144,6 +1150,7 @@ static int __dev_alloc_name(struct net *net, const char *name, char *res)if (i == max_netdevices)return -ENFILE ; +found:/* 'res' and 'name' could overlap, use 'buf' as an intermediate buffer */ strscpy (buf, name,IFNAMSIZ );snprintf (res,IFNAMSIZ , buf, i);
---
plus eventually some additional check to use such heuristic only if the
total number of devices is significantly high. That would need some
additional book-keeping, not added here.
Cheers,
Paolo
Quoted 103 lines · Paolo Abeni
External email: Use caution opening links or attachments
Quoted 58 lines · William Tu
Quoted 37 lines · Paolo Abeni
External email: Use caution opening links or attachments
Quoted 23 lines · William Tu
When a system has around 1000 netdevs, adding the 1001st device becomes very slow. The devlink command to create an SF
$ devlink port add pci/0000:03:00.0 flavour pcisf \ pfnum 0 sfnum 1001 takes around 5 seconds, and Linux perf and flamegraph show 19% of time spent on __dev_alloc_name() [1].The reason is that devlink first requests for next available "eth%d". And
__dev_alloc_namewill scan all existing netdev to match on "ethN", set N to a 'inuse' bitmap, and find/return next available number, in our case eth0.And later on based on udev rule, we renamed it from eth0 to "en3f0pf0sf1001" and with altname below
14: en3f0pf0sf1001: <BROADCAST,MULTICAST,UP,LOWER_UP> ... altname enp3s0f0npf0sf1001So eth0 is actually never being used, but as we have 1k "en3f0pf0sfN" devices + 1k altnames, the
__dev_alloc_namespends lots of time goint through all existing netdev and try to build the 'inuse' bitmap of pattern 'eth%d'. And the bitmap barely has any bit set, and it rescanes every time.Quoted 5 lines
I want to see if it makes sense to save/cache the result, or is there any way to not go through the 'eth%d' pattern search. The RFC patch adds
name_pat(name pattern) hlist and saves the 'inuse' bitmap. It saves pattens, ex: "eth%d", "veth%d", with the bitmap, and lookup before scanning all existing netdevs.An alternative heuristic that should be cheap and possibly reasonable could be optimistically check for <name>0..<name><very small int> availability, possibly restricting such attempt at scenarios where the total number of hashed netdevice names is somewhat high.
Quoted 5 lines
WDYT?
Cheers,
Paolo
Hi Paolo,
Thanks for your suggestion!
I'm not clear with that idea.The current code has to do a full scan of all netdevs in a list, and the name list is not sorted / ordered. So to get to know, ex: eth0 .. eth10, we still need to do a full scan, find netdev with prefix "eth", and get net available bit 11 (10+1).
And in another use case where users doesn't install UDEV rule to rename, the system can actually create eth998, eth999, eth1000....What if we create prefix map (maybe using xarray)
idx entry=(prefix, bitmap)
--------------------Quoted 7 lines
0 eth, 1111000000... 1 veth, 1000000... 2 can, 11100000... 3 firewire, 00000...but then we need to unset the bit when device is removed. William
Sorry for the late reply. I mean something alike the following (completely untested!!!):
---net/core/dev.c +7
-1@@ -1109,6 +1109,12 @@ static int __dev_alloc_name(struct net *net, const char *name, char *res)if (!p || p[1 ] !='d' ||strchr (p +2 ,'%' ))return -EINVAL ; +for (i =0 ; i <4 ; ++i) { +snprintf (buf,IFNAMSIZ , name, i); +if (!__dev_get_by_name (net, buf)) + goto found; + } +/* Use one page as a bit array of possible slots */ inuse =bitmap_zalloc (max_netdevices,GFP_ATOMIC );if (!inuse)@@ -1144,6 +1150,7 @@ static int __dev_alloc_name(struct net *net, const char *name, char *res)if (i == max_netdevices)return -ENFILE ; +found:/* 'res' and 'name' could overlap, use 'buf' as an intermediate buffer */ strscpy (buf, name,IFNAMSIZ );snprintf (res,IFNAMSIZ , buf, i); ---plus eventually some additional check to use such heuristic only if the total number of devices is significantly high. That would need some additional book-keeping, not added here.
Quoted 3 lines
Cheers,
Paolo
Hi Paolo,
Thanks, now I understand the idea.
Will give it a try.
William
Quoted 1 line
Quoted 29 lines · On Mon, 6 May 2024 20:32:07 +0000 William Tu <[email protected]> wrote:
When a system has around 1000 netdevs, adding the 1001st device becomes very slow. The devlink command to create an SF
$ devlink port add pci/0000:03:00.0 flavour pcisf \ pfnum 0 sfnum 1001 takes around 5 seconds, and Linux perf and flamegraph show 19% of time spent on __dev_alloc_name() [1].The reason is that devlink first requests for next available "eth%d". And
__dev_alloc_namewill scan all existing netdev to match on "ethN", set N to a 'inuse' bitmap, and find/return next available number, in our case eth0.And later on based on udev rule, we renamed it from eth0 to "en3f0pf0sf1001" and with altname below
14: en3f0pf0sf1001: <BROADCAST,MULTICAST,UP,LOWER_UP> ...altname enp3s0f0npf0sf1001So eth0 is actually never being used, but as we have 1k "en3f0pf0sfN" devices + 1k altnames, the
__dev_alloc_namespends lots of time goint through all existing netdev and try to build the 'inuse' bitmap of pattern 'eth%d'. And the bitmap barely has any bit set, and it rescanes every time.I want to see if it makes sense to save/cache the result, or is there any way to not go through the 'eth%d' pattern search. The RFC patch adds
name_pat(name pattern) hlist and saves the 'inuse' bitmap. It saves pattens, ex: "eth%d", "veth%d", with the bitmap, and lookup before scanning all existing netdevs.
Quoted 8 lines
Note: code is working just for quick performance benchmark, and still missing lots of stuff. Using hlist seems to overkill, as I think we only have few patterns
$ git grep alloc_netdev drivers/ net/ | grep %d1. https://github.com/williamtu/net-next/issues/1
Signed-off-by William Tu <[email protected]>
Actual patch is bit of a mess, with commented out code, leftover printks, random whitespace changes. Please fix that.
The issue is that bitmap gets to be large and adds bloat to embedded devices.
Perhaps you could either force devlink to use the same device each time (eth0) if it is going to be renamed anyway.
Quoted 43 lines · Stephen Hemminger
External email: Use caution opening links or attachments
Quoted 37 lines · On Mon, 6 May 2024 20:32:07 +0000 William Tu <[email protected]> wrote:
When a system has around 1000 netdevs, adding the 1001st device becomes very slow. The devlink command to create an SF
$ devlink port add pci/0000:03:00.0 flavour pcisf \ pfnum 0 sfnum 1001 takes around 5 seconds, and Linux perf and flamegraph show 19% of time spent on __dev_alloc_name() [1].The reason is that devlink first requests for next available "eth%d". And
__dev_alloc_namewill scan all existing netdev to match on "ethN", set N to a 'inuse' bitmap, and find/return next available number, in our case eth0.And later on based on udev rule, we renamed it from eth0 to "en3f0pf0sf1001" and with altname below
14: en3f0pf0sf1001: <BROADCAST,MULTICAST,UP,LOWER_UP> ...altname enp3s0f0npf0sf1001So eth0 is actually never being used, but as we have 1k "en3f0pf0sfN" devices + 1k altnames, the
__dev_alloc_namespends lots of time goint through all existing netdev and try to build the 'inuse' bitmap of pattern 'eth%d'. And the bitmap barely has any bit set, and it rescanes every time.I want to see if it makes sense to save/cache the result, or is there any way to not go through the 'eth%d' pattern search. The RFC patch adds
name_pat(name pattern) hlist and saves the 'inuse' bitmap. It saves pattens, ex: "eth%d", "veth%d", with the bitmap, and lookup before scanning all existing netdevs.Note: code is working just for quick performance benchmark, and still missing lots of stuff. Using hlist seems to overkill, as I think we only have few patterns
$ git grep alloc_netdev drivers/ net/ | grep %d1. https://github.com/williamtu/net-next/issues/1
Signed-off-by William Tu <[email protected]>
Hi Stephen,
Thanks for your feedback.
Quoted 2 lines
Actual patch is bit of a mess, with commented out code, leftover printks, random whitespace changes. Please fix that.
Yes, working on it.
Quoted 2 lines
The issue is that bitmap gets to be large and adds bloat to embedded devices.
the bitmap size is fixed (8*PAGE_SIZE), set_bit is also fast. It's just that for each new device, we always re-scan all existing netdevs, set bit map, and then free the bitmap.
Quoted 3 lines
Perhaps you could either force devlink to use the same device each time (eth0) if it is going to be renamed anyway.
It is working like that now (with udev) in my slow environment. So it's always getting eth0, (because bitmap is all 0s), and udev renames it to enp0xxx. Then next time rescan and since eth0 is still available, __dev_alloc_name still returns eth0, and udev renames it again, and next device creations follows the same, and the time to rescan gets longer and longer.
Regards,
William
Quoted 67 lines · William Tu
External email: Use caution opening links or attachments
Quoted 43 lines · Stephen Hemminger
External email: Use caution opening links or attachments
Quoted 37 lines · On Mon, 6 May 2024 20:32:07 +0000 William Tu <[email protected]> wrote:
When a system has around 1000 netdevs, adding the 1001st device becomes very slow. The devlink command to create an SF
$ devlink port add pci/0000:03:00.0 flavour pcisf \ pfnum 0 sfnum 1001 takes around 5 seconds, and Linux perf and flamegraph show 19% of time spent on __dev_alloc_name() [1].The reason is that devlink first requests for next available "eth%d". And
__dev_alloc_namewill scan all existing netdev to match on "ethN", set N to a 'inuse' bitmap, and find/return next available number, in our case eth0.And later on based on udev rule, we renamed it from eth0 to "en3f0pf0sf1001" and with altname below
14: en3f0pf0sf1001: <BROADCAST,MULTICAST,UP,LOWER_UP> ... altname enp3s0f0npf0sf1001So eth0 is actually never being used, but as we have 1k "en3f0pf0sfN" devices + 1k altnames, the
__dev_alloc_namespends lots of time goint through all existing netdev and try to build the 'inuse' bitmap of pattern 'eth%d'. And the bitmap barely has any bit set, and it rescanes every time.I want to see if it makes sense to save/cache the result, or is there any way to not go through the 'eth%d' pattern search. The RFC patch adds
name_pat(name pattern) hlist and saves the 'inuse' bitmap. It saves pattens, ex: "eth%d", "veth%d", with the bitmap, and lookup before scanning all existing netdevs.Note: code is working just for quick performance benchmark, and still missing lots of stuff. Using hlist seems to overkill, as I think we only have few patterns
$ git grep alloc_netdev drivers/ net/ | grep %d1. https://github.com/williamtu/net-next/issues/1
Signed-off-by William Tu <[email protected]>Hi Stephen,
Thanks for your feedback.Quoted 2 lines
Actual patch is bit of a mess, with commented out code, leftover printks, random whitespace changes. Please fix that.
Yes, working on it.
Quoted 2 lines
The issue is that bitmap gets to be large and adds bloat to embedded devices.
the bitmap size is fixed (8*PAGE_SIZE),
set_bitis also fast. It's just that for each new device, we always re-scan all existing netdevs, set bit map, and then free the bitmap.Quoted 3 lines
Perhaps you could either force devlink to use the same device each time (eth0) if it is going to be renamed anyway.
It is working like that now (with udev) in my slow environment. So it's always getting eth0, (because bitmap is all 0s), and udev renames it to enp0xxx. Then next time rescan and since eth0 is still available,
__dev_alloc_namestill returns eth0, and udev renames it again, and next device creations follows the same, and the time to rescan gets longer and longer.
Quoted 4 lines
Regards,
William
Hi Stephen and Paoblo,
Today I realize this isn't an issue.
Basically my perf result doesn't get the full picture. The 19% of time spent on __dev_alloc_name seems to be OK, becuase:
$ time devlink port add pci/0000:03:00.0 flavour pcisf \ pfnum 0 sfnum 1001 real 0m1.440s user 0m0.000s sys 0m0.004s It's just the 19% of the 'sys' time, not real time.
Thanks for your suggestions
William
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi William,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build warnings:
[auto build test WARNING on net/main]
[also build test WARNING on linus/master v6.9-rc7]
[cannot apply to net-next/main horms-ipvs/master next-20240508] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/William-Tu/net-cache-the-__dev_alloc_name/20240507-043305 base: net/main patch link: https://lore.kernel.org/r/20240506203207.1307971-1-witu%40nvidia.com patch subject: [PATCH RFC net-next] net: cache the __dev_alloc_name() config: alpha-defconfig (https://download.01.org/0day-ci/archive/20240509/[email protected]/config) compiler: alpha-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240509/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> net/core/dev.c:295:13: warning: 'netdev_name_pat_in_use' defined but not used [-Wunused-function]
295 | static bool netdev_name_pat_in_use(struct net *net, const char *pat) // eth%d
| ^~~~~~~~~~~~~~~~~~~~~~
>> net/core/dev.c:277:13: warning: 'netdev_name_pat_node_del' defined but not used [-Wunused-function]
277 | static void netdev_name_pat_node_del(struct netdev_name_pat_node *pat_node)
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> net/core/dev.c:264:13: warning: 'netdev_name_pat_node_free' defined but not used [-Wunused-function] 264 | static void netdev_name_pat_node_free(struct netdev_name_pat_node *pat_node)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
vim +/netdev_name_pat_in_use +295 net/core/dev.c
263
> 264 static void netdev_name_pat_node_free(struct netdev_name_pat_node *pat_node)
265 {
266 bitmap_free(pat_node->inuse);
267 kfree(pat_node);
268 }
269
270 static void netdev_name_pat_node_add(struct net *net,
271 struct netdev_name_pat_node *pat_node)
272 {
273 hlist_add_head(&pat_node->hlist,
274 dev_name_pat_hash(net, pat_node->name_pat));
275 }
276
> 277 static void netdev_name_pat_node_del(struct netdev_name_pat_node *pat_node)
278 {
279 hlist_del_rcu(&pat_node->hlist);
280 }
281
282 static struct netdev_name_pat_node *
283 netdev_name_pat_node_lookup(struct net *net, const char *pat)
284 {
285 struct hlist_head *head = dev_name_pat_hash(net, pat);
286 struct netdev_name_pat_node *pat_node;
287
288 hlist_for_each_entry(pat_node, head, hlist) {
289 if (!strcmp(pat_node->name_pat, pat))
290 return pat_node;
291 }
292 return NULL;
293 }
294
> 295 static bool netdev_name_pat_in_use(struct net *net, const char *pat) // eth%d 296 {
297 return netdev_name_pat_node_lookup(net, pat);
298 }
299
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki