Network activity LED trigger
Subsystems (3)
Here comes a basic patch that adds a network led activity. It is not configurable yet, but is enough to make a LED configured with the "network-activity" trigger to blink on network activity.
Netdev people can probably comment on the place of ledtrig_network_activity(), which is probably not adequate. Also the ledtrig_network_activity can be network device specific for instance.
drivers/leds/Kconfig +7 -0
@@ -127,5 +127,12 @@ config LEDS_TRIGGER_HEARTBEAT load average. If unsure, say Y. +config LEDS_TRIGGER_NETWORK_ACT + tristate "LED Network Activity Trigger" + depends on LEDS_TRIGGER && NET + help + This allow LEDs to be controlled by network activity at layer-3 networking. + If unsure, say Y. + endmenu
drivers/leds/Makefile +1 -0
@@ -21,3 +21,4 @@ obj-$(CONFIG_LEDS_COBALT) += leds-cobalt.o obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o +obj-$(CONFIG_LEDS_TRIGGER_NETWORK_ACT) += ledtrig-network-activity.o
drivers/leds/ledtrig-network-activity.c new file +61 -0
61 lines not on this page · raw message
include/linux/leds.h +6 -0
@@ -110,4 +110,10 @@ extern void ledtrig_ide_activity(void);#define ledtrig_ide_activity () do {} while(0)#endif +#ifdef CONFIG_LEDS_TRIGGER_NETWORK_ACT +extern void ledtrig_network_activity (void ); +#else +#define ledtrig_network_activity () do {} while(0) +#endif +#endif /* __LINUX_LEDS_H_INCLUDED */
net/core/dev.c +3 -0
@@ -116,6 +116,7 @@#include <linux/dmaengine.h> #include <linux/err.h> #include <linux/ctype.h> +#include <linux/leds.h> /* * The list of packet types we will receive (as opposed to discard)
@@ -1451,6 +1452,8 @@ int dev_queue_xmit(struct sk_buff *skb) gso:spin_lock_prefetch (&dev->queue_lock); +ledtrig_network_activity (); +/* Disable soft irqs for various locks below. Also * stops preemption for RCU. */
You know that you posted this exact message last time? ;-> And i responded here:
http://marc.info/?l=linux-netdev&m=117882888105536&w=2
cheers,
jamal
Quoted 9 lines · Florian Fainelli
Here comes a basic patch that adds a network led activity. It is not configurable yet, but is enough to make a LED configured with the "network-activity" trigger to blink on network activity.
Netdev people can probably comment on the place of
ledtrig_network_activity(), which is probably not adequate. Also theledtrig_network_activitycan be network device specific for instance.Signed-off-by Florian Fainelli <[email protected]>