Re: [PATCH net-next v1 4/4] usbnet: add support for label from device tree

From: Andrew Lunn
Date: Thu Feb 03 2022 - 08:04:44 EST


On Thu, Feb 03, 2022 at 05:20:34AM +0300, Sergey Ryazanov wrote:
> Hello Greg,
>
> if I may be allowed, I would like to make a couple of points about
> specifying network interface names in DT. As in previous mail, not to
> defend this particular patch, but to talk about names assignment in
> general.
>
> I may be totally wrong, so consider my words as a request for
> discussion. I have been thinking about an efficient way for network
> device names assignment for routers with a fixed configuration and
> have always come to a conclusion that DT is a good place for names
> storage. Recent DSA capability to assign names from labels and this
> patch by Oleksij show that I am not alone.

DSA doing this is not recent. The first patch implementing DSA in 2008
had the ability to set the interface names. This was long before the
idea that userspace should set interface names became the 'correct'
way to do this.

The current thinking for routers which don't make use of the DSA
framework, it to use interface names like swXpY, where X is the switch
number and Y is the port number. udev can make use of for example
/sys/class/net/*/phys_port_name to get the pY bit to give the
interface its full name.

Andrew