Skip to content

Commit 36c4211

Browse files
Somasundaram Krishnasamyvijay-suman
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] (cherry picked from commit dc4af8d) This commit is cherry-picked from UEK6 Orabug: 34074776 Signed-off-by: Somasundaram Krishnasamy <[email protected]> Reviewed-by: John Donnelly <[email protected]>
1 parent 0e43075 commit 36c4211

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
@@ -164,6 +164,9 @@
164164
#include "devmem.h"
165165
#include "net-sysfs.h"
166166

167+
static int ifnames_skip = 0;
168+
core_param(ifnames_skip, ifnames_skip, int, 0444);
169+
167170
static DEFINE_SPINLOCK(ptype_lock);
168171
struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
169172

@@ -1117,6 +1120,12 @@ static int __dev_alloc_name(struct net *net, const char *name, char *res)
11171120
if (!inuse)
11181121
return -ENOMEM;
11191122

1123+
if (ifnames_skip) {
1124+
int j;
1125+
for (j = 0; j < ifnames_skip && j < max_netdevices; j++)
1126+
set_bit(j, inuse);
1127+
}
1128+
11201129
for_each_netdev(net, d) {
11211130
struct netdev_name_node *name_node;
11221131

0 commit comments

Comments
 (0)