static int iwl_mvm_sched_scan_lmac(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct cfg80211_sched_scan_request *req,
- struct ieee80211_scan_ies *ies)
+ struct ieee80211_scan_ies *ies,
+ struct iwl_mvm_scan_params *params)
{
- struct iwl_host_cmd hcmd = {
- .id = SCAN_OFFLOAD_REQUEST_CMD,
- .len = { iwl_mvm_scan_size(mvm), },
- .data = { mvm->scan_cmd, },
- .dataflags = { IWL_HCMD_DFL_NOCOPY, },
- };
struct iwl_scan_req_lmac *cmd = mvm->scan_cmd;
struct iwl_scan_probe_req *preq;
- struct iwl_mvm_scan_params params = {};
- int ret;
u32 flags = 0, ssid_bitmap = 0;
lockdep_assert_held(&mvm->mutex);
- /* we should have failed registration if scan_cmd was NULL */
- if (WARN_ON(mvm->scan_cmd == NULL))
- return -ENOMEM;
-
- if (!iwl_mvm_scan_fits(mvm, req->n_ssids, ies, req->n_channels))
- return -ENOBUFS;
-
- iwl_mvm_scan_calc_params(mvm, vif, req->n_ssids, 0, ¶ms);
-
- iwl_mvm_build_generic_scan_cmd(mvm, cmd, ¶ms);
+ iwl_mvm_build_generic_scan_cmd(mvm, cmd, params);
cmd->n_channels = (u8)req->n_channels;
if (req->n_ssids == 1 && req->ssids[0].ssid_len != 0)
flags |= IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION;
- if (params.passive_fragmented)
+ if (params->passive_fragmented)
flags |= IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED;
if (req->n_ssids == 0)
req->mac_addr : NULL,
req->mac_addr_mask);
- ret = iwl_mvm_send_cmd(mvm, &hcmd);
- if (!ret) {
- IWL_DEBUG_SCAN(mvm,
- "Sched scan request was sent successfully\n");
- } else {
- /*
- * If the scan failed, it usually means that the FW was unable
- * to allocate the time events. Warn on it, but maybe we
- * should try to send the command again with different params.
- */
- IWL_ERR(mvm, "Sched scan failed! ret %d\n", ret);
- mvm->scan_status &= ~IWL_MVM_SCAN_SCHED;
- ret = -EIO;
- }
- return ret;
+ return 0;
}
static int iwl_mvm_sched_scan_umac(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct cfg80211_sched_scan_request *req,
- struct ieee80211_scan_ies *ies)
+ struct ieee80211_scan_ies *ies,
+ struct iwl_mvm_scan_params *params)
{
-
- struct iwl_host_cmd hcmd = {
- .id = SCAN_REQ_UMAC,
- .len = { iwl_mvm_scan_size(mvm), },
- .data = { mvm->scan_cmd, },
- .dataflags = { IWL_HCMD_DFL_NOCOPY, },
- };
struct iwl_scan_req_umac *cmd = mvm->scan_cmd;
struct iwl_scan_req_umac_tail *sec_part = (void *)&cmd->data +
sizeof(struct iwl_scan_channel_cfg_umac) *
mvm->fw->ucode_capa.n_scan_channels;
- struct iwl_mvm_scan_params params = {};
u32 uid, flags;
u32 ssid_bitmap = 0;
- int ret, uid_idx;
+ int uid_idx;
lockdep_assert_held(&mvm->mutex);
if (uid_idx >= mvm->max_scans)
return -EBUSY;
- /* we should have failed registration if scan_cmd was NULL */
- if (WARN_ON(mvm->scan_cmd == NULL))
- return -ENOMEM;
-
- if (!iwl_mvm_scan_fits(mvm, req->n_ssids, ies, req->n_channels))
- return -ENOBUFS;
-
- iwl_mvm_scan_calc_params(mvm, vif, req->n_ssids, req->flags,
- ¶ms);
-
- iwl_mvm_build_generic_umac_scan_cmd(mvm, cmd, ¶ms);
+ iwl_mvm_build_generic_umac_scan_cmd(mvm, cmd, params);
cmd->flags = cpu_to_le32(IWL_UMAC_SCAN_FLAG_PREEMPTIVE);
cmd->ooc_priority = cpu_to_le32(IWL_SCAN_PRIORITY_LOW);
flags = iwl_mvm_scan_umac_common_flags(mvm, req->n_ssids, req->ssids,
- params.passive_fragmented);
+ params->passive_fragmented);
flags |= IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC;
req->mac_addr : NULL,
req->mac_addr_mask);
- ret = iwl_mvm_send_cmd(mvm, &hcmd);
- if (!ret) {
- IWL_DEBUG_SCAN(mvm,
- "Sched scan request was sent successfully\n");
- } else {
- /*
- * If the scan failed, it usually means that the FW was unable
- * to allocate the time events. Warn on it, but maybe we
- * should try to send the command again with different params.
- */
- IWL_ERR(mvm, "Sched scan failed! ret %d\n", ret);
- }
- return ret;
+ return 0;
}
static int iwl_mvm_num_scans(struct iwl_mvm *mvm)
struct ieee80211_scan_ies *ies,
int type)
{
+ struct iwl_host_cmd hcmd = {
+ .len = { iwl_mvm_scan_size(mvm), },
+ .data = { mvm->scan_cmd, },
+ .dataflags = { IWL_HCMD_DFL_NOCOPY, },
+ };
+ struct iwl_mvm_scan_params params = {};
int ret;
lockdep_assert_held(&mvm->mutex);
if (ret)
return ret;
+ /* we should have failed registration if scan_cmd was NULL */
+ if (WARN_ON(!mvm->scan_cmd))
+ return -ENOMEM;
+
+ if (!iwl_mvm_scan_fits(mvm, req->n_ssids, ies, req->n_channels))
+ return -ENOBUFS;
+
+ iwl_mvm_scan_calc_params(mvm, vif, req->n_ssids, req->flags,
+ ¶ms);
+
ret = iwl_mvm_config_sched_scan_profiles(mvm, req);
if (ret)
return ret;
if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) {
- ret = iwl_mvm_sched_scan_umac(mvm, vif, req, ies);
+ hcmd.id = SCAN_REQ_UMAC;
+ ret = iwl_mvm_sched_scan_umac(mvm, vif, req, ies, ¶ms);
} else {
- ret = iwl_mvm_sched_scan_lmac(mvm, vif, req, ies);
- if (!ret)
- mvm->scan_status |= IWL_MVM_SCAN_SCHED;
+ hcmd.id = SCAN_OFFLOAD_REQUEST_CMD;
+ ret = iwl_mvm_sched_scan_lmac(mvm, vif, req, ies, ¶ms);
+ }
+
+ if (ret)
+ return ret;
+
+ ret = iwl_mvm_send_cmd(mvm, &hcmd);
+ if (!ret) {
+ IWL_DEBUG_SCAN(mvm,
+ "Sched scan request was sent successfully\n");
+ mvm->scan_status |= type;
+ } else {
+ /* If the scan failed, it usually means that the FW was unable
+ * to allocate the time events. Warn on it, but maybe we
+ * should try to send the command again with different params.
+ */
+ IWL_ERR(mvm, "Sched scan failed! ret %d\n", ret);
}
return ret;