diff --git a/umac/regulatory/core/src/reg_priv.h b/umac/regulatory/core/src/reg_priv.h index 7f20ba8f83..ffa2c75256 100644 --- a/umac/regulatory/core/src/reg_priv.h +++ b/umac/regulatory/core/src/reg_priv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -74,6 +74,8 @@ struct wlan_regulatory_psoc_priv_obj { struct unsafe_ch_list unsafe_chan_list; struct ch_avoid_ind_type avoid_freq_list; enum restart_beaconing_on_ch_avoid_rule restart_beaconing; + struct wlan_psoc_host_hal_reg_capabilities_ext + reg_cap[PSOC_MAX_PHY_REG_CAP]; qdf_spinlock_t cbk_list_lock; }; diff --git a/umac/regulatory/core/src/reg_services.c b/umac/regulatory/core/src/reg_services.c index 8f3fa7eac0..17578f4c20 100644 --- a/umac/regulatory/core/src/reg_services.c +++ b/umac/regulatory/core/src/reg_services.c @@ -2201,8 +2201,8 @@ static void reg_init_pdev_mas_chan_list(struct wlan_regulatory_pdev_priv_obj } -static void reg_compute_pdev_current_chan_list(struct wlan_regulatory_pdev_priv_obj - *pdev_priv_obj) +static void reg_compute_pdev_current_chan_list( + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj) { qdf_mem_copy(pdev_priv_obj->cur_chan_list, pdev_priv_obj->mas_chan_list, @@ -3027,7 +3027,7 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification( psoc_priv_obj->indoor_chan_enabled; pdev_priv_obj->en_chan_144 = true; - reg_cap_ptr = parent_psoc->ext_service_param.reg_cap; + reg_cap_ptr = psoc_priv_obj->reg_cap; for (cnt = 0; cnt < PSOC_MAX_PHY_REG_CAP; cnt++) { if (reg_cap_ptr == NULL) { @@ -3775,9 +3775,9 @@ static QDF_STATUS reg_process_ch_avoid_freq(struct wlan_objmgr_psoc *psoc, start_ch_idx = INVALID_CHANNEL; end_ch_idx = INVALID_CHANNEL; start_channel = reg_freq_to_chan(pdev, - psoc_priv_obj->avoid_freq_list.avoid_freq_range[i].start_freq); + psoc_priv_obj->avoid_freq_list.avoid_freq_range[i].start_freq); end_channel = reg_freq_to_chan(pdev, - psoc_priv_obj->avoid_freq_list.avoid_freq_range[i].end_freq); + psoc_priv_obj->avoid_freq_list.avoid_freq_range[i].end_freq); reg_debug("start: freq %d, ch %d, end: freq %d, ch %d", psoc_priv_obj->avoid_freq_list.avoid_freq_range[i].start_freq, start_channel, @@ -3792,19 +3792,19 @@ static QDF_STATUS reg_process_ch_avoid_freq(struct wlan_objmgr_psoc *psoc, for (ch_loop = 0; ch_loop < NUM_CHANNELS; ch_loop++) { - if (REG_CH_TO_FREQ(ch_loop) >= psoc_priv_obj->avoid_freq_list. - avoid_freq_range[i].start_freq) { + if (REG_CH_TO_FREQ(ch_loop) >= + psoc_priv_obj->avoid_freq_list.avoid_freq_range[i].start_freq) { start_ch_idx = ch_loop; break; } } for (ch_loop = 0; ch_loop < NUM_CHANNELS; ch_loop++) { - if (REG_CH_TO_FREQ(ch_loop) >= psoc_priv_obj->avoid_freq_list. - avoid_freq_range[i].end_freq) { + if (REG_CH_TO_FREQ(ch_loop) >= + psoc_priv_obj->avoid_freq_list.avoid_freq_range[i].end_freq) { end_ch_idx = ch_loop; - if (REG_CH_TO_FREQ(ch_loop) > psoc_priv_obj->avoid_freq_list. - avoid_freq_range[i].end_freq) + if (REG_CH_TO_FREQ(ch_loop) > + psoc_priv_obj->avoid_freq_list.avoid_freq_range[i].end_freq) end_ch_idx--; break; } @@ -4120,3 +4120,45 @@ bool reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev) return pdev_priv_obj->en_chan_144; } + +struct wlan_psoc_host_hal_reg_capabilities_ext *reg_get_hal_reg_cap( + struct wlan_objmgr_psoc *psoc) +{ + struct wlan_regulatory_psoc_priv_obj *soc_reg; + + soc_reg = reg_get_psoc_obj(psoc); + + if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) { + reg_err("psoc reg component is NULL"); + return NULL; + } + + return soc_reg->reg_cap; +} + +QDF_STATUS reg_set_hal_reg_cap(struct wlan_objmgr_psoc *psoc, + struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap, + uint16_t phy_cnt) +{ + struct wlan_regulatory_psoc_priv_obj *soc_reg; + + soc_reg = reg_get_psoc_obj(psoc); + + if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) { + reg_err("psoc reg component is NULL"); + return QDF_STATUS_E_FAILURE; + } + + if (phy_cnt > PSOC_MAX_PHY_REG_CAP) { + reg_err("phy cnt:%d is more than %d", phy_cnt, + PSOC_MAX_PHY_REG_CAP); + return QDF_STATUS_E_FAILURE; + } + + qdf_mem_copy(soc_reg->reg_cap, reg_cap, + phy_cnt * + sizeof(struct wlan_psoc_host_hal_reg_capabilities_ext)); + + return QDF_STATUS_SUCCESS; +} + diff --git a/umac/regulatory/core/src/reg_services.h b/umac/regulatory/core/src/reg_services.h index cbbb388550..3ac25c1e42 100644 --- a/umac/regulatory/core/src/reg_services.h +++ b/umac/regulatory/core/src/reg_services.h @@ -435,4 +435,26 @@ QDF_STATUS reg_process_ch_avoid_event(struct wlan_objmgr_psoc *psoc, */ QDF_STATUS reg_send_scheduler_msg_sb(struct wlan_objmgr_psoc *psoc, struct wlan_objmgr_pdev *pdev); + +/** + * reg_get_hal_reg_cap() - Get HAL REG capabilities + * @psoc: psoc for country information + * + * Return: hal reg cap pointer + */ +struct wlan_psoc_host_hal_reg_capabilities_ext *reg_get_hal_reg_cap( + struct wlan_objmgr_psoc *psoc); + +/** + * reg_set_hal_reg_cap() - Set HAL REG capabilities + * @psoc: psoc for country information + * @reg_cap: Regulatory caps pointer + * @phy_cnt: number of phy + * + * Return: hal reg cap pointer + */ +QDF_STATUS reg_set_hal_reg_cap(struct wlan_objmgr_psoc *psoc, + struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap, + uint16_t phy_cnt); + #endif diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h index 9690991ba6..219ada42bd 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h @@ -254,4 +254,25 @@ QDF_STATUS ucfg_reg_11d_vdev_delete_update(struct wlan_objmgr_vdev *vdev); * Return: QDF_STATUS */ QDF_STATUS ucfg_reg_11d_vdev_created_update(struct wlan_objmgr_vdev *vdev); + +/** + * ucfg_reg_get_hal_reg_cap() - return hal reg cap + * @psoc: psoc ptr + * + * Return: ptr to wlan_psoc_host_hal_reg_capabilities_ext + */ +struct wlan_psoc_host_hal_reg_capabilities_ext *ucfg_reg_get_hal_reg_cap( + struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_reg_set_hal_reg_cap() - update hal reg cap + * @psoc: psoc ptr + * @reg_cap: Regulatory cap array + * @phy_cnt: Number of phy + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_set_hal_reg_cap(struct wlan_objmgr_psoc *psoc, + struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap, + uint16_t phy_cnt); #endif diff --git a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c index 5669242b29..0997e0c56e 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c @@ -24,6 +24,7 @@ #include #include "../../core/src/reg_services.h" +#include QDF_STATUS ucfg_reg_register_event_handler(uint8_t vdev_id, reg_event_cb cb, void *arg) @@ -230,3 +231,19 @@ QDF_STATUS ucfg_reg_11d_vdev_created_update(struct wlan_objmgr_vdev *vdev) { return reg_11d_vdev_created_update(vdev); } + +struct wlan_psoc_host_hal_reg_capabilities_ext *ucfg_reg_get_hal_reg_cap( + struct wlan_objmgr_psoc *psoc) +{ + return reg_get_hal_reg_cap(psoc); +} +qdf_export_symbol(ucfg_reg_get_hal_reg_cap); + +QDF_STATUS ucfg_reg_set_hal_reg_cap(struct wlan_objmgr_psoc *psoc, + struct wlan_psoc_host_hal_reg_capabilities_ext *hal_reg_cap, + uint16_t phy_cnt) + +{ + return reg_set_hal_reg_cap(psoc, hal_reg_cap, phy_cnt); +} +qdf_export_symbol(ucfg_reg_set_hal_reg_cap);