[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ynk5UPWkuoXeqfJj@shell.armlinux.org.uk>
Date: Mon, 9 May 2022 16:54:56 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Josua Mayer <josua@...id-run.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Rob Herring <robh+dt@...nel.org>, Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>
Subject: Re: [PATCH RFC] net: sfp: support assigning status LEDs to SFP
connectors
On Mon, May 09, 2022 at 03:29:38PM +0300, Josua Mayer wrote:
> Dear Maintainers,
>
> I am working on a new device based on the LX2160A platform, that exposes
> 16 sfp connectors, each with its own led controlled by gpios intended
> to show link status.
> This patch intends to illustrate in code what we want to achieve,
> so that I can better ask you all:
> How can this work with the generic led framework, and how was it meant to work?
>
> The paragraphs below are a discussion of paths I have explored without success.
> Please let me know if you have any opinions and ideas.
>
> Describing in device-tree that an led node belongs to a particular network
> device (dpmac) however seems impossible. Instead the standard appears to work
> through triggers, where in device-tree one only annotates that the led should
> show a trigger "netdev" or "phy". Both of these make no sense when multiple
> network interfaces exist - raising the first question:
> How can device-tree indicate that an individual led should show the events of
> a particular network interface?
>
> We have found that there is a way in sysfs to echo the name of the network
> device to the api of the led driver, and it will start showing link status.
> However this has to be done at runtime by the user.
> But network interface names are unstable. They depend on probe order and
> can be changed at will. Further they can be moved to different namespaces,
> which will allow e.g. two instances of "eth0" to coexist.
> On the Layerscape platform in particular these devices are created dynamically
> by the networkign coprocessor, which supports complex functions such as
> creating one network interface that spans multiple ports.
> It seems to me that the netdev trigger therefore can not properly reflect
> the relation between an LED (which is hard-wired to an sfp cage), and the
> link state reported by e.g. a phy inside an sfp module.
>
> There exists also a phy trigger for leds.
> When invoking the phy_attach or phy_connect functions from the generic phy
> framework to connect an instance of net_device with an instance of phy_device,
> a trigger providing the link and speed events is registered.
> You may notice that again leds are tied to existence of a particular logical
> network interface, which may or may not exist, and may span multiple
> physical interfaces in case of layerscape.
> This is a dead end though, simply because the dpaa2 driver does not even use
> objects of phy_device, so this registering of triggers never happens.
>
> In addition the dpmac nodes in device-tree don't really have a phy modeled.
> One end are the serdes which are managed by the networking coprocessor.
> The other end has removable sfp modules, which may or may not contain a phy.
>
> The serdes are modeled as phy in device-tree though, perhaps the dpaa2 driver
> could be extended to instantiate phy_device objects for the serdes?
> However I feel like this would especially not solve when mutliple physical
> ports are used as one logical interface.
>
> It seems to me that there should be a way to explicitly link gpio-driven LEDs to
> either specific phy nodes, or specific sfp connectors - and have them receive
> link events from the respective phy, fully independent even from whether there
> is a logical network interface.
>
> If you got here, thank you very much for reading!
> Ay comments?
You really don't need any of this.
We already have the "netdev" trigger - you just need to assign the LED
to the appropriate netdev link.
I do this on the SolidSense platform with the two LEDs when using it as
my internet gateway on the boat - one LED gives wlan status, the other
LED gives wwan status, both of them green for link and red for tx/rx
activity.
Exactly the same can be done with SFPs if the net device is exclusive
to the SFP socket. Doing it this way also tells you that the netdev
link is up, not just that a SFP has decided to deassert the RXLOS
signals, which on some SFPs is tied inactive.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists