aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath10k/mac.c
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2013-07-31 04:32:40 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2013-08-02 02:35:21 -0400
commit2e1dea40512d7e99a7e91ac88a6f434a5d7c6fde (patch)
treec8abfc11810c59cbacb2edf37de630e86f8bd3a5 /drivers/net/wireless/ath/ath10k/mac.c
parent7c199997ded6c90fd45a50f49e9ac63adaacb95e (diff)
ath10k: implement get_survey()
This implements a limited subset of what can be reported in the survey dump. This can be used for assessing approximate channel load, e.g. for automatic channel selection. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/mac.c')
-rw-r--r--drivers/net/wireless/ath/ath10k/mac.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 57843377fa0b..9ea31f89b748 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2934,6 +2934,41 @@ static void ath10k_restart_complete(struct ieee80211_hw *hw)
2934 mutex_unlock(&ar->conf_mutex); 2934 mutex_unlock(&ar->conf_mutex);
2935} 2935}
2936 2936
2937static int ath10k_get_survey(struct ieee80211_hw *hw, int idx,
2938 struct survey_info *survey)
2939{
2940 struct ath10k *ar = hw->priv;
2941 struct ieee80211_supported_band *sband;
2942 struct survey_info *ar_survey = &ar->survey[idx];
2943 int ret = 0;
2944
2945 mutex_lock(&ar->conf_mutex);
2946
2947 sband = hw->wiphy->bands[IEEE80211_BAND_2GHZ];
2948 if (sband && idx >= sband->n_channels) {
2949 idx -= sband->n_channels;
2950 sband = NULL;
2951 }
2952
2953 if (!sband)
2954 sband = hw->wiphy->bands[IEEE80211_BAND_5GHZ];
2955
2956 if (!sband || idx >= sband->n_channels) {
2957 ret = -ENOENT;
2958 goto exit;
2959 }
2960
2961 spin_lock_bh(&ar->data_lock);
2962 memcpy(survey, ar_survey, sizeof(*survey));
2963 spin_unlock_bh(&ar->data_lock);
2964
2965 survey->channel = &sband->channels[idx];
2966
2967exit:
2968 mutex_unlock(&ar->conf_mutex);
2969 return ret;
2970}
2971
2937static const struct ieee80211_ops ath10k_ops = { 2972static const struct ieee80211_ops ath10k_ops = {
2938 .tx = ath10k_tx, 2973 .tx = ath10k_tx,
2939 .start = ath10k_start, 2974 .start = ath10k_start,
@@ -2955,6 +2990,7 @@ static const struct ieee80211_ops ath10k_ops = {
2955 .flush = ath10k_flush, 2990 .flush = ath10k_flush,
2956 .tx_last_beacon = ath10k_tx_last_beacon, 2991 .tx_last_beacon = ath10k_tx_last_beacon,
2957 .restart_complete = ath10k_restart_complete, 2992 .restart_complete = ath10k_restart_complete,
2993 .get_survey = ath10k_get_survey,
2958#ifdef CONFIG_PM 2994#ifdef CONFIG_PM
2959 .suspend = ath10k_suspend, 2995 .suspend = ath10k_suspend,
2960 .resume = ath10k_resume, 2996 .resume = ath10k_resume,