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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 8/9/22 5:35 PM, Tim Harvey wrote:
> On Tue, Aug 9, 2022 at 1:48 PM Sean Anderson <sean.anderson@xxxxxxxx> wrote:
>>
>>
>>
>> On 8/8/22 5:45 PM, Michal Suchánek wrote:
>> > On Mon, Aug 08, 2022 at 02:38:35PM -0700, Stephen Hemminger wrote:
>> >> On Mon, 8 Aug 2022 23:09:45 +0200
>> >> Michal Suchánek <msuchanek@xxxxxxx> wrote:
>> >>
>> >> > On Mon, Aug 08, 2022 at 03:57:55PM -0400, Sean Anderson wrote:
>> >> > > Hi Tim,
>> >> > >
>> >> > > On 8/8/22 3:18 PM, Tim Harvey wrote:
>> >> > > > Greetings,
>> >> > > >
>> >> > > > I'm trying to understand if there is any implication of 'ethernet<n>'
>> >> > > > aliases in Linux such as:
>> >> > > >         aliases {
>> >> > > >                 ethernet0 = &eqos;
>> >> > > >                 ethernet1 = &fec;
>> >> > > >                 ethernet2 = &lan1;
>> >> > > >                 ethernet3 = &lan2;
>> >> > > >                 ethernet4 = &lan3;
>> >> > > >                 ethernet5 = &lan4;
>> >> > > >                 ethernet6 = &lan5;
>> >> > > >         };
>> >> > > >
>> >> > > > I know U-Boot boards that use device-tree will use these aliases to
>> >> > > > name the devices in U-Boot such that the device with alias 'ethernet0'
>> >> > > > becomes eth0 and alias 'ethernet1' becomes eth1 but for Linux it
>> >> > > > appears that the naming of network devices that are embedded (ie SoC)
>> >> > > > vs enumerated (ie pci/usb) are always based on device registration
>> >> > > > order which for static drivers depends on Makefile linking order and
>> >> > > > has nothing to do with device-tree.
>> >> > > >
>> >> > > > Is there currently any way to control network device naming in Linux
>> >> > > > other than udev?
>> >> > >
>> >> > > You can also use systemd-networkd et al. (but that is the same kind of mechanism)
>> >> > >
>> >> > > > Does Linux use the ethernet<n> aliases for anything at all?
>> >> > >
>> >> > > No :l
>> >> >
>> >> > Maybe it's a great opportunity for porting biosdevname to DT based
>> >> > platforms ;-)
>> >>
>> >> Sorry, biosdevname was wrong way to do things.
>> >> Did you look at the internals, it was dumpster diving as root into BIOS.
>> >
>> > When it's BIOS what defines the names then you have to read them from
>> > the BIOS. Recently it was updated to use some sysfs file or whatver.
>> > It's not like you would use any of that code with DT, anyway.
>> >
>> >> Systemd-networkd does things in much more supportable manner using existing
>> >> sysfs API's.
>> >
>> > Which is a dumpster of systemd code, no thanks.
>> >
>> > I want my device naming independent of the init system, especially if
>> > it's systemd.
>>
>> Well, there's always nameif...
>>
>> That said, I have made [1] for people using systemd-networkd.
>>
>> --Sean
>>
>> [1] https://github.com/systemd/systemd/pull/24265
> 
> Sean,
> 
> That looks very promising. Linux is definitely flipping eth0/eth1
> between fec/eqos for me when booting an Ubuntu rootfs telling me that
> the netdev registration between those two drivers is racy.

Yeah, I always end up creating either udev rules or .link files so I
can keep my sanity :)

> Can you give me an example udev rule that shows how to invoke the new
> naming scheme your adding here?

I believe you use 75-net-description.rules, and then ID_NET_* will be
available for you to use in your rules. You can try it out manually by
running

	udevadm test-builtin net_id /sys/class/net/eth0

--Sean



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux