[PATCH] Net device error logging, revised
From: Jim Keniston <hidden>
Date: 2003-09-15 23:12:12
Also in:
lkml
This patch extends the concept of Linux 2.6's dev_* logging macros to
support network devices. This is a modification of a patch posted
last month, and addresses the issues raised since then, namely:
1. To minimize stack usage, the msg[] buffer in __netdev_printk() has been
made static and protected by a spinlock. (The spinlock shouldn't be a big
performance hit because we're about to serialize on printk's lock anyway.)
2. It is no longer possible to omit the msglevel arg. For example,
netdev_err(dev,, "NIC fried!\n");
no longer works. This must be expressed as
netdev_err(dev, ALL, "NIC fried!\n");
or (see #3 below) something like
netdev_fatal(dev, HW, "NIC fried!\n");
3. A new macro, netdev_fatal, is included. Given the call
netdev_fatal(dev, HW, "NIC fried!\n");
the indicated message is always logged: the msglevel arg (HW, in this
case) is NOT consulted. In fact, the msglevel arg to netdev_fatal
is ignored in this implementation. (As previously discussed, in some
future implementation, the msglevel could be logged to help indicate
the circumstances under which the event was logged.)
4. It was suggested that the netdev_* macros should support message
filtering via simple message levels -- e.g.,
if (dev->msg_enable > 5) printk(KERN_INFO "Received a packet.\n");
-- in addition to (or instead of) via the NETIF_MSG_* bit masks. But
Jeff Garzik reiterated his desire to standardize on NETIF_MSG_*, so
I'm leaving things unchanged in that respect.
5. It was suggested that netdev_dbg is not flexible enough to handle all
debugging situations. This is probably true. Because of the special
nature of debugging messages, I'd expect the developer to use other
approaches in debug code if netdev_dbg doesn't fill the bill. But the
netdev_dbg approach appears to be reasonably useful. (For comparison,
there are currently 188 calls to dev_dbg in Linux drivers.) No change
here.
6. Certain comments seemed to imply that you should be able to
suppress all messages (even those with a msglevel of ALL) by setting the
msg_enable field to 0. I chose not to support this, because it seemed
counterintuitive and inconsistent with existing practice.
Jim Keniston
IBM Linux Technology Center Attachments
- netdev-2.6.0-test5.patch [text/plain] 5765 bytes · preview