diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index 667d967cf4..c16d07369e 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -354,6 +354,28 @@ static void mlme_init_wds_config_cfg(struct wlan_objmgr_psoc *psoc, } #endif +#ifdef CONFIG_BAND_6GHZ +/** + * mlme_init_relaxed_6ghz_conn_policy() - initialize relaxed 6GHz + * policy connection flag + * @psoc: Pointer to PSOC + * @gen: pointer to generic CFG items + * + * Return: None + */ +static void mlme_init_relaxed_6ghz_conn_policy(struct wlan_objmgr_psoc *psoc, + struct wlan_mlme_generic *gen) +{ + gen->relaxed_6ghz_conn_policy = + cfg_default(CFG_RELAXED_6GHZ_CONN_POLICY); +} +#else +static void mlme_init_relaxed_6ghz_conn_policy(struct wlan_objmgr_psoc *psoc, + struct wlan_mlme_generic *gen) +{ +} +#endif + /** * mlme_init_mgmt_hw_tx_retry_count_cfg() - initialize mgmt hw tx retry count * @psoc: Pointer to PSOC @@ -461,6 +483,7 @@ static void mlme_init_generic_cfg(struct wlan_objmgr_psoc *psoc, gen->tx_retry_multiplier = cfg_get(psoc, CFG_TX_RETRY_MULTIPLIER); mlme_init_wds_config_cfg(psoc, gen); mlme_init_mgmt_hw_tx_retry_count_cfg(psoc, gen); + mlme_init_relaxed_6ghz_conn_policy(psoc, gen); } static void mlme_init_edca_ani_cfg(struct wlan_objmgr_psoc *psoc, diff --git a/components/mlme/dispatcher/inc/cfg_mlme_generic.h b/components/mlme/dispatcher/inc/cfg_mlme_generic.h index 8d7725ec2b..b131b16c4f 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_generic.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_generic.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-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 @@ -178,6 +178,30 @@ enum wlan_wds_mode { 1, \ "rf test mode Enable Flag") +#ifdef CONFIG_BAND_6GHZ +/** + * relaxed_6ghz_conn_policy - Enable 6ghz relaxed connection policy + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This cfg is used to set 6Ghz relaxed connection policies where STA + * will be allowed to operate in VLP mode and scan/connect to 6 GHz BSS + * with unmatching country code. + * + * Related: None + * + * Supported Feature: STA + */ +#define CFG_RELAXED_6GHZ_CONN_POLICY CFG_BOOL( \ + "relaxed_6ghz_conn_policy", \ + 0, \ + "6ghz relaxed connection policy") +#define CFG_RELAX_6GHZ_CONN_POLICY CFG(CFG_RELAXED_6GHZ_CONN_POLICY) +#else +#define CFG_RELAX_6GHZ_CONN_POLICY +#endif + /* * * BandCapability - Preferred band (0: 2.4G, 5G, and 6G, @@ -971,5 +995,6 @@ enum wlan_wds_mode { CFG(CFG_RF_TEST_MODE_SUPP_ENABLED) \ CFG_WDS_MODE_ALL \ CFG(CFG_TX_RETRY_MULTIPLIER) \ - CFG(CFG_MGMT_FRAME_HW_TX_RETRY_COUNT) + CFG(CFG_MGMT_FRAME_HW_TX_RETRY_COUNT) \ + CFG_RELAX_6GHZ_CONN_POLICY #endif /* __CFG_MLME_GENERIC_H */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index 4ac879d6ad..89b9061a3c 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -2238,6 +2238,28 @@ wlan_mlme_is_rf_test_mode_enabled(struct wlan_objmgr_psoc *psoc, bool *value); QDF_STATUS wlan_mlme_set_rf_test_mode_enabled(struct wlan_objmgr_psoc *psoc, bool value); +#ifdef CONFIG_BAND_6GHZ +/** + * wlan_mlme_is_relaxed_6ghz_conn_policy_enabled() - Get the 6ghz relaxed + * connection policy flag + * @psoc: psoc context + * @value: Enable/Disable value ptr. + * + * Return: QDF_STATUS + */ +QDF_STATUS +wlan_mlme_is_relaxed_6ghz_conn_policy_enabled(struct wlan_objmgr_psoc *psoc, + bool *value); +#else +static inline QDF_STATUS +wlan_mlme_is_relaxed_6ghz_conn_policy_enabled(struct wlan_objmgr_psoc *psoc, + bool *value) +{ + *value = false; + return QDF_STATUS_SUCCESS; +} +#endif + /** * wlan_mlme_get_sta_miracast_mcc_rest_time() - Get STA/MIRACAST MCC rest time * diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index a6122c4ae3..2705061f77 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -1340,6 +1340,7 @@ enum mlme_cfg_frame_type { * @dual_sta_policy_cfg: Dual STA policies configuration * @tx_retry_multiplier: TX xretry extension parameter * @mgmt_hw_tx_retry_count: MGMT HW tx retry count for frames + * @relaxed_6ghz_conn_policy: 6GHz relaxed connection policy */ struct wlan_mlme_generic { uint32_t band_capability; @@ -1387,6 +1388,9 @@ struct wlan_mlme_generic { struct dual_sta_policy dual_sta_policy; uint32_t tx_retry_multiplier; uint8_t mgmt_hw_tx_retry_count[CFG_FRAME_TYPE_MAX]; +#ifdef CONFIG_BAND_6GHZ + bool relaxed_6ghz_conn_policy; +#endif }; /* diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index 2025a76f5a..a3a5aff218 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h @@ -2760,6 +2760,23 @@ ucfg_mlme_set_rf_test_mode_enabled(struct wlan_objmgr_psoc *psoc, bool value) return wlan_mlme_set_rf_test_mode_enabled(psoc, value); } +/** + * ucfg_mlme_is_relaxed_6ghz_conn_policy_enabled() - Get 6ghz relaxed + * connection policy flag + * @psoc: pointer to psoc object + * @value: Value that needs to be set from the caller + * + * Inline UCFG API to be used by HDD/OSIF callers + * + * Return: QDF Status + */ +static inline QDF_STATUS +ucfg_mlme_is_relaxed_6ghz_conn_policy_enabled(struct wlan_objmgr_psoc *psoc, + bool *value) +{ + return wlan_mlme_is_relaxed_6ghz_conn_policy_enabled(psoc, value); +} + /** * ucfg_mlme_get_opr_rate() - Get operational rate set * @psoc: pointer to vdev object diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index 05b743aae8..df9b2cabb7 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -3032,6 +3032,23 @@ wlan_mlme_set_rf_test_mode_enabled(struct wlan_objmgr_psoc *psoc, bool value) return QDF_STATUS_SUCCESS; } +#ifdef CONFIG_BAND_6GHZ +QDF_STATUS +wlan_mlme_is_relaxed_6ghz_conn_policy_enabled(struct wlan_objmgr_psoc *psoc, + bool *value) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) + return QDF_STATUS_E_FAILURE; + + *value = mlme_obj->cfg.gen.relaxed_6ghz_conn_policy; + + return QDF_STATUS_SUCCESS; +} +#endif + QDF_STATUS wlan_mlme_cfg_set_vht_chan_width(struct wlan_objmgr_psoc *psoc, uint8_t value) { diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index e84dfd9678..0c15863672 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -14710,6 +14710,7 @@ static int hdd_features_init(struct hdd_context *hdd_ctx) mac_handle_t mac_handle; bool b_cts2self, is_imps_enabled; bool rf_test_mode; + bool conn_policy; hdd_enter(); @@ -14803,6 +14804,16 @@ static int hdd_features_init(struct hdd_context *hdd_ctx) wlan_cm_set_6ghz_key_mgmt_mask(hdd_ctx->psoc, ALLOWED_KEYMGMT_6G_MASK); } + + status = ucfg_mlme_is_relaxed_6ghz_conn_policy_enabled(hdd_ctx->psoc, + &conn_policy); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("Get 6ghz relaxed connection policy failed"); + return QDF_STATUS_E_FAILURE; + } + if (conn_policy) + wlan_cm_set_relaxed_6ghz_conn_policy(hdd_ctx->psoc, true); + hdd_thermal_stats_cmd_init(hdd_ctx); sme_set_cal_failure_event_cb(hdd_ctx->mac_handle, hdd_cal_fail_send_event);