This proposal extends the concept of Linux 2.5's dev_* logging macros to support network devices. This feature is intended to simplify error-log analysis by programs (such as health/configuration monitors) and by ordinary people who need clearer error reporting. Two patches are appended. The first implements the feature described here. The second is provided by Scott Feldman, maintainer of the e1000 Ethernet driver, and demonstrates how he could modify that driver to take advantage of this feature. BACKGROUND: dev_* MACROS The existing dev_* macros (dev_dbg, dev_info, dev_warn, dev_err, dev_printk) are defined in linux/device.h in Linux 2.5. When used in place of printk, they enhance the standard printk message by prepending the driver name and bus ID of the device in question. These macros take the usual printk args, plus a pointer to the relevant struct device. The driver name and bus ID enable the log reader to find the device's information in sysfs. netdev_* MACROS Alan Cox suggested that the dev_* macros could serve as examples for logging macros in other parts of the kernel. This proposal defines analogous macros for network devices. These new macros are netdev_dbg, netdev_info, netdev_warn, netdev_err, and netdev_printk. These macros take the usual printk args, plus a pointer to the relevant struct net_device. The enhanced printk message includes the device's interface name (e.g., "eth0"). It also includes the driver name and bus ID of the underlying device; this makes it easy to associate the message with the network device's sysfs info. For example, changing printk(KERN_ERR "The EEPROM Checksum Is Not Valid\n"); to netdev_err(netdev, "The EEPROM Checksum Is Not Valid\n"); changes the message from The EEPROM Checksum Is Not Valid to something like eth0 e1000 40:0b.0: The EEPROM Checksum Is Not Valid You could find out more about the indicated device by looking in the directory /sysfs/bus/*/drivers/e1000/40:0b.0. This proposal adds a new member, dev, to struct net_device that points to the underlying struct device. This pointer is typically set in the driver's probe function. For simplicity, the netdev_* macros assume that netdev (the net_device arg) and netdev->name are non-null. The latter is true as soon as you call alloc_netdev() for the device. Jim Keniston IBM Linux Technology Center -----