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 94ce0f137f..c6bf5322be 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 @@ -637,6 +637,18 @@ QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc, uint32_t *pcl_channels, uint32_t *len, uint8_t *pcl_weight, uint32_t weight_len); +/** + * policy_mgr_init_chan_avoidance() - init channel avoidance in policy manager. + * @psoc: PSOC object information + * @chan_freq_list: channel frequency list + * @chan_cnt: channel count + * + * Return: QDF_STATUS + */ +QDF_STATUS policy_mgr_init_chan_avoidance(struct wlan_objmgr_psoc *psoc, + qdf_freq_t *chan_freq_list, + uint16_t chan_cnt); + /** * policy_mgr_update_with_safe_channel_list() - provides the safe * channel list diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_ucfg.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_ucfg.h index a339f90073..3b7280b5fe 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_ucfg.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_ucfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020 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 @@ -254,6 +254,20 @@ bool ucfg_policy_mgr_get_dfs_master_dynamic_enabled(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id); +/** + * ucfg_policy_mgr_init_chan_avoidance() - init channel avoidance in policy + * manager + * @psoc: pointer to psoc + * @chan_freq_list: channel frequency list + * @chan_cnt: channel count + * + * Return: QDF_STATUS_SUCCESS up on success and any other status for failure. + */ +QDF_STATUS +ucfg_policy_mgr_init_chan_avoidance(struct wlan_objmgr_psoc *psoc, + qdf_freq_t *chan_freq_list, + uint16_t chan_cnt); + /** * ucfg_policy_mgr_get_sap_mandt_chnl() - to find out if SAP mandatory channel * support is enabled diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c index 521681a4df..0b980e2a65 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c @@ -212,6 +212,31 @@ policy_mgr_reg_chan_change_callback(struct wlan_objmgr_psoc *psoc, pm_ctx->unsafe_channel_count); } +QDF_STATUS policy_mgr_init_chan_avoidance(struct wlan_objmgr_psoc *psoc, + qdf_freq_t *chan_freq_list, + uint16_t chan_cnt) +{ + struct policy_mgr_psoc_priv_obj *pm_ctx; + uint32_t i; + + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("Invalid Context"); + return QDF_STATUS_E_FAILURE; + } + + pm_ctx->unsafe_channel_count = chan_cnt >= NUM_CHANNELS ? + NUM_CHANNELS : chan_cnt; + + for (i = 0; i < pm_ctx->unsafe_channel_count; i++) + pm_ctx->unsafe_channel_list[i] = chan_freq_list[i]; + + policy_mgr_debug("Channel list init, received %d avoided channels", + pm_ctx->unsafe_channel_count); + + return QDF_STATUS_SUCCESS; +} + void policy_mgr_update_with_safe_channel_list(struct wlan_objmgr_psoc *psoc, uint32_t *pcl_channels, uint32_t *len, diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_ucfg.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_ucfg.c index e95f07b85e..e285d395ef 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_ucfg.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_ucfg.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020 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 @@ -206,6 +206,14 @@ ucfg_policy_mgr_get_sta_sap_scc_lte_coex_chnl(struct wlan_objmgr_psoc *psoc, sta_sap_scc_lte_coex); } +QDF_STATUS +ucfg_policy_mgr_init_chan_avoidance(struct wlan_objmgr_psoc *psoc, + qdf_freq_t *chan_freq_list, + uint16_t chan_cnt) +{ + return policy_mgr_init_chan_avoidance(psoc, chan_freq_list, chan_cnt); +} + QDF_STATUS ucfg_policy_mgr_get_sap_mandt_chnl(struct wlan_objmgr_psoc *psoc, uint8_t *sap_mandt_chnl) { diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 3f8d226559..b1ed94cf62 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -9871,6 +9871,10 @@ static void hdd_init_channel_avoidance(struct hdd_context *hdd_ctx) } + ucfg_policy_mgr_init_chan_avoidance( + hdd_ctx->psoc, + (qdf_freq_t *)hdd_ctx->unsafe_channel_list, + hdd_ctx->unsafe_channel_count); } static void hdd_lte_coex_restart_sap(struct hdd_adapter *adapter,