Commit 6579e57b authored by Arjan van de Ven's avatar Arjan van de Ven Committed by David S. Miller

net: Print the module name as part of the watchdog message

As suggested by Dave:

This patch adds a function to get the driver name from a struct net_device,
and consequently uses this in the watchdog timeout handler to print as 
part of the message. 
Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7943986c
...@@ -1645,6 +1645,8 @@ extern void dev_seq_stop(struct seq_file *seq, void *v); ...@@ -1645,6 +1645,8 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
extern int netdev_class_create_file(struct class_attribute *class_attr); extern int netdev_class_create_file(struct class_attribute *class_attr);
extern void netdev_class_remove_file(struct class_attribute *class_attr); extern void netdev_class_remove_file(struct class_attribute *class_attr);
extern char *netdev_drivername(struct net_device *dev, char *buffer, int len);
extern void linkwatch_run_queue(void); extern void linkwatch_run_queue(void);
extern int netdev_compute_features(unsigned long all, unsigned long one); extern int netdev_compute_features(unsigned long all, unsigned long one);
......
...@@ -4686,6 +4686,26 @@ static int __net_init netdev_init(struct net *net) ...@@ -4686,6 +4686,26 @@ static int __net_init netdev_init(struct net *net)
return -ENOMEM; return -ENOMEM;
} }
char *netdev_drivername(struct net_device *dev, char *buffer, int len)
{
struct device_driver *driver;
struct device *parent;
if (len <= 0 || !buffer)
return buffer;
buffer[0] = 0;
parent = dev->dev.parent;
if (!parent)
return buffer;
driver = parent->driver;
if (driver && driver->name)
strlcpy(buffer, driver->name, len);
return buffer;
}
static void __net_exit netdev_exit(struct net *net) static void __net_exit netdev_exit(struct net *net)
{ {
kfree(net->dev_name_head); kfree(net->dev_name_head);
......
...@@ -212,9 +212,9 @@ static void dev_watchdog(unsigned long arg) ...@@ -212,9 +212,9 @@ static void dev_watchdog(unsigned long arg)
if (some_queue_stopped && if (some_queue_stopped &&
time_after(jiffies, (dev->trans_start + time_after(jiffies, (dev->trans_start +
dev->watchdog_timeo))) { dev->watchdog_timeo))) {
printk(KERN_INFO "NETDEV WATCHDOG: %s: " char drivername[64];
"transmit timed out\n", printk(KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n",
dev->name); dev->name, netdev_drivername(dev, drivername, 64));
dev->tx_timeout(dev); dev->tx_timeout(dev);
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment