2010-04-27 22:08:35

by Benoit Papillault

[permalink] [raw]
Subject: [PATCH] ath9k: Added get_survey callback in order to get channel noise


Signed-off-by: Benoit Papillault <[email protected]>
---
drivers/net/wireless/ath/ath9k/main.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index c03821e..f0b2aa2 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2047,6 +2047,25 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
return ret;
}

+static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
+ struct survey_info *survey)
+{
+ struct ath_wiphy *aphy = hw->priv;
+ struct ath_softc *sc = aphy->sc;
+ struct ath_hw *ah = sc->sc_ah;
+ struct ath_common *common = ath9k_hw_common(ah);
+ struct ieee80211_conf *conf = &hw->conf;
+
+ if (idx != 0)
+ return -ENOENT;
+
+ survey->channel = conf->channel;
+ survey->filled = SURVEY_INFO_NOISE_DBM;
+ survey->noise = common->ani.noise_floor;
+
+ return 0;
+}
+
static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
{
struct ath_wiphy *aphy = hw->priv;
@@ -2122,6 +2141,7 @@ struct ieee80211_ops ath9k_ops = {
.set_tsf = ath9k_set_tsf,
.reset_tsf = ath9k_reset_tsf,
.ampdu_action = ath9k_ampdu_action,
+ .get_survey = ath9k_get_survey,
.sw_scan_start = ath9k_sw_scan_start,
.sw_scan_complete = ath9k_sw_scan_complete,
.rfkill_poll = ath9k_rfkill_poll_state,
--
1.5.6.5



2010-04-28 20:13:49

by Benoit Papillault

[permalink] [raw]
Subject: Re: [PATCH] ath9k: Added get_survey callback in order to get channel noise

Jouni Malinen a écrit :
> On Tue, 2010-04-27 at 15:08 -0700, Benoit Papillault wrote:
>
>> +static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
>> + struct survey_info *survey)
>>
>
>
>> + struct ieee80211_conf *conf = &hw->conf;
>> +
>> + if (idx != 0)
>> + return -ENOENT;
>> +
>> + survey->channel = conf->channel;
>>
>
> Are there any plans on providing this information from all channels? I
> have assumed that the survey command was supposed to be used for
> surveying all channels (e.g., to get information for auto-channel
> selection) and returning something for the current channel is quite
> limited subset of that. In other words, I would like to be able to run a
> scan of all channels and then use NL80211_CMD_GET_SURVEY to fetch
> additional per-channel information like noise (and also channel usage
> statistics in case of ath9k) from the scanned channels.
>
> - Jouni
>
Hi Jouni,

I dig into the source code to understand the use of "idx" and having the
value for all scanned channels sounds a good plan. However :

- when doing a normal scan (iw dev wlan0 scan), the noise floor
calibration is started in a special mode, so I don't know if the results
is accurate enought.

- the first calibration takes some times .... more than the scan itself.
So, you cannot get a valid value before switching to the next channel.

Anyway, how idx is supposed to be used? From 0 ... up to the callback
returning -ENOENT ?
Do we need to keep a table with noise for each channel and return those
where we have a value, in which case idx cannot be used as an index into
this table ?

Regards,
Benoit


2010-04-27 22:17:04

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH] ath9k: Added get_survey callback in order to get channel noise

On Tue, Apr 27, 2010 at 03:08:24PM -0700, Benoit Papillault wrote:
>
> Signed-off-by: Benoit Papillault <[email protected]>

Looks good, thanks for this work.

Luis

2010-04-28 07:00:50

by Jouni Malinen

[permalink] [raw]
Subject: Re: [PATCH] ath9k: Added get_survey callback in order to get channel noise

On Tue, 2010-04-27 at 15:08 -0700, Benoit Papillault wrote:
> +static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
> + struct survey_info *survey)

> + struct ieee80211_conf *conf = &hw->conf;
> +
> + if (idx != 0)
> + return -ENOENT;
> +
> + survey->channel = conf->channel;

Are there any plans on providing this information from all channels? I
have assumed that the survey command was supposed to be used for
surveying all channels (e.g., to get information for auto-channel
selection) and returning something for the current channel is quite
limited subset of that. In other words, I would like to be able to run a
scan of all channels and then use NL80211_CMD_GET_SURVEY to fetch
additional per-channel information like noise (and also channel usage
statistics in case of ath9k) from the scanned channels.

- Jouni



2010-04-29 00:39:09

by Xu, Martin

[permalink] [raw]
Subject: RE: kernel warning on 2.6.33 ath9k

> -----Original Message-----
> From: John W. Linville [mailto:[email protected]]
> Sent: Wednesday, April 28, 2010 10:05 PM
> To: Xu, Martin
> Cc: [email protected]; [email protected]
> Subject: Re: kernel warning on 2.6.33 ath9k
>
> On Wed, Apr 28, 2010 at 04:01:45PM +0800, Xu, Martin wrote:
> > Hi
> > I found that kernel reports below warning when using ath9k in kernel 2.6.33.
> > Someone can kindly tell me whether it is the new found issue or the issue is
> known and has been fixed in later commit in git tree?
> > Thanks!
>
> Looks like this:
Yes, just this, thanks.


2010-04-28 14:15:12

by John W. Linville

[permalink] [raw]
Subject: Re: kernel warning on 2.6.33 ath9k

On Wed, Apr 28, 2010 at 04:01:45PM +0800, Xu, Martin wrote:
> Hi
> I found that kernel reports below warning when using ath9k in kernel 2.6.33.
> Someone can kindly tell me whether it is the new found issue or the issue is known and has been fixed in later commit in git tree?
> Thanks!

Looks like this:

https://bugzilla.kernel.org/show_bug.cgi?id=15839

> ------------[ cut here ]------------
> WARNING: at kernel/softirq.c:143 local_bh_enable_ip+0x32/0x76()
> Hardware name: AO532h
> Modules linked in: cbc ecryptfs ath9k ath9k_common battery atl1c joydev ath9k_hw uvcvideo
> Pid: 850, comm: wpa_supplicant Not tainted 2.6.33.2-8.1-netbook #1
> Call Trace:
> [<c1030978>] warn_slowpath_common+0x66/0x7d
> [<c1035a74>] ? local_bh_enable_ip+0x32/0x76
> [<c103099c>] warn_slowpath_null+0xd/0x10
> [<c1035a74>] local_bh_enable_ip+0x32/0x76
> [<c14789c0>] _raw_spin_unlock_bh+0x17/0x19
> [<f871dbd3>] ath_tx_node_cleanup+0xe0/0xf9 [ath9k]
> [<c103ae46>] ? lock_timer_base+0x22/0x41
> [<f871a005>] ath9k_sta_notify+0x74/0x78 [ath9k]
> [<c1443987>] __sta_info_unlink+0x139/0x189
> [<f8719f91>] ? ath9k_sta_notify+0x0/0x78 [ath9k]
> [<c14439fa>] sta_info_unlink+0x23/0x31
> [<c1448834>] ieee80211_set_disassoc+0x1bd/0x1e3
> [<c1448cf8>] ieee80211_mgd_deauth+0x3c/0xfe
> [<c144df21>] ieee80211_deauth+0x14/0x16
> [<c143c3fc>] __cfg80211_mlme_deauth+0xe9/0xf2
> [<c143eea1>] __cfg80211_disconnect+0xcb/0x12e
> [<c1440b74>] cfg80211_wext_siwmlme+0x64/0x80
> [<c1441cf6>] ioctl_standard_call+0x1d7/0x26f
> [<c139281b>] ? dev_get_by_name_rcu+0x73/0x80
> [<c13928d9>] ? __dev_get_by_name+0x71/0x7e
> [<c1441e81>] wext_handle_ioctl+0xf3/0x17e
> [<c1440b10>] ? cfg80211_wext_siwmlme+0x0/0x80
> [<c1396410>] dev_ioctl+0x578/0x598
> [<c10091b9>] ? restore_i387_fxsave+0x54/0x66
> [<c1387b44>] sock_ioctl+0x1cf/0x1db
> [<c10b0979>] vfs_ioctl+0x28/0x92
> [<c1387975>] ? sock_ioctl+0x0/0x1db
> [<c10b0ed6>] do_vfs_ioctl+0x453/0x491
> [<c1388233>] ? sys_recvmsg+0x2c/0x47
> [<c1389542>] ? sys_socketcall+0x147/0x18c
> [<c10b0f43>] sys_ioctl+0x2f/0x49
> [<c10027d0>] sysenter_do_call+0x12/0x26

--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2010-04-28 08:02:23

by Xu, Martin

[permalink] [raw]
Subject: kernel warning on 2.6.33 ath9k

SGkNCkkgZm91bmQgdGhhdCBrZXJuZWwgcmVwb3J0cyBiZWxvdyB3YXJuaW5nIHdoZW4gdXNpbmcg
YXRoOWsgaW4ga2VybmVsIDIuNi4zMy4NClNvbWVvbmUgY2FuIGtpbmRseSB0ZWxsIG1lIHdoZXRo
ZXIgaXQgaXMgdGhlIG5ldyBmb3VuZCBpc3N1ZSBvciB0aGUgaXNzdWUgaXMga25vd24gYW5kIGhh
cyBiZWVuIGZpeGVkIGluI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