[PATCH v2 -mm 7/9] netconsole: Use netif_running() in write_msg()
From: Satyam Sharma
Date: Tue Jul 10 2007 - 05:00:57 EST
From: Satyam Sharma <ssatyam@xxxxxxxxxxxxxx>
[7/9] netconsole: Use netif_running() in write_msg()
Avoid unnecessarily disabling interrupts and calling netpoll_send_udp()
if the corresponding local interface is not up.
Signed-off-by: Satyam Sharma <ssatyam@xxxxxxxxxxxxxx>
Cc: Keiichi Kii <k-keiichi@xxxxxxxxxxxxx>
---
drivers/net/netconsole.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
---
diff -ruNp a/drivers/net/netconsole.c b/drivers/net/netconsole.c
--- a/drivers/net/netconsole.c 2007-07-10 07:26:47.000000000 +0530
+++ b/drivers/net/netconsole.c 2007-07-10 07:45:51.000000000 +0530
@@ -113,16 +113,16 @@ static void write_msg(struct console *co
unsigned long flags;
struct netconsole_target *nt = &default_target;
- local_irq_save(flags);
-
- for (left = len; left;) {
- frag = min(left, MAX_PRINT_CHUNK);
- netpoll_send_udp(&nt->np, msg, frag);
- msg += frag;
- left -= frag;
+ if (netif_running(nt->np.dev)) {
+ local_irq_save(flags);
+ for (left = len; left;) {
+ frag = min(left, MAX_PRINT_CHUNK);
+ netpoll_send_udp(&nt->np, msg, frag);
+ msg += frag;
+ left -= frag;
+ }
+ local_irq_restore(flags);
}
-
- local_irq_restore(flags);
}
static struct console netconsole = {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/