From: "Marek Behún" <kabel@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>,
Rob Herring <robh+dt@kernel.org>, Pavel Machek <pavel@ucw.cz>,
"linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: lets settle the LED `function` property regarding the netdev trigger
Date: Wed, 6 Oct 2021 01:06:06 +0200 [thread overview]
Message-ID: <20211006010606.15d7370b@thinkpad> (raw)
In-Reply-To: <YVzMghbt1+ZSILpQ@lunn.ch>
On Wed, 6 Oct 2021 00:06:58 +0200
Andrew Lunn <andrew@lunn.ch> wrote:
> > > I suggest we start with simple independent LEDs. That gives enough to
> > > support the majority of use cases people actually need. And is enough
> > > to unblock people who i keep NACKing patches and tell them to wait for
> > > this work to get merged.
> >
> > Of course, and I plan to do so. Those netdev trigger extensions and
> > multi-color function definitions are for later :)
>
> Great.
>
> > We got side tracked in this discussion, sorry about that.
> >
> > In this thread I just wanted to settle the LED function property for
> > LEDs indicating network ports.
> >
> > So would you, Andrew, agree with:
> > - extending function property to be array of strings instead of only
> > one string, so that we can do
> > function = "link", "activity";
>
> I agree with having a list, and we use the combination. If the
> combination is not possible by the hardware, then -EINVAL, or
> -EOPNOTSUPP.
>
> > - having separate functions for different link modes
> > function = "link1000", "link100";
>
> I would suggest this, so you can use
>
> function = "link1000", "link100", "activity"
The problem here is that LED core uses function to compose LED name:
devicename:color:function
Should we use the first function? Then this LED will be named:
ethphy42:green:link1000
but it also indicates link100...
> What could be interesting is how you do this in sysfs? How do you
> enumerate what the hardware can do? How do you select what you want?
This is again sidetrack from the original discussion, which was only
meant to discuss DT, but okay :)
> Do you need to do
>
> echo "link1000 link100 activity" > /sys/class/net/eth0/phy/led/function
>
> And we can have something like
>
> cat /sys/class/net/eth0/phy/led/function
> activity
> link10 activity
> link100 activity
> link1000 activity
> [link100 link1000 activity]
> link10
> link100
> link1000
No, my current ideas about the netdev trigger extension are as follows
(not yet complete):
$ cd /sys/.../<LED>
$ echo netdev >trigger # To enable netdev trigger
$ echo eth0 >device_name
$ echo 1 >ext # To enable extended netdev trigger.
# This will create directory modes if there is
# a PHY attached to the interface
$ ls modes/
1000baseT_Full 100BaseT_Full 100BaseT_Half 10BaseT_Full 10BaseT_Half
$ cd modes/1000baseT_Full
$ ls
brightness link rx tx interval
So basically if you enable the extended netdev trigger, you will get
all the standard netdev settings for each PHY mode. (With a little
change to support blinking on link.)
With this you can set the LED:
ON when linked and speed=1000m or 100m, blink on activity
or
blink with 50ms interval when speed=1000m
blink with 100ms interval when speed=100m
blink with 200ms interval when speed=10m
(Note that these don't need to be supported by PHY. We are talking
about SW control. If the PHY supports some of these in HW, then the
trigger can be offloaded.)
Marek
next prev parent reply other threads:[~2021-10-05 23:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-01 12:36 lets settle the LED `function` property regarding the netdev trigger Marek Behún
2021-10-03 18:56 ` Andrew Lunn
2021-10-03 19:26 ` Marek Behún
2021-10-04 14:50 ` Andrew Lunn
2021-10-04 15:08 ` Marek Behún
2021-10-04 17:28 ` Andrew Lunn
2021-10-05 20:30 ` Marek Behún
2021-10-05 21:52 ` Andrew Lunn
2021-10-05 19:58 ` Jacek Anaszewski
2021-10-05 20:12 ` Andrew Lunn
2021-10-05 20:26 ` Marek Behún
2021-10-05 21:01 ` Andrew Lunn
2021-10-05 21:43 ` Marek Behún
2021-10-05 22:06 ` Andrew Lunn
2021-10-05 23:06 ` Marek Behún [this message]
2021-10-06 12:57 ` Andrew Lunn
2021-10-07 17:13 ` Marek Behún
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211006010606.15d7370b@thinkpad \
--to=kabel@kernel.org \
--cc=andrew@lunn.ch \
--cc=devicetree@vger.kernel.org \
--cc=jacek.anaszewski@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).