2010-08-29 14:35:23 +00:00
|
|
|
--- a/drivers/leds/Kconfig
|
|
|
|
+++ b/drivers/leds/Kconfig
|
2010-10-04 20:43:07 +00:00
|
|
|
@@ -384,4 +384,11 @@ config LEDS_TRIGGER_MORSE
|
2010-08-29 14:35:23 +00:00
|
|
|
tristate "LED Morse Trigger"
|
|
|
|
depends on LEDS_TRIGGERS
|
|
|
|
|
|
|
|
+config LEDS_TRIGGER_NETDEV
|
|
|
|
+ tristate "LED Netdev Trigger"
|
|
|
|
+ depends on NET && LEDS_TRIGGERS
|
|
|
|
+ help
|
|
|
|
+ This allows LEDs to be controlled by network device activity.
|
|
|
|
+ If unsure, say Y.
|
|
|
|
+
|
|
|
|
endif # NEW_LEDS
|
|
|
|
--- a/drivers/leds/Makefile
|
|
|
|
+++ b/drivers/leds/Makefile
|
2010-10-05 08:50:54 +00:00
|
|
|
@@ -50,3 +50,4 @@ obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) +=
|
2010-08-29 14:35:23 +00:00
|
|
|
obj-$(CONFIG_LEDS_TRIGGER_GPIO) += ledtrig-gpio.o
|
|
|
|
obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
|
|
|
|
obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o
|
|
|
|
+obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o
|
2010-08-29 18:33:06 +00:00
|
|
|
--- a/drivers/leds/ledtrig-netdev.c
|
|
|
|
+++ b/drivers/leds/ledtrig-netdev.c
|
2010-10-05 08:50:54 +00:00
|
|
|
@@ -309,6 +309,7 @@ static void netdev_trig_timer(unsigned l
|
2010-08-29 18:33:06 +00:00
|
|
|
struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg;
|
2010-10-05 08:50:54 +00:00
|
|
|
const struct net_device_stats *dev_stats;
|
2010-08-29 18:33:06 +00:00
|
|
|
unsigned new_activity;
|
|
|
|
+ struct rtnl_link_stats64 temp;
|
|
|
|
|
|
|
|
write_lock(&trigger_data->lock);
|
|
|
|
|
|
|
|
@@ -318,7 +319,7 @@ static void netdev_trig_timer(unsigned l
|
|
|
|
goto no_restart;
|
|
|
|
}
|
|
|
|
|
|
|
|
- dev_stats = dev_get_stats(trigger_data->net_dev);
|
|
|
|
+ dev_stats = dev_get_stats(trigger_data->net_dev, &temp);
|
|
|
|
new_activity =
|
|
|
|
((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) +
|
|
|
|
((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0);
|