diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c index 70c5937b29..08d33b2931 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c @@ -37,6 +37,7 @@ #include "wlan_reg_ucfg_api.h" #define POLICY_MGR_MAX_CON_STRING_LEN 100 +#define LOWER_END_FREQ_5GHZ 4900 static const uint16_t sap_mand_5g_freq_list[] = {5745, 5765, 5785, 5805}; @@ -859,10 +860,12 @@ void policy_mgr_restore_deleted_conn_info(struct wlan_objmgr_psoc *psoc, static bool policy_mgr_is_freq_range_5_6ghz(qdf_freq_t start_freq, qdf_freq_t end_freq) { - if ((wlan_reg_is_5ghz_ch_freq(start_freq) || - wlan_reg_is_6ghz_chan_freq(start_freq)) && - (wlan_reg_is_5ghz_ch_freq(end_freq) || - wlan_reg_is_6ghz_chan_freq(end_freq))) + /* + * As Fw is sending the whole hardware range which include 4.9Ghz as + * well. Use LOWER_END_FREQ_5GHZ to differentiate 2.4Ghz and 5Ghz + */ + if (start_freq >= LOWER_END_FREQ_5GHZ && + end_freq >= LOWER_END_FREQ_5GHZ) return true; return false; @@ -871,8 +874,11 @@ policy_mgr_is_freq_range_5_6ghz(qdf_freq_t start_freq, qdf_freq_t end_freq) static bool policy_mgr_is_freq_range_2ghz(qdf_freq_t start_freq, qdf_freq_t end_freq) { - if (wlan_reg_is_24ghz_ch_freq(start_freq) && - wlan_reg_is_24ghz_ch_freq(end_freq)) + /* + * As Fw is sending the whole hardware range which include 4.9Ghz as + * well. Use LOWER_END_FREQ_5GHZ to differentiate 2.4Ghz and 5Ghz + */ + if (start_freq < LOWER_END_FREQ_5GHZ && end_freq < LOWER_END_FREQ_5GHZ) return true; return false; @@ -884,9 +890,11 @@ policy_mgr_fill_curr_mac_2ghz_freq(uint32_t mac_id, struct policy_mgr_psoc_priv_obj *pm_ctx) { pm_ctx->hw_mode.cur_mac_freq_range[mac_id].low_2ghz_freq = - freq->start_freq; + QDF_MAX(freq->start_freq, + wlan_reg_min_24ghz_chan_freq()); pm_ctx->hw_mode.cur_mac_freq_range[mac_id].high_2ghz_freq = - freq->end_freq; + QDF_MIN(freq->end_freq, + wlan_reg_max_24ghz_chan_freq()); } static void @@ -894,10 +902,17 @@ policy_mgr_fill_curr_mac_5ghz_freq(uint32_t mac_id, struct policy_mgr_pdev_mac_freq_map *freq, struct policy_mgr_psoc_priv_obj *pm_ctx) { + qdf_freq_t max_5g_freq; + + max_5g_freq = wlan_reg_max_6ghz_chan_freq() ? + wlan_reg_max_6ghz_chan_freq() : + wlan_reg_max_5ghz_chan_freq(); + pm_ctx->hw_mode.cur_mac_freq_range[mac_id].low_5ghz_freq = - freq->start_freq; + QDF_MAX(freq->start_freq, + wlan_reg_min_5ghz_chan_freq()); pm_ctx->hw_mode.cur_mac_freq_range[mac_id].high_5ghz_freq = - freq->end_freq; + QDF_MIN(freq->end_freq, max_5g_freq); } void @@ -928,7 +943,7 @@ policy_mgr_fill_legacy_freq_range(struct policy_mgr_psoc_priv_obj *pm_ctx, policy_mgr_fill_curr_mac_freq_by_hwmode(pm_ctx, mode); } -static void +static QDF_STATUS policy_mgr_fill_curr_freq_by_pdev_freq(int32_t num_mac_freq, struct policy_mgr_pdev_mac_freq_map *freq, struct policy_mgr_psoc_priv_obj *pm_ctx, @@ -944,25 +959,31 @@ policy_mgr_fill_curr_freq_by_pdev_freq(int32_t num_mac_freq, if (mac_id >= MAX_MAC) { policy_mgr_debug("Invalid pdev id %d", mac_id); - return; + return QDF_STATUS_E_INVAL; } - policy_mgr_debug("pdev_id %d start freq %d end_freq %d", + policy_mgr_debug("mac_id %d start freq %d end_freq %d", mac_id, freq[i].start_freq, freq[i].end_freq); if (policy_mgr_is_freq_range_2ghz(freq[i].start_freq, - freq[i].end_freq)) + freq[i].end_freq)) { policy_mgr_fill_curr_mac_2ghz_freq(mac_id, &freq[i], pm_ctx); - else if (policy_mgr_is_freq_range_5_6ghz(freq[i].start_freq, - freq[i].end_freq)) + } else if (policy_mgr_is_freq_range_5_6ghz(freq[i].start_freq, + freq[i].end_freq)) { policy_mgr_fill_curr_mac_5ghz_freq(mac_id, &freq[i], pm_ctx); - else - policy_mgr_fill_legacy_freq_range(pm_ctx, hw_mode); + } else { + policy_mgr_err("Invalid different band freq range: mac_id %d start freq %d end_freq %d", + mac_id, freq[i].start_freq, + freq[i].end_freq); + return QDF_STATUS_E_INVAL; + } } + + return QDF_STATUS_SUCCESS; } static void @@ -971,10 +992,14 @@ policy_mgr_update_curr_mac_freq(uint32_t num_mac_freq, struct policy_mgr_psoc_priv_obj *pm_ctx, struct policy_mgr_hw_mode_params hw_mode) { + QDF_STATUS status; + if (num_mac_freq && freq) { - policy_mgr_fill_curr_freq_by_pdev_freq(num_mac_freq, freq, - pm_ctx, hw_mode); - return; + status = policy_mgr_fill_curr_freq_by_pdev_freq(num_mac_freq, + freq, pm_ctx, + hw_mode); + if (QDF_IS_STATUS_SUCCESS(status)) + return; } policy_mgr_fill_legacy_freq_range(pm_ctx, hw_mode); diff --git a/core/hdd/src/wlan_hdd_sysfs_policy_mgr.c b/core/hdd/src/wlan_hdd_sysfs_policy_mgr.c index 5783d16e2d..27a47ca562 100644 --- a/core/hdd/src/wlan_hdd_sysfs_policy_mgr.c +++ b/core/hdd/src/wlan_hdd_sysfs_policy_mgr.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2011-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 above @@ -49,8 +50,9 @@ static ssize_t hdd_pm_cinfo_show(struct hdd_context *hdd_ctx) conn_info++; } - pr_info("|\t|current state dbs - %-10d|\n", - policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc)); + pr_info("|\t|current state dbs - %-10d, sbs - %-10d|\n", + policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc), + policy_mgr_is_current_hwmode_sbs(hdd_ctx->psoc)); hdd_exit(); return 0; diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index e8ada7558a..07405c9893 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -7180,8 +7180,9 @@ static int __iw_set_var_ints_getnone(struct net_device *dev, conn_info++; } - pr_info("|\t|current state dbs - %-10d|\n", - policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc)); + pr_info("|\t|current state dbs - %-10d, sbs - %-10d|\n", + policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc), + policy_mgr_is_current_hwmode_sbs(hdd_ctx->psoc)); } break; diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index f22f2018f4..7d2724e4ce 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/core/sap/src/sap_api_link_cntl.c @@ -573,10 +573,10 @@ wlansap_roam_process_dfs_chansw_update(mac_handle_t mac_handle, * Fetch the number of SAP interfaces. If the number of sap Interface * more than one then we will make is_sap_ready_for_chnl_chng to true * for that sapctx. If there is only one SAP interface then process - * immediately. If Dual BAND SAP is enabled then also process - * immediately, as in this case the both SAP will be in different band - * and channel change on one SAP doesn't mean channel change on - * other interface. + * immediately. If Dual BAND SAP OR SBS in different mac, is enabled + * then also process immediately, as in this case the both SAP will be + * in different band and channel change on one SAP doesn't mean channel + * change on other interface. * * For example, * Let's say SAP(2G) + SAP(5G-DFS) is initial connection which triggered @@ -594,6 +594,7 @@ wlansap_roam_process_dfs_chansw_update(mac_handle_t mac_handle, sap_scc_dfs = sap_is_conc_sap_doing_scc_dfs(mac_handle, sap_ctx); if (sap_get_total_number_sap_intf(mac_handle) <= 1 || policy_mgr_is_current_hwmode_dbs(mac_ctx->psoc) || + policy_mgr_is_current_hwmode_sbs(mac_ctx->psoc) || sap_ctx->csa_reason == CSA_REASON_DCS || !sap_scc_dfs) { /*