From 7c56c2335eed1a51f12962af7cf1c933df3bb0c8 Mon Sep 17 00:00:00 2001 From: Nitesh Shah Date: Fri, 12 May 2017 16:54:33 +0530 Subject: [PATCH] qcacmn: Provide Rx LDPC support for 2G STA Currently Rx LDPC is disabled for STA(2G) connection due to PHY-B hardware limitation. PHY-A can still support RxLDPC, so make changes such a way that when ever STA is on 2G band and current hardware mode is non-dbs then enable the Rx LDPC and if STA is on 2G band and current hardware mode is dbs then disable the RX LDPC. Change-Id: Ib0183fea06619056c61e297d3fcfd82d91775dcd CRs-Fixed: 2046542 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 22 ++++++++++ .../policy_mgr/src/wlan_policy_mgr_action.c | 32 ++++++++++++++ .../policy_mgr/src/wlan_policy_mgr_core.c | 44 +++++++++++++++++++ .../src/wlan_policy_mgr_init_deinit.c | 6 +++ 4 files changed, 104 insertions(+) diff --git a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h index 40cce054c0e1..1b0d80f75900 100644 --- a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h +++ b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h @@ -735,6 +735,9 @@ typedef void (*policy_mgr_nss_update_cback)(struct wlan_objmgr_psoc *psoc, /** * struct policy_mgr_sme_cbacks - SME Callbacks to be invoked * from policy manager + * @sme_check_enable_rx_ldpc_sta_ini_item: Get rx ldpc sta ini value + * @sme_set_vdev_ies_per_band: Set vdev IEs per band + * @sme_issue_same_ap_reassoc_cmd: Issue AP reassoc * @sme_get_valid_channels: Get valid channel list * @sme_get_nss_for_vdev: Get the allowed nss value for the vdev * @sme_soc_set_dual_mac_config: Set the dual MAC scan & FW @@ -745,6 +748,10 @@ typedef void (*policy_mgr_nss_update_cback)(struct wlan_objmgr_psoc *psoc, * @sme_change_mcc_beacon_interval: Set MCC beacon interval to FW */ struct policy_mgr_sme_cbacks { + bool (*sme_check_enable_rx_ldpc_sta_ini_item)(void); + void (*sme_set_vdev_ies_per_band)(uint8_t vdev_id, + uint8_t is_hw_mode_dbs); + QDF_STATUS (*sme_issue_same_ap_reassoc_cmd)(uint8_t session_id); QDF_STATUS (*sme_get_valid_channels)(uint8_t *chan_list, uint32_t *list_len); void (*sme_get_nss_for_vdev)(enum tQDF_ADAPTER_MODE, @@ -1906,4 +1913,19 @@ uint32_t policy_mgr_get_hw_dbs_nss(struct wlan_objmgr_psoc *psoc, * Return: true for success, else false */ bool policy_mgr_is_dnsc_set(struct wlan_objmgr_vdev *vdev); + +/** + * policy_mgr_find_sta_and_update_caps_with_reassociation() - find sta and + * update HT/VHT caps and do reassociation with same ap + * @psoc: PSOC object information + * @is_hw_mode_dbs: DBS or NON-DBS hardware mode to use + * + * This API will find the 2G STA currently active from policy manager table + * and update their HT/VHT caps to firmware and trigger self reassociation + * with same AP through LFR3 roaming module. + * + * Return: QDF_STATUS + */ +QDF_STATUS policy_mgr_find_sta_and_update_caps_with_reassociation( + struct wlan_objmgr_psoc *psoc, uint8_t is_hw_mode_dbs); #endif /* __WLAN_POLICY_MGR_API_H */ diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index 1695fc4bff80..231ea42ec002 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -423,6 +423,7 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc, QDF_STATUS status = QDF_STATUS_E_FAILURE; struct policy_mgr_hw_mode_params hw_mode; struct dbs_nss nss_dbs; + struct policy_mgr_psoc_priv_obj *pm_ctx; if (policy_mgr_is_hw_dbs_capable(psoc) == false) { policy_mgr_err("driver isn't dbs capable, no further action needed"); @@ -447,6 +448,12 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_ALREADY; } + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("Invalid context"); + return QDF_STATUS_E_FAILURE; + } + if ((PM_SBS == action) || (action == PM_SBS_DOWNGRADE)) { if (!policy_mgr_is_hw_sbs_capable(psoc)) { /* No action */ @@ -459,6 +466,31 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc, } + /* + * just check PM_DBS action only, no need to check for + * PM_DBS_DOWNGRADE as it will eventually call PM_DBS. if you check + * for PM_DBS_DOWNGRADE then IE update and self reassoc will happen + * two times back to back as this functon is nested which + * will not make sense. Same things apply for PM_SINGLE_MAC_UPGRADE + * and PM_SINGLE_MAC operations. + */ + if ((PM_DBS == action) && !hw_mode.dbs_cap && + pm_ctx->sme_cbacks.sme_check_enable_rx_ldpc_sta_ini_item()) { + policy_mgr_notice("Going for DBS, disable rx-ldpc for all 2G STAs"); + policy_mgr_find_sta_and_update_caps_with_reassociation(psoc, + true); + } else if ((PM_SINGLE_MAC == action) && hw_mode.dbs_cap + && + pm_ctx->sme_cbacks.sme_check_enable_rx_ldpc_sta_ini_item()) { + /* + * don't use default RX LDPC which isenabled for 5g and + * disable for 2g + */ + policy_mgr_notice("Going for SMM, enable rx-ldpc for all 2G STAs"); + policy_mgr_find_sta_and_update_caps_with_reassociation(psoc, + false); + } + switch (action) { case PM_DBS_DOWNGRADE: /* diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c index 03fc3396196d..86fad4330025 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c @@ -2252,6 +2252,50 @@ static void policy_mgr_nss_update_cb(struct wlan_objmgr_psoc *psoc, return; } +QDF_STATUS policy_mgr_find_sta_and_update_caps_with_reassociation( + struct wlan_objmgr_psoc *psoc, uint8_t is_hw_mode_dbs) +{ + struct policy_mgr_psoc_priv_obj *pm_ctx; + QDF_STATUS status = QDF_STATUS_SUCCESS; + uint32_t index, count; + uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS]; + uint32_t conn_index = 0; + uint32_t vdev_id, channel; + + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("Invalid Context"); + return QDF_STATUS_E_FAILURE; + } + + count = policy_mgr_mode_specific_connection_count(psoc, PM_STA_MODE, + list); + for (index = 0; index < count; index++) { + qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); + vdev_id = pm_conc_connection_list[list[index]].vdev_id; + channel = pm_conc_connection_list[list[index]].chan; + qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); + conn_index = policy_mgr_get_connection_for_vdev_id(psoc, + vdev_id); + if (MAX_NUMBER_OF_CONC_CONNECTIONS == conn_index) { + policy_mgr_err("connection not found for vdev %d", + vdev_id); + continue; + } + /* do it only for 2.4GHz channels */ + if (!WLAN_REG_IS_24GHZ_CH(channel)) + continue; + pm_ctx->sme_cbacks.sme_set_vdev_ies_per_band(vdev_id, + is_hw_mode_dbs); + status = pm_ctx->sme_cbacks.sme_issue_same_ap_reassoc_cmd( + vdev_id); + if (QDF_STATUS_E_FAILURE == status) + policy_mgr_err("Self reassoc failed %d", status); + } + + return status; +} + /** * policy_mgr_complete_action() - initiates actions needed on * current connections once channel has been decided for the new diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c index 43f325412fdd..5fed2e24f1c7 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c @@ -501,6 +501,12 @@ QDF_STATUS policy_mgr_register_sme_cb(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_FAILURE; } + pm_ctx->sme_cbacks.sme_check_enable_rx_ldpc_sta_ini_item = + sme_cbacks->sme_check_enable_rx_ldpc_sta_ini_item; + pm_ctx->sme_cbacks.sme_set_vdev_ies_per_band = + sme_cbacks->sme_set_vdev_ies_per_band; + pm_ctx->sme_cbacks.sme_issue_same_ap_reassoc_cmd = + sme_cbacks->sme_issue_same_ap_reassoc_cmd; pm_ctx->sme_cbacks.sme_get_nss_for_vdev = sme_cbacks->sme_get_nss_for_vdev; pm_ctx->sme_cbacks.sme_get_valid_channels =