aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mac80211_hwsim.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-04-15 16:21:34 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-15 16:21:34 -0400
commit5c01d5669356e13f0fb468944c1dd4c6a7e978ad (patch)
treefa43345288d7b25fac92b3b35360a177c4947313 /drivers/net/wireless/mac80211_hwsim.c
parentfea069152614cdeefba4b2bf80afcddb9c217fc8 (diff)
parenta5e944f1d955f3819503348426763e21e0413ba6 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts: Documentation/feature-removal-schedule.txt drivers/net/wireless/ath/ath5k/phy.c drivers/net/wireless/wl12xx/wl1271_main.c
Diffstat (limited to 'drivers/net/wireless/mac80211_hwsim.c')
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 7cd5f56662f..dfff02f5c86 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -291,7 +291,8 @@ struct mac80211_hwsim_data {
291 struct ieee80211_channel *channel; 291 struct ieee80211_channel *channel;
292 unsigned long beacon_int; /* in jiffies unit */ 292 unsigned long beacon_int; /* in jiffies unit */
293 unsigned int rx_filter; 293 unsigned int rx_filter;
294 bool started, idle; 294 bool started, idle, scanning;
295 struct mutex mutex;
295 struct timer_list beacon_timer; 296 struct timer_list beacon_timer;
296 enum ps_mode { 297 enum ps_mode {
297 PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL 298 PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL
@@ -957,9 +958,9 @@ static int mac80211_hwsim_hw_scan(struct ieee80211_hw *hw,
957 hsd->hw = hw; 958 hsd->hw = hw;
958 INIT_DELAYED_WORK(&hsd->w, hw_scan_done); 959 INIT_DELAYED_WORK(&hsd->w, hw_scan_done);
959 960
960 printk(KERN_DEBUG "hwsim scan request\n"); 961 printk(KERN_DEBUG "hwsim hw_scan request\n");
961 for (i = 0; i < req->n_channels; i++) 962 for (i = 0; i < req->n_channels; i++)
962 printk(KERN_DEBUG "hwsim scan freq %d\n", 963 printk(KERN_DEBUG "hwsim hw_scan freq %d\n",
963 req->channels[i]->center_freq); 964 req->channels[i]->center_freq);
964 965
965 ieee80211_queue_delayed_work(hw, &hsd->w, 2 * HZ); 966 ieee80211_queue_delayed_work(hw, &hsd->w, 2 * HZ);
@@ -967,6 +968,36 @@ static int mac80211_hwsim_hw_scan(struct ieee80211_hw *hw,
967 return 0; 968 return 0;
968} 969}
969 970
971static void mac80211_hwsim_sw_scan(struct ieee80211_hw *hw)
972{
973 struct mac80211_hwsim_data *hwsim = hw->priv;
974
975 mutex_lock(&hwsim->mutex);
976
977 if (hwsim->scanning) {
978 printk(KERN_DEBUG "two hwsim sw_scans detected!\n");
979 goto out;
980 }
981
982 printk(KERN_DEBUG "hwsim sw_scan request, prepping stuff\n");
983 hwsim->scanning = true;
984
985out:
986 mutex_unlock(&hwsim->mutex);
987}
988
989static void mac80211_hwsim_sw_scan_complete(struct ieee80211_hw *hw)
990{
991 struct mac80211_hwsim_data *hwsim = hw->priv;
992
993 mutex_lock(&hwsim->mutex);
994
995 printk(KERN_DEBUG "hwsim sw_scan_complete\n");
996 hwsim->scanning = true;
997
998 mutex_unlock(&hwsim->mutex);
999}
1000
970static struct ieee80211_ops mac80211_hwsim_ops = 1001static struct ieee80211_ops mac80211_hwsim_ops =
971{ 1002{
972 .tx = mac80211_hwsim_tx, 1003 .tx = mac80211_hwsim_tx,
@@ -984,6 +1015,8 @@ static struct ieee80211_ops mac80211_hwsim_ops =
984 .conf_tx = mac80211_hwsim_conf_tx, 1015 .conf_tx = mac80211_hwsim_conf_tx,
985 CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd) 1016 CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd)
986 .ampdu_action = mac80211_hwsim_ampdu_action, 1017 .ampdu_action = mac80211_hwsim_ampdu_action,
1018 .sw_scan_start = mac80211_hwsim_sw_scan,
1019 .sw_scan_complete = mac80211_hwsim_sw_scan_complete,
987 .flush = mac80211_hwsim_flush, 1020 .flush = mac80211_hwsim_flush,
988}; 1021};
989 1022
@@ -1179,8 +1212,11 @@ static int __init init_mac80211_hwsim(void)
1179 if (radios < 1 || radios > 100) 1212 if (radios < 1 || radios > 100)
1180 return -EINVAL; 1213 return -EINVAL;
1181 1214
1182 if (fake_hw_scan) 1215 if (fake_hw_scan) {
1183 mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan; 1216 mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
1217 mac80211_hwsim_ops.sw_scan_start = NULL;
1218 mac80211_hwsim_ops.sw_scan_complete = NULL;
1219 }
1184 1220
1185 spin_lock_init(&hwsim_radio_lock); 1221 spin_lock_init(&hwsim_radio_lock);
1186 INIT_LIST_HEAD(&hwsim_radios); 1222 INIT_LIST_HEAD(&hwsim_radios);
@@ -1285,6 +1321,7 @@ static int __init init_mac80211_hwsim(void)
1285 } 1321 }
1286 /* By default all radios are belonging to the first group */ 1322 /* By default all radios are belonging to the first group */
1287 data->group = 1; 1323 data->group = 1;
1324 mutex_init(&data->mutex);
1288 1325
1289 /* Work to be done prior to ieee80211_register_hw() */ 1326 /* Work to be done prior to ieee80211_register_hw() */
1290 switch (regtest) { 1327 switch (regtest) {