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

Commit 74afb00f authored by Pragaspathi Thilagaraj's avatar Pragaspathi Thilagaraj Committed by Madan Koyyalamudi
Browse files

qcacld-3.0: Check for allowed frequency during set pcl

Sta is not allowed to connect/roam in 6 GHz frequency or indoor
frequency in non-DBS target if SAP is active.
But STA roams to 6 GHz AP when SAP is active since the PCL allows
6 GHz frequency.

While populating PCL to firmware, check if 6 GHz and indoor
frequencies are allowed for non-dbs target and set the
weight appropriately if the channels are not allowed

Change-Id: I0e5fdc5b3c4177283d91cdfc58359336cc11910d
CRs-Fixed: 3205494
parent 419a07c0
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -750,14 +750,10 @@ QDF_STATUS if_mgr_validate_candidate(struct wlan_objmgr_vdev *vdev,
	 * Do not allow STA to connect on 6Ghz or indoor channel for non dbs
	 * hardware if SAP and skip_6g_and_indoor_freq_scan ini are present
	 */
	if (wlan_scan_cfg_skip_6g_and_indoor_freq(psoc) &&
	    !policy_mgr_is_hw_dbs_capable(psoc) &&
	    (WLAN_REG_IS_6GHZ_CHAN_FREQ(chan_freq) ||
	    wlan_reg_is_freq_indoor(pdev, chan_freq)) &&
	    op_mode == QDF_STA_MODE &&
	    policy_mgr_mode_specific_connection_count(
				psoc, PM_SAP_MODE, NULL)) {
		ifmgr_debug("STA connection not allowed on bssid: "QDF_MAC_ADDR_FMT" with freq: %d (6Ghz or indoor(%d)), as SAP is present",
	if (op_mode == QDF_STA_MODE &&
	    !policy_mgr_is_sta_chan_valid_for_connect_and_roam(pdev,
							       chan_freq)) {
		ifmgr_debug("STA connection not allowed on bssid: "QDF_MAC_ADDR_FMT" with freq: %d (6Ghz or indoor(%d)), as not valid for connection",
			    QDF_MAC_ADDR_REF(candidate_info->peer_addr.bytes),
			    chan_freq,
			    wlan_reg_is_freq_indoor(pdev, chan_freq));
+12 −0
Original line number Diff line number Diff line
@@ -3730,4 +3730,16 @@ bool policy_mgr_is_sta_mon_concurrency(struct wlan_objmgr_psoc *psoc);
 *
 */
QDF_STATUS policy_mgr_check_mon_concurrency(struct wlan_objmgr_psoc *psoc);

/**
 * policy_mgr_is_sta_chan_valid_for_connect_and_roam  - Check if given
 * channel is valid for STA connection/roam pcl channels
 * @pdev: pdev
 * @freq: frequency
 *
 * Return: true if channel is valid else false
 */
bool policy_mgr_is_sta_chan_valid_for_connect_and_roam(
				struct wlan_objmgr_pdev *pdev,
				qdf_freq_t freq);
#endif /* __WLAN_POLICY_MGR_API_H */
+32 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include "wlan_utility.h"
#include "wlan_mlme_ucfg_api.h"
#include "csr_neighbor_roam.h"
#include "wlan_scan_api.h"

/**
 * first_connection_pcl_table - table which provides PCL for the
@@ -2755,3 +2756,34 @@ QDF_STATUS policy_mgr_filter_passive_ch(struct wlan_objmgr_pdev *pdev,

	return QDF_STATUS_SUCCESS;
}

bool policy_mgr_is_sta_chan_valid_for_connect_and_roam(
					struct wlan_objmgr_pdev *pdev,
					qdf_freq_t freq)
{
	struct wlan_objmgr_psoc *psoc;
	uint32_t sap_count;
	bool skip_6g_and_indoor_freq;

	psoc = wlan_pdev_get_psoc(pdev);
	if (!psoc)
		return true;

	skip_6g_and_indoor_freq =
		wlan_scan_cfg_skip_6g_and_indoor_freq(psoc);
	sap_count =
		policy_mgr_mode_specific_connection_count(psoc, PM_SAP_MODE,
							  NULL);
	/*
	 * Do not allow STA to connect/roam on 6Ghz or indoor channel for
	 * non-dbs hardware if SAP is present and skip_6g_and_indoor_freq_scan
	 * ini is enabled
	 */
	if (skip_6g_and_indoor_freq && sap_count &&
	    !policy_mgr_is_hw_dbs_capable(psoc) &&
	    (WLAN_REG_IS_6GHZ_CHAN_FREQ(freq) ||
	     wlan_reg_is_freq_indoor(pdev, freq)))
		return false;

	return true;
}
+17 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2020, 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 above
@@ -62,9 +63,11 @@ wlan_cm_roam_send_set_vdev_pcl(struct wlan_objmgr_psoc *psoc,
	struct fw_scan_channels *freq_list;
	struct wlan_objmgr_vdev *vdev;
	struct wmi_pcl_chan_weights *weights;
	struct wlan_objmgr_pdev *pdev;
	QDF_STATUS status = QDF_STATUS_E_FAILURE;
	uint32_t band_capability;
	uint16_t i;
	bool is_channel_allowed;

	/*
	 * If vdev_id is WLAN_UMAC_VDEV_ID_MAX, then PDEV pcl command
@@ -85,6 +88,13 @@ wlan_cm_roam_send_set_vdev_pcl(struct wlan_objmgr_psoc *psoc,
		return status;
	}

	pdev = wlan_vdev_get_pdev(vdev);
	if (!pdev) {
		mlme_err("pdev object is NULL");
		status = QDF_STATUS_E_FAILURE;
		return status;
	}

	roam_tx_ops = wlan_cm_roam_get_tx_ops_from_vdev(vdev);
	if (!roam_tx_ops || !roam_tx_ops->send_vdev_set_pcl_cmd) {
		mlme_err("send_vdev_set_pcl_cmd is NULL");
@@ -133,6 +143,13 @@ wlan_cm_roam_send_set_vdev_pcl(struct wlan_objmgr_psoc *psoc,
		    !WLAN_REG_IS_24GHZ_CH_FREQ(weights->saved_chan_list[i]))
			weights->weighed_valid_list[i] =
				WEIGHT_OF_DISALLOWED_CHANNELS;

		is_channel_allowed =
			policy_mgr_is_sta_chan_valid_for_connect_and_roam(
					pdev, weights->saved_chan_list[i]);
		if (!is_channel_allowed)
			weights->weighed_valid_list[i] =
					WEIGHT_OF_DISALLOWED_CHANNELS;
	}

	if (QDF_IS_STATUS_ERROR(status)) {
+9 −0
Original line number Diff line number Diff line
@@ -9301,6 +9301,7 @@ QDF_STATUS wma_send_set_pcl_cmd(tp_wma_handle wma_handle,
{
	uint32_t i;
	QDF_STATUS status;
	bool is_channel_allowed;

	if (!wma_handle) {
		wma_err("WMA handle is NULL. Cannot issue command");
@@ -9343,6 +9344,14 @@ QDF_STATUS wma_send_set_pcl_cmd(tp_wma_handle wma_handle,
		    msg->chan_weights.saved_chan_list[i]))
			msg->chan_weights.weighed_valid_list[i] =
				WEIGHT_OF_DISALLOWED_CHANNELS;

		is_channel_allowed =
			policy_mgr_is_sta_chan_valid_for_connect_and_roam(
					wma_handle->pdev,
					msg->chan_weights.saved_chan_list[i]);
		if (!is_channel_allowed)
			msg->chan_weights.weighed_valid_list[i] =
						WEIGHT_OF_DISALLOWED_CHANNELS;
	}

	if (!QDF_IS_STATUS_SUCCESS(status)) {