diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2010-04-08 11:50:47 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-04-08 15:24:17 -0400 |
commit | f74cb0f7b1d8d6e4c11c6679a7d012be641225e3 (patch) | |
tree | df41f9864d174d6da73c1364d12a95df662649b1 /drivers | |
parent | 4f59fce9e099fb6ba3c8361e5094163a3efce5be (diff) |
mac80211_hwsim: add sw_scan sw_scan_complete
Simple pre-scan and scan complete callbacks, this at least shows
to me that mac80211 will issue two scans at the same time on the
same wiphy.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/mac80211_hwsim.c | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 6ea77e95277b..ec8b08291790 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -290,7 +290,8 @@ struct mac80211_hwsim_data { | |||
290 | struct ieee80211_channel *channel; | 290 | struct ieee80211_channel *channel; |
291 | unsigned long beacon_int; /* in jiffies unit */ | 291 | unsigned long beacon_int; /* in jiffies unit */ |
292 | unsigned int rx_filter; | 292 | unsigned int rx_filter; |
293 | bool started, idle; | 293 | bool started, idle, scanning; |
294 | struct mutex mutex; | ||
294 | struct timer_list beacon_timer; | 295 | struct timer_list beacon_timer; |
295 | enum ps_mode { | 296 | enum ps_mode { |
296 | PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL | 297 | PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL |
@@ -956,9 +957,9 @@ static int mac80211_hwsim_hw_scan(struct ieee80211_hw *hw, | |||
956 | hsd->hw = hw; | 957 | hsd->hw = hw; |
957 | INIT_DELAYED_WORK(&hsd->w, hw_scan_done); | 958 | INIT_DELAYED_WORK(&hsd->w, hw_scan_done); |
958 | 959 | ||
959 | printk(KERN_DEBUG "hwsim scan request\n"); | 960 | printk(KERN_DEBUG "hwsim hw_scan request\n"); |
960 | for (i = 0; i < req->n_channels; i++) | 961 | for (i = 0; i < req->n_channels; i++) |
961 | printk(KERN_DEBUG "hwsim scan freq %d\n", | 962 | printk(KERN_DEBUG "hwsim hw_scan freq %d\n", |
962 | req->channels[i]->center_freq); | 963 | req->channels[i]->center_freq); |
963 | 964 | ||
964 | ieee80211_queue_delayed_work(hw, &hsd->w, 2 * HZ); | 965 | ieee80211_queue_delayed_work(hw, &hsd->w, 2 * HZ); |
@@ -966,6 +967,36 @@ static int mac80211_hwsim_hw_scan(struct ieee80211_hw *hw, | |||
966 | return 0; | 967 | return 0; |
967 | } | 968 | } |
968 | 969 | ||
970 | static void mac80211_hwsim_sw_scan(struct ieee80211_hw *hw) | ||
971 | { | ||
972 | struct mac80211_hwsim_data *hwsim = hw->priv; | ||
973 | |||
974 | mutex_lock(&hwsim->mutex); | ||
975 | |||
976 | if (hwsim->scanning) { | ||
977 | printk(KERN_DEBUG "two hwsim sw_scans detected!\n"); | ||
978 | goto out; | ||
979 | } | ||
980 | |||
981 | printk(KERN_DEBUG "hwsim sw_scan request, prepping stuff\n"); | ||
982 | hwsim->scanning = true; | ||
983 | |||
984 | out: | ||
985 | mutex_unlock(&hwsim->mutex); | ||
986 | } | ||
987 | |||
988 | static void mac80211_hwsim_sw_scan_complete(struct ieee80211_hw *hw) | ||
989 | { | ||
990 | struct mac80211_hwsim_data *hwsim = hw->priv; | ||
991 | |||
992 | mutex_lock(&hwsim->mutex); | ||
993 | |||
994 | printk(KERN_DEBUG "hwsim sw_scan_complete\n"); | ||
995 | hwsim->scanning = true; | ||
996 | |||
997 | mutex_unlock(&hwsim->mutex); | ||
998 | } | ||
999 | |||
969 | static struct ieee80211_ops mac80211_hwsim_ops = | 1000 | static struct ieee80211_ops mac80211_hwsim_ops = |
970 | { | 1001 | { |
971 | .tx = mac80211_hwsim_tx, | 1002 | .tx = mac80211_hwsim_tx, |
@@ -983,6 +1014,8 @@ static struct ieee80211_ops mac80211_hwsim_ops = | |||
983 | .conf_tx = mac80211_hwsim_conf_tx, | 1014 | .conf_tx = mac80211_hwsim_conf_tx, |
984 | CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd) | 1015 | CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd) |
985 | .ampdu_action = mac80211_hwsim_ampdu_action, | 1016 | .ampdu_action = mac80211_hwsim_ampdu_action, |
1017 | .sw_scan_start = mac80211_hwsim_sw_scan, | ||
1018 | .sw_scan_complete = mac80211_hwsim_sw_scan_complete, | ||
986 | .flush = mac80211_hwsim_flush, | 1019 | .flush = mac80211_hwsim_flush, |
987 | }; | 1020 | }; |
988 | 1021 | ||
@@ -1178,8 +1211,11 @@ static int __init init_mac80211_hwsim(void) | |||
1178 | if (radios < 1 || radios > 100) | 1211 | if (radios < 1 || radios > 100) |
1179 | return -EINVAL; | 1212 | return -EINVAL; |
1180 | 1213 | ||
1181 | if (fake_hw_scan) | 1214 | if (fake_hw_scan) { |
1182 | mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan; | 1215 | mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan; |
1216 | mac80211_hwsim_ops.sw_scan_start = NULL; | ||
1217 | mac80211_hwsim_ops.sw_scan_complete = NULL; | ||
1218 | } | ||
1183 | 1219 | ||
1184 | spin_lock_init(&hwsim_radio_lock); | 1220 | spin_lock_init(&hwsim_radio_lock); |
1185 | INIT_LIST_HEAD(&hwsim_radios); | 1221 | INIT_LIST_HEAD(&hwsim_radios); |
@@ -1284,6 +1320,7 @@ static int __init init_mac80211_hwsim(void) | |||
1284 | } | 1320 | } |
1285 | /* By default all radios are belonging to the first group */ | 1321 | /* By default all radios are belonging to the first group */ |
1286 | data->group = 1; | 1322 | data->group = 1; |
1323 | mutex_init(&data->mutex); | ||
1287 | 1324 | ||
1288 | /* Work to be done prior to ieee80211_register_hw() */ | 1325 | /* Work to be done prior to ieee80211_register_hw() */ |
1289 | switch (regtest) { | 1326 | switch (regtest) { |