Re: Naming of network devices - how to improve it in buster
- Date: Fri, 14 Jul 2017 11:20:00 -0300
- From: Henrique de Moraes Holschuh <hmh@xxxxxxxxxx>
- Subject: Re: Naming of network devices - how to improve it in buster
On Fri, 14 Jul 2017, Tom H wrote:
> > I've never seen the kernel vary the order it enumerates a PCI bus.
It doesn't, the last time it changed was on 2.4->2.6.
OTOH, *driver probe* ordering can and does change, especially when
device probes are being done in parallel. It is best to not get bus
enumeration (and even device endpoint enumeration) confused with device
*registration* by kernel drivers.
> For PCI Express; for all I know, other technologies might enumerate
> differently or change the enumeration method with different driver
Most buses are stable as far as enumeration goes: we don't have HBAs and
endpoints being renumbered across boots at all for PCI and PCIe and even
But bus device enumeration is separate from device register ordering.
> Per driver. There's no guarantee that the kernel will load the drivers
> in the same order at boot. There was even a (specific) note in one of
Indeed. Unless you add modules for which you care about the load order
to /etc/modules. Those are staticaly loaded first (obeying dependencies
by depmod, though) even by the initramfs. It has been supported for a
decade or more.
That *still* won't help for some drivers, where parallel *device* probes
are done AND device answer speed mandates which one will register first.
This does *not* apply to PCI/PCIe NICs handled by the same kernel
driver, but it very likely applies to USB for example.
> The classic naming scheme for network interfaces applied by the kernel
> is to simply assign names beginning with "eth0", "eth1", ... to all
> interfaces as they are probed by the drivers. As the driver probing is
Unfortunately, this is incorrect.
MOST PCI/PCIe NICs indeed use "ethX", etc. But the naming scheme really
is device driver-specific, and the "default" name used by a driver is
considered part of the kernel stable ABI, and cannot be changed on the
kernel side unless it is done opt-in at kernel config time (kconfig) or
at boot time (kernel command line, device tree, etc).
That said, most consumer devices nowadays are handled by drivers that
will use either ethX or wlanX by default.
> generally not predictable for modern technology this means that as soon
> as multiple network interfaces are available the assignment of the names
> "eth0", "eth1" and so on is generally not fixed anymore and it might
> very well happen that "eth0" on one boot ends up being "eth1" on the
Correct, in the general case.