lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 10 May 2022 12:44:41 +0300
From:   Josua Mayer <josua@...id-run.com>
To:     "Russell King (Oracle)" <linux@...linux.org.uk>
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

Hi Russell,

Am 09.05.22 um 18:54 schrieb Russell King (Oracle):
> 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.
Yes, that is what we are doing at runtime now:
echo eth12 > /sys/class/leds/led_c1_at/device_name

I feared though (without testing) that this might break when interfaces 
are moved between namespaces, or renamed.
And it seemed wrong requiring the user to do explicitly make this 
assignment, when the purpose is very much fixed once you put a case 
around it and add some labels.

> 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.
Ah. And do you put the assignment of the LEDs into an init script?
> Exactly the same can be done with SFPs if the net device is exclusive
> to the SFP socket.
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.

> 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.
Good point, I have already noticed inconsistencies in this regard.
The information provided by the netdev trigger does seem superior.

We will try to adopt a solution based on what Andrew pointed me to, as 
that one appears to be a good way to describe this relationship between 
LEDs and MACs (by extension eth[0-9]+ interfaces).

> Thanks.

Thank you for your comments!

sincerely
Josua Mayer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ