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

Commit cd2bb512 authored by Sam Leffler's avatar Sam Leffler Committed by Johannes Berg
Browse files

mac80211: add support for tx to abort low priority scan requests



Use NL80211_SCAN_FLAG_LOW_PRIORITY flag in mac80211's scan state
machine to prematurely terminate scan operations if outbound
traffic collides. This is useful for marking background scans so
they don't affect throughput.

Signed-off-by: default avatarSam Leffler <sleffler@chromium.org>
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
[set feature flag only if software scan is used]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 15d6030b
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -866,6 +866,7 @@ enum {
 * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to
 * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to
 *	send out data
 *	send out data
 * @SCAN_RESUME: Resume the scan and scan the next channel
 * @SCAN_RESUME: Resume the scan and scan the next channel
 * @SCAN_ABORT: Abort the scan and go back to operating channel
 */
 */
enum mac80211_scan_state {
enum mac80211_scan_state {
	SCAN_DECISION,
	SCAN_DECISION,
@@ -873,6 +874,7 @@ enum mac80211_scan_state {
	SCAN_SEND_PROBE,
	SCAN_SEND_PROBE,
	SCAN_SUSPEND,
	SCAN_SUSPEND,
	SCAN_RESUME,
	SCAN_RESUME,
	SCAN_ABORT,
};
};


struct ieee80211_local {
struct ieee80211_local {
+3 −0
Original line number Original line Diff line number Diff line
@@ -602,6 +602,9 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
			   NL80211_FEATURE_SAE |
			   NL80211_FEATURE_SAE |
			   NL80211_FEATURE_HT_IBSS;
			   NL80211_FEATURE_HT_IBSS;


	if (!ops->hw_scan)
		wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN;

	if (!ops->set_key)
	if (!ops->set_key)
		wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
		wiphy->flags |= WIPHY_FLAG_IBSS_RSN;


+17 −4
Original line number Original line Diff line number Diff line
@@ -466,6 +466,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
			sizeof(*local->hw_scan_req) +
			sizeof(*local->hw_scan_req) +
			req->n_channels * sizeof(req->channels[0]);
			req->n_channels * sizeof(req->channels[0]);
		local->hw_scan_req->ie = ies;
		local->hw_scan_req->ie = ies;
		local->hw_scan_req->flags = req->flags;


		local->hw_scan_band = 0;
		local->hw_scan_band = 0;


@@ -566,6 +567,7 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
	unsigned long min_beacon_int = 0;
	unsigned long min_beacon_int = 0;
	struct ieee80211_sub_if_data *sdata;
	struct ieee80211_sub_if_data *sdata;
	struct ieee80211_channel *next_chan;
	struct ieee80211_channel *next_chan;
	enum mac80211_scan_state next_scan_state;


	/*
	/*
	 * check if at least one STA interface is associated,
	 * check if at least one STA interface is associated,
@@ -624,10 +626,18 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
			usecs_to_jiffies(min_beacon_int * 1024) *
			usecs_to_jiffies(min_beacon_int * 1024) *
			local->hw.conf.listen_interval);
			local->hw.conf.listen_interval);


	if (associated && (!tx_empty || bad_latency || listen_int_exceeded))
	if (associated && !tx_empty) {
		local->next_scan_state = SCAN_SUSPEND;
		if (local->scan_req->flags & NL80211_SCAN_FLAG_LOW_PRIORITY)
			next_scan_state = SCAN_ABORT;
		else
		else
		local->next_scan_state = SCAN_SET_CHANNEL;
			next_scan_state = SCAN_SUSPEND;
	} else if (associated && (bad_latency || listen_int_exceeded)) {
		next_scan_state = SCAN_SUSPEND;
	} else {
		next_scan_state = SCAN_SET_CHANNEL;
	}

	local->next_scan_state = next_scan_state;


	*next_delay = 0;
	*next_delay = 0;
}
}
@@ -798,6 +808,9 @@ void ieee80211_scan_work(struct work_struct *work)
		case SCAN_RESUME:
		case SCAN_RESUME:
			ieee80211_scan_state_resume(local, &next_delay);
			ieee80211_scan_state_resume(local, &next_delay);
			break;
			break;
		case SCAN_ABORT:
			aborted = true;
			goto out_complete;
		}
		}
	} while (next_delay == 0);
	} while (next_delay == 0);