From 969f23e2302317b84a1b336e3e4e8b9eef30bd3b Mon Sep 17 00:00:00 2001 From: sheenam monga Date: Fri, 23 Jul 2021 18:27:05 +0530 Subject: [PATCH] qcacld-3.0: Don't process csa request immediately for P2P GO If STA is connected to one channel and p2p is up on same channel, and sta moves to another channel then p2p go also tries to switch to sta channel immediately in case g_enable_go_force_scc is enabled. But Go can't send channel switch announcement as go sends 1.5 sec of NOA during sta connection with new channel due to which p2p may get disconnect. Fix is to not try to move to sta channel immediately. P2P Go will try to switch channel only after NOA completion which is 1.5 seconds. Add delay work queue of 3 seconds to handle worst case scenario when BT is on and P2P tries to switch channel. Change-Id: I557940dfc79da4922694ed24a573e41aae75c09a CRs-Fixed: 2989207 --- .../policy_mgr/src/wlan_policy_mgr_action.c | 20 +++++++++++++++---- .../policy_mgr/src/wlan_policy_mgr_i.h | 5 +++-- .../src/wlan_policy_mgr_init_deinit.c | 14 +++++++++---- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index c6c792f89271..3f15455d58ed 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -2368,6 +2368,7 @@ void policy_mgr_check_concurrent_intf_and_restart_sap( uint32_t op_ch_freq_list[MAX_NUMBER_OF_CONC_CONNECTIONS] = {0}; uint8_t vdev_id[MAX_NUMBER_OF_CONC_CONNECTIONS] = {0}; uint32_t cc_count = 0; + uint32_t timeout_ms = 0; bool restart_sap = false; uint32_t sap_freq; /* @@ -2447,10 +2448,21 @@ sap_restart: if (restart_sap || ((mcc_to_scc_switch != QDF_MCC_TO_SCC_SWITCH_DISABLE) && (sta_check || gc_check))) { - if (pm_ctx->sta_ap_intf_check_work_info) { - qdf_sched_work(0, &pm_ctx->sta_ap_intf_check_work); - policy_mgr_debug( - "Checking for Concurrent Change interference"); + if (!pm_ctx->sta_ap_intf_check_work_info) { + policy_mgr_err("invalid sta_ap_intf_check_work_info"); + return; + } + + policy_mgr_debug("Checking for Concurrent Change interference"); + + if (policy_mgr_mode_specific_connection_count( + psoc, PM_P2P_GO_MODE, NULL)) + timeout_ms = MAX_NOA_TIME; + + if (!qdf_delayed_work_start(&pm_ctx->sta_ap_intf_check_work, + timeout_ms)) { + policy_mgr_err("change interface request failure"); + return; } } } diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h index 999d7aefd8fc..fd6922e77d94 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h @@ -26,7 +26,7 @@ #include "qdf_defer.h" #include "wlan_reg_services_api.h" #include "cds_ieee80211_common_i.h" - +#include "qdf_delayed_work.h" #define DBS_OPPORTUNISTIC_TIME 5 #define POLICY_MGR_SER_CMD_TIMEOUT 4000 @@ -40,6 +40,7 @@ #define PM_24_GHZ_CH_FREQ_6 (2437) #define PM_5_GHZ_CH_FREQ_36 (5180) #define CHANNEL_SWITCH_COMPLETE_TIMEOUT (2000) +#define MAX_NOA_TIME (3000) /** * Policy Mgr hardware mode list bit-mask definitions. @@ -351,7 +352,7 @@ struct policy_mgr_psoc_priv_obj { uint32_t concurrency_mode; uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE]; uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE]; - qdf_work_t sta_ap_intf_check_work; + struct qdf_delayed_work sta_ap_intf_check_work; qdf_work_t nan_sap_conc_work; uint32_t num_dbs_hw_modes; struct dbs_hw_mode_info hw_mode; diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c index 76d12c80f741..c1bb04c28958 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c @@ -338,9 +338,15 @@ QDF_STATUS policy_mgr_psoc_open(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_FAILURE; } pm_ctx->sta_ap_intf_check_work_info->psoc = psoc; - qdf_create_work(0, &pm_ctx->sta_ap_intf_check_work, - policy_mgr_check_sta_ap_concurrent_ch_intf, - pm_ctx->sta_ap_intf_check_work_info); + if (QDF_IS_STATUS_ERROR(qdf_delayed_work_create( + &pm_ctx->sta_ap_intf_check_work, + policy_mgr_check_sta_ap_concurrent_ch_intf, + pm_ctx))) { + policy_mgr_err("Failed to create dealyed work queue"); + qdf_mutex_destroy(&pm_ctx->qdf_conc_list_lock); + qdf_mem_free(pm_ctx->sta_ap_intf_check_work_info); + return QDF_STATUS_E_FAILURE; + } return QDF_STATUS_SUCCESS; } @@ -369,7 +375,7 @@ QDF_STATUS policy_mgr_psoc_close(struct wlan_objmgr_psoc *psoc) } if (pm_ctx->sta_ap_intf_check_work_info) { - qdf_cancel_work(&pm_ctx->sta_ap_intf_check_work); + qdf_delayed_work_destroy(&pm_ctx->sta_ap_intf_check_work); qdf_mem_free(pm_ctx->sta_ap_intf_check_work_info); pm_ctx->sta_ap_intf_check_work_info = NULL; }