diff --git a/components/cmn_services/interface_mgr/src/wlan_if_mgr_sap.c b/components/cmn_services/interface_mgr/src/wlan_if_mgr_sap.c index 3e3ec38b62..4c4773df68 100644 --- a/components/cmn_services/interface_mgr/src/wlan_if_mgr_sap.c +++ b/components/cmn_services/interface_mgr/src/wlan_if_mgr_sap.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 above @@ -26,6 +27,7 @@ #include "wlan_if_mgr_main.h" #include "wlan_p2p_cfg_api.h" #include "wlan_tdls_api.h" +#include "wlan_p2p_api.h" QDF_STATUS if_mgr_ap_start_bss(struct wlan_objmgr_vdev *vdev, struct if_mgr_event_data *event_data) @@ -128,3 +130,25 @@ if_mgr_ap_stop_bss_complete(struct wlan_objmgr_vdev *vdev, return QDF_STATUS_SUCCESS; } +#ifdef WLAN_FEATURE_P2P_P2P_STA +QDF_STATUS +if_mgr_csa_complete(struct wlan_objmgr_vdev *vdev, + struct if_mgr_event_data *event_data) +{ + struct wlan_objmgr_psoc *psoc; + struct wlan_objmgr_pdev *pdev; + QDF_STATUS status = QDF_STATUS_SUCCESS; + + pdev = wlan_vdev_get_pdev(vdev); + if (!pdev) + return QDF_STATUS_E_FAILURE; + psoc = wlan_pdev_get_psoc(pdev); + if (!psoc) + return QDF_STATUS_E_FAILURE; + + status = wlan_p2p_check_and_force_scc_go_plus_go(psoc, vdev); + if (QDF_IS_STATUS_ERROR(status)) + ifmgr_err("force scc failure with status: %d", status); + return status; +} +#endif diff --git a/components/p2p/core/src/wlan_p2p_main.c b/components/p2p/core/src/wlan_p2p_main.c index af75439459..95f5696c25 100644 --- a/components/p2p/core/src/wlan_p2p_main.c +++ b/components/p2p/core/src/wlan_p2p_main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -35,6 +36,7 @@ #include "wlan_p2p_off_chan_tx.h" #include "wlan_p2p_cfg.h" #include "cfg_ucfg_api.h" +#include "wlan_mlme_api.h" /** * p2p_get_cmd_type_str() - parse cmd to string @@ -1508,3 +1510,49 @@ QDF_STATUS p2p_status_stop_bss(struct wlan_objmgr_vdev *vdev) } #endif /* WLAN_FEATURE_P2P_DEBUG */ + +#ifdef WLAN_FEATURE_P2P_P2P_STA +QDF_STATUS p2p_check_and_force_scc_go_plus_go(struct wlan_objmgr_psoc *psoc, + struct wlan_objmgr_vdev *vdev) +{ + int go_count = 0; + uint32_t existing_chan_freq, chan_freq; + enum phy_ch_width existing_ch_width, ch_width; + uint8_t existing_vdev_id = WLAN_UMAC_VDEV_ID_MAX, vdev_id; + enum policy_mgr_con_mode existing_vdev_mode = PM_MAX_NUM_OF_MODE; + bool go_force_scc = false; + + go_count = policy_mgr_mode_specific_connection_count( + psoc, PM_P2P_GO_MODE, NULL); + go_force_scc = policy_mgr_go_scc_enforced(psoc); + if (go_count > 1 && go_force_scc) { + vdev_id = wlan_vdev_get_id(vdev); + chan_freq = wlan_get_operation_chan_freq(vdev); + ch_width = vdev->vdev_mlme.bss_chan->ch_width; + p2p_debug("Current vdev_id %d, chan_freq %d and ch_width %d", + vdev_id, chan_freq, ch_width); + existing_vdev_id = policy_mgr_fetch_existing_con_info( + psoc, vdev_id, + chan_freq, + &existing_vdev_mode, + &existing_chan_freq, + &existing_ch_width); + p2p_debug("Existing vdev_id %d, chan_freq %d and ch_width %d", + existing_vdev_id, existing_chan_freq, + existing_ch_width); + if (existing_vdev_id == WLAN_UMAC_VDEV_ID_MAX) { + p2p_debug("force scc not required"); + return QDF_STATUS_SUCCESS; + } + if (existing_vdev_mode == PM_P2P_GO_MODE) { + policy_mgr_process_forcescc_for_go(psoc, + existing_vdev_id, + chan_freq, + ch_width, + PM_P2P_GO_MODE); + p2p_debug("CSA for vdev_id %d", existing_vdev_id); + } + } + return QDF_STATUS_SUCCESS; +} +#endif diff --git a/components/p2p/core/src/wlan_p2p_main.h b/components/p2p/core/src/wlan_p2p_main.h index bf85652c0a..09f4966865 100644 --- a/components/p2p/core/src/wlan_p2p_main.h +++ b/components/p2p/core/src/wlan_p2p_main.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -589,4 +590,22 @@ static inline QDF_STATUS p2p_status_stop_bss(struct wlan_objmgr_vdev *vdev) return QDF_STATUS_SUCCESS; } #endif /* WLAN_FEATURE_P2P_DEBUG */ +#ifdef WLAN_FEATURE_P2P_P2P_STA +/** + * p2p_check_and_force_scc_go_plus_go() - Check and do force scc for + * go plus go + * @psoc: psoc object + * @vdev: vdev object + * + * This function checks whether force scc is enabled or not. If it + * is enabled then it will do force scc to remaining p2p go vdev if + * user has initiated CSA to current vdev. + * + * Return: status + */ + +QDF_STATUS +p2p_check_and_force_scc_go_plus_go(struct wlan_objmgr_psoc *psoc, + struct wlan_objmgr_vdev *vdev); +#endif /* WLAN_FEATURE_P2P_P2P_STA */ #endif /* _WLAN_P2P_MAIN_H_ */ diff --git a/components/p2p/dispatcher/inc/wlan_p2p_api.h b/components/p2p/dispatcher/inc/wlan_p2p_api.h index f487d48703..3c7a85da04 100644 --- a/components/p2p/dispatcher/inc/wlan_p2p_api.h +++ b/components/p2p/dispatcher/inc/wlan_p2p_api.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -70,4 +71,22 @@ QDF_STATUS wlan_p2p_status_connect(struct wlan_objmgr_vdev *vdev); * Return: QDF_STATUS_SUCCESS - in case of success */ QDF_STATUS wlan_p2p_abort_scan(struct wlan_objmgr_pdev *pdev); + +#ifdef WLAN_FEATURE_P2P_P2P_STA +/** + * wlan_p2p_check_and_force_scc_go_plus_go() - Check and do force scc for + * go plus go + * @psoc: psoc object + * @vdev: vdev object + * + * This function checks whether force scc is enabled or not. If it + * is enabled then it will do force scc to remaining p2p go vdev if + * user has initiated CSA to current vdev. + * + * Return: status + */ +QDF_STATUS +wlan_p2p_check_and_force_scc_go_plus_go(struct wlan_objmgr_psoc *psoc, + struct wlan_objmgr_vdev *vdev); +#endif #endif diff --git a/components/p2p/dispatcher/src/wlan_p2p_api.c b/components/p2p/dispatcher/src/wlan_p2p_api.c index 5f7cd95b3d..286a75dea9 100644 --- a/components/p2p/dispatcher/src/wlan_p2p_api.c +++ b/components/p2p/dispatcher/src/wlan_p2p_api.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -74,6 +75,20 @@ QDF_STATUS wlan_p2p_status_connect(struct wlan_objmgr_vdev *vdev) return p2p_status_connect(vdev); } +#ifdef WLAN_FEATURE_P2P_P2P_STA +QDF_STATUS +wlan_p2p_check_and_force_scc_go_plus_go(struct wlan_objmgr_psoc *psoc, + struct wlan_objmgr_vdev *vdev) +{ + if (!vdev) { + p2p_err("vdev is NULL"); + return QDF_STATUS_E_INVAL; + } + + return p2p_check_and_force_scc_go_plus_go(psoc, vdev); +} +#endif + static void wlan_p2p_abort_vdev_scan(struct wlan_objmgr_pdev *pdev, void *object, void *arg) { diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index 1982199309..f22f2018f4 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/core/sap/src/sap_api_link_cntl.c @@ -53,6 +53,9 @@ #include #include +/* IF MGR API header file */ +#include "wlan_if_mgr_ucfg_api.h" + /*---------------------------------------------------------------------------- * Preprocessor Definitions and Constants * -------------------------------------------------------------------------*/ @@ -1146,6 +1149,9 @@ QDF_STATUS wlansap_roam_callback(void *ctx, break; case eCSR_ROAM_SET_CHANNEL_RSP: sap_debug("Received set channel response"); + ucfg_if_mgr_deliver_event(sap_ctx->vdev, + WLAN_IF_MGR_EV_CSA_COMPLETE, + NULL); break; case eCSR_ROAM_CAC_COMPLETE_IND: sap_debug("Received cac complete indication");