From 511e657dcecf8741d4d059dafa31fc39e18ac171 Mon Sep 17 00:00:00 2001 From: Tushnim Bhattacharyya Date: Wed, 1 Aug 2018 19:15:55 -0700 Subject: [PATCH] qcacmn: Do HW mode change based on all the candidate APs for STA The driver currently changes the hw_mode based upon the first candidate found in the scan list, and tries to connect to it. It may happen that the connection fails, and the STA then tries to connect to the AP on same channel as the concurrent adapter. It would result in hw_mode = DBS, as it is not updated after connection success/failure. Also if the first AP channel is in same band as that of concurrent adapter, and the connection fails, and the STA tries to connect to an AP in a different band, this too is not allowed as hw_mode is not DBS Fix is to change the hw_mode based upon the scan list. If the driver finds any scan result which may lead to DBS connection, the hw_mode should be set to DBS. Once the connection is done or failed, the driver can check and update the hw_mode again. Change-Id: I3c186f47dd5528f0af2598bb02c1b7e297d01548 CRs-Fixed: 2290760 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 12 +++++++ .../policy_mgr/src/wlan_policy_mgr_action.c | 34 ++++++++++++++++++- .../policy_mgr/src/wlan_policy_mgr_pcl.c | 11 +----- 3 files changed, 46 insertions(+), 11 deletions(-) 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 d0e6ee9e7e62..f9d38dc4c9b6 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 @@ -704,6 +704,18 @@ enum policy_mgr_con_mode policy_mgr_convert_device_mode_to_qdf_type( enum QDF_OPMODE policy_mgr_get_qdf_mode_from_pm( enum policy_mgr_con_mode device_mode); +/** + * policy_mgr_check_n_start_opportunistic_timer - check single mac upgrade + * needed or not, if needed start the oppurtunistic timer. + * @psoc: pointer to SOC + * + * This function starts the oppurtunistic timer if hw_mode change is needed + * + * Return: QDF_STATUS + */ +QDF_STATUS policy_mgr_check_n_start_opportunistic_timer( + struct wlan_objmgr_psoc *psoc); + /** * policy_mgr_pdev_set_hw_mode() - Set HW mode command to FW * @psoc: PSOC object information 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 2d9cab406595..061a068e6eb0 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 @@ -93,6 +93,29 @@ void policy_mgr_hw_mode_transition_cb(uint32_t old_hw_mode_index, return; } +QDF_STATUS policy_mgr_check_n_start_opportunistic_timer( + struct wlan_objmgr_psoc *psoc) +{ + struct policy_mgr_psoc_priv_obj *pm_ctx; + QDF_STATUS status = QDF_STATUS_E_FAILURE; + + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("PM ctx not valid. Oppurtunistic timer cannot start"); + return QDF_STATUS_E_FAILURE; + } + if (policy_mgr_need_opportunistic_upgrade(psoc)) { + /* let's start the timer */ + qdf_mc_timer_stop(&pm_ctx->dbs_opportunistic_timer); + status = qdf_mc_timer_start( + &pm_ctx->dbs_opportunistic_timer, + DBS_OPPORTUNISTIC_TIME * 1000); + if (!QDF_IS_STATUS_SUCCESS(status)) + policy_mgr_err("Failed to start dbs opportunistic timer"); + } + return status; +} + QDF_STATUS policy_mgr_pdev_set_hw_mode(struct wlan_objmgr_psoc *psoc, uint32_t session_id, enum hw_mode_ss_config mac0_ss, @@ -1458,13 +1481,22 @@ void policy_mgr_checkn_update_hw_mode_single_mac_mode( qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) { - if (pm_conc_connection_list[i].in_use) + if (pm_conc_connection_list[i].in_use) { if (!WLAN_REG_IS_SAME_BAND_CHANNELS(channel, pm_conc_connection_list[i].chan)) { qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); policy_mgr_debug("DBS required"); return; } + if (policy_mgr_is_hw_dbs_2x2_capable(psoc) && + (WLAN_REG_IS_24GHZ_CH(channel) || + WLAN_REG_IS_24GHZ_CH + (pm_conc_connection_list[i].chan))) { + qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); + policy_mgr_debug("DBS required"); + return; + } + } } qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); pm_dbs_opportunistic_timer_handler((void *)psoc); diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c index 1a4c8f4c5200..e41025045d5d 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c @@ -130,16 +130,7 @@ void policy_mgr_decr_session_set_pcl(struct wlan_objmgr_psoc *psoc, */ policy_mgr_set_pcl_for_existing_combo(psoc, PM_STA_MODE); /* do we need to change the HW mode */ - if (policy_mgr_need_opportunistic_upgrade(psoc)) { - /* let's start the timer */ - qdf_mc_timer_stop(&pm_ctx->dbs_opportunistic_timer); - qdf_status = qdf_mc_timer_start( - &pm_ctx->dbs_opportunistic_timer, - DBS_OPPORTUNISTIC_TIME * 1000); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) - policy_mgr_err("Failed to start dbs opportunistic timer"); - } - + policy_mgr_check_n_start_opportunistic_timer(psoc); return; }