diff options
author | Christian Lamparter <chunkeey@googlemail.com> | 2011-08-20 03:53:59 +0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-24 22:57:13 +0400 |
commit | 0d78156eef1d8869ea4e56f8a257252a8f262f04 (patch) | |
tree | bfd4db22b84225b3f5ae777c6503eb30af37ff07 /drivers/net/wireless/p54/eeprom.c | |
parent | 6423d30f030b560ef1b701bb1f205c3817efe380 (diff) | |
download | linux-0d78156eef1d8869ea4e56f8a257252a8f262f04.tar.xz |
p54: improve site survey
The firmware keeps track of channel usage. This data can
be used by the automatic channel selection to find the best
channel.
Survey data from wlan4
frequency: 5200 MHz [in use]
noise: -91 dBm
channel active time: 811909 ms
channel busy time: 63395 ms
channel transmit time: 59636 ms
Survey data from wlan4
frequency: 5210 MHz
noise: -91 dBm
channel active time: 121 ms
channel busy time: 119 ms
channel transmit time: 0 ms
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54/eeprom.c')
-rw-r--r-- | drivers/net/wireless/p54/eeprom.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c index 54cc0bba66b9..8b6f363b3f7d 100644 --- a/drivers/net/wireless/p54/eeprom.c +++ b/drivers/net/wireless/p54/eeprom.c @@ -145,6 +145,7 @@ static int p54_fill_band_bitrates(struct ieee80211_hw *dev, static int p54_generate_band(struct ieee80211_hw *dev, struct p54_channel_list *list, + unsigned int *chan_num, enum ieee80211_band band) { struct p54_common *priv = dev->priv; @@ -190,7 +191,14 @@ static int p54_generate_band(struct ieee80211_hw *dev, tmp->channels[j].band = chan->band; tmp->channels[j].center_freq = chan->freq; + priv->survey[*chan_num].channel = &tmp->channels[j]; + priv->survey[*chan_num].filled = SURVEY_INFO_NOISE_DBM | + SURVEY_INFO_CHANNEL_TIME | + SURVEY_INFO_CHANNEL_TIME_BUSY | + SURVEY_INFO_CHANNEL_TIME_TX; + tmp->channels[j].hw_value = (*chan_num); j++; + (*chan_num)++; } if (j == 0) { @@ -263,7 +271,7 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) { struct p54_common *priv = dev->priv; struct p54_channel_list *list; - unsigned int i, j, max_channel_num; + unsigned int i, j, k, max_channel_num; int ret = 0; u16 freq; @@ -283,6 +291,13 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) ret = -ENOMEM; goto free; } + priv->chan_num = max_channel_num; + priv->survey = kzalloc(sizeof(struct survey_info) * max_channel_num, + GFP_KERNEL); + if (!priv->survey) { + ret = -ENOMEM; + goto free; + } list->max_entries = max_channel_num; list->channels = kzalloc(sizeof(struct p54_channel_entry) * @@ -321,8 +336,9 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) sort(list->channels, list->entries, sizeof(struct p54_channel_entry), p54_compare_channels, NULL); + k = 0; for (i = 0, j = 0; i < IEEE80211_NUM_BANDS; i++) { - if (p54_generate_band(dev, list, i) == 0) + if (p54_generate_band(dev, list, &k, i) == 0) j++; } if (j == 0) { @@ -335,6 +351,10 @@ free: kfree(list->channels); kfree(list); } + if (ret) { + kfree(priv->survey); + priv->survey = NULL; + } return ret; } @@ -853,10 +873,12 @@ err: kfree(priv->output_limit); kfree(priv->curve_data); kfree(priv->rssi_db); + kfree(priv->survey); priv->iq_autocal = NULL; priv->output_limit = NULL; priv->curve_data = NULL; priv->rssi_db = NULL; + priv->survey = NULL; wiphy_err(dev->wiphy, "eeprom parse failed!\n"); return err; |