ethernet<n> dt aliases implications in U-Boot and Linux

Sean Anderson sean.anderson at seco.com
Thu Aug 11 21:43:34 CEST 2022



On 8/10/22 11:35 AM, Michal Suchánek wrote:
> On Wed, Aug 10, 2022 at 05:17:56PM +0200, Andrew Lunn wrote:
>> > > I guess you are new to the netdev list :-)
>> > > 
>> > > This is one of those FAQ sort of things, discussed every
>> > > year. Anything like this is always NACKed. I don't see why this time
>> > > should be any different.
>> > > 
>> > > DSA is somewhat special because it is very old. It comes from before
>> > > the times of DT. Its DT binding was proposed relatively earl in DT
>> > > times, and would be rejected in modern days. But the rules of ABI mean
>> > > the label property will be valid forever. But i very much doubt it
>> > > will spread to interfaces in general.
>> > 
>> > And if this is a FAQ maybe you can point to a summary (perhaps in
>> > previous mail discusssion) that explains how to provide stable interface
>> > names for Ethernet devices on a DT based platform?
>> 
>> As far so the kernel is concerned, interface names are unstable. They
>> have never been truly stable, but they have got more unstable in the
>> past decade with multiple busses being probed in parallel, which did
>> not happen before so much.
>> 
>> > On x86 there is a name derived from the device location in the bus
>> > topology
>> 
>> This is nothing to do with x86. That is userspace, e.g. systemd,
>> renaming the interfaces. This applies for any architecture for which
>> systemd runs on.
>> 
>> > which may be somewhat stable but it is not clear that it
>> > cannot change, and there is an optional BIOS provided table that can
>> > asssign meaningful names to the interfaces.
>> 
>> I doubt the kernel is looking at ACPI tables. It is user space which
>> does that.
>> 
>> The kernel provides udev with a bunch of information about the
>> interface, its bus location, MAC address, etc. Userspace can then
>> decide what it wants to call it, and what its alternative names are,
>> etc.
>> 
>> Also, this is not just a network interface name problem. Any device
>> with a number/letter in it is unstable. I2C bus devices: i2c0,
>> i2c1... SPI bus deviceS: spi0, spi1...,
> 
> Thees do have numbered aliases in the DT. I don't know if the kernel
> uses them for anything.

This is an issue for serial devices IMO. The only way to specify a
stable console is to use its address! Things like /dev/ttyS0 can
easily be reordered just by plugging/unplugging a card. You can of
course add a udev rule to create some stable symlinks, but that's
too late.

>> Block devices, sda, sdb, sdc,
> 
> These too, at least mmc.


Which I am very grateful exists. While the block device situation is
not as bad due to e.g. /dev/block/by-foo, it's still nice to be able
to have a consistent name.

--Sean


More information about the U-Boot mailing list