From d50f3a6b05e6ac42d1aec8a14cb66d05a8eb4e52 Mon Sep 17 00:00:00 2001 From: Shashikala Prabhu Date: Wed, 11 Jul 2018 12:30:40 +0530 Subject: [PATCH] qcacmn: Fix 4.9GHz issue for legacy devices In the scan channel list, host sends both 2.4GHz and 4.9GHz channels to FW because there are ieee channels which have same value in 2.4 GHz and 5GHz bands. Example: channel 1 is 2.412 in 2.4GHz and 4.942 in 5 GHz. When converting a channel to freq, the host uses low/high 2GHz and 5GHz frequency ranges. For a partial-offload 5GHz pdev, both low/high 2.4 GHz and 5 GHz frequencies are set and hence 4.9 GHz channel is converted to 2.4GHz frequency. To fix the above issue, based on the wireless modes remove either low/high 2.4 GHz or low/high 5 GHz frequency based on the wireless modes. Change-Id: I1fb0a56c70d1dc0ffc2731da3f25c910af46bb41 CRs-Fixed: 2239771 --- target_if/init_deinit/src/init_cmd_api.c | 7 ++++++ target_if/regulatory/inc/target_if_reg.h | 5 ++++ target_if/regulatory/src/target_if_reg.c | 32 ++++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/target_if/init_deinit/src/init_cmd_api.c b/target_if/init_deinit/src/init_cmd_api.c index 93f85be0ab6c..7228a55392ad 100644 --- a/target_if/init_deinit/src/init_cmd_api.c +++ b/target_if/init_deinit/src/init_cmd_api.c @@ -32,6 +32,7 @@ #include #include #include +#include /** * init_deinit_alloc_host_mem_chunk() - allocates chunk of memory requested @@ -462,6 +463,12 @@ void init_deinit_prepare_send_init_cmd( init_deinit_derive_band_to_mac_param(psoc, tgt_hdl, init_param.band_to_mac); + } else { + ret_val = tgt_if_regulatory_modify_freq_range(psoc); + if (QDF_IS_STATUS_ERROR(ret_val)) { + target_if_err("Modify freq range is failed"); + return; + } } ret_val = target_if_alloc_pdevs(psoc, tgt_hdl); diff --git a/target_if/regulatory/inc/target_if_reg.h b/target_if/regulatory/inc/target_if_reg.h index c0cf63c40fa8..60a5c78c4fd7 100644 --- a/target_if/regulatory/inc/target_if_reg.h +++ b/target_if/regulatory/inc/target_if_reg.h @@ -41,4 +41,9 @@ QDF_STATUS target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops */ QDF_STATUS target_if_reg_set_offloaded_info(struct wlan_objmgr_psoc *psoc); +/** + * tgt_if_regulatory_modify_freq_range() - Modify low and high freq ranges based + * on wireless mode. + */ +QDF_STATUS tgt_if_regulatory_modify_freq_range(struct wlan_objmgr_psoc *psoc); #endif /* __TARGET_IF_REG_H__ */ diff --git a/target_if/regulatory/src/target_if_reg.c b/target_if/regulatory/src/target_if_reg.c index ec50a3aa61bd..c1aceb9efd3f 100644 --- a/target_if/regulatory/src/target_if_reg.c +++ b/target_if/regulatory/src/target_if_reg.c @@ -29,6 +29,7 @@ #include #include #include +#include static inline uint32_t get_chan_list_cc_event_id(void) { @@ -334,6 +335,37 @@ static QDF_STATUS tgt_if_regulatory_stop_11d_scan( reg_stop_11d_scan_req); } +QDF_STATUS tgt_if_regulatory_modify_freq_range(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap; + + reg_cap = ucfg_reg_get_hal_reg_cap(psoc); + if (!reg_cap) { + target_if_err("reg cap is NULL"); + return QDF_STATUS_E_FAILURE; + } + + if (!(reg_cap->wireless_modes & WMI_HOST_REGDMN_MODE_11A)) { + reg_cap->low_5ghz_chan = 0; + reg_cap->high_5ghz_chan = 0; + } + + if (!(reg_cap->wireless_modes & + (WMI_HOST_REGDMN_MODE_11B | WMI_HOST_REGDMN_MODE_PUREG))) { + reg_cap->low_2ghz_chan = 0; + reg_cap->high_2ghz_chan = 0; + } + + target_if_info( + "phy_id = %d - low_2ghz_chan = %d high_2ghz_chan = %d low_5ghz_chan = %d high_5ghz_chan = %d", + reg_cap->phy_id, + reg_cap->low_2ghz_chan, + reg_cap->high_2ghz_chan, + reg_cap->low_5ghz_chan, + reg_cap->high_5ghz_chan); + + return QDF_STATUS_SUCCESS; +} QDF_STATUS target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)