Skip to contentSkip to conversation

netconsole: Use netif_running() in write_msg()

PATCH Applied [email protected] 2 participants 2 messages Aug 10, 2007

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

PATCH 21/28 netconsole: Use netif_running() in write_msg()

From: Satyam Sharma <[email protected]>

Based upon initial work by Keiichi Kii <[email protected]>.

Avoid unnecessarily disabling interrupts and calling netpoll_send_udp() if the corresponding local interface is not up.

---

 drivers/net/netconsole.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/netconsole.c renamed from drivers/net/netconsole.c~netconsole-use-netif_running-in-write_msg +9 -9
diff -puN drivers/net/netconsole.c~netconsole-use-netif_running-in-write_msg drivers/net/netconsole.c
@@ -75,16 +75,16 @@ static void write_msg(struct console *co
 	int frag, left;
 	unsigned long flags;
 
-	local_irq_save(flags);
-
-	for (left = len; left;) {
-		frag = min(left, MAX_PRINT_CHUNK);
-		netpoll_send_udp(&np, msg, frag);
-		msg += frag;
-		left -= frag;
+	if (netif_running(np.dev)) {
+		local_irq_save(flags);
+		for (left = len; left;) {
+			frag = min(left, MAX_PRINT_CHUNK);
+			netpoll_send_udp(&np, msg, frag);
+			msg += frag;
+			left -= frag;
+		}
+		local_irq_restore(flags);
 	}
-
-	local_irq_restore(flags);
 }
 
 static struct console netconsole = {

_

maintainer Applied
#1 lore raw

From: [email protected]
Date: Fri, 10 Aug 2007 14:12:04 -0700

Quoted 11 lines

From: Satyam Sharma <[email protected]>

Based upon initial work by Keiichi Kii <[email protected]>.

Avoid unnecessarily disabling interrupts and calling netpoll_send_udp() if the corresponding local interface is not up.

Applied to net-2.6.24, thanks!