1 /* 2 * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. 3 * 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * DOC: reg_priv_objs.h 22 * This file contains regulatory component private data structures. 23 */ 24 25 #ifndef __REG_PRIV_OBJS_H 26 #define __REG_PRIV_OBJS_H 27 28 #define reg_alert(params...) \ 29 QDF_TRACE_FATAL(QDF_MODULE_ID_REGULATORY, params) 30 #define reg_err(params...) \ 31 QDF_TRACE_ERROR(QDF_MODULE_ID_REGULATORY, params) 32 #define reg_err_rl(params...) \ 33 QDF_TRACE_ERROR_RL(QDF_MODULE_ID_REGULATORY, params) 34 #define reg_warn(params...) \ 35 QDF_TRACE_WARN(QDF_MODULE_ID_REGULATORY, params) 36 #define reg_notice(params...) \ 37 QDF_TRACE_INFO(QDF_MODULE_ID_REGULATORY, params) 38 #define reg_info(params...) \ 39 QDF_TRACE_INFO(QDF_MODULE_ID_REGULATORY, params) 40 #define reg_debug(params...) \ 41 QDF_TRACE_DEBUG(QDF_MODULE_ID_REGULATORY, params) 42 #define reg_debug_rl(params...) \ 43 QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_REGULATORY, params) 44 45 #define reg_nofl_alert(params...) \ 46 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_REGULATORY, params) 47 #define reg_nofl_err(params...) \ 48 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_REGULATORY, params) 49 #define reg_nofl_warn(params...) \ 50 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_REGULATORY, params) 51 #define reg_nofl_info(params...) \ 52 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_REGULATORY, params) 53 #define reg_nofl_debug(params...) \ 54 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_REGULATORY, params) 55 56 /** 57 * typedef reg_chan_change_callback() - Regulatory channel change callback 58 * @psoc: Pointer to psoc 59 * @pdev: Pointer to pdev 60 * @chan_list: Pointer to regulatory channel list 61 * @avoid_freq_ind: Pointer to avoid frequencies 62 * @arg: list of arguments 63 */ 64 typedef void (*reg_chan_change_callback)( 65 struct wlan_objmgr_psoc *psoc, 66 struct wlan_objmgr_pdev *pdev, 67 struct regulatory_channel *chan_list, 68 struct avoid_freq_ind_data *avoid_freq_ind, 69 void *arg); 70 71 /** 72 * struct chan_change_cbk_entry - Channel change callback entry 73 * @cbk: Callback 74 * @arg: Arguments 75 */ 76 struct chan_change_cbk_entry { 77 reg_chan_change_callback cbk; 78 void *arg; 79 }; 80 81 /** 82 * struct wlan_regulatory_psoc_priv_obj - wlan regulatory psoc private object 83 * @new_user_ctry_pending: In this array, element[phy_id] is true if any user 84 * country update is pending for pdev (phy_id), used in case of MCL. 85 * @new_init_ctry_pending: In this array, element[phy_id] is true if any user 86 * country update is pending for pdev (phy_id), used in case of WIN. 87 * @new_11d_ctry_pending: In this array, element[phy_id] is true if any 11d 88 * country update is pending for pdev (phy_id). 89 * @world_country_pending: In this array, element[phy_id] is true if any world 90 * country update is pending for pdev (phy_id). 91 * @ignore_fw_reg_offload_ind: Ignore FW reg offload indication 92 */ 93 struct wlan_regulatory_psoc_priv_obj { 94 struct mas_chan_params mas_chan_params[PSOC_MAX_PHY_REG_CAP]; 95 bool offload_enabled; 96 uint8_t num_phy; 97 char cur_country[REG_ALPHA2_LEN + 1]; 98 char def_country[REG_ALPHA2_LEN + 1]; 99 uint16_t def_country_code; 100 uint16_t def_region_domain; 101 enum country_src cc_src; 102 struct wlan_objmgr_psoc *psoc_ptr; 103 bool new_user_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 104 bool new_init_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 105 bool new_11d_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 106 bool world_country_pending[PSOC_MAX_PHY_REG_CAP]; 107 bool dfs_enabled; 108 enum band_info band_capability; 109 bool indoor_chan_enabled; 110 bool ignore_fw_reg_offload_ind; 111 bool enable_11d_supp_original; 112 bool enable_11d_supp; 113 bool is_11d_offloaded; 114 uint8_t vdev_id_for_11d_scan; 115 uint8_t master_vdev_cnt; 116 uint8_t vdev_cnt_11d; 117 uint32_t scan_11d_interval; 118 #ifdef HOST_11D_SCAN 119 bool is_host_11d_inited; 120 wlan_scan_requester scan_req_id; 121 uint32_t scan_id; 122 qdf_mc_timer_t timer; 123 #endif 124 uint8_t vdev_ids_11d[MAX_STA_VDEV_CNT]; 125 bool user_ctry_priority; 126 bool user_ctry_set; 127 struct chan_change_cbk_entry cbk_list[REG_MAX_CHAN_CHANGE_CBKS]; 128 uint8_t num_chan_change_cbks; 129 uint8_t ch_avoid_ind; 130 struct unsafe_ch_list unsafe_chan_list; 131 struct ch_avoid_ind_type avoid_freq_list; 132 enum restart_beaconing_on_ch_avoid_rule restart_beaconing; 133 struct wlan_psoc_host_hal_reg_capabilities_ext 134 reg_cap[PSOC_MAX_PHY_REG_CAP]; 135 bool force_ssc_disable_indoor_channel; 136 bool enable_srd_chan_in_master_mode; 137 bool enable_11d_in_world_mode; 138 qdf_spinlock_t cbk_list_lock; 139 }; 140 141 struct wlan_regulatory_pdev_priv_obj { 142 struct regulatory_channel cur_chan_list[NUM_CHANNELS]; 143 struct regulatory_channel mas_chan_list[NUM_CHANNELS]; 144 #ifdef DISABLE_CHANNEL_LIST 145 struct regulatory_channel cache_disable_chan_list[NUM_CHANNELS]; 146 uint32_t num_cache_channels; 147 bool disable_cached_channels; 148 #endif 149 char default_country[REG_ALPHA2_LEN + 1]; 150 uint16_t def_region_domain; 151 uint16_t def_country_code; 152 char current_country[REG_ALPHA2_LEN + 1]; 153 uint16_t reg_dmn_pair; 154 uint16_t ctry_code; 155 enum dfs_reg dfs_region; 156 uint32_t phybitmap; 157 struct wlan_objmgr_pdev *pdev_ptr; 158 uint32_t range_2g_low; 159 uint32_t range_2g_high; 160 uint32_t range_5g_low; 161 uint32_t range_5g_high; 162 bool dfs_enabled; 163 bool set_fcc_channel; 164 enum band_info band_capability; 165 bool indoor_chan_enabled; 166 bool en_chan_144; 167 uint32_t wireless_modes; 168 struct ch_avoid_ind_type freq_avoid_list; 169 bool force_ssc_disable_indoor_channel; 170 bool sap_state; 171 struct reg_rule_info reg_rules; 172 qdf_spinlock_t reg_rules_lock; 173 }; 174 175 /** 176 * reg_get_psoc_obj() - Provides the reg component object pointer 177 * @psoc: pointer to psoc object. 178 * 179 * Return: reg component object pointer 180 */ 181 struct wlan_regulatory_psoc_priv_obj *reg_get_psoc_obj( 182 struct wlan_objmgr_psoc *psoc); 183 184 /** 185 * reg_get_pdev_obj() - Provides the reg component object pointer 186 * @psoc: pointer to psoc object. 187 * 188 * Return: reg component object pointer 189 */ 190 struct wlan_regulatory_pdev_priv_obj *reg_get_pdev_obj( 191 struct wlan_objmgr_pdev *pdev); 192 193 /** 194 * wlan_regulatory_psoc_obj_created_notification() - PSOC obj create callback 195 * @psoc: PSOC object 196 * @arg_list: Variable argument list 197 * 198 * This callback is registered with object manager during initialization to 199 * get notified when the object is created. 200 * 201 * Return: Success or Failure 202 */ 203 QDF_STATUS wlan_regulatory_psoc_obj_created_notification( 204 struct wlan_objmgr_psoc *psoc, void *arg_list); 205 206 /** 207 * wlan_regulatory_psoc_obj_destroyed_notification() - PSOC obj delete callback 208 * @psoc: PSOC object 209 * @arg_list: Variable argument list 210 * 211 * This callback is registered with object manager during initialization to 212 * get notified when the object is deleted. 213 * 214 * Return: Success or Failure 215 */ 216 QDF_STATUS wlan_regulatory_psoc_obj_destroyed_notification( 217 struct wlan_objmgr_psoc *psoc, void *arg_list); 218 219 /** 220 * wlan_regulatory_pdev_obj_created_notification() - PDEV obj create callback 221 * @pdev: pdev object 222 * @arg_list: Variable argument list 223 * 224 * This callback is registered with object manager during initialization to 225 * get notified when the pdev object is created. 226 * 227 * Return: Success or Failure 228 */ 229 QDF_STATUS wlan_regulatory_pdev_obj_created_notification( 230 struct wlan_objmgr_pdev *pdev, void *arg_list); 231 232 /** 233 * wlan_regulatory_pdev_obj_destroyed_notification() - PDEV obj destroy callback 234 * @pdev: pdev object 235 * @arg_list: Variable argument list 236 * 237 * This callback is registered with object manager during initialization to 238 * get notified when the pdev object is destroyed. 239 * 240 * Return: Success or Failure 241 */ 242 QDF_STATUS wlan_regulatory_pdev_obj_destroyed_notification( 243 struct wlan_objmgr_pdev *pdev, void *arg_list); 244 #endif 245