Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df2b35b6 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

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: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c0acf38e
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -610,6 +610,11 @@ static void wireless_seq_printf_stats(struct seq_file *seq,
{
{
	/* Get stats from the driver */
	/* Get stats from the driver */
	struct iw_statistics *stats = get_wireless_stats(dev);
	struct iw_statistics *stats = get_wireless_stats(dev);
	static struct iw_statistics nullstats = {};

	/* show device if it's wireless regardless of current stats */
	if (!stats && dev->wireless_handlers)
		stats = &nullstats;


	if (stats) {
	if (stats) {
		seq_printf(seq, "%6s: %04x  %3d%c  %3d%c  %3d%c  %6d %6d %6d "
		seq_printf(seq, "%6s: %04x  %3d%c  %3d%c  %3d%c  %6d %6d %6d "
@@ -628,6 +633,8 @@ static void wireless_seq_printf_stats(struct seq_file *seq,
			   stats->discard.nwid, stats->discard.code,
			   stats->discard.nwid, stats->discard.code,
			   stats->discard.fragment, stats->discard.retries,
			   stats->discard.fragment, stats->discard.retries,
			   stats->discard.misc, stats->miss.beacon);
			   stats->discard.misc, stats->miss.beacon);

		if (stats != &nullstats)
			stats->qual.updated &= ~IW_QUAL_ALL_UPDATED;
			stats->qual.updated &= ~IW_QUAL_ALL_UPDATED;
	}
	}
}
}