Browse Source

qcacmn: Allow scan/connection if RF test mode/Safe mode enabled

Currently if AP and STA have different ctry codes, STA should
operate in VLP mode. And if STA ctry code is US, then scan and
connection are not allowed as US VLP is not supported yet.
However, if RF test mode or Wi-Fi Safe Mode is enabled, allow
scan and connection on this AP and STA can operate in LPI mode.

Change-Id: I513657b8e274ef07eb9e9b5fc265722cb01525de
CRs-Fixed: 3079537
Gururaj Pandurangi 3 years ago
parent
commit
fb6af4edcd

+ 12 - 2
umac/regulatory/core/src/reg_utils.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 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
@@ -36,6 +37,7 @@
 #include <qdf_platform.h>
 #include "reg_services_common.h"
 #include "reg_build_chan_list.h"
+#include "wlan_cm_bss_score_param.h"
 
 #define DEFAULT_WORLD_REGDMN 0x60
 
@@ -325,7 +327,8 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
 
 #ifdef CONFIG_REG_CLIENT
 QDF_STATUS
-reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry,
+reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
+			       uint8_t *ap_ctry, uint8_t *sta_ctry,
 			       enum reg_6g_ap_type *pwr_type_6g,
 			       bool *ctry_code_match)
 {
@@ -336,7 +339,14 @@ reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry,
 			  ap_ctry[1], sta_ctry[0], sta_ctry[1]);
 		*ctry_code_match = false;
 
-		if (wlan_reg_is_us(sta_ctry)) {
+		/**
+		 * Do not return if Wi-Fi safe mode or RF test mode is
+		 * enabled, rather STA should operate in LPI mode.
+		 * wlan_cm_get_check_6ghz_security API returns true if
+		 * neither Safe mode nor RF test mode are enabled.
+		 */
+		if (wlan_reg_is_us(sta_ctry) &&
+		    wlan_cm_get_check_6ghz_security(psoc)) {
 			reg_err("US VLP not in place yet, connection not allowed");
 			return QDF_STATUS_E_NOSUPPORT;
 		}

+ 3 - 1
umac/regulatory/core/src/reg_utils.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -254,7 +255,8 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
  * Return: QDF_STATUS
  */
 QDF_STATUS
-reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry,
+reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
+			       uint8_t *ap_ctry, uint8_t *sta_ctry,
 			       enum reg_6g_ap_type *pwr_type_6g,
 			       bool *ctry_code_match);
 #endif

+ 3 - 1
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 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
@@ -461,7 +462,8 @@ QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc,
  * Return: QDF_STATUS
  */
 QDF_STATUS
-wlan_reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry,
+wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
+				    uint8_t *ap_ctry, uint8_t *sta_ctry,
 				    enum reg_6g_ap_type *pwr_type_6g,
 				    bool *ctry_code_match);
 #endif

+ 5 - 3
umac/regulatory/dispatcher/src/wlan_reg_services_api.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -86,12 +87,13 @@ QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(uint16_t regdmn,
 
 #ifdef CONFIG_REG_CLIENT
 QDF_STATUS
-wlan_reg_get_6g_power_type_for_ctry(uint8_t *ap_ctry, uint8_t *sta_ctry,
+wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
+				    uint8_t *ap_ctry, uint8_t *sta_ctry,
 				    enum reg_6g_ap_type *pwr_type_6g,
 				    bool *ctry_code_match)
 {
-	return reg_get_6g_power_type_for_ctry(ap_ctry, sta_ctry, pwr_type_6g,
-					      ctry_code_match);
+	return reg_get_6g_power_type_for_ctry(psoc, ap_ctry, sta_ctry,
+					      pwr_type_6g, ctry_code_match);
 }
 #endif
 

+ 8 - 1
umac/scan/core/src/wlan_scan_cache_db.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 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
@@ -1118,7 +1119,13 @@ 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)) {
+		/**
+		 * Do not drop the frame if Wi-Fi safe mode or RF test mode is
+		 * enabled. wlan_cm_get_check_6ghz_security API returns true if
+		 * neither Safe mode nor RF test mode are enabled.
+		 */
+		if (!scm_is_bss_allowed_for_country(psoc, scan_entry) &&
+		    wlan_cm_get_check_6ghz_security(psoc)) {
 			scm_info_rl(
 				"Drop frame from "QDF_MAC_ADDR_FMT
 				": AP in VLP mode not supported for US",