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

Commit ee7e4cf0 authored by Jyoti Kumari's avatar Jyoti Kumari
Browse files

qcacmn: Skip STA scan on 6Ghz and 5ghz indoor chan if SAP is up

Currently STA can scan and come up on 6Ghz or 5Ghz indoor channel
if hardware is non-dbs and SAP is present

As part of this change, do not allow STA to scan on 6Ghz and
5Ghz indoor channel for non-dbs hardware if SAP is present

Change-Id: I97759f8b2c6a1c460d90fbb797a0e64d2532797c
CRs-Fixed: 3186406
parent e1faf406
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -341,6 +342,8 @@ struct extscan_def_config {
 * @adaptive_dwell_time_mode_nc: adaptive dwell mode without connection
 * @honour_nl_scan_policy_flags: honour nl80211 scan policy flags
 * @extscan_adaptive_dwell_mode: Adaptive dwell mode during ext scan
 * @skip_6g_and_indoor_freq: skip 6Ghz and 5Gh indoor freq channel for
 * STA scan if hw is non-DBS and SAP is present
 * @scan_f_passive: passively scan all channels including active channels
 * @scan_f_bcast_probe: add wild card ssid prbreq even if ssid_list is specified
 * @scan_f_cck_rates: add cck rates to rates/xrates ie in prb req
@@ -432,6 +435,7 @@ struct scan_default_params {
	enum scan_dwelltime_adaptive_mode adaptive_dwell_time_mode_nc;
	bool honour_nl_scan_policy_flags;
	enum scan_dwelltime_adaptive_mode extscan_adaptive_dwell_mode;
	bool skip_6g_and_indoor_freq;
	union {
		struct {
			uint32_t scan_f_passive:1,
+82 −17
Original line number Diff line number Diff line
@@ -803,6 +803,65 @@ static void scm_req_update_concurrency_params(struct wlan_objmgr_vdev *vdev,
	}
}

/**
 *scm_update_5g_chlist() - Modify channel list to skip 5Ghz channel
 * @req: scan request
 *
 * Return: None
 */
static inline void scm_update_5g_chlist(struct scan_start_request *req)
{
	uint32_t i;
	uint32_t num_scan_channels = 0;
	qdf_freq_t freq;

	for (i = 0; i < req->scan_req.chan_list.num_chan; i++) {
		freq = req->scan_req.chan_list.chan[i].freq;
		if (WLAN_REG_IS_5GHZ_CH_FREQ(freq))
			continue;

		req->scan_req.chan_list.chan[num_scan_channels++] =
				req->scan_req.chan_list.chan[i];
	}
	if (num_scan_channels < req->scan_req.chan_list.num_chan)
		scm_debug("5g chan skipped (%d, %d)",
			  req->scan_req.chan_list.num_chan, num_scan_channels);
	req->scan_req.chan_list.num_chan = num_scan_channels;
}

/**
 * scm_filter_6g_and_indoor_freq() - Modify channel list to skip 6Ghz and 5Ghz
 * indoor channel if hw mode is non dbs and SAP is present
 * @pdev: pointer to pdev
 * @req: scan request
 *
 * Return: None
 */
static void scm_filter_6g_and_indoor_freq(struct wlan_objmgr_pdev *pdev,
					  struct scan_start_request *req)
{
	uint32_t i;
	uint32_t num_scan_channels;
	qdf_freq_t freq;

	num_scan_channels = 0;
	for (i = 0; i < req->scan_req.chan_list.num_chan; i++) {
		freq = req->scan_req.chan_list.chan[i].freq;
		if (WLAN_REG_IS_6GHZ_CHAN_FREQ(freq))
			continue;

		if (wlan_reg_is_freq_indoor(pdev, freq))
			continue;

		req->scan_req.chan_list.chan[num_scan_channels++] =
				req->scan_req.chan_list.chan[i];
	}
	if (num_scan_channels < req->scan_req.chan_list.num_chan)
		scm_debug("6g and indoor channel chan skipped (%d, %d)",
			  req->scan_req.chan_list.num_chan, num_scan_channels);
	req->scan_req.chan_list.num_chan = num_scan_channels;
}

/**
 * scm_scan_chlist_concurrency_modify() - modify chan list to skip 5G if
 *    required
@@ -817,31 +876,37 @@ static inline void scm_scan_chlist_concurrency_modify(
	struct wlan_objmgr_vdev *vdev, struct scan_start_request *req)
{
	struct wlan_objmgr_psoc *psoc;
	uint32_t i;
	uint32_t num_scan_channels;
	struct wlan_objmgr_pdev *pdev;
	struct wlan_scan_obj *scan_obj;

	pdev = wlan_vdev_get_pdev(vdev);
	if (!pdev)
		return;

	psoc = wlan_vdev_get_psoc(vdev);
	if (!psoc)
		return;

	scan_obj = wlan_psoc_get_scan_obj(psoc);
	if (!scan_obj)
		return;

	/* do this only for STA and P2P-CLI mode */
	if (!(wlan_vdev_mlme_get_opmode(req->vdev) == QDF_STA_MODE) &&
	    !(wlan_vdev_mlme_get_opmode(req->vdev) == QDF_P2P_CLIENT_MODE))
		return;
	if (!policy_mgr_scan_trim_5g_chnls_for_dfs_ap(psoc))
		return;
	num_scan_channels = 0;
	for (i = 0; i < req->scan_req.chan_list.num_chan; i++) {
		if (WLAN_REG_IS_5GHZ_CH_FREQ(
			req->scan_req.chan_list.chan[i].freq)) {
			continue;
		}
		req->scan_req.chan_list.chan[num_scan_channels++] =
			req->scan_req.chan_list.chan[i];
	}
	if (num_scan_channels < req->scan_req.chan_list.num_chan)
		scm_debug("5g chan skipped (%d, %d)",
			  req->scan_req.chan_list.num_chan, num_scan_channels);
	req->scan_req.chan_list.num_chan = num_scan_channels;
	if (policy_mgr_scan_trim_5g_chnls_for_dfs_ap(psoc))
		scm_update_5g_chlist(req);

	/*
	 * Do not allow STA to scan on 6Ghz or indoor channel for non dbs
	 * hardware if SAP and skip_6g_and_indoor_freq_scan ini are present
	 */
	if (scan_obj->scan_def.skip_6g_and_indoor_freq &&
	    !policy_mgr_is_hw_dbs_capable(psoc) &&
	    (wlan_vdev_mlme_get_opmode(vdev) == QDF_STA_MODE) &&
	    policy_mgr_mode_specific_connection_count(psoc, PM_SAP_MODE, NULL))
		scm_filter_6g_and_indoor_freq(pdev, req);
}
#else
static inline
+9 −0
Original line number Diff line number Diff line
@@ -335,4 +335,13 @@ QDF_STATUS wlan_scan_start(struct scan_start_request *req);
 */
QDF_STATUS wlan_scan_cancel(struct scan_cancel_request *req);

/**
 * wlan_scan_cfg_skip_6g_and_indoor_freq() - API to get 6g and indoor freq
 * scan ini val
 * @psoc: psoc object
 *
 * Return: skip 6g and indoor freq scan or not
 */
bool wlan_scan_cfg_skip_6g_and_indoor_freq(
			struct wlan_objmgr_psoc *psoc);
#endif
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -1412,6 +1413,26 @@ enum scan_mode_6ghz {
			false, \
			"scan allow bss with corrupted ie")

/*
 * <ini>
 * skip_6g_and_indoor_freq_scan - Skip scan on 6Ghz and indoor channel
 * @Min: 0
 * @Max: 1
 * @Default: 0
 *
 * This ini is used to skip 6Ghz and 5Gh indoor freq for STA scan if hw is
 * non-DBS and SAP is present
 *
 * Related: scan
 *
 * Usage: External
 *
 * <ini>
 */
#define CFG_SKIP_6GHZ_AND_INDOOR_FREQ_SCAN CFG_INI_BOOL( \
			"skip_6g_and_indoor_freq_scan", \
			false, \
			"skip sta scan on 6Ghz and 5Ghz indoor channel")
#define CFG_SCAN_ALL \
	CFG(CFG_DROP_BCN_ON_CHANNEL_MISMATCH) \
	CFG(CFG_DROP_BCN_ON_INVALID_FREQ) \
@@ -1449,6 +1470,7 @@ enum scan_mode_6ghz {
	CFG(CFG_6GHZ_SCAN_MODE) \
	CFG(CFG_6GHZ_SCAN_MODE_DUTY_CYCLE) \
	CFG(CFG_SCAN_ALLOW_BSS_WITH_CORRUPTED_IE) \
	CFG(CFG_SKIP_6GHZ_AND_INDOOR_FREQ_SCAN) \
	CFG_SCAN_PNO

#endif /* __CONFIG_SCAN_H */
+11 −0
Original line number Diff line number Diff line
@@ -430,3 +430,14 @@ QDF_STATUS wlan_scan_cancel(struct scan_cancel_request *req)

	return status;
}

bool wlan_scan_cfg_skip_6g_and_indoor_freq(struct wlan_objmgr_psoc *psoc)
{
	struct wlan_scan_obj *scan_obj;

	scan_obj = wlan_psoc_get_scan_obj(psoc);
	if (!scan_obj)
		return false;

	return scan_obj->scan_def.skip_6g_and_indoor_freq;
}
Loading