diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-02-17 04:48:17 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-02-20 10:09:54 -0500 |
commit | 37e3308cb2b6933019d9d9c2045877d6d68d9c5a (patch) | |
tree | d9b71804d022a78a65f55d1b6dce4012cd4ee97b | |
parent | d9b8396a52b4e857263eeb9e1eba474ea11c19bf (diff) |
mac80211: allow driver to return error from sched_scan_stop
In order to solve races with sched_scan_stop, it is necessary
for the driver to be able to return an error to propagate that
to cfg80211 so it doesn't send an event.
Reviewed-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mac80211.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/main.c | 6 | ||||
-rw-r--r-- | include/net/mac80211.h | 3 | ||||
-rw-r--r-- | net/mac80211/driver-ops.h | 12 | ||||
-rw-r--r-- | net/mac80211/scan.c | 2 |
5 files changed, 19 insertions, 10 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index beaf8140abbf..7492fc0f2766 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -1746,14 +1746,16 @@ out: | |||
1746 | return ret; | 1746 | return ret; |
1747 | } | 1747 | } |
1748 | 1748 | ||
1749 | static void iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw, | 1749 | static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw, |
1750 | struct ieee80211_vif *vif) | 1750 | struct ieee80211_vif *vif) |
1751 | { | 1751 | { |
1752 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | 1752 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
1753 | 1753 | ||
1754 | mutex_lock(&mvm->mutex); | 1754 | mutex_lock(&mvm->mutex); |
1755 | iwl_mvm_sched_scan_stop(mvm); | 1755 | iwl_mvm_sched_scan_stop(mvm); |
1756 | mutex_unlock(&mvm->mutex); | 1756 | mutex_unlock(&mvm->mutex); |
1757 | |||
1758 | return 0; | ||
1757 | } | 1759 | } |
1758 | 1760 | ||
1759 | static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | 1761 | static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 7aae5b3a0c2c..4175a57ac9f5 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -3668,8 +3668,8 @@ out: | |||
3668 | return ret; | 3668 | return ret; |
3669 | } | 3669 | } |
3670 | 3670 | ||
3671 | static void wl1271_op_sched_scan_stop(struct ieee80211_hw *hw, | 3671 | static int wl1271_op_sched_scan_stop(struct ieee80211_hw *hw, |
3672 | struct ieee80211_vif *vif) | 3672 | struct ieee80211_vif *vif) |
3673 | { | 3673 | { |
3674 | struct wl1271 *wl = hw->priv; | 3674 | struct wl1271 *wl = hw->priv; |
3675 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | 3675 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); |
@@ -3691,6 +3691,8 @@ static void wl1271_op_sched_scan_stop(struct ieee80211_hw *hw, | |||
3691 | wl1271_ps_elp_sleep(wl); | 3691 | wl1271_ps_elp_sleep(wl); |
3692 | out: | 3692 | out: |
3693 | mutex_unlock(&wl->mutex); | 3693 | mutex_unlock(&wl->mutex); |
3694 | |||
3695 | return 0; | ||
3694 | } | 3696 | } |
3695 | 3697 | ||
3696 | static int wl1271_op_set_frag_threshold(struct ieee80211_hw *hw, u32 value) | 3698 | static int wl1271_op_set_frag_threshold(struct ieee80211_hw *hw, u32 value) |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index a6bcc39e146e..86faa413b37d 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -2460,6 +2460,7 @@ enum ieee80211_roc_type { | |||
2460 | * This process will continue until sched_scan_stop is called. | 2460 | * This process will continue until sched_scan_stop is called. |
2461 | * | 2461 | * |
2462 | * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan. | 2462 | * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan. |
2463 | * In this case, ieee80211_sched_scan_stopped() must not be called. | ||
2463 | * | 2464 | * |
2464 | * @sw_scan_start: Notifier function that is called just before a software scan | 2465 | * @sw_scan_start: Notifier function that is called just before a software scan |
2465 | * is started. Can be NULL, if the driver doesn't need this notification. | 2466 | * is started. Can be NULL, if the driver doesn't need this notification. |
@@ -2807,7 +2808,7 @@ struct ieee80211_ops { | |||
2807 | struct ieee80211_vif *vif, | 2808 | struct ieee80211_vif *vif, |
2808 | struct cfg80211_sched_scan_request *req, | 2809 | struct cfg80211_sched_scan_request *req, |
2809 | struct ieee80211_sched_scan_ies *ies); | 2810 | struct ieee80211_sched_scan_ies *ies); |
2810 | void (*sched_scan_stop)(struct ieee80211_hw *hw, | 2811 | int (*sched_scan_stop)(struct ieee80211_hw *hw, |
2811 | struct ieee80211_vif *vif); | 2812 | struct ieee80211_vif *vif); |
2812 | void (*sw_scan_start)(struct ieee80211_hw *hw); | 2813 | void (*sw_scan_start)(struct ieee80211_hw *hw); |
2813 | void (*sw_scan_complete)(struct ieee80211_hw *hw); | 2814 | void (*sw_scan_complete)(struct ieee80211_hw *hw); |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index ef8b385eff04..fc689f5d971e 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -354,16 +354,20 @@ drv_sched_scan_start(struct ieee80211_local *local, | |||
354 | return ret; | 354 | return ret; |
355 | } | 355 | } |
356 | 356 | ||
357 | static inline void drv_sched_scan_stop(struct ieee80211_local *local, | 357 | static inline int drv_sched_scan_stop(struct ieee80211_local *local, |
358 | struct ieee80211_sub_if_data *sdata) | 358 | struct ieee80211_sub_if_data *sdata) |
359 | { | 359 | { |
360 | int ret; | ||
361 | |||
360 | might_sleep(); | 362 | might_sleep(); |
361 | 363 | ||
362 | check_sdata_in_driver(sdata); | 364 | check_sdata_in_driver(sdata); |
363 | 365 | ||
364 | trace_drv_sched_scan_stop(local, sdata); | 366 | trace_drv_sched_scan_stop(local, sdata); |
365 | local->ops->sched_scan_stop(&local->hw, &sdata->vif); | 367 | ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif); |
366 | trace_drv_return_void(local); | 368 | trace_drv_return_int(local, ret); |
369 | |||
370 | return ret; | ||
367 | } | 371 | } |
368 | 372 | ||
369 | static inline void drv_sw_scan_start(struct ieee80211_local *local) | 373 | static inline void drv_sw_scan_start(struct ieee80211_local *local) |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index b211e412511f..836f500dfbf3 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -1056,7 +1056,7 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata) | |||
1056 | local->sched_scan_req = NULL; | 1056 | local->sched_scan_req = NULL; |
1057 | 1057 | ||
1058 | if (rcu_access_pointer(local->sched_scan_sdata)) | 1058 | if (rcu_access_pointer(local->sched_scan_sdata)) |
1059 | drv_sched_scan_stop(local, sdata); | 1059 | ret = drv_sched_scan_stop(local, sdata); |
1060 | 1060 | ||
1061 | out: | 1061 | out: |
1062 | mutex_unlock(&local->mtx); | 1062 | mutex_unlock(&local->mtx); |