* [PATCH] net: show stopped status in sysfs
@ 2010-05-03 21:24 Michael S. Tsirkin
0 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2010-05-03 21:24 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Eric W. Biederman, Johannes Berg,
Tom Herbert <t
When debugging faulty hardware (in case of virt, faulty
emulation) I found it helpful to be able to examine
stopped status of the interface. The following patch makes
this visible in sysfs.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
net/core/net-sysfs.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index c57c4b2..e1f80c0 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -132,6 +132,16 @@ static ssize_t show_carrier(struct device *dev,
return -EINVAL;
}
+static ssize_t show_stopped(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct net_device *netdev = to_net_dev(dev);
+ if (netif_running(netdev)) {
+ return sprintf(buf, fmt_dec, !!netif_queue_stopped(netdev));
+ }
+ return -EINVAL;
+}
+
static ssize_t show_speed(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -303,6 +313,7 @@ static struct device_attribute net_class_attributes[] = {
__ATTR(address, S_IRUGO, show_address, NULL),
__ATTR(broadcast, S_IRUGO, show_broadcast, NULL),
__ATTR(carrier, S_IRUGO, show_carrier, NULL),
+ __ATTR(carrier, S_IRUGO, show_stopped, NULL),
__ATTR(speed, S_IRUGO, show_speed, NULL),
__ATTR(duplex, S_IRUGO, show_duplex, NULL),
__ATTR(dormant, S_IRUGO, show_dormant, NULL),
--
1.7.1.rc1.22.g3163
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: show stopped status in sysfs
[not found] <20100503212423.GA15998@redhat.com>
@ 2010-05-03 21:44 ` Ben Hutchings
2010-05-03 22:04 ` David Miller
2010-05-03 22:05 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2010-05-03 21:44 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: David S. Miller, Eric Dumazet, Eric W. Biederman, Johannes Berg,
Tom Herbert, netdev, linux-kernel
On Tue, 2010-05-04 at 00:24 +0300, Michael S. Tsirkin wrote:
> When debugging faulty hardware (in case of virt, faulty
> emulation) I found it helpful to be able to examine
> stopped status of the interface. The following patch makes
> this visible in sysfs.
[...]
This is a per-queue attribute and should not be associated directly with
the netdev.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: show stopped status in sysfs
2010-05-03 21:44 ` [PATCH] net: show stopped status in sysfs Ben Hutchings
@ 2010-05-03 22:04 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-05-03 22:04 UTC (permalink / raw)
To: bhutchings
Cc: mst, eric.dumazet, ebiederm, johannes, therbert, netdev,
linux-kernel
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Mon, 03 May 2010 22:44:53 +0100
> On Tue, 2010-05-04 at 00:24 +0300, Michael S. Tsirkin wrote:
>> When debugging faulty hardware (in case of virt, faulty
>> emulation) I found it helpful to be able to examine
>> stopped status of the interface. The following patch makes
>> this visible in sysfs.
> [...]
>
> This is a per-queue attribute and should not be associated directly with
> the netdev.
Right.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: show stopped status in sysfs
[not found] <20100503212423.GA15998@redhat.com>
2010-05-03 21:44 ` [PATCH] net: show stopped status in sysfs Ben Hutchings
@ 2010-05-03 22:05 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-05-03 22:05 UTC (permalink / raw)
To: mst; +Cc: eric.dumazet, ebiederm, johannes, therbert, netdev, linux-kernel
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Tue, 4 May 2010 00:24:25 +0300
> @@ -303,6 +313,7 @@ static struct device_attribute net_class_attributes[] = {
> __ATTR(address, S_IRUGO, show_address, NULL),
> __ATTR(broadcast, S_IRUGO, show_broadcast, NULL),
> __ATTR(carrier, S_IRUGO, show_carrier, NULL),
> + __ATTR(carrier, S_IRUGO, show_stopped, NULL),
Besides the fact that you have to publish this as a per-queue attribute,
you're also erroneously naming it 'carrier' here.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-03 22:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20100503212423.GA15998@redhat.com>
2010-05-03 21:44 ` [PATCH] net: show stopped status in sysfs Ben Hutchings
2010-05-03 22:04 ` David Miller
2010-05-03 22:05 ` David Miller
2010-05-03 21:24 Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).