[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YvMF1JW3RzRbOhlx@lunn.ch>
Date: Wed, 10 Aug 2022 03:11:48 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Tim Harvey <tharvey@...eworks.com>
Cc: Pali Rohár <pali@...nel.org>,
Sean Anderson <sean.anderson@...o.com>,
Michal Suchánek <msuchanek@...e.de>,
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
> 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.
Andrew
Powered by blists - more mailing lists