diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2008-07-21 16:31:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-21 16:31:48 -0400 |
commit | 6579e57b31d79d31d9b806e41ba48774e73257dc (patch) | |
tree | 03ba72024a1982ee76b8a891a443b0fdfb6d7c93 | |
parent | 7943986ca1138ac99597b1aa4dc893012dcfdc08 (diff) |
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: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netdevice.h | 2 | ||||
-rw-r--r-- | net/core/dev.c | 20 | ||||
-rw-r--r-- | net/sched/sch_generic.c | 6 |
3 files changed, 25 insertions, 3 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 812bcd8b4363..f5ea445f89f0 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1645,6 +1645,8 @@ extern void dev_seq_stop(struct seq_file *seq, void *v); | |||
1645 | extern int netdev_class_create_file(struct class_attribute *class_attr); | 1645 | extern int netdev_class_create_file(struct class_attribute *class_attr); |
1646 | extern void netdev_class_remove_file(struct class_attribute *class_attr); | 1646 | extern void netdev_class_remove_file(struct class_attribute *class_attr); |
1647 | 1647 | ||
1648 | extern char *netdev_drivername(struct net_device *dev, char *buffer, int len); | ||
1649 | |||
1648 | extern void linkwatch_run_queue(void); | 1650 | extern void linkwatch_run_queue(void); |
1649 | 1651 | ||
1650 | extern int netdev_compute_features(unsigned long all, unsigned long one); | 1652 | extern int netdev_compute_features(unsigned long all, unsigned long one); |
diff --git a/net/core/dev.c b/net/core/dev.c index 1698b3998981..ad5598d2bb37 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -4686,6 +4686,26 @@ err_name: | |||
4686 | return -ENOMEM; | 4686 | return -ENOMEM; |
4687 | } | 4687 | } |
4688 | 4688 | ||
4689 | char *netdev_drivername(struct net_device *dev, char *buffer, int len) | ||
4690 | { | ||
4691 | struct device_driver *driver; | ||
4692 | struct device *parent; | ||
4693 | |||
4694 | if (len <= 0 || !buffer) | ||
4695 | return buffer; | ||
4696 | buffer[0] = 0; | ||
4697 | |||
4698 | parent = dev->dev.parent; | ||
4699 | |||
4700 | if (!parent) | ||
4701 | return buffer; | ||
4702 | |||
4703 | driver = parent->driver; | ||
4704 | if (driver && driver->name) | ||
4705 | strlcpy(buffer, driver->name, len); | ||
4706 | return buffer; | ||
4707 | } | ||
4708 | |||
4689 | static void __net_exit netdev_exit(struct net *net) | 4709 | static void __net_exit netdev_exit(struct net *net) |
4690 | { | 4710 | { |
4691 | kfree(net->dev_name_head); | 4711 | kfree(net->dev_name_head); |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index cb625b4d6da5..4ac7e3a8c253 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -212,9 +212,9 @@ static void dev_watchdog(unsigned long arg) | |||
212 | if (some_queue_stopped && | 212 | if (some_queue_stopped && |
213 | time_after(jiffies, (dev->trans_start + | 213 | time_after(jiffies, (dev->trans_start + |
214 | dev->watchdog_timeo))) { | 214 | dev->watchdog_timeo))) { |
215 | printk(KERN_INFO "NETDEV WATCHDOG: %s: " | 215 | char drivername[64]; |
216 | "transmit timed out\n", | 216 | printk(KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n", |
217 | dev->name); | 217 | dev->name, netdev_drivername(dev, drivername, 64)); |
218 | dev->tx_timeout(dev); | 218 | dev->tx_timeout(dev); |
219 | WARN_ON_ONCE(1); | 219 | WARN_ON_ONCE(1); |
220 | } | 220 | } |