Subject: Re: [PATCH RFC] net: sfp: support assigning status LEDs to SFP connectors

From: "Russell King (Oracle)" <[email-masked]>
Date: Wed, 11 May 2022 14:39:23 +0100

On Wed, May 11, 2022 at 01:22:22PM +0000, Ioana Ciornei wrote:
> On Tue, May 10, 2022 at 12:44:41PM +0300, Josua Mayer wrote:
> 
> > One issue is that the interfaces don't have stable names. It purely depends
> > on probe order,
> > which is controlled by sending commands to the networking coprocessor.
> > 
> > We actually get asked this question sometimes how to have stable device
> > names, and so far the answer has been systemd services with explicit sleep
> > to force the order.
> > But this is a different topic.
> > 
> 
> Stable names can be achieved using some udev rules based on the OF node.
> For example, I am using the following rules on a Clearfog CX LX2:
> 
> [root@clearfog-cx-lx2 ~] # cat /etc/udev/rules.d/70-persistent-net.rules
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="fsl_dpaa2_eth", ENV{OF_FULLNAME}=="/soc/fsl-mc@80c000000/dpmacs/ethernet@7", NAME="eth7"
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="fsl_dpaa2_eth", ENV{OF_FULLNAME}=="/soc/fsl-mc@80c000000/dpmacs/ethernet@8", NAME="eth8"
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="fsl_dpaa2_eth", ENV{OF_FULLNAME}=="/soc/fsl-mc@80c000000/dpmacs/ethernet@9", NAME="eth9"
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="fsl_dpaa2_eth", ENV{OF_FULLNAME}=="/soc/fsl-mc@80c000000/dpmacs/ethernet@a", NAME="eth10"
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="fsl_dpaa2_eth", ENV{OF_FULLNAME}=="/soc/fsl-mc@80c000000/dpmacs/ethernet@11", NAME="eth17"

Or by using systemd - for example, on the Armada 38x Clearfog platform,
I use:

/etc/systemd/network/01-ded.link:
[Match]
Path=platform-f1070000.ethernet
[Link]
MACAddressPolicy=none
Name=eno0

/etc/systemd/network/02-sw.link:
[Match]
Path=platform-f1030000.ethernet
[Link]
MACAddressPolicy=none
Name=eno1

/etc/systemd/network/03-sfp.link:
[Match]
Path=platform-f1034000.ethernet
[Link]
MACAddressPolicy=none
Name=eno2

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!