Opened 10 years ago

Closed 9 years ago

#2776 closed enhancement (fixed)

New LED trigger type netdev - triggers LEDs on network device activity

Reported by: oliver@… Owned by: developers
Priority: normal Milestone:
Component: kernel Version:
Keywords: Cc:


I have a D-Link DSL-502T (AR7-based) which, while it has an ethernet activity LED, the LED is not actually directly driven by the ethernet hardware. The vendor firmware drives the LED in their ethernet driver on every packet (yuck!).

The attached patch adds a "netdev" LED trigger type which drives the LED based on some combination of link state and tx/rx activity. It's useful for both ethernet & ADSL monitoring. For link state it uses a netdev notifier. For tx/rx activity it polls device tx/rx stats from a timer.

Also in this patch is an init.d script to configure triggers appropriately for the LEDs available on the DSL-502T

Attachments (2)

01-ledtrig-netdev.patch (15.9 KB) - added by oliver@… 10 years ago.
Adds "netdev" LED trigger
02-ledtrig_netdev-menuconfig.patch (1.3 KB) - added by NRForbes 10 years ago.
Add option for ledtrig-netdev to "Kernel Modules > Other" for menuconfig system

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by oliver@…

Adds "netdev" LED trigger

comment:1 Changed 10 years ago by nabcore

I've tested this patch against r9666 on a DG834G(v2), but I cannot see any related files appearing in the sys dir:

root@Bunny:/sys/class/leds# ls -l
lrwxrwxrwx    1 root     root            0 Jan  1  2000 status -> ../../devices/platform/leds-gpio/leds/status

If I'm correct, an ethernet dir should appear here.

I'm pretty sure it got complied into the image that I flashed onto the router:

root@Bunny:/proc# cat config.gz | gzip -d | grep LED
# LED drivers
# LED Triggers

comment:2 Changed 10 years ago by oliver@…

The trigger module just adds a new LED trigger type that drives an existing LED off network activity, it doesn't create any new LED definitions. For the DSL-502T I added detection of status / ethernet / usb LEDs in #2746, but that's obviously not going to work for you since you're on different hardware. The trunk AR7 code only knows how to configure FritzBox hardware, IIRC, and everything else falls back to a single generic "status" LED.

You could try using the gpio character device (you have to create the /dev nodes by hand) to find out which lines drive which LEDs on your hardware, then add something appropriate to arch/mips/ar7/platform.c

comment:3 Changed 10 years ago by nabcore

One more thing..the /etc/init.d/ledsetup file with the package needs to executable for it to run.

comment:4 Changed 10 years ago by NRForbes

Hi Oliver,

Thanks for a great addition. I have a small additional patch which allows this trigger to be selected via the menuconfig system, to give us a little more control.

I have also been working on getting the ATM driver to control LEDs (see ticket #2996), and am now thinking about the best way of configuring all the LED stuff in userspace. I'd appreciate any comments you have on the approach I have outlined in that ticket?



Changed 10 years ago by NRForbes

Add option for ledtrig-netdev to "Kernel Modules > Other" for menuconfig system

comment:5 Changed 9 years ago by blogic

  • Resolution set to fixed
  • Status changed from new to closed

applied in [10566] and [10567], the init.d part will be added at a later point

has this patch gone into upstream kernel yet ?

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.