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

Commit 4a070e1f authored by Gururaj Pandurangi's avatar Gururaj Pandurangi Committed by Gerrit - the friendly Code Review server
Browse files

qcacmn: Exclude 6GHz APs in VLP from scan list for US

If STA country code is US and 6G AP country IE is other than
US, STA would use VLP mode. Since US VLP is not determined
we don't allow connection to go through. Additionally, don't
include such AP to scan result.

Change-Id: I41b0c7dbea681b2ef1bea7c0a572ee1d7248fa6e
CRs-Fixed: 2953248
parent a34b539f
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -906,6 +906,40 @@ static QDF_STATUS scm_add_update_entry(struct wlan_objmgr_psoc *psoc,
	return QDF_STATUS_SUCCESS;
}

#ifdef CONFIG_REG_CLIENT
/**
 * scm_is_bss_allowed_for_country() - Check if bss is allowed to start for a
 * specific country and power mode (VLP?LPI/SP) for 6GHz.
 * @psoc: psoc ptr
 * @scan_entry: ptr to scan entry
 *
 * Return: True if allowed, False if not.
 */
static bool scm_is_bss_allowed_for_country(struct wlan_objmgr_psoc *psoc,
					   struct scan_cache_entry *scan_entry)
{
	struct wlan_country_ie *cc_ie;
	uint8_t programmed_country[REG_ALPHA2_LEN + 1];

	if (wlan_reg_is_6ghz_chan_freq(scan_entry->channel.chan_freq)) {
		cc_ie = util_scan_entry_country(scan_entry);
		wlan_reg_read_current_country(psoc, programmed_country);
		if (cc_ie && qdf_mem_cmp(cc_ie->cc, programmed_country,
					 REG_ALPHA2_LEN)) {
			if (wlan_reg_is_us(programmed_country))
				return false;
		}
	}
	return true;
}
#else
static bool scm_is_bss_allowed_for_country(struct wlan_objmgr_psoc *psoc,
					   struct scan_cache_entry *scan_entry)
{
	return true;
}
#endif

QDF_STATUS __scm_handle_bcn_probe(struct scan_bcn_probe_event *bcn)
{
	struct wlan_objmgr_psoc *psoc;
@@ -1071,6 +1105,15 @@ QDF_STATUS __scm_handle_bcn_probe(struct scan_bcn_probe_event *bcn)
		if (scan_obj->cb.update_beacon)
			scan_obj->cb.update_beacon(pdev, scan_entry);

		if (!scm_is_bss_allowed_for_country(psoc, scan_entry)) {
			scm_info("Drop frame from "QDF_MAC_ADDR_FMT
				 ": AP in VLP mode not supported for US",
				 QDF_MAC_ADDR_REF(scan_entry->bssid.bytes));
			util_scan_free_cache_entry(scan_entry);
			qdf_mem_free(scan_node);
			continue;
		}

		status = scm_add_update_entry(psoc, pdev, scan_entry);
		if (QDF_IS_STATUS_ERROR(status)) {
			scm_debug("failed to add entry for BSSID: "QDF_MAC_ADDR_FMT" Seq Num: %d",