From: Florian Fainelli <f.fainelli@gmail.com>
To: Sean Anderson <sean.anderson@seco.com>,
Tim Harvey <tharvey@gateworks.com>,
netdev <netdev@vger.kernel.org>, u-boot <u-boot@lists.denx.de>,
Device Tree Mailing List <devicetree@vger.kernel.org>
Subject: Re: ethernet<n> dt aliases implications in U-Boot and Linux
Date: Mon, 8 Aug 2022 14:18:59 -0700 [thread overview]
Message-ID: <4edd83d8-e6d9-ad11-c1b1-078f556ea4f3@gmail.com> (raw)
In-Reply-To: <5914cae0-e87b-fb94-85dd-33311fc84c52@seco.com>
On 8/8/22 12:57, 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
It is actually used, but by individual drivers, not by the networking
stack AFAICT:
git grep -E "of_alias_get_id\((.*), \"(eth|ethernet)\"\)" *
drivers/net/ethernet/broadcom/genet/bcmmii.c: id =
of_alias_get_id(dn, "eth");
drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c: plat->bus_id =
of_alias_get_id(np, "ethernet");
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c: plat->bus_id =
of_alias_get_id(np, "ethernet");
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c: plat->bus_id =
of_alias_get_id(np, "ethernet");
There were discussions about using that alias to name ethernet network
devices in the past (cannot quite point to the thread), the current
consensus appears to be that if you use the "label" property (which was
primed by DSA) then your network device will follow that name, still not
something the networking stack does for you within the guts of
register_netdev().
--
Florian
next prev parent reply other threads:[~2022-08-08 21:19 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-08 19:18 ethernet<n> dt aliases implications in U-Boot and Linux Tim Harvey
2022-08-08 19:57 ` Sean Anderson
2022-08-08 21:09 ` Michal Suchánek
2022-08-08 21:38 ` Stephen Hemminger
2022-08-08 21:45 ` Michal Suchánek
2022-08-09 20:48 ` Sean Anderson
2022-08-09 21:31 ` Pali Rohár
2022-08-09 21:36 ` Sean Anderson
2022-08-09 21:42 ` Pali Rohár
2022-08-09 22:41 ` Sean Anderson
2022-08-09 22:42 ` Tim Harvey
2022-08-09 22:45 ` Pali Rohár
2022-08-09 23:17 ` Tim Harvey
2022-08-10 1:11 ` Andrew Lunn
2022-08-10 7:16 ` Michal Suchánek
2022-08-10 15:17 ` Andrew Lunn
2022-08-10 15:35 ` Michal Suchánek
2022-08-11 19:43 ` Sean Anderson
2022-08-20 9:16 ` Pali Rohár
2022-08-20 13:02 ` Sean Anderson
2022-08-09 21:39 ` Tim Harvey
2022-08-09 21:45 ` Pali Rohár
2022-08-09 21:58 ` Stephen Hemminger
2022-08-10 9:56 ` Francesco Dolcini
2022-08-23 19:21 ` Rob Herring
2022-08-09 21:35 ` Tim Harvey
2022-08-09 21:41 ` Sean Anderson
2022-08-08 21:18 ` Tim Harvey
2022-08-08 21:18 ` Florian Fainelli [this message]
2022-08-08 21:28 ` Tim Harvey
2022-08-08 21:34 ` Florian Fainelli
2022-08-08 21:40 ` Tim Harvey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4edd83d8-e6d9-ad11-c1b1-078f556ea4f3@gmail.com \
--to=f.fainelli@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sean.anderson@seco.com \
--cc=tharvey@gateworks.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).