summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/iwlwifi/mvm/mac80211.c
diff options
context:
space:
mode:
authorLuciano Coelho <luciano.coelho@intel.com>2015-03-20 15:51:36 +0200
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2015-04-29 13:12:48 +0300
commit6749dd80bb335f1bf9b214a0dc44943f0b5044ca (patch)
tree777ebbde7153b1016f4cc0dba51fcb57010b00fd /drivers/net/wireless/iwlwifi/mvm/mac80211.c
parent65ff556b07161be5ab608fe93697dbbdc0d9252d (diff)
iwlwifi: mvm: move scan code from mac80211.c to scan.c
Move all the scan code that was in mac80211.c to scan.c where it belongs, leaving only the parts that are specific to mac80211 ops. Change some function definitions slightly to improve consistency. Signed-off-by: Luciano Coelho <luciano.coelho@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/mac80211.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c80
1 files changed, 5 insertions, 75 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 6350ca22ce36..ff3273afff4f 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -80,7 +80,6 @@
#include "sta.h"
#include "time-event.h"
#include "iwl-eeprom-parse.h"
-#include "fw-api-scan.h"
#include "iwl-phy-db.h"
#include "testmode.h"
#include "iwl-fw-error-dump.h"
@@ -2381,81 +2380,21 @@ static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
iwl_mvm_unref(mvm, IWL_MVM_REF_BSS_CHANGED);
}
-static int iwl_mvm_num_scans(struct iwl_mvm *mvm)
-{
- return hweight32(mvm->scan_status & IWL_MVM_SCAN_MASK);
-}
-
-static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type)
-{
- /* This looks a bit arbitrary, but the idea is that if we run
- * out of possible simultaneous scans and the userspace is
- * trying to run a scan type that is already running, we
- * return -EBUSY. But if the userspace wants to start a
- * different type of scan, we stop the opposite type to make
- * space for the new request. The reason is backwards
- * compatibility with old wpa_supplicant that wouldn't stop a
- * scheduled scan before starting a normal scan.
- */
-
- if (iwl_mvm_num_scans(mvm) < mvm->max_scans)
- return 0;
-
- /* Use a switch, even though this is a bitmask, so that more
- * than one bits set will fall in default and we will warn.
- */
- switch (type) {
- case IWL_MVM_SCAN_REGULAR:
- if (mvm->scan_status & IWL_MVM_SCAN_REGULAR_MASK)
- return -EBUSY;
- return iwl_mvm_scan_offload_stop(mvm, true);
- case IWL_MVM_SCAN_SCHED:
- if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK)
- return -EBUSY;
- return iwl_mvm_cancel_scan(mvm);
- default:
- WARN_ON(1);
- break;
- }
-
- return -EIO;
-}
-
static int iwl_mvm_mac_hw_scan(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_scan_request *hw_req)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
- struct cfg80211_scan_request *req = &hw_req->req;
int ret;
- if (req->n_channels == 0 ||
- req->n_channels > mvm->fw->ucode_capa.n_scan_channels)
+ if (hw_req->req.n_channels == 0 ||
+ hw_req->req.n_channels > mvm->fw->ucode_capa.n_scan_channels)
return -EINVAL;
mutex_lock(&mvm->mutex);
-
- if (iwl_mvm_is_lar_supported(mvm) && !mvm->lar_regdom_set) {
- IWL_ERR(mvm, "scan while LAR regdomain is not set\n");
- ret = -EBUSY;
- goto out;
- }
-
- ret = iwl_mvm_check_running_scans(mvm, IWL_MVM_SCAN_REGULAR);
- if (ret)
- goto out;
-
- iwl_mvm_ref(mvm, IWL_MVM_REF_SCAN);
-
- if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN)
- ret = iwl_mvm_scan_umac(mvm, vif, hw_req);
- else
- ret = iwl_mvm_scan_lmac(mvm, vif, hw_req);
-
- if (ret)
- iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
-out:
+ ret = iwl_mvm_reg_scan_start(mvm, vif, &hw_req->req, &hw_req->ies);
mutex_unlock(&mvm->mutex);
+
return ret;
}
@@ -2794,25 +2733,16 @@ static int iwl_mvm_mac_sched_scan_start(struct ieee80211_hw *hw,
struct ieee80211_scan_ies *ies)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
+
int ret;
mutex_lock(&mvm->mutex);
- if (iwl_mvm_is_lar_supported(mvm) && !mvm->lar_regdom_set) {
- IWL_ERR(mvm, "sched-scan while LAR regdomain is not set\n");
- ret = -EBUSY;
- goto out;
- }
-
if (!vif->bss_conf.idle) {
ret = -EBUSY;
goto out;
}
- ret = iwl_mvm_check_running_scans(mvm, IWL_MVM_SCAN_SCHED);
- if (ret)
- goto out;
-
ret = iwl_mvm_sched_scan_start(mvm, vif, req, ies);
out: