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 bb354d1e6631..11add67ba3d7 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,6 +1,6 @@ /* * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 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 @@ -884,6 +884,7 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, * @psoc: PSOC object information * @mode: connection mode * @ch_freq: target channel frequency to switch + * @bw: target channel bandwidth * @vdev_id: vdev id of channel switch interface * @forced: forced to chan switch. * @reason: request reason of CSA @@ -903,8 +904,17 @@ policy_mgr_nan_sap_pre_enable_conc_check(struct wlan_objmgr_psoc *psoc, bool policy_mgr_allow_concurrency_csa(struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, - uint32_t ch_freq, uint32_t vdev_id, - bool forced, enum sap_csa_reason_code reason); + uint32_t ch_freq, enum hw_mode_bandwidth bw, + uint32_t vdev_id, bool forced, + enum sap_csa_reason_code reason); + +/** + * policy_mgr_get_bw() - Convert phy_ch_width to hw_mode_bandwidth. + * @chan_width: phy_ch_width + * + * Return: hw_mode_bandwidth + */ +enum hw_mode_bandwidth policy_mgr_get_bw(enum phy_ch_width chan_width); /** * policy_mgr_get_first_connection_pcl_table_index() - provides the diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index 4785a580def7..e54d98c61b7a 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 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 @@ -2653,11 +2653,14 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, } if (ch_freq) { - chan_state = wlan_reg_get_5g_bonded_channel_state_for_freq( + if (wlan_reg_is_5ghz_ch_freq(ch_freq)) { + chan_state = + wlan_reg_get_5g_bonded_channel_state_for_freq( pm_ctx->pdev, ch_freq, policy_mgr_get_ch_width(bw)); - if (chan_state == CHANNEL_STATE_DFS) - is_dfs_ch = true; + if (chan_state == CHANNEL_STATE_DFS) + is_dfs_ch = true; + } /* don't allow 3rd home channel on same MAC * also check for single mac target which doesn't * support interbad MCC as well @@ -2693,8 +2696,10 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, sta_sap_scc_on_dfs_chan = policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(psoc); go_force_scc = policy_mgr_go_scc_enforced(psoc); - if ((!sta_sap_scc_on_dfs_chan && mode == PM_SAP_MODE) || - (!go_force_scc && mode == PM_P2P_GO_MODE)) { + if ((mode == PM_SAP_MODE || mode == PM_P2P_GO_MODE) && + (!sta_sap_scc_on_dfs_chan || + !policy_mgr_is_sta_sap_scc(psoc, ch_freq) || + (!go_force_scc && mode == PM_P2P_GO_MODE))) { if (is_dfs_ch) match = policy_mgr_disallow_mcc(psoc, ch_freq); @@ -2796,8 +2801,9 @@ bool policy_mgr_allow_concurrency(struct wlan_objmgr_psoc *psoc, bool policy_mgr_allow_concurrency_csa(struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode, - uint32_t ch_freq, uint32_t vdev_id, - bool forced, enum sap_csa_reason_code reason) + uint32_t ch_freq, enum hw_mode_bandwidth bw, + uint32_t vdev_id, bool forced, + enum sap_csa_reason_code reason) { bool allow = false; struct policy_mgr_conc_connection_info @@ -2812,8 +2818,8 @@ policy_mgr_allow_concurrency_csa(struct wlan_objmgr_psoc *psoc, policy_mgr_err("Invalid Context"); return allow; } - policy_mgr_debug("check concurrency_csa vdev:%d ch %d, forced %d, reason %d", - vdev_id, ch_freq, forced, reason); + policy_mgr_debug("check concurrency_csa vdev:%d ch %d bw %d, forced %d, reason %d", + vdev_id, ch_freq, bw, forced, reason); status = policy_mgr_get_chan_by_session_id(psoc, vdev_id, &old_ch_freq); @@ -2851,8 +2857,7 @@ policy_mgr_allow_concurrency_csa(struct wlan_objmgr_psoc *psoc, policy_mgr_store_and_del_conn_info_by_vdev_id( psoc, vdev_id, info, &num_cxn_del); - allow = policy_mgr_allow_concurrency(psoc, mode, ch_freq, - HW_MODE_20_MHZ); + allow = policy_mgr_allow_concurrency(psoc, mode, ch_freq, bw); /* Restore the connection entry */ if (num_cxn_del > 0) policy_mgr_restore_deleted_conn_info(psoc, info, num_cxn_del); 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 fd6922e77d94..e70b599e774b 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 @@ -1,5 +1,6 @@ /* * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022-2023 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 @@ -570,14 +571,6 @@ void pm_dbs_opportunistic_timer_handler(void *data); enum policy_mgr_con_mode policy_mgr_get_mode(uint8_t type, uint8_t subtype); -/** - * policy_mgr_get_bw() - Convert phy_ch_width to hw_mode_bandwidth. - * @chan_width: phy_ch_width - * - * Return: hw_mode_bandwidth - */ -enum hw_mode_bandwidth policy_mgr_get_bw(enum phy_ch_width chan_width); - QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, enum policy_mgr_pcl_type pcl, uint32_t *pcl_channels, uint32_t *len, diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index afa99fb8bed5..f5edc1c9c586 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 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 @@ -2966,6 +2966,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq, struct wlan_objmgr_vdev *vdev; bool strict; uint32_t sta_cnt = 0; + struct ch_params ch_params = {0}; hdd_ctx = WLAN_HDD_GET_CTX(adapter); ret = wlan_hdd_validate_context(hdd_ctx); @@ -3046,7 +3047,10 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq, hdd_err("Channel switch in progress!!"); return -EBUSY; } - + ch_params.ch_width = target_bw; + target_bw = wlansap_get_csa_chanwidth_from_phymode(sap_ctx, + target_chan_freq, + &ch_params); /* * Do SAP concurrency check to cover channel switch case as following: * There is already existing SAP+GO combination but due to upper layer @@ -3063,7 +3067,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq, hdd_ctx->psoc, policy_mgr_convert_device_mode_to_qdf_type( adapter->device_mode), - target_chan_freq, + target_chan_freq, policy_mgr_get_bw(target_bw), adapter->vdev_id, forced, sap_ctx->csa_reason)) {