[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220810071603.GR17705@kitsune.suse.cz>
Date: Wed, 10 Aug 2022 09:16:03 +0200
From: Michal Suchánek <msuchanek@...e.de>
To: Andrew Lunn <andrew@...n.ch>
Cc: Tim Harvey <tharvey@...eworks.com>,
Pali Rohár <pali@...nel.org>,
Sean Anderson <sean.anderson@...o.com>,
Stephen Hemminger <stephen@...workplumber.org>,
netdev <netdev@...r.kernel.org>, u-boot <u-boot@...ts.denx.de>,
Device Tree Mailing List <devicetree@...r.kernel.org>
Subject: Re: ethernet<n> dt aliases implications in U-Boot and Linux
On Wed, Aug 10, 2022 at 03:11:48AM +0200, Andrew Lunn wrote:
> > Is something like the following really that crazy of an idea?
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index e0878a500aa9..a679c74a63c6 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -1151,6 +1151,15 @@ static int dev_alloc_name_ns(struct net *net,
> > int ret;
> >
> > BUG_ON(!net);
> > +#ifdef CONFIG_OF
> > + if (dev->dev.parent && dev->dev.parent->of_node) {
> > + const char *name =
> > of_get_property(dev->dev.parent->of_node, "label", NULL);
> > + if (name) {
> > + strlcpy(dev->name, name, IFNAMSIZ);
> > + return 0;
> > + }
> > + }
> > +#endif
> > ret = __dev_alloc_name(net, name, buf);
> > if (ret >= 0)
> > strlcpy(dev->name, buf, IFNAMSIZ);
> >
> > I still like using the index from aliases/ethernet* instead as there
> > is a precedence for that in other Linux drivers as well as U-Boot
>
> 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?
On x86 there is a name derived from the device location in the bus
topology 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.
What are the equivalents for DT?
Thanks
Michal
Powered by blists - more mailing lists