From e0334a5e1d0b4d45372388eee0c7b26b0bfeb26a Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Tue, 21 Jan 2020 14:30:06 +0530 Subject: [PATCH] qcacld-3.0: Set connection update in success only Currently the driver sets the connection update flag in case of the hw mode cb when the set hw mode is done, irrespective of the status code sent by the FW. This leads to the completion for wait for event and the caller to the current connection update would get a wrong expectation that the hw mode requested by it was set, which would not be the case when the hw mode is not set according to the user or the set hw mode was rejected by the target itself. Fix is to set the connection mode only when the status is success or already the HW mode is set. Change-Id: Ic7257b0be5a4bcdaecffb788cf3394b06ddfd5e5 CRs-Fixed: 2604062 --- .../policy_mgr/inc/wlan_policy_mgr_public_struct.h | 4 ++-- .../cmn_services/policy_mgr/src/wlan_policy_mgr_core.c | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h index d7705e8ff093..ff246f6f7d5d 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h @@ -949,22 +949,22 @@ enum hw_mode_bandwidth { * enum set_hw_mode_status - Status of set HW mode command * @SET_HW_MODE_STATUS_OK: command successful * @SET_HW_MODE_STATUS_EINVAL: Requested invalid hw_mode - * @SET_HW_MODE_STATUS_ALREADY: Requested hw mode is already applied to FW. * @SET_HW_MODE_STATUS_ECANCELED: HW mode change cancelled * @SET_HW_MODE_STATUS_ENOTSUP: HW mode not supported * @SET_HW_MODE_STATUS_EHARDWARE: HW mode change prevented by hardware * @SET_HW_MODE_STATUS_EPENDING: HW mode change is pending * @SET_HW_MODE_STATUS_ECOEX: HW mode change conflict with Coex + * @SET_HW_MODE_STATUS_ALREADY: Requested hw mode is already applied to FW. */ enum set_hw_mode_status { SET_HW_MODE_STATUS_OK, SET_HW_MODE_STATUS_EINVAL, - SET_HW_MODE_STATUS_ALREADY, SET_HW_MODE_STATUS_ECANCELED, SET_HW_MODE_STATUS_ENOTSUP, SET_HW_MODE_STATUS_EHARDWARE, SET_HW_MODE_STATUS_EPENDING, SET_HW_MODE_STATUS_ECOEX, + SET_HW_MODE_STATUS_ALREADY, }; typedef void (*dual_mac_cb)(enum set_hw_mode_status status, 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 3edcfceb7150..4149abda1f8e 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 @@ -923,6 +923,11 @@ void policy_mgr_pdev_set_hw_mode_cb(uint32_t status, policy_mgr_set_hw_mode_change_in_progress(context, POLICY_MGR_HW_MODE_NOT_IN_PROGRESS); + if (status == SET_HW_MODE_STATUS_OK || + status == SET_HW_MODE_STATUS_ALREADY) { + policy_mgr_set_connection_update(context); + } + if (status != SET_HW_MODE_STATUS_OK) { policy_mgr_debug("Set HW mode failed with status %d", status); goto next_action; @@ -980,9 +985,6 @@ next_action: policy_mgr_debug("No action needed right now"); set_done_event: - ret = policy_mgr_set_connection_update(context); - if (!QDF_IS_STATUS_SUCCESS(ret)) - policy_mgr_err("ERROR: set connection_update_done event failed"); ret = policy_mgr_set_opportunistic_update(context); if (!QDF_IS_STATUS_SUCCESS(ret)) policy_mgr_err("ERROR: set opportunistic_update event failed");