diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-07-01 15:26:42 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:48 -0400 |
commit | df2b35b65b7142bac2c7add3a1dedde3a373aff3 (patch) | |
tree | 7c06b2d0b4c3e7e29f975808eff9e12d87bca8b0 /net/wireless | |
parent | c0acf38e0ba42f93d8d56a6db2e2116ea1b23961 (diff) |
wext: allow returning NULL stats
Currently, wext drivers cannot return NULL for stats even though
that would make the ioctl return -EOPNOTSUPP because that would
mean they are no longer listed in /proc/net/wireless. This patch
changes the wext core's behaviour to list them if they have any
wireless_handlers, but only show their stats when available, so
that drivers can start returning NULL if stats are currently not
available, reducing confusion for e.g. IBSS.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/wext.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/net/wireless/wext.c b/net/wireless/wext.c index 252c2010c2e2..5da07e079c20 100644 --- a/net/wireless/wext.c +++ b/net/wireless/wext.c | |||
@@ -610,6 +610,11 @@ static void wireless_seq_printf_stats(struct seq_file *seq, | |||
610 | { | 610 | { |
611 | /* Get stats from the driver */ | 611 | /* Get stats from the driver */ |
612 | struct iw_statistics *stats = get_wireless_stats(dev); | 612 | struct iw_statistics *stats = get_wireless_stats(dev); |
613 | static struct iw_statistics nullstats = {}; | ||
614 | |||
615 | /* show device if it's wireless regardless of current stats */ | ||
616 | if (!stats && dev->wireless_handlers) | ||
617 | stats = &nullstats; | ||
613 | 618 | ||
614 | if (stats) { | 619 | if (stats) { |
615 | seq_printf(seq, "%6s: %04x %3d%c %3d%c %3d%c %6d %6d %6d " | 620 | seq_printf(seq, "%6s: %04x %3d%c %3d%c %3d%c %6d %6d %6d " |
@@ -628,7 +633,9 @@ static void wireless_seq_printf_stats(struct seq_file *seq, | |||
628 | stats->discard.nwid, stats->discard.code, | 633 | stats->discard.nwid, stats->discard.code, |
629 | stats->discard.fragment, stats->discard.retries, | 634 | stats->discard.fragment, stats->discard.retries, |
630 | stats->discard.misc, stats->miss.beacon); | 635 | stats->discard.misc, stats->miss.beacon); |
631 | stats->qual.updated &= ~IW_QUAL_ALL_UPDATED; | 636 | |
637 | if (stats != &nullstats) | ||
638 | stats->qual.updated &= ~IW_QUAL_ALL_UPDATED; | ||
632 | } | 639 | } |
633 | } | 640 | } |
634 | 641 | ||