Skip to contentSkip to conversation

leds: add "network" LED trigger (lan/wan/wlan)

PATCH Superseded Mieczyslaw Nalewaj 1 participant 1 message Nov 25, 2025 1 message not in the archive LED

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v3 2/2 leds: add "network" LED trigger (lan/wan/wlan)

LED trigger for network interfaces.

- Aggregated per-family (lan/wan/wlan).
- Family and flags are taken from device tree properties:
   - "dev"  : simple family string "lan" | "wan" | "wlan"
   - "mode" : any combination of "link", "tx", "rx" flags Priority/combination:
   * If "mode" present: flags come from "mode" and take precedence. Family is taken from "dev" if present, otherwise from the LED name.
   * If only "dev" present: use its family and default flags = link+tx+rx.
   * If neither present: fall back to LED device name parsing.

- Suffix "-online" is valid ONLY in the LED name (label),
   e.g. "green:wlan-online". It indicates the online variant but is applied only when DT "mode" is absent.

Behaviour:
- wlan (normal): blink/solid driven by throughput table
- lan/wan (normal): one-shot blink on TX/RX packet change
- *-online variants: steady ON while any interface of the family has carrier

Interfaces are auto-tracked by name match (lan0, wan1, wlan2, phy0, wl1, ath0, ra0…). Up to MAX_IFACES (16) interfaces per family

This trigger is intended for board/device authors and drivers to provide simple network-activity LED behaviour without per-interface wiring in userspace.

drivers/leds/trigger/Kconfig +0 -0
@@ -129,6 +129,15 @@ config LEDS_TRIGGER_NETDEV

       This allows LEDs to be controlled by network device activity. If unsure, say Y.

+config LEDS_TRIGGER_NETWORK
+    tristate "LED trigger for network interfaces"
+    depends on NET
+    help
+      Per-family network LED trigger: aggregates lan/wan/wlan stats; +      family from DT 'dev' or name; flags from DT 'mode'; +      '-online' - online-only if mode absent.
+      If unsure, say Y.
+
 config LEDS_TRIGGER_PATTERN
     tristate "LED Pattern Trigger"
     help

drivers/leds/trigger/ledtrig-network.c new file +1019 -0

1,019 lines not on this page · raw message

drivers/leds/trigger/Makefile +0 -0
@@ -16,3 +16,4 @@ obj-$(CONFIG_LEDS_TRIGGER_NETDEV)    += led

 obj-$(CONFIG_LEDS_TRIGGER_PATTERN)    += ledtrig-pattern.o obj-$(CONFIG_LEDS_TRIGGER_TTY)        += ledtrig-tty.o obj-$(CONFIG_LEDS_TRIGGER_INPUT_EVENTS)    += ledtrig-input-events.o +obj-$(CONFIG_LEDS_TRIGGER_NETWORK)    += ledtrig-network.o