Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b06d277 authored by Avraham Stern's avatar Avraham Stern Committed by Johannes Berg
Browse files

cfg80211: Add multiple scan plans for scheduled scan



Add the option to configure multiple 'scan plans' for scheduled scan.
Each 'scan plan' defines the number of scan cycles and the interval
between scans. The scan plans are executed in the order they were
configured. The last scan plan will always run infinitely and thus
defines only the interval between scans.
The maximum number of scan plans supported by the device and the
maximum number of iterations in a single scan plan are advertised
to userspace so it can configure the scan plans appropriately.

When scheduled scan results are received there is no way to know which
scan plan is being currently executed, so there is no way to know when
the next scan iteration will start. This is not a problem, however.
The scan start timestamp is only used for flushing old scan results,
and there is no difference between flushing all results received until
the end of the previous iteration or the start of the current one,
since no results will be received in between.

Signed-off-by: default avatarAvraham Stern <avraham.stern@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent af614261
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3312,7 +3312,7 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy,
	}

	/* fw uses seconds, also make sure that it's >0 */
	interval = max_t(u16, 1, request->interval / 1000);
	interval = max_t(u16, 1, request->scan_plans[0].interval);

	ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx,
				  interval, interval,
+1 −0
Original line number Diff line number Diff line
@@ -629,6 +629,7 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode)
	kfree(mvm->d3_resume_sram);
	if (mvm->nd_config) {
		kfree(mvm->nd_config->match_sets);
		kfree(mvm->nd_config->scan_plans);
		kfree(mvm->nd_config);
		mvm->nd_config = NULL;
	}
+2 −2
Original line number Diff line number Diff line
@@ -1271,12 +1271,12 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,

	params.type = iwl_mvm_get_scan_type(mvm, vif, &params);

	if (req->interval > U16_MAX) {
	if (req->scan_plans[0].interval > U16_MAX) {
		IWL_DEBUG_SCAN(mvm,
			       "interval value is > 16-bits, set to max possible\n");
		params.interval = U16_MAX;
	} else {
		params.interval = req->interval / MSEC_PER_SEC;
		params.interval = req->scan_plans[0].interval;
	}

	/* In theory, LMAC scans can handle a 32-bit delay, but since
+2 −1
Original line number Diff line number Diff line
@@ -350,7 +350,8 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
	cfg->bss_type = SCAN_BSS_TYPE_ANY;
	/* currently NL80211 supports only a single interval */
	for (i = 0; i < SCAN_MAX_CYCLE_INTERVALS; i++)
		cfg->intervals[i] = cpu_to_le32(req->interval);
		cfg->intervals[i] = cpu_to_le32(req->scan_plans[0].interval *
						MSEC_PER_SEC);

	cfg->ssid_len = 0;
	ret = wlcore_scan_sched_scan_ssid_list(wl, wlvif, req);
+5 −3
Original line number Diff line number Diff line
@@ -228,13 +228,15 @@ int wl18xx_scan_sched_scan_config(struct wl1271 *wl,
	wl18xx_adjust_channels(cmd, cmd_channels);

	if (c->num_short_intervals && c->long_interval &&
	    c->long_interval > req->interval) {
		cmd->short_cycles_msec = cpu_to_le16(req->interval);
	    c->long_interval > req->scan_plans[0].interval * MSEC_PER_SEC) {
		cmd->short_cycles_msec =
			cpu_to_le16(req->scan_plans[0].interval * MSEC_PER_SEC);
		cmd->long_cycles_msec = cpu_to_le16(c->long_interval);
		cmd->short_cycles_count = c->num_short_intervals;
	} else {
		cmd->short_cycles_msec = 0;
		cmd->long_cycles_msec = cpu_to_le16(req->interval);
		cmd->long_cycles_msec =
			cpu_to_le16(req->scan_plans[0].interval * MSEC_PER_SEC);
		cmd->short_cycles_count = 0;
	}
	wl1271_debug(DEBUG_SCAN, "short_interval: %d, long_interval: %d, num_short: %d",
Loading