Skip to content

Commit

Permalink
wl1271: add get_survey callback in order to get channel noise
Browse files Browse the repository at this point in the history
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Acked-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
  • Loading branch information
John W. Linville committed Jul 29, 2010
1 parent bef9cb5 commit ece550d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/wireless/wl12xx/wl1271.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 17 additions & 0 deletions drivers/net/wireless/wl12xx/wl1271_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,22 @@ static u64 wl1271_op_get_tsf(struct ieee80211_hw *hw)
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,
Expand Down Expand Up @@ -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)
};

Expand Down
7 changes: 7 additions & 0 deletions drivers/net/wireless/wl12xx/wl1271_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ece550d

Please sign in to comment.