ethernet<n> dt aliases implications in U-Boot and Linux
Andrew Lunn
andrew at lunn.ch
Wed Aug 10 03:11:48 CEST 2022
> 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
More information about the U-Boot
mailing list