提交 c7d42480 编写于 作者: L Luciano Coelho 提交者: Emmanuel Grumbach

iwlwifi: mvm: combine regular and sched scan stop functions

The regular and scheduled scan functions are very similar, so they can
be combined into one.
Signed-off-by: NLuciano Coelho <luciano.coelho@intel.com>
Reviewed-by: NJohannes Berg <johannes.berg@intel.com>
Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
上级 65f4a8e0
...@@ -761,7 +761,7 @@ void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif) ...@@ -761,7 +761,7 @@ void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
static int iwl_mvm_switch_to_d3(struct iwl_mvm *mvm) static int iwl_mvm_switch_to_d3(struct iwl_mvm *mvm)
{ {
iwl_mvm_reg_scan_stop(mvm); iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, true);
iwl_trans_stop_device(mvm->trans); iwl_trans_stop_device(mvm->trans);
......
...@@ -510,6 +510,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) ...@@ -510,6 +510,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX;
BUILD_BUG_ON(IWL_MVM_SCAN_STOPPING_MASK & IWL_MVM_SCAN_MASK);
BUILD_BUG_ON(IWL_MVM_MAX_UMAC_SCANS > HWEIGHT32(IWL_MVM_SCAN_MASK) || BUILD_BUG_ON(IWL_MVM_MAX_UMAC_SCANS > HWEIGHT32(IWL_MVM_SCAN_MASK) ||
IWL_MVM_MAX_LMAC_SCANS > HWEIGHT32(IWL_MVM_SCAN_MASK)); IWL_MVM_MAX_LMAC_SCANS > HWEIGHT32(IWL_MVM_SCAN_MASK));
...@@ -2361,7 +2362,7 @@ static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw, ...@@ -2361,7 +2362,7 @@ static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
mutex_lock(&mvm->mutex); mutex_lock(&mvm->mutex);
if (changes & BSS_CHANGED_IDLE && !bss_conf->idle) if (changes & BSS_CHANGED_IDLE && !bss_conf->idle)
iwl_mvm_sched_scan_stop(mvm, true); iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, true);
switch (vif->type) { switch (vif->type) {
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
...@@ -2417,7 +2418,7 @@ static void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw, ...@@ -2417,7 +2418,7 @@ static void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw,
*/ */
if ((mvm->scan_status & IWL_MVM_SCAN_REGULAR) || if ((mvm->scan_status & IWL_MVM_SCAN_REGULAR) ||
(mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN)) (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN))
iwl_mvm_reg_scan_stop(mvm); iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, true);
mutex_unlock(&mvm->mutex); mutex_unlock(&mvm->mutex);
} }
...@@ -2775,7 +2776,7 @@ static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw, ...@@ -2775,7 +2776,7 @@ static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw,
return 0; return 0;
} }
ret = iwl_mvm_sched_scan_stop(mvm, false); ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, false);
mutex_unlock(&mvm->mutex); mutex_unlock(&mvm->mutex);
iwl_mvm_wait_for_async_handlers(mvm); iwl_mvm_wait_for_async_handlers(mvm);
......
...@@ -447,6 +447,8 @@ iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif) ...@@ -447,6 +447,8 @@ iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif)
extern const u8 tid_to_mac80211_ac[]; extern const u8 tid_to_mac80211_ac[];
#define IWL_MVM_SCAN_STOPPING_SHIFT 8
enum iwl_scan_status { enum iwl_scan_status {
IWL_MVM_SCAN_REGULAR = BIT(0), IWL_MVM_SCAN_REGULAR = BIT(0),
IWL_MVM_SCAN_SCHED = BIT(1), IWL_MVM_SCAN_SCHED = BIT(1),
...@@ -463,8 +465,8 @@ enum iwl_scan_status { ...@@ -463,8 +465,8 @@ enum iwl_scan_status {
IWL_MVM_SCAN_NETDETECT_MASK = IWL_MVM_SCAN_NETDETECT | IWL_MVM_SCAN_NETDETECT_MASK = IWL_MVM_SCAN_NETDETECT |
IWL_MVM_SCAN_STOPPING_NETDETECT, IWL_MVM_SCAN_STOPPING_NETDETECT,
IWL_MVM_SCAN_STOPPING_MASK = 0xff00, IWL_MVM_SCAN_STOPPING_MASK = 0xff << IWL_MVM_SCAN_STOPPING_SHIFT,
IWL_MVM_SCAN_MASK = 0x00ff, IWL_MVM_SCAN_MASK = 0xff,
}; };
/** /**
...@@ -1121,7 +1123,7 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -1121,7 +1123,7 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct cfg80211_scan_request *req, struct cfg80211_scan_request *req,
struct ieee80211_scan_ies *ies); struct ieee80211_scan_ies *ies);
int iwl_mvm_scan_size(struct iwl_mvm *mvm); int iwl_mvm_scan_size(struct iwl_mvm *mvm);
int iwl_mvm_reg_scan_stop(struct iwl_mvm *mvm); int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify);
int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm); int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm);
void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm); void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm);
...@@ -1137,7 +1139,6 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, ...@@ -1137,7 +1139,6 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
struct cfg80211_sched_scan_request *req, struct cfg80211_sched_scan_request *req,
struct ieee80211_scan_ies *ies, struct ieee80211_scan_ies *ies,
int type); int type);
int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm, bool notify);
int iwl_mvm_rx_scan_match_found(struct iwl_mvm *mvm, int iwl_mvm_rx_scan_match_found(struct iwl_mvm *mvm,
struct iwl_rx_cmd_buffer *rxb, struct iwl_rx_cmd_buffer *rxb,
struct iwl_device_cmd *cmd); struct iwl_device_cmd *cmd);
......
...@@ -1139,11 +1139,11 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type) ...@@ -1139,11 +1139,11 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type)
case IWL_MVM_SCAN_REGULAR: case IWL_MVM_SCAN_REGULAR:
if (mvm->scan_status & IWL_MVM_SCAN_REGULAR_MASK) if (mvm->scan_status & IWL_MVM_SCAN_REGULAR_MASK)
return -EBUSY; return -EBUSY;
return iwl_mvm_sched_scan_stop(mvm, true); return iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, true);
case IWL_MVM_SCAN_SCHED: case IWL_MVM_SCAN_SCHED:
if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK) if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK)
return -EBUSY; return -EBUSY;
return iwl_mvm_reg_scan_stop(mvm); iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, true);
case IWL_MVM_SCAN_NETDETECT: case IWL_MVM_SCAN_NETDETECT:
/* No need to stop anything for net-detect since the /* No need to stop anything for net-detect since the
* firmware is restarted anyway. This way, any sched * firmware is restarted anyway. This way, any sched
...@@ -1524,11 +1524,11 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm) ...@@ -1524,11 +1524,11 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm)
} }
} }
int iwl_mvm_reg_scan_stop(struct iwl_mvm *mvm) int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify)
{ {
int ret; int ret;
if (!(mvm->scan_status & IWL_MVM_SCAN_REGULAR)) if (!(mvm->scan_status & type))
return 0; return 0;
if (iwl_mvm_is_radio_killed(mvm)) { if (iwl_mvm_is_radio_killed(mvm)) {
...@@ -1536,43 +1536,27 @@ int iwl_mvm_reg_scan_stop(struct iwl_mvm *mvm) ...@@ -1536,43 +1536,27 @@ int iwl_mvm_reg_scan_stop(struct iwl_mvm *mvm)
goto out; goto out;
} }
ret = iwl_mvm_scan_stop_wait(mvm, IWL_MVM_SCAN_REGULAR); ret = iwl_mvm_scan_stop_wait(mvm, type);
if (!ret) if (!ret)
mvm->scan_status |= IWL_MVM_SCAN_STOPPING_REGULAR; mvm->scan_status |= type << IWL_MVM_SCAN_STOPPING_SHIFT;
out: out:
/* Clear the scan status so the next scan requests will /* Clear the scan status so the next scan requests will
* succeed and mark the scan as stopping, so that the Rx * succeed and mark the scan as stopping, so that the Rx
* handler doesn't do anything, as the scan was stopped from * handler doesn't do anything, as the scan was stopped from
* above. Since the rx handler won't do anything now, we have * above.
* to release the scan reference here.
*/ */
iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); mvm->scan_status &= ~type;
mvm->scan_status &= ~IWL_MVM_SCAN_REGULAR; if (type == IWL_MVM_SCAN_REGULAR) {
ieee80211_scan_completed(mvm->hw, true); /* Since the rx handler won't do anything now, we have
* to release the scan reference here.
return ret; */
} iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
if (notify)
int iwl_mvm_sched_scan_stop(struct iwl_mvm *mvm, bool notify) ieee80211_scan_completed(mvm->hw, true);
{ } else if (notify) {
int ret;
if (!(mvm->scan_status & IWL_MVM_SCAN_SCHED))
return 0;
if (iwl_mvm_is_radio_killed(mvm)) {
ret = 0;
goto out;
}
ret = iwl_mvm_scan_stop_wait(mvm, IWL_MVM_SCAN_SCHED);
if (!ret)
mvm->scan_status |= IWL_MVM_SCAN_STOPPING_SCHED;
out:
mvm->scan_status &= ~IWL_MVM_SCAN_SCHED;
if (notify)
ieee80211_sched_scan_stopped(mvm->hw); ieee80211_sched_scan_stopped(mvm->hw);
}
return ret; return ret;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册