Search Linux Wireless

Re: [RFC] cfg80211: survey report capability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2009-11-10 at 10:48 +0100, Holger Schurig wrote:

> +/** enum survey_info_flags - survey information flags

Nit: missing newline

> + *
> + * Used by the driver to indicate which info in &struct survey_info
> + * it has filled in during the get_survey().
> + */
> +enum survey_info_flags {
> +	SURVEY_INFO_CHANNEL = 1<<0,
> +	SURVEY_INFO_NOISE = 1<<1,

A response w/o a channel seems entirely useless, shouldn't we just
require a channel?

> + * @filled: bitflag of flags from &enum survey_info_flags
> + * @noise: channel noise in mBm
> + * @channel: the channel this survey record reports
> + *
> + * This structure can later be expanded with things like
> + * channel duty cycles etc.
> + */
> +struct survey_info {
> +	u32 filled;
> +	struct ieee80211_channel *channel;
> +	s8 noise;

For mBm, an s8 won't be enough I think? -90 dBm == -9000 mBm?

> +static void get_survey_callback(void *c, struct survey_info *params)
> +{
> +	struct get_survey_cookie *cookie = c;
> +
> +	if (params->filled & SURVEY_INFO_CHANNEL)
> +		if (nl80211_msg_put_channel(cookie->msg, params->channel))
> +			goto nla_put_failure;
> +
> +	if (params->filled & SURVEY_INFO_NOISE)
> +		NLA_PUT_U32(cookie->msg, NL80211_ATTR_NOISE,
> +			params->noise);
> +
> + nla_put_failure:
> +	cookie->error = 1;
> +}

You need to construct a nested attribute here and put the values into it
so that the callback can be invoked multiple times, once for each
channel. OTOH, when there are many many channels that will overrun the
message size at some point and we'll pull our hair (like we're doing now
with the channel list in phy info) ... so I'd prefer you move this to a
dump-style model like dump_stations has.

Right now you're retrieving a single channel but can't even control
which one. Maybe that's useful functionality in addition to dump when
you _can_ ask for information on a specific channel, but that'd have to
pass in the frequency from userspace.

Retrieving all data like you've implemented (though I guess you forgot
the multiple channels case) should be a dump. Maybe that's sufficient
since there won't be huge amounts of data and userspace can just pick
out what it needs from the dump.

johannes

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux