T Tobin C. Harding #
Message details and related content
Current implementation of __dev_alloc_name uses a custom bitmap of a single page to iterate network device id's and allocate an unused id. This is seemingly the same task that the IDA does. Also the current implementation leads to a upper limit of 8 * PAGE_SIZE on the number of network id's (for each name format i.e eth0). This patch uses the kernel's IDA as a replacement to the page based bitmap. This has the effect of simplifying the code and removing the upper limit. Testing was carried out using a simple network device module, the core of which is; #define NDEVICES 32768 /* current implementation hard limit */ /* test driver */ static int tm_init_module(void) { int result; int i; unsigned long before, after, diff, msec; pr_debug("tm: init module"); before = jiffies; for (i = 0; i < NDEVICES; i++) { devs[i] = alloc_netdev(0, "sn%d", NET_NAME_UNKNOWN, tm_init); if (!devs[i]) return -ENOMEM; result = register_netdev(devs[i]); if (result) { pr_err("tm: error %i registering device \"%s\"\n", result, devs[i]->name); tm_cleanup(); return -ENODEV;