Skip to contentSkip to conversation

Network activity LED trigger

PATCH Florian Fainelli 2 participants 2 messages May 23, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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
index 80acd08..25d2b58 100644
@@ -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
index aa2c18e..bc899d3 100644
@@ -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
index 88afcef..ed3774e 100644
@@ -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
index 4317c1b..9423b26 100644
@@ -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.
 	 */
#1 lore raw

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 the ledtrig_network_activity can be network device specific for instance.