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

Commit 6d7a37c7 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "nl80211: Introduce scan flags to emphasize requested scan behavior"

parents 6c79485c df7d3c6c
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -55,6 +55,12 @@
 */
#define CFG80211_ROAMED_API_UNIFIED 1

/* Indicate backport support for DBS scan control */
#define CFG80211_SCAN_DBS_CONTROL_SUPPORT 1

/* Indicate backport support for per chain rssi scan */
#define CFG80211_SCAN_PER_CHAIN_RSSI_SUPPORT 1

/**
 * DOC: Introduction
 *
@@ -1742,6 +1748,8 @@ enum cfg80211_signal_type {
 *	by %parent_bssid.
 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
 *	the BSS that requested the scan in which the beacon/probe was received.
 * @chains: bitmask for filled values in @chain_signal.
 * @chain_signal: per-chain signal strength of last received BSS in dBm.
 */
struct cfg80211_inform_bss {
	struct ieee80211_channel *chan;
@@ -1750,6 +1758,8 @@ struct cfg80211_inform_bss {
	u64 boottime_ns;
	u64 parent_tsf;
	u8 parent_bssid[ETH_ALEN] __aligned(2);
	u8 chains;
	s8 chain_signal[IEEE80211_MAX_CHAINS];
};

/**
@@ -1793,6 +1803,8 @@ struct cfg80211_bss_ies {
 *	that holds the beacon data. @beacon_ies is still valid, of course, and
 *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
 * @signal: signal strength value (type depends on the wiphy's signal_type)
 * @chains: bitmask for filled values in @chain_signal.
 * @chain_signal: per-chain signal strength of last received BSS in dBm.
 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
 */
struct cfg80211_bss {
@@ -1811,6 +1823,8 @@ struct cfg80211_bss {
	u16 capability;

	u8 bssid[ETH_ALEN];
	u8 chains;
	s8 chain_signal[IEEE80211_MAX_CHAINS];

	u8 priv[0] __aligned(sizeof(void *));
};
+56 −0
Original line number Diff line number Diff line
@@ -3782,6 +3782,9 @@ enum nl80211_bss_scan_width {
 *	@NL80211_BSS_PARENT_BSSID. (u64).
 * @NL80211_BSS_PARENT_BSSID: the BSS according to which @NL80211_BSS_PARENT_TSF
 *	is set.
 * @NL80211_BSS_CHAIN_SIGNAL: per-chain signal strength of last BSS update.
 *	Contains a nested array of signal strength attributes (u8, dBm),
 *	using the nesting index as the antenna number.
 * @__NL80211_BSS_AFTER_LAST: internal
 * @NL80211_BSS_MAX: highest BSS attribute
 */
@@ -3805,6 +3808,7 @@ enum nl80211_bss {
	NL80211_BSS_PAD,
	NL80211_BSS_PARENT_TSF,
	NL80211_BSS_PARENT_BSSID,
	NL80211_BSS_CHAIN_SIGNAL,

	/* keep last */
	__NL80211_BSS_AFTER_LAST,
@@ -4835,6 +4839,27 @@ enum nl80211_feature_flags {
 *	RSSI threshold values to monitor rather than exactly one threshold.
 * @NL80211_EXT_FEATURE_FILS_SK_OFFLOAD: Driver SME supports FILS shared key
 *	authentication with %NL80211_CMD_CONNECT.
 * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK: Device wants to do 4-way
 *	handshake with PSK in station mode (PSK is passed as part of the connect
 *	and associate commands), doing it in the host might not be supported.
 * @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X: Device wants to do doing 4-way
 *	handshake with 802.1X in station mode (will pass EAP frames to the host
 *	and accept the set_pmk/del_pmk commands), doing it in the host might not
 *	be supported.
 * @NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME: Driver is capable of overriding
 *	the max channel attribute in the FILS request params IE with the
 *	actual dwell time.
 * @NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP: Driver accepts broadcast probe
 *	response
 * @NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE: Driver supports sending
 *	the first probe request in each channel at rate of at least 5.5Mbps.
 * @NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION: Driver supports
 *	probe request tx deferral and suppression
 * @NL80211_EXT_FEATURE_MFP_OPTIONAL: Driver supports the %NL80211_MFP_OPTIONAL
 *	value in %NL80211_ATTR_USE_MFP.
 * @NL80211_EXT_FEATURE_LOW_SPAN_SCAN: Driver supports low span scan.
 * @NL80211_EXT_FEATURE_LOW_POWER_SCAN: Driver supports low power scan.
 * @NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN: Driver supports high accuracy scan.
 *
 * @NUM_NL80211_EXT_FEATURES: number of extended features.
 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -4855,6 +4880,16 @@ enum nl80211_ext_feature_index {
	NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI,
	NL80211_EXT_FEATURE_CQM_RSSI_LIST,
	NL80211_EXT_FEATURE_FILS_SK_OFFLOAD,
	NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK,
	NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X,
	NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME,
	NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP,
	NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE,
	NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION,
	NL80211_EXT_FEATURE_MFP_OPTIONAL,
	NL80211_EXT_FEATURE_LOW_SPAN_SCAN,
	NL80211_EXT_FEATURE_LOW_POWER_SCAN,
	NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN,

	/* add new features before the definition below */
	NUM_NL80211_EXT_FEATURES,
@@ -4915,6 +4950,10 @@ enum nl80211_timeout_reason {
 * of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN
 * requests.
 *
 * NL80211_SCAN_FLAG_LOW_SPAN, NL80211_SCAN_FLAG_LOW_POWER, and
 * NL80211_SCAN_FLAG_HIGH_ACCURACY flags are exclusive of each other, i.e., only
 * one of them can be used in the request.
 *
 * @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority
 * @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning
 * @NL80211_SCAN_FLAG_AP: force a scan even if the interface is configured
@@ -4931,12 +4970,29 @@ enum nl80211_timeout_reason {
 *	locally administered 1, multicast 0) is assumed.
 *	This flag must not be requested when the feature isn't supported, check
 *	the nl80211 feature flags for the device.
 *	SSID and/or RSSI.
 * @NL80211_SCAN_FLAG_LOW_SPAN: Span corresponds to the total time taken to
 *	accomplish the scan. Thus, this flag intends the driver to perform the
 *	scan request with lesser span/duration. It is specific to the driver
 *	implementations on how this is accomplished. Scan accuracy may get
 *	impacted with this flag.
 * @NL80211_SCAN_FLAG_LOW_POWER: This flag intends the scan attempts to consume
 *	optimal possible power. Drivers can resort to their specific means to
 *	optimize the power. Scan accuracy may get impacted with this flag.
 * @NL80211_SCAN_FLAG_HIGH_ACCURACY: Accuracy here intends to the extent of scan
 *	results obtained. Thus HIGH_ACCURACY scan flag aims to get maximum
 *	possible scan results. This flag hints the driver to use the best
 *	possible scan configuration to improve the accuracy in scanning.
 *	Latency and power use may get impacted with this flag.
 */
enum nl80211_scan_flags {
	NL80211_SCAN_FLAG_LOW_PRIORITY			= 1<<0,
	NL80211_SCAN_FLAG_FLUSH				= 1<<1,
	NL80211_SCAN_FLAG_AP				= 1<<2,
	NL80211_SCAN_FLAG_RANDOM_ADDR			= 1<<3,
	NL80211_SCAN_FLAG_LOW_SPAN			= 1<<8,
	NL80211_SCAN_FLAG_LOW_POWER			= 1<<9,
	NL80211_SCAN_FLAG_HIGH_ACCURACY			= 1<<10,
};

/**
+16 −2
Original line number Diff line number Diff line
@@ -6701,8 +6701,17 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
	if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) {
		request->flags = nla_get_u32(
			info->attrs[NL80211_ATTR_SCAN_FLAGS]);
		if ((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) &&
		    !(wiphy->features & NL80211_FEATURE_LOW_PRIORITY_SCAN)) {
		if (((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) &&
		     !(wiphy->features & NL80211_FEATURE_LOW_PRIORITY_SCAN)) ||
		    ((request->flags & NL80211_SCAN_FLAG_LOW_SPAN) &&
		     !wiphy_ext_feature_isset(wiphy,
				      NL80211_EXT_FEATURE_LOW_SPAN_SCAN)) ||
		    ((request->flags & NL80211_SCAN_FLAG_LOW_POWER) &&
		     !wiphy_ext_feature_isset(wiphy,
				      NL80211_EXT_FEATURE_LOW_POWER_SCAN)) ||
		    ((request->flags & NL80211_SCAN_FLAG_HIGH_ACCURACY) &&
		     !wiphy_ext_feature_isset(wiphy,
		      NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN))) {
			err = -EOPNOTSUPP;
			goto out_free;
		}
@@ -7585,6 +7594,11 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
			      intbss->ts_boottime, NL80211_BSS_PAD))
		goto nla_put_failure;

	if (!nl80211_put_signal(msg, intbss->pub.chains,
				intbss->pub.chain_signal,
				NL80211_BSS_CHAIN_SIGNAL))
		goto nla_put_failure;

	switch (rdev->wiphy.signal_type) {
	case CFG80211_SIGNAL_TYPE_MBM:
		if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res->signal))
+5 −0
Original line number Diff line number Diff line
@@ -904,6 +904,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev,
		found->ts = tmp->ts;
		found->ts_boottime = tmp->ts_boottime;
		found->parent_tsf = tmp->parent_tsf;
		found->pub.chains = tmp->pub.chains;
		memcpy(found->pub.chain_signal, tmp->pub.chain_signal,
		       IEEE80211_MAX_CHAINS);
		ether_addr_copy(found->parent_bssid, tmp->parent_bssid);
	} else {
		struct cfg80211_internal_bss *new;
@@ -1156,6 +1159,8 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
	tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info);
	tmp.ts_boottime = data->boottime_ns;
	tmp.parent_tsf = data->parent_tsf;
	tmp.pub.chains = data->chains;
	memcpy(tmp.pub.chain_signal, data->chain_signal, IEEE80211_MAX_CHAINS);
	ether_addr_copy(tmp.parent_bssid, data->parent_bssid);

	signal_valid = abs(data->chan->center_freq - channel->center_freq) <=