aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mac80211_hwsim.c
diff options
context:
space:
mode:
authorHolger Schurig <holgerschurig@gmail.com>2010-04-19 04:23:57 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-20 11:50:52 -0400
commit1289723ef238908ca8d95ff48a46ee0de970f882 (patch)
treeb4d584aee8abcc33dec2039fb45112156d3cd3d0 /drivers/net/wireless/mac80211_hwsim.c
parent03ceedea972a82d343fa5c2528b3952fa9e615d5 (diff)
mac80211: sample survey implementation for mac80211 & hwsim
This adds the survey function to both mac80211 itself and to mac80211_hwsim. For the latter driver, we simply invent some noise level.A real driver which cannot determine the real channel noise MUST NOT report any noise, especially not a magically conjured one :-) Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mac80211_hwsim.c')
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index ec8b08291790..79bb8833ddb9 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -829,6 +829,33 @@ static int mac80211_hwsim_conf_tx(
829 return 0; 829 return 0;
830} 830}
831 831
832static int mac80211_hwsim_get_survey(
833 struct ieee80211_hw *hw, int idx,
834 struct survey_info *survey)
835{
836 struct ieee80211_conf *conf = &hw->conf;
837
838 printk(KERN_DEBUG "%s:%s (idx=%d)\n",
839 wiphy_name(hw->wiphy), __func__, idx);
840
841 if (idx != 0)
842 return -ENOENT;
843
844 /* Current channel */
845 survey->channel = conf->channel;
846
847 /*
848 * Magically conjured noise level --- this is only ok for simulated hardware.
849 *
850 * A real driver which cannot determine the real channel noise MUST NOT
851 * report any noise, especially not a magically conjured one :-)
852 */
853 survey->filled = SURVEY_INFO_NOISE_DBM;
854 survey->noise = -92;
855
856 return 0;
857}
858
832#ifdef CONFIG_NL80211_TESTMODE 859#ifdef CONFIG_NL80211_TESTMODE
833/* 860/*
834 * This section contains example code for using netlink 861 * This section contains example code for using netlink
@@ -1012,6 +1039,7 @@ static struct ieee80211_ops mac80211_hwsim_ops =
1012 .sta_notify = mac80211_hwsim_sta_notify, 1039 .sta_notify = mac80211_hwsim_sta_notify,
1013 .set_tim = mac80211_hwsim_set_tim, 1040 .set_tim = mac80211_hwsim_set_tim,
1014 .conf_tx = mac80211_hwsim_conf_tx, 1041 .conf_tx = mac80211_hwsim_conf_tx,
1042 .get_survey = mac80211_hwsim_get_survey,
1015 CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd) 1043 CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd)
1016 .ampdu_action = mac80211_hwsim_ampdu_action, 1044 .ampdu_action = mac80211_hwsim_ampdu_action,
1017 .sw_scan_start = mac80211_hwsim_sw_scan, 1045 .sw_scan_start = mac80211_hwsim_sw_scan,