Răsfoiți Sursa

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
Pragaspathi Thilagaraj 2 ani în urmă
părinte
comite
142cab9c7e

+ 4 - 8
components/cmn_services/interface_mgr/src/wlan_if_mgr_roam.c

@@ -771,14 +771,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));

+ 11 - 0
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -4381,4 +4381,15 @@ uint32_t
 policy_mgr_get_connected_roaming_vdev_band_mask(struct wlan_objmgr_psoc *psoc,
 						uint8_t vdev_id);
 
+/**
+ * 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
components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c

@@ -39,6 +39,7 @@
 #endif
 #include "wlan_cm_ucfg_api.h"
 #include "wlan_cm_roam_api.h"
+#include "wlan_scan_api.h"
 
 /**
  * first_connection_pcl_table - table which provides PCL for the
@@ -3381,3 +3382,34 @@ bool policy_mgr_is_3rd_conn_on_same_band_allowed(struct wlan_objmgr_psoc *psoc,
 	}
 	return ret;
 }
+
+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 - 1
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_tgt_if_tx_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-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
@@ -63,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
@@ -89,6 +91,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");
@@ -137,6 +146,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)) {

+ 11 - 0
core/wma/src/wma_main.c

@@ -9180,6 +9180,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_validate_handle(wma_handle))
 		return QDF_STATUS_E_NULL_VALUE;
@@ -9216,6 +9217,16 @@ QDF_STATUS wma_send_set_pcl_cmd(tp_wma_handle wma_handle,
 			wma_map_pcl_weights(
 				msg->chan_weights.weighed_valid_list[i]);
 
+		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;
+			continue;
+		}
+
 		if (msg->band_mask ==
 		      (BIT(REG_BAND_2G) | BIT(REG_BAND_5G) | BIT(REG_BAND_6G)))
 			continue;