This patch extends the concept of Linux 2.6's dev_* logging macros to support network devices. Analogous netdev_* macros are defined. This feature is part of an effort to simplify error-log analysis by providing more consistent and informative messages. This is a modification of a proposal from May. The changes reflect suggestions made on LKML, at the Kernel Summit, and at OLS. Calls to the netdev_* macros (netdev_printk and wrappers such as netdev_err) are intended to replace calls to printk in network device drivers. These macros have the following characteristics: - Same format + args as the corresponding printk call. - Approximately the same amount of text as the corresponding printk call. - The first arg is a pointer to the net_device struct. - The second (optional) arg, which is a NETIF_MSG_* message level, can be used to implement verbosity control. - Standard message prefixes: verbose (see below) during probe, or just the interface name once the device is registered. - The current implementation just calls printk. However, the netdev_* interface (and availability of the net_device pointer) opens the door for logging additional information (via printk, via evlog/netlink, etc.) as desired, with no change to driver code. Examples: netdev_err(netdev, RX_ERR, "No mem: dropped packet\n"); logs a message such as the following if the NETIF_MSG_RX_ERR bit is set in netdev->msg_enable. eth2: No mem: dropped packet netdev_err(netdev,, "The EEPROM Checksum Is Not Valid\n"); unconditionally logs a message such as: eth%d (e1000 0000:00:03.0): The EEPROM Checksum Is Not Valid The message's prefix includes the driver name and bus ID because the message is logged at probe time, before netdev is registered. Note that the netdev_* interface can be used in v2.4 drivers as well, but in a v2.4 implementation, the message prefix would always be just the interface name. Three other patches are included in subsequent emails. These patch the e100, e1000, and tg3 Ethernet drivers to use the netdev_* macros. (For e100 and e1000, they also add the necessary scaffolding for verbosity control via the NETIF_MSG_* message levels). Jim Keniston IBM Linux Technology Center -----