Subject: Re: [PATCH] net: rocker: Change netdev names to include slot number

From: David Ahern <[email-masked]>
Date: Tue, 03 Feb 2015 09:06:16 -0700

On 2/2/15 10:46 PM, Scott Feldman wrote:
>> [root@f21 ~]# cat /sys/devices/virtual/net/sw5p0/phys_port_id
>> cat: /sys/devices/virtual/net/sw5p0/phys_port_id: Operation not supported
>
> We should implement .ndo_get_phys_port_id in rocker to return a unique
> name for the port, which can then be used in udev script to name
> interface.  When rocker device is instantiated, a unique switch name
> is given on qemu cmd line, for example "sw1".  Rocker device could
> return that string to the driver, or even combine that string with the

Right. That's what I went looking for at first and noticed that info is 
not pushed to the driver. And then I know at least one vendor puts the 
slot id in interface names which is the reason I went for the PCI slot id.

> port index to have "sw1p1".  The second instantiated rocker device
> would give up "sw2px" port names.

And yes, adding the port index to the above name -- though ideally 
starting at 1 and not 0.

>
> A real switch with a physical port than can be split, or when multiple
> ports are ganged to form one mega port, letting the device pick a
> unique name is probably best.  For example, splitting a single
> physical 40Gb port into 4 10Gb ports would present 4 kernel
> interfaces, but we probably want to use the base port in the naming,
> so we'd have something like "sw1p1s1" to mean switch 1, front panel
> port 1, split port 1.  Letting the device name the ports on current
> port configuration of the port will keep driver/kernel simple, and let
> udev be the final name chooser.

Exactly. When you add in break out ports to the mix having sane, logical 
default names (without udev) makes life easier. That was my ultimate 
intent here - logical default names that udev or a user could then 
modify if so desired.

But anyways, since the request is to have udev do the naming I need to 
come back to it. A quick search on the systemd web site did not stumble 
onto examples I could use, so I need to put this on the back burner 
until I have time to dig through systemd docs.

David