[PATCH v2 -mm 7/9] netconsole: Use netif_running() in write_msg()

Satyam Sharma
2007-07-10T09:00:56Z

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

[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@cse.iitk.ac.in>
Cc: Keiichi Kii <k-keiichi@bx.jp.nec.com>

---

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 = {