From a0f55ea6b135630eb232efd3a8765a1a51692590 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Thu, 7 Mar 2019 12:39:17 +0530 Subject: [PATCH] qcacld-3.0: Send HW mode change before switching channel in DBS mode If DBS 2x2 mode is supported, to operate in 2.4Ghz the driver needs to be in DBS mode before vdev start/restart is sent on 2.4Ghz channel. In scenareo with gWlanMccToSccSwitchMode 4, when AP is in 5Ghz and STA connect to any other channel in 5ghz, it force AP to switch to 2.4 Ghz channel. Thus AP sends vdev restart without sending the HW mode change to firmware. Fix is to set HW mode before the AP start channel switch. Change-Id: I2a1c176d5f3ed8cc2f62dc24c72959db1afbaae3 CRs-Fixed: 2414034 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 14 +++++++- .../policy_mgr/src/wlan_policy_mgr_action.c | 34 +++++++++++++++++++ core/sap/src/sap_module.c | 4 +++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h index 01b0f7c7f660..a5a60b86664f 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -1762,6 +1762,18 @@ QDF_STATUS policy_mgr_get_valid_chan_weights(struct wlan_objmgr_psoc *psoc, QDF_STATUS policy_mgr_set_hw_mode_on_channel_switch( struct wlan_objmgr_psoc *psoc, uint8_t session_id); +/** + * policy_mgr_set_hw_mode_before_channel_switch() - Set hw mode + * before channel switch, this is required if DBS mode is 2x2 + * @psoc: PSOC object information + * @vdev_id: vdev id on which channel switch is required + * @chan: New channel to which channel switch is requested + * + * Return: QDF_STATUS + */ +QDF_STATUS policy_mgr_set_hw_mode_before_channel_switch( + struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, uint8_t chan); + /** * policy_mgr_set_do_hw_mode_change_flag() - Set flag to indicate hw mode change * @psoc: PSOC object information 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 786f42b5c13d..be74e940701d 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 @@ -1910,6 +1910,40 @@ done: return status; } +QDF_STATUS policy_mgr_set_hw_mode_before_channel_switch( + struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, uint8_t chan) +{ + QDF_STATUS status; + struct policy_mgr_conc_connection_info info; + uint8_t num_cxn_del = 0; + + if (!policy_mgr_is_hw_dbs_capable(psoc)) { + policy_mgr_err("DBS is disabled"); + return QDF_STATUS_E_NOSUPPORT; + } + + /* + * Store the connection's parameter and temporarily delete it + * from the concurrency table. This way the allow concurrency + * check can be used as though a new connection is coming up, + * after check, restore the connection to concurrency table. + */ + policy_mgr_store_and_del_conn_info_by_vdev_id(psoc, vdev_id, + &info, &num_cxn_del); + + status = policy_mgr_update_and_wait_for_connection_update(psoc, + vdev_id, chan, + POLICY_MGR_UPDATE_REASON_CHANNEL_SWITCH); + if (QDF_IS_STATUS_ERROR(status)) + policy_mgr_err("Failed to update HW modeStatus %d", status); + + /* Restore the connection entry */ + if (num_cxn_del) + policy_mgr_restore_deleted_conn_info(psoc, &info, num_cxn_del); + + return status; +} + void policy_mgr_checkn_update_hw_mode_single_mac_mode( struct wlan_objmgr_psoc *psoc, uint8_t channel) { diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 7c6d8ca3d84d..d95b8f3e9e7f 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -1376,6 +1376,10 @@ QDF_STATUS wlansap_set_channel_change_with_csa(struct sap_context *sapContext, if (status != QDF_STATUS_SUCCESS) return status; + policy_mgr_set_hw_mode_before_channel_switch(mac->psoc, + sapContext->sessionId, + targetChannel); + /* * Copy the requested target channel * to sap context.