linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wl1271: add get_survey callback in order to get channel noise
@ 2010-07-28 20:42 John W. Linville
  2010-07-29  5:00 ` Juuso Oikarinen
  0 siblings, 1 reply; 2+ messages in thread
From: John W. Linville @ 2010-07-28 20:42 UTC (permalink / raw)
  To: linux-wireless; +Cc: Luciano Coelho, Juuso Oikarinen, John W. Linville

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 drivers/net/wireless/wl12xx/wl1271.h      |    3 +++
 drivers/net/wireless/wl12xx/wl1271_main.c |   17 +++++++++++++++++
 drivers/net/wireless/wl12xx/wl1271_rx.c   |    7 +++++++
 3 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 53d47d7..dd3cee6 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -475,6 +475,9 @@ struct wl1271 {
 	bool sg_enabled;
 
 	struct list_head list;
+
+	/* Most recently reported noise in dBm */
+	s8 noise;
 };
 
 int wl1271_plt_start(struct wl1271 *wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 864318f..374abf0 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1927,6 +1927,22 @@ out:
 	return mactime;
 }
 
+static int wl1271_op_get_survey(struct ieee80211_hw *hw, int idx,
+				struct survey_info *survey)
+{
+	struct wl1271 *wl = hw->priv;
+	struct ieee80211_conf *conf = &hw->conf;
+ 
+	if (idx != 0)
+		return -ENOENT;
+ 
+	survey->channel = conf->channel;
+	survey->filled = SURVEY_INFO_NOISE_DBM;
+	survey->noise = wl->noise;
+ 
+	return 0;
+}
+
 /* can't be const, mac80211 writes to this */
 static struct ieee80211_rate wl1271_rates[] = {
 	{ .bitrate = 10,
@@ -2156,6 +2172,7 @@ static const struct ieee80211_ops wl1271_ops = {
 	.set_rts_threshold = wl1271_op_set_rts_threshold,
 	.conf_tx = wl1271_op_conf_tx,
 	.get_tsf = wl1271_op_get_tsf,
+	.get_survey = wl1271_op_get_survey,
 	CFG80211_TESTMODE_CMD(wl1271_tm_cmd)
 };
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_rx.c b/drivers/net/wireless/wl12xx/wl1271_rx.c
index e98f22b..019aa79 100644
--- a/drivers/net/wireless/wl12xx/wl1271_rx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_rx.c
@@ -55,6 +55,13 @@ static void wl1271_rx_status(struct wl1271 *wl,
 
 	status->signal = desc->rssi;
 
+	/*
+	 * FIXME: In wl1251, the SNR should be divided by two.  In wl1271 we
+	 * need to divide by two for now, but TI has been discussing about
+	 * changing it.  This needs to be rechecked.
+	 */
+	wl->noise = desc->rssi - (desc->snr >> 1);
+
 	status->freq = ieee80211_channel_to_frequency(desc->channel);
 
 	if (desc->flags & WL1271_RX_DESC_ENCRYPT_MASK) {
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] wl1271: add get_survey callback in order to get channel noise
  2010-07-28 20:42 [PATCH] wl1271: add get_survey callback in order to get channel noise John W. Linville
@ 2010-07-29  5:00 ` Juuso Oikarinen
  0 siblings, 0 replies; 2+ messages in thread
From: Juuso Oikarinen @ 2010-07-29  5:00 UTC (permalink / raw)
  To: ext John W. Linville; +Cc: linux-wireless, Coelho Luciano (Nokia-MS/Helsinki)

On Wed, 2010-07-28 at 22:42 +0200, ext John W. Linville wrote:
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> ---
>  drivers/net/wireless/wl12xx/wl1271.h      |    3 +++
>  drivers/net/wireless/wl12xx/wl1271_main.c |   17 +++++++++++++++++
>  drivers/net/wireless/wl12xx/wl1271_rx.c   |    7 +++++++
>  3 files changed, 27 insertions(+), 0 deletions(-)
> 

I was thinking about the algorithm to get the noise, but then noticed
Kalle Valo's comment for wl1251. Pretty much the same applies here.

Acked-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>



-Juuso



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-29  5:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-28 20:42 [PATCH] wl1271: add get_survey callback in order to get channel noise John W. Linville
2010-07-29  5:00 ` Juuso Oikarinen

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).