From 590802cbec3e1a0c071036615f40563b42d3b813 Mon Sep 17 00:00:00 2001 From: Srinivas Dasari Date: Tue, 18 May 2021 20:24:58 +0530 Subject: [PATCH] qcacld-3.0: Don't set the hw_mode to SMM if connection is in progress Currently, hdd_vdev_destroy checks if any vdev is actively using DBS while cleaning up the vdev. It stops the timer and sends set hw_mode command to firmware to set the hw_mode to SMM if no vdev is using DBS. This causes delay in p2p interface down in below scenario, 1. Bring up both sta and p2p vdevs. 2. Initiate connection on sta to an AP which has both 2GHz and 5GHz candidates. hw_mode would be set to DBS as one of the candidate is 2GHz. 3. Connection would be attempted first on 5GHz candidate if the 5GHz candidate score is good. 4. If p2p interface is disabled while sta connection is happening, it stops the opportunistic timer and sets the hw_mode to SMM. But the command would be waiting in serialization queue as connect command is active currently. This is a blocking call and userspace thread would be stuck till connection completion/ connection timeout(5 seconds) happens. The above wait results delay in p2p down which in turn results delay in wifi turn-on(as p2p down+set random mac+p2p up happens as part of wifi turn on) and turn-off. Don't set the hw_mode to SMM in this case as the sta connection is in progress. Change-Id: If286fe9bd9906eba71686cf1d50880aa065cc100 CRs-Fixed: 2926272 --- core/hdd/src/wlan_hdd_hostapd.c | 8 +------- core/hdd/src/wlan_hdd_hostapd.h | 7 +++++++ core/hdd/src/wlan_hdd_main.c | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index a8d43f2a6b17..faaeed49efa5 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -2895,13 +2895,7 @@ static int hdd_softap_unpack_ie(mac_handle_t mac_handle, return QDF_STATUS_SUCCESS; } -/** - * hdd_is_any_sta_connecting() - check if any sta is connecting - * @hdd_ctx: hdd context - * - * Return: true if any sta is connecting - */ -static bool hdd_is_any_sta_connecting(struct hdd_context *hdd_ctx) +bool hdd_is_any_sta_connecting(struct hdd_context *hdd_ctx) { struct hdd_adapter *adapter = NULL, *next_adapter = NULL; struct hdd_station_ctx *sta_ctx; diff --git a/core/hdd/src/wlan_hdd_hostapd.h b/core/hdd/src/wlan_hdd_hostapd.h index 6f5314f21b9d..a583aac09832 100644 --- a/core/hdd/src/wlan_hdd_hostapd.h +++ b/core/hdd/src/wlan_hdd_hostapd.h @@ -327,4 +327,11 @@ enum qca_wlan_802_11_mode hdd_convert_dot11mode_from_phymode(int phymode); */ void hdd_stop_sap_due_to_invalid_channel(struct work_struct *work); +/** + * hdd_is_any_sta_connecting() - check if any sta is connecting + * @hdd_ctx: hdd context + * + * Return: true if any sta is connecting + */ +bool hdd_is_any_sta_connecting(struct hdd_context *hdd_ctx); #endif /* end #if !defined(WLAN_HDD_HOSTAPD_H) */ diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 707cf3f4e58c..3280d882429c 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -5499,7 +5499,8 @@ int hdd_vdev_destroy(struct hdd_adapter *adapter) 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)) + (!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 */