From 34ec96337fc7a8b2bfcef5dcdda75e65a7f059af Mon Sep 17 00:00:00 2001 From: Surya Prakash Sivaraj Date: Fri, 24 Mar 2023 20:53:22 +0530 Subject: [PATCH] qcacld-3.0: Cleanup P2P GO support on indoor channel Rename policy_mgr_is_sap_allowed_on_indoor() to policy_mgr_is_sap_go_interface_allowed_on_indoor() since it is common between SAP and GO. Cleanup the API as well. Change-Id: I8380bd81c5050e9f12c00fff830455f14135c2b4 CRs-Fixed: 3423703 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 10 +++-- .../policy_mgr/src/wlan_policy_mgr_action.c | 20 +++++---- .../src/wlan_policy_mgr_get_set_utils.c | 44 ++++++++++++------- components/p2p/core/src/wlan_p2p_main.c | 2 +- components/p2p/dispatcher/inc/cfg_p2p.h | 11 ++--- core/hdd/src/wlan_hdd_hostapd.c | 9 ++-- core/sap/src/sap_ch_select.c | 7 +-- 7 files changed, 62 insertions(+), 41 deletions(-) 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 42bf2f8f5e..d068765121 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 @@ -5010,8 +5010,8 @@ policy_mgr_is_conc_sap_present_on_sta_freq(struct wlan_objmgr_psoc *psoc, uint32_t policy_mgr_get_connection_count_with_ch_freq(uint32_t ch_freq); /** - * policy_mgr_is_sap_allowed_on_indoor() - Check if the SAP operation - * is allowed in the indoor channel + * policy_mgr_is_sap_go_interface_allowed_on_indoor() - Check if SAP or GO + * interface is allowed on the indoor channel * * @pdev: pointer to pdev * @vdev_id: vdev id @@ -5019,8 +5019,10 @@ uint32_t policy_mgr_get_connection_count_with_ch_freq(uint32_t ch_freq); * * Return: is SAP allowed */ -bool policy_mgr_is_sap_allowed_on_indoor(struct wlan_objmgr_pdev *pdev, - uint8_t vdev_id, qdf_freq_t ch_freq); +bool +policy_mgr_is_sap_go_interface_allowed_on_indoor(struct wlan_objmgr_pdev *pdev, + uint8_t vdev_id, + qdf_freq_t ch_freq); #ifdef WLAN_FEATURE_TDLS_CONCURRENCIES /** 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 5f507b6dc2..2d977d26e1 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 @@ -1723,9 +1723,10 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect( * channel. */ if (pm_ctx->last_disconn_sta_freq == op_ch_freq_list[i] && - !policy_mgr_is_sap_allowed_on_indoor(pm_ctx->pdev, - sap_vdev_id, - op_ch_freq_list[i])) { + !policy_mgr_is_sap_go_interface_allowed_on_indoor( + pm_ctx->pdev, + sap_vdev_id, + op_ch_freq_list[i])) { curr_sap_freq = op_ch_freq_list[i]; policy_mgr_debug("indoor sap_ch_freq %u", curr_sap_freq); @@ -1781,9 +1782,10 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect( * on indoor which is not removed in policy_mgr_get_pcl */ if (!sta_gc_present && - !policy_mgr_is_sap_allowed_on_indoor(pm_ctx->pdev, - sap_vdev_id, - pcl_channels[i])) { + !policy_mgr_is_sap_go_interface_allowed_on_indoor( + pm_ctx->pdev, + sap_vdev_id, + pcl_channels[i])) { policy_mgr_debug("Do not allow SAP on indoor frequency, STA is absent"); continue; } @@ -2628,9 +2630,9 @@ policy_mgr_valid_sap_conc_channel_check(struct wlan_objmgr_psoc *psoc, find_alternate = true; policymgr_nofl_debug("sap not capable on SRD con ch_freq %d", ch_freq); - } else if (!policy_mgr_is_sap_allowed_on_indoor(pm_ctx->pdev, - sap_vdev_id, - ch_freq)) { + } else if (!policy_mgr_is_sap_go_interface_allowed_on_indoor( + pm_ctx->pdev, + sap_vdev_id, ch_freq)) { policymgr_nofl_debug("sap not capable on indoor con ch_freq %d is_sta_sap_scc:%d", ch_freq, is_sta_sap_scc); find_alternate = true; 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 adc0025afc..5705550c96 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 @@ -9085,8 +9085,10 @@ bool policy_mgr_is_sap_allowed_on_dfs_freq(struct wlan_objmgr_pdev *pdev, return true; } -bool policy_mgr_is_sap_allowed_on_indoor(struct wlan_objmgr_pdev *pdev, - uint8_t vdev_id, qdf_freq_t ch_freq) +bool +policy_mgr_is_sap_go_interface_allowed_on_indoor(struct wlan_objmgr_pdev *pdev, + uint8_t vdev_id, + qdf_freq_t ch_freq) { struct wlan_objmgr_psoc *psoc; bool is_scc = false, indoor_support = false; @@ -9110,7 +9112,7 @@ bool policy_mgr_is_sap_allowed_on_indoor(struct wlan_objmgr_pdev *pdev, * a) Restrict 6 GHz SAP * b) Restrict standalone 5 GHz SAP * - * If p2p_go_on_indoor_chan is enabled - Allow GO + * If p2p_go_on_5ghz_indoor_chan is enabled - Allow GO * with or without concurrency * * If sta_sap_scc_on_indoor_chan is enabled - Allow @@ -9118,18 +9120,30 @@ bool policy_mgr_is_sap_allowed_on_indoor(struct wlan_objmgr_pdev *pdev, * * Restrict all other operations on indoor */ - if (indoor_support) { + + if (indoor_support) return true; - } else if (WLAN_REG_IS_6GHZ_CHAN_FREQ(ch_freq) || - (!is_scc && mode == QDF_SAP_MODE)) { + + if (WLAN_REG_IS_6GHZ_CHAN_FREQ(ch_freq)) { + policy_mgr_rl_debug("SAP operation is not allowed on 6 GHz indoor channel"); + return false; + } + + if (mode == QDF_SAP_MODE) { + if (is_scc && + policy_mgr_get_sta_sap_scc_allowed_on_indoor_chnl(psoc)) + return true; policy_mgr_rl_debug("SAP operation is not allowed on indoor channel"); return false; - } else if (mode == QDF_P2P_GO_MODE && - ucfg_p2p_get_indoor_ch_support(psoc)) { - return true; - } else if (is_scc && - policy_mgr_get_sta_sap_scc_allowed_on_indoor_chnl(psoc)) { - return true; + } + + if (mode == QDF_P2P_GO_MODE) { + if (ucfg_p2p_get_indoor_ch_support(psoc) || + (is_scc && + policy_mgr_get_sta_sap_scc_allowed_on_indoor_chnl(psoc))) + return true; + policy_mgr_rl_debug("GO operation is not allowed on indoor channel"); + return false; } policy_mgr_rl_debug("SAP operation is not allowed on indoor channel"); @@ -9898,9 +9912,9 @@ bool policy_mgr_is_restart_sap_required(struct wlan_objmgr_psoc *psoc, if (connection[i].freq != freq && WLAN_REG_IS_24GHZ_CH_FREQ(connection[i].freq) && WLAN_REG_IS_5GHZ_CH_FREQ(freq) && - !policy_mgr_is_sap_allowed_on_indoor(pm_ctx->pdev, - vdev_id, - freq)) { + !policy_mgr_is_sap_go_interface_allowed_on_indoor( + pm_ctx->pdev, + vdev_id, freq)) { policy_mgr_debug("SAP in indoor freq: sta:%d sap:%d", connection[i].freq, freq); restart_required = true; diff --git a/components/p2p/core/src/wlan_p2p_main.c b/components/p2p/core/src/wlan_p2p_main.c index e040ec5e45..b717ac3d09 100644 --- a/components/p2p/core/src/wlan_p2p_main.c +++ b/components/p2p/core/src/wlan_p2p_main.c @@ -554,7 +554,7 @@ static QDF_STATUS p2p_object_init_params( p2p_soc_obj->param.is_random_seq_num_enabled = cfg_get(psoc, CFG_ACTION_FRAME_RANDOM_SEQ_NUM_ENABLED); p2p_soc_obj->param.indoor_channel_support = - cfg_get(psoc, CFG_P2P_GO_ON_INDOOR_CHANNEL); + cfg_get(psoc, CFG_P2P_GO_ON_5GHZ_INDOOR_CHANNEL); return QDF_STATUS_SUCCESS; } diff --git a/components/p2p/dispatcher/inc/cfg_p2p.h b/components/p2p/dispatcher/inc/cfg_p2p.h index 4bf31c20b1..7ff9388bcf 100644 --- a/components/p2p/dispatcher/inc/cfg_p2p.h +++ b/components/p2p/dispatcher/inc/cfg_p2p.h @@ -125,7 +125,7 @@ /* * - * p2p_go_on_indoor_chan - Allow P2P GO to operate on 5 GHz indoor channels + * p2p_go_on_5ghz_indoor_chan - Allow P2P GO to operate on 5 GHz indoor channels * * @Min: 0 * @Max: 1 @@ -142,15 +142,16 @@ * * */ -#define CFG_P2P_GO_ON_INDOOR_CHANNEL CFG_INI_BOOL("p2p_go_on_indoor_chan", \ - "0", \ - "Allow P2P GO on 5 GHz indoor channels") +#define CFG_P2P_GO_ON_5GHZ_INDOOR_CHANNEL CFG_INI_BOOL(\ + "p2p_go_on_5ghz_indoor_chan", \ + "0", \ + "Allow P2P GO on 5 GHz indoor channels") #define CFG_P2P_ALL \ CFG(CFG_ACTION_FRAME_RANDOM_SEQ_NUM_ENABLED) \ CFG(CFG_GO_KEEP_ALIVE_PERIOD) \ CFG(CFG_GO_LINK_MONITOR_PERIOD) \ CFG(CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED) \ - CFG(CFG_P2P_GO_ON_INDOOR_CHANNEL) + CFG(CFG_P2P_GO_ON_5GHZ_INDOOR_CHANNEL) #endif diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index a7a2c871b3..6f90efbdd0 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -3311,9 +3311,10 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq, return status; } - if (!policy_mgr_is_sap_allowed_on_indoor(hdd_ctx->pdev, - adapter->deflink->vdev_id, - target_chan_freq)) { + if (!policy_mgr_is_sap_go_interface_allowed_on_indoor( + hdd_ctx->pdev, + adapter->deflink->vdev_id, + target_chan_freq)) { hdd_debug("Channel switch is not allowed to indoor frequency %d", target_chan_freq); return -EINVAL; @@ -7616,7 +7617,7 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, if (!status) return -EINVAL; - status = policy_mgr_is_sap_allowed_on_indoor( + status = policy_mgr_is_sap_go_interface_allowed_on_indoor( hdd_ctx->pdev, adapter->deflink->vdev_id, chandef->chan->center_freq); diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c index 1edd7c5549..56a7ae8f57 100644 --- a/core/sap/src/sap_ch_select.c +++ b/core/sap/src/sap_ch_select.c @@ -509,9 +509,10 @@ static bool sap_chan_sel_init(mac_handle_t mac_handle, continue; /* Skip indoor channels for non-scc indoor scenario*/ - if (!policy_mgr_is_sap_allowed_on_indoor(mac->pdev, - sap_ctx->sessionId, - *pChans)) { + if (!policy_mgr_is_sap_go_interface_allowed_on_indoor( + mac->pdev, + sap_ctx->sessionId, + *pChans)) { sap_debug("Do not allow SAP on indoor frequency %u", *pChans); continue;