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 01b0f7c7f6..a5a60b8666 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 786f42b5c1..be74e94070 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 7c6d8ca3d8..d95b8f3e9e 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.