diff options
author | John W. Linville <linville@tuxdriver.com> | 2010-07-28 14:04:24 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-07-29 12:46:45 -0400 |
commit | 0d462bbb0e20863b6c796abd779bfdb534d60278 (patch) | |
tree | 4e3d3baf1ea55ed16a36ff634bbbeccde1827e51 /drivers/net/wireless/mwl8k.c | |
parent | 4c85ab11ca56da1aa59b58c80cc6a356515cc645 (diff) |
mwl8k: add get_survey callback in order to get channel noise
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
Diffstat (limited to 'drivers/net/wireless/mwl8k.c')
-rw-r--r-- | drivers/net/wireless/mwl8k.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 28beeaf1f4c6..d761ed2d8af4 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -86,7 +86,7 @@ struct rxd_ops { | |||
86 | void (*rxd_init)(void *rxd, dma_addr_t next_dma_addr); | 86 | void (*rxd_init)(void *rxd, dma_addr_t next_dma_addr); |
87 | void (*rxd_refill)(void *rxd, dma_addr_t addr, int len); | 87 | void (*rxd_refill)(void *rxd, dma_addr_t addr, int len); |
88 | int (*rxd_process)(void *rxd, struct ieee80211_rx_status *status, | 88 | int (*rxd_process)(void *rxd, struct ieee80211_rx_status *status, |
89 | __le16 *qos); | 89 | __le16 *qos, s8 *noise); |
90 | }; | 90 | }; |
91 | 91 | ||
92 | struct mwl8k_device_info { | 92 | struct mwl8k_device_info { |
@@ -207,6 +207,9 @@ struct mwl8k_priv { | |||
207 | 207 | ||
208 | /* Tasklet to perform RX. */ | 208 | /* Tasklet to perform RX. */ |
209 | struct tasklet_struct poll_rx_task; | 209 | struct tasklet_struct poll_rx_task; |
210 | |||
211 | /* Most recently reported noise in dBm */ | ||
212 | s8 noise; | ||
210 | }; | 213 | }; |
211 | 214 | ||
212 | /* Per interface specific private data */ | 215 | /* Per interface specific private data */ |
@@ -741,7 +744,7 @@ static void mwl8k_rxd_8366_ap_refill(void *_rxd, dma_addr_t addr, int len) | |||
741 | 744 | ||
742 | static int | 745 | static int |
743 | mwl8k_rxd_8366_ap_process(void *_rxd, struct ieee80211_rx_status *status, | 746 | mwl8k_rxd_8366_ap_process(void *_rxd, struct ieee80211_rx_status *status, |
744 | __le16 *qos) | 747 | __le16 *qos, s8 *noise) |
745 | { | 748 | { |
746 | struct mwl8k_rxd_8366_ap *rxd = _rxd; | 749 | struct mwl8k_rxd_8366_ap *rxd = _rxd; |
747 | 750 | ||
@@ -752,6 +755,7 @@ mwl8k_rxd_8366_ap_process(void *_rxd, struct ieee80211_rx_status *status, | |||
752 | memset(status, 0, sizeof(*status)); | 755 | memset(status, 0, sizeof(*status)); |
753 | 756 | ||
754 | status->signal = -rxd->rssi; | 757 | status->signal = -rxd->rssi; |
758 | *noise = -rxd->noise_floor; | ||
755 | 759 | ||
756 | if (rxd->rate & MWL8K_8366_AP_RATE_INFO_MCS_FORMAT) { | 760 | if (rxd->rate & MWL8K_8366_AP_RATE_INFO_MCS_FORMAT) { |
757 | status->flag |= RX_FLAG_HT; | 761 | status->flag |= RX_FLAG_HT; |
@@ -839,7 +843,7 @@ static void mwl8k_rxd_sta_refill(void *_rxd, dma_addr_t addr, int len) | |||
839 | 843 | ||
840 | static int | 844 | static int |
841 | mwl8k_rxd_sta_process(void *_rxd, struct ieee80211_rx_status *status, | 845 | mwl8k_rxd_sta_process(void *_rxd, struct ieee80211_rx_status *status, |
842 | __le16 *qos) | 846 | __le16 *qos, s8 *noise) |
843 | { | 847 | { |
844 | struct mwl8k_rxd_sta *rxd = _rxd; | 848 | struct mwl8k_rxd_sta *rxd = _rxd; |
845 | u16 rate_info; | 849 | u16 rate_info; |
@@ -853,6 +857,7 @@ mwl8k_rxd_sta_process(void *_rxd, struct ieee80211_rx_status *status, | |||
853 | memset(status, 0, sizeof(*status)); | 857 | memset(status, 0, sizeof(*status)); |
854 | 858 | ||
855 | status->signal = -rxd->rssi; | 859 | status->signal = -rxd->rssi; |
860 | *noise = -rxd->noise_level; | ||
856 | status->antenna = MWL8K_STA_RATE_INFO_ANTSELECT(rate_info); | 861 | status->antenna = MWL8K_STA_RATE_INFO_ANTSELECT(rate_info); |
857 | status->rate_idx = MWL8K_STA_RATE_INFO_RATEID(rate_info); | 862 | status->rate_idx = MWL8K_STA_RATE_INFO_RATEID(rate_info); |
858 | 863 | ||
@@ -1053,7 +1058,8 @@ static int rxq_process(struct ieee80211_hw *hw, int index, int limit) | |||
1053 | 1058 | ||
1054 | rxd = rxq->rxd + (rxq->head * priv->rxd_ops->rxd_size); | 1059 | rxd = rxq->rxd + (rxq->head * priv->rxd_ops->rxd_size); |
1055 | 1060 | ||
1056 | pkt_len = priv->rxd_ops->rxd_process(rxd, &status, &qos); | 1061 | pkt_len = priv->rxd_ops->rxd_process(rxd, &status, &qos, |
1062 | &priv->noise); | ||
1057 | if (pkt_len < 0) | 1063 | if (pkt_len < 0) |
1058 | break; | 1064 | break; |
1059 | 1065 | ||
@@ -3755,6 +3761,22 @@ static int mwl8k_get_stats(struct ieee80211_hw *hw, | |||
3755 | return mwl8k_cmd_get_stat(hw, stats); | 3761 | return mwl8k_cmd_get_stat(hw, stats); |
3756 | } | 3762 | } |
3757 | 3763 | ||
3764 | static int mwl8k_get_survey(struct ieee80211_hw *hw, int idx, | ||
3765 | struct survey_info *survey) | ||
3766 | { | ||
3767 | struct mwl8k_priv *priv = hw->priv; | ||
3768 | struct ieee80211_conf *conf = &hw->conf; | ||
3769 | |||
3770 | if (idx != 0) | ||
3771 | return -ENOENT; | ||
3772 | |||
3773 | survey->channel = conf->channel; | ||
3774 | survey->filled = SURVEY_INFO_NOISE_DBM; | ||
3775 | survey->noise = priv->noise; | ||
3776 | |||
3777 | return 0; | ||
3778 | } | ||
3779 | |||
3758 | static int | 3780 | static int |
3759 | mwl8k_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 3781 | mwl8k_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
3760 | enum ieee80211_ampdu_mlme_action action, | 3782 | enum ieee80211_ampdu_mlme_action action, |
@@ -3786,6 +3808,7 @@ static const struct ieee80211_ops mwl8k_ops = { | |||
3786 | .sta_remove = mwl8k_sta_remove, | 3808 | .sta_remove = mwl8k_sta_remove, |
3787 | .conf_tx = mwl8k_conf_tx, | 3809 | .conf_tx = mwl8k_conf_tx, |
3788 | .get_stats = mwl8k_get_stats, | 3810 | .get_stats = mwl8k_get_stats, |
3811 | .get_survey = mwl8k_get_survey, | ||
3789 | .ampdu_action = mwl8k_ampdu_action, | 3812 | .ampdu_action = mwl8k_ampdu_action, |
3790 | }; | 3813 | }; |
3791 | 3814 | ||