openwrtv3/target/linux/generic
Kevin Darbyshire-Bryant eb8fbc4318 generic: swconfig: add mode led attribute
Add sysfs 'mode' attribute to swconfig controlled LEDs.

swconfig 'link state' LEDs blink in the presence of port traffic.  This
behaviour becomes more obvious as switches start to support
get_port_stats() e.g. commits 0369e35891,
3056d09b40,
4ddbc43cc1,
4d8a66d934.

This blinking can be confusing/distracting if the switch has other LEDs
used to indicate traffic.  Provide a 'mode' sysfs attribute that
controls the blink on traffic behaviour.

mode - either "none" (LED is off) or a space separated list of one or more:

link: LED's normal state reflects whether the link is up (has carrier) or not
tx:   LED blinks on transmitted data
rx:   LED blinks on receive data

Note that 'link' considers any port speed mask that may be applicable.
e.g. if an LED is configured to indicate 1Gbit link speed and mode is
set to 'link rx tx' but the port is connected at 100Mbit then the LED
will not light or blink. A mode of 'tx rx' will blink in the presence of
traffic only if the port matches the rate (if configured)
This maintains compatibility with existing behaviour.

Attribute is 'link tx rx' by default for backwards compatible behaviour.

Many thanks to Thibaut Varene for providing a more sensible led_event
routine after I had mangled the original, and other coding style hints.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Acked-by: Thibaut VARENE <hacks@slashdirt.org>
2018-02-14 07:54:24 +01:00
..
backport-4.9 kernel: use upstream patches for musl 2018-01-20 22:11:33 +01:00
backport-4.14 kernel: backport fix undefined abort 2018-02-10 20:58:39 +01:00
files generic: swconfig: add mode led attribute 2018-02-14 07:54:24 +01:00
hack-4.9 kernel: fix forwarding locally generated packages in bridge isolation patch 2018-02-05 10:16:26 +01:00
hack-4.14 kernel: bump 4.14 to 4.14.18 2018-02-08 18:43:13 +01:00
image treewide: replace nbd@openwrt.org with nbd@nbd.name 2016-06-07 08:58:42 +02:00
other-files kernel: move initramfs's init script out of base-files 2017-04-04 14:06:40 +02:00
pending-3.18 kernel: use upstream patches for musl 2018-01-20 22:11:33 +01:00
pending-4.4 kernel: use upstream patches for musl 2018-01-20 22:11:33 +01:00
pending-4.9 kernel: use upstream patches for musl 2018-01-20 22:11:33 +01:00
pending-4.14 kernel: ubifs: create use file system format 4 by default 2018-02-13 22:24:56 +01:00
config-3.18 kernel: mtdsplit: Add support for D-link JBOOT 2018-02-11 16:02:52 +01:00
config-4.4 kernel: mtdsplit: Add support for D-link JBOOT 2018-02-11 16:02:52 +01:00
config-4.9 kernel: add missing symbol 2018-02-13 10:55:46 +01:00
config-4.14 kernel: ubifs: create use file system format 4 by default 2018-02-13 22:24:56 +01:00
PATCHES kernel: update PATCHES with a stricter policy 2013-07-09 20:52:07 +00:00