wifi: iwlwifi: mvm: Refactor scan start
authorIlan Peer <ilan.peer@intel.com>
Mon, 11 Mar 2024 06:28:12 +0000 (08:28 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 25 Mar 2024 14:36:04 +0000 (15:36 +0100)
To support staring internal scan, refactor the scan code such
that the body iwl_mvm_reg_scan_start() is now moved to a local
function that can be used by other flows as well.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240311081938.e7833d4cfc53.I43c1c533c2a5243229002fde6360d423946c54fa@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/scan.c

index f3e3986b4c72f2aabfd9ff67edf8c11a1bebc03c..a6f42d55bd9834e1d9b686ba66d6966b77726d00 100644 (file)
@@ -2914,9 +2914,11 @@ static void iwl_mvm_fill_respect_p2p_go(struct iwl_mvm *mvm,
        }
 }
 
-int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-                          struct cfg80211_scan_request *req,
-                          struct ieee80211_scan_ies *ies)
+static int _iwl_mvm_single_scan_start(struct iwl_mvm *mvm,
+                                     struct ieee80211_vif *vif,
+                                     struct cfg80211_scan_request *req,
+                                     struct ieee80211_scan_ies *ies,
+                                     int type)
 {
        struct iwl_host_cmd hcmd = {
                .len = { iwl_mvm_scan_size(mvm), },
@@ -2934,7 +2936,7 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
                return -EBUSY;
        }
 
-       ret = iwl_mvm_check_running_scans(mvm, IWL_MVM_SCAN_REGULAR);
+       ret = iwl_mvm_check_running_scans(mvm, type);
        if (ret)
                return ret;
 
@@ -2983,8 +2985,7 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 
        iwl_mvm_scan_6ghz_passive_scan(mvm, &params, vif);
 
-       uid = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params,
-                                    IWL_MVM_SCAN_REGULAR);
+       uid = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params, type);
 
        if (uid < 0)
                return uid;
@@ -3004,7 +3005,7 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
        }
 
        IWL_DEBUG_SCAN(mvm, "Scan request was sent successfully\n");
-       mvm->scan_status |= IWL_MVM_SCAN_REGULAR;
+       mvm->scan_status |= type;
        mvm->scan_vif = iwl_mvm_vif_from_mac80211(vif);
 
        if (params.enable_6ghz_passive)
@@ -3016,6 +3017,14 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
        return 0;
 }
 
+int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+                          struct cfg80211_scan_request *req,
+                          struct ieee80211_scan_ies *ies)
+{
+       return _iwl_mvm_single_scan_start(mvm, vif, req, ies,
+                                         IWL_MVM_SCAN_REGULAR);
+}
+
 int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
                             struct ieee80211_vif *vif,
                             struct cfg80211_sched_scan_request *req,