Skip to content

Commit dc4af8d

Browse files
Brian Malyjfvogel
authored andcommitted
add kernel param to pre-allocate NICs
Orabug: 30962711 This is so that eth0, eth1, ... ethX are available for ip link rename set for certain applications (that will not be named). Signed-off-by: Brian Maly <[email protected]> Reviewed-by: Saar Maoz <[email protected]> Signed-off-by: Allen Pais<[email protected]
1 parent dcb6105 commit dc4af8d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

net/core/dev.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@
151151
/* This should be increased if a protocol with a bigger head is added. */
152152
#define GRO_MAX_HEAD (MAX_HEADER + 128)
153153

154+
static int ifnames_skip = 0;
155+
core_param(ifnames_skip, ifnames_skip, int, 0444);
156+
154157
static DEFINE_SPINLOCK(ptype_lock);
155158
static DEFINE_SPINLOCK(offload_lock);
156159
struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
@@ -999,6 +1002,12 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)
9991002
if (!inuse)
10001003
return -ENOMEM;
10011004

1005+
if (ifnames_skip) {
1006+
int j;
1007+
for (j = 0; j < ifnames_skip && j < max_netdevices; j++)
1008+
set_bit(j, inuse);
1009+
}
1010+
10021011
for_each_netdev(net, d) {
10031012
if (!sscanf(d->name, name, &i))
10041013
continue;

0 commit comments

Comments
 (0)