aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2011-05-12 09:28:29 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-05-12 14:10:55 -0400
commit85a9994a0a6cba1a6cc6af4bd3ebd85f778be0fe (patch)
treee9dd8fff75d9c0ee2f5aec129bb6132499c72461 /net/mac80211
parenta3836e02ba4c50db958d32d710b226f2408623dc (diff)
cfg80211/mac80211: avoid bounce back mac->cfg->mac on sched_scan_stopped
When sched_scan_stopped was called by the driver, mac80211 calls cfg80211, which in turn was calling mac80211 back with a flag "driver_initiated". This flag was used so that mac80211 would do the necessary cleanup but would not call the driver. This was enough to prevent the bounce back between the driver and mac80211, but not between mac80211 and cfg80211. To fix this, we now do the cleanup in mac80211 before calling cfg80211. To help with locking issues, the workqueue was moved from cfg80211 to mac80211. Reported-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Luciano Coelho <coelho@ti.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c5
-rw-r--r--net/mac80211/ieee80211_i.h5
-rw-r--r--net/mac80211/main.c3
-rw-r--r--net/mac80211/scan.c33
4 files changed, 35 insertions, 11 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 303f33fcb844..2d1c1a5f3c51 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1372,15 +1372,14 @@ ieee80211_sched_scan_start(struct wiphy *wiphy,
1372} 1372}
1373 1373
1374static int 1374static int
1375ieee80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev, 1375ieee80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev)
1376 bool driver_initiated)
1377{ 1376{
1378 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1377 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1379 1378
1380 if (!sdata->local->ops->sched_scan_stop) 1379 if (!sdata->local->ops->sched_scan_stop)
1381 return -EOPNOTSUPP; 1380 return -EOPNOTSUPP;
1382 1381
1383 return ieee80211_request_sched_scan_stop(sdata, driver_initiated); 1382 return ieee80211_request_sched_scan_stop(sdata);
1384} 1383}
1385 1384
1386static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev, 1385static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 6f55a789c099..82f90ff8bb18 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -849,6 +849,7 @@ struct ieee80211_local {
849 849
850 bool sched_scanning; 850 bool sched_scanning;
851 struct ieee80211_sched_scan_ies sched_scan_ies; 851 struct ieee80211_sched_scan_ies sched_scan_ies;
852 struct work_struct sched_scan_stopped_work;
852 853
853 unsigned long leave_oper_channel_time; 854 unsigned long leave_oper_channel_time;
854 enum mac80211_scan_state next_scan_state; 855 enum mac80211_scan_state next_scan_state;
@@ -1160,8 +1161,8 @@ void ieee80211_rx_bss_put(struct ieee80211_local *local,
1160/* scheduled scan handling */ 1161/* scheduled scan handling */
1161int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, 1162int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
1162 struct cfg80211_sched_scan_request *req); 1163 struct cfg80211_sched_scan_request *req);
1163int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata, 1164int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata);
1164 bool driver_initiated); 1165void ieee80211_sched_scan_stopped_work(struct work_struct *work);
1165 1166
1166/* off-channel helpers */ 1167/* off-channel helpers */
1167bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local); 1168bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local);
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 30e6a682a047..7f89011fa22d 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -652,6 +652,9 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
652 setup_timer(&local->dynamic_ps_timer, 652 setup_timer(&local->dynamic_ps_timer,
653 ieee80211_dynamic_ps_timer, (unsigned long) local); 653 ieee80211_dynamic_ps_timer, (unsigned long) local);
654 654
655 INIT_WORK(&local->sched_scan_stopped_work,
656 ieee80211_sched_scan_stopped_work);
657
655 sta_info_init(local); 658 sta_info_init(local);
656 659
657 for (i = 0; i < IEEE80211_MAX_QUEUES; i++) { 660 for (i = 0; i < IEEE80211_MAX_QUEUES; i++) {
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index ea44a8e941ec..d20046b5d8f4 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -902,8 +902,7 @@ out:
902 return ret; 902 return ret;
903} 903}
904 904
905int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata, 905int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata)
906 bool driver_initiated)
907{ 906{
908 struct ieee80211_local *local = sdata->local; 907 struct ieee80211_local *local = sdata->local;
909 int ret = 0, i; 908 int ret = 0, i;
@@ -919,11 +918,9 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata,
919 for (i = 0; i < IEEE80211_NUM_BANDS; i++) 918 for (i = 0; i < IEEE80211_NUM_BANDS; i++)
920 kfree(local->sched_scan_ies.ie[i]); 919 kfree(local->sched_scan_ies.ie[i]);
921 920
922 if (!driver_initiated) 921 drv_sched_scan_stop(local, sdata);
923 drv_sched_scan_stop(local, sdata);
924 local->sched_scanning = false; 922 local->sched_scanning = false;
925 } 923 }
926
927out: 924out:
928 mutex_unlock(&sdata->local->mtx); 925 mutex_unlock(&sdata->local->mtx);
929 926
@@ -940,12 +937,36 @@ void ieee80211_sched_scan_results(struct ieee80211_hw *hw)
940} 937}
941EXPORT_SYMBOL(ieee80211_sched_scan_results); 938EXPORT_SYMBOL(ieee80211_sched_scan_results);
942 939
940void ieee80211_sched_scan_stopped_work(struct work_struct *work)
941{
942 struct ieee80211_local *local =
943 container_of(work, struct ieee80211_local,
944 sched_scan_stopped_work);
945 int i;
946
947 mutex_lock(&local->mtx);
948
949 if (!local->sched_scanning) {
950 mutex_unlock(&local->mtx);
951 return;
952 }
953
954 for (i = 0; i < IEEE80211_NUM_BANDS; i++)
955 kfree(local->sched_scan_ies.ie[i]);
956
957 local->sched_scanning = false;
958
959 mutex_unlock(&local->mtx);
960
961 cfg80211_sched_scan_stopped(local->hw.wiphy);
962}
963
943void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw) 964void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)
944{ 965{
945 struct ieee80211_local *local = hw_to_local(hw); 966 struct ieee80211_local *local = hw_to_local(hw);
946 967
947 trace_api_sched_scan_stopped(local); 968 trace_api_sched_scan_stopped(local);
948 969
949 cfg80211_sched_scan_stopped(hw->wiphy); 970 ieee80211_queue_work(&local->hw, &local->sched_scan_stopped_work);
950} 971}
951EXPORT_SYMBOL(ieee80211_sched_scan_stopped); 972EXPORT_SYMBOL(ieee80211_sched_scan_stopped);