From cd311c87fc13c637c7840b2c77be6dea4bed06b2 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Fri, 14 Sep 2018 10:55:10 +0530 Subject: [PATCH] qcacld-3.0: Update correct PHY mode while processing ch_info_req Currently PHY mode is not getting updated and it is being set as 0, which is resulting in an invalid channel setting to FW for LOWI. To address this issue update the PHY mode correctly. Change-Id: I1f650268e2ba1814a435994d558b4b68030eb8c1 CRs-Fixed: 2318551 --- core/wma/src/wma_features.c | 5 +++++ core/wma/src/wma_main.c | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index 9de9bd2f8bfd..3cabd9b26f18 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -677,6 +677,11 @@ WLAN_PHY_MODE wma_chan_phy_mode(u8 chan, enum phy_ch_width chan_width, return MODE_UNKNOWN; } + if (chan_width >= CH_WIDTH_INVALID) { + WMA_LOGE("%s : Invalid channel width", __func__); + return MODE_UNKNOWN; + } + if (WLAN_REG_IS_24GHZ_CH(chan)) { if (((CH_WIDTH_5MHZ == chan_width) || (CH_WIDTH_10MHZ == chan_width)) && diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 7cd6a711ce8f..8aa71b2f7aff 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -3089,6 +3089,30 @@ static void wma_register_apf_events(tp_wma_handle wma_handle) } #endif /* FEATURE_WLAN_APF */ +/** + * wma_get_phy_mode_cb() - Callback to get current PHY Mode. + * @chan: channel number + * @chan_width: maximum channel width possible + * @phy_mode: PHY Mode + * + * Return: None + */ +static void wma_get_phy_mode_cb(uint8_t chan, uint32_t chan_width, + uint32_t *phy_mode) +{ + uint32_t dot11_mode; + struct sAniSirGlobal *mac = cds_get_context(QDF_MODULE_ID_PE); + + if (!mac) { + wma_err("MAC context is NULL"); + *phy_mode = MODE_UNKNOWN; + return; + } + + wlan_cfg_get_int(mac, WNI_CFG_DOT11_MODE, &dot11_mode); + *phy_mode = wma_chan_phy_mode(chan, chan_width, dot11_mode); +} + /** * wma_open() - Allocate wma context and initialize it. * @cds_context: cds context @@ -3591,6 +3615,9 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, wma_register_debug_callback(); + wifi_pos_register_get_phy_mode_cb(wma_handle->psoc, + wma_get_phy_mode_cb); + /* Register callback with PMO so PMO can update the vdev pause bitmap*/ pmo_register_pause_bitmap_notifier(wma_handle->psoc, wma_vdev_update_pause_bitmap);