qcacld-3.0: Refactor opportunistic timer in vdev destroy

Refactor the opportunistic timer stop code in the hdd_vdev_destroy()
and move it to a new API.

Change-Id: I27d80897fab6a8f6efacb300ce5cc86c53eccf93
CRs-Fixed: 3306902
This commit is contained in:
Vinod Kumar Pirla
2022-10-06 17:38:08 +05:30
committed by Madan Koyyalamudi
parent 8ef0316626
commit 79e69d325a

View File

@@ -6215,6 +6215,29 @@ static void hdd_check_wait_for_hw_mode_completion(struct hdd_context *hdd_ctx)
} }
} }
static void hdd_stop_last_active_connection(struct hdd_context *hdd_ctx,
struct wlan_objmgr_vdev *vdev)
{
enum policy_mgr_con_mode mode;
struct wlan_objmgr_psoc *psoc;
/* If this is the last active connection check
* and stop the opportunistic timer.
*/
psoc = wlan_vdev_get_psoc(vdev);
mode = policy_mgr_convert_device_mode_to_qdf_type(
wlan_vdev_mlme_get_opmode(vdev));
if ((policy_mgr_get_connection_count(psoc) == 1 &&
policy_mgr_mode_specific_connection_count(psoc,
mode, NULL) == 1) ||
(!policy_mgr_get_connection_count(psoc) &&
!hdd_is_any_sta_connecting(hdd_ctx))) {
policy_mgr_check_and_stop_opportunistic_timer(
psoc,
wlan_vdev_get_id(vdev));
}
}
int hdd_vdev_destroy(struct hdd_adapter *adapter) int hdd_vdev_destroy(struct hdd_adapter *adapter)
{ {
QDF_STATUS status; QDF_STATUS status;
@@ -6234,25 +6257,12 @@ int hdd_vdev_destroy(struct hdd_adapter *adapter)
hdd_ctx = WLAN_HDD_GET_CTX(adapter); hdd_ctx = WLAN_HDD_GET_CTX(adapter);
/*
* if this is the last active connection check & stop the
* opportunistic timer first
*/
if ((policy_mgr_get_connection_count(hdd_ctx->psoc) == 1 &&
policy_mgr_mode_specific_connection_count(hdd_ctx->psoc,
policy_mgr_convert_device_mode_to_qdf_type(
adapter->device_mode), NULL) == 1) ||
(!policy_mgr_get_connection_count(hdd_ctx->psoc) &&
!hdd_is_any_sta_connecting(hdd_ctx)))
policy_mgr_check_and_stop_opportunistic_timer(hdd_ctx->psoc,
adapter->vdev_id);
/* Check and wait for hw mode response */
hdd_check_wait_for_hw_mode_completion(hdd_ctx);
vdev = hdd_objmgr_get_vdev_by_user(adapter, WLAN_OSIF_ID); vdev = hdd_objmgr_get_vdev_by_user(adapter, WLAN_OSIF_ID);
if (!vdev) if (!vdev)
return -EINVAL; return -EINVAL;
hdd_stop_last_active_connection(hdd_ctx, vdev);
hdd_check_wait_for_hw_mode_completion(hdd_ctx);
ucfg_pmo_del_wow_pattern(vdev); ucfg_pmo_del_wow_pattern(vdev);
status = ucfg_reg_11d_vdev_delete_update(vdev); status = ucfg_reg_11d_vdev_delete_update(vdev);
ucfg_scan_vdev_set_disable(vdev, REASON_VDEV_DOWN); ucfg_scan_vdev_set_disable(vdev, REASON_VDEV_DOWN);