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_warn(params...) \ 33 QDF_TRACE_WARN(QDF_MODULE_ID_REGULATORY, params) 34 #define reg_notice(params...) \ 35 QDF_TRACE_INFO(QDF_MODULE_ID_REGULATORY, params) 36 #define reg_info(params...) \ 37 QDF_TRACE_INFO(QDF_MODULE_ID_REGULATORY, params) 38 #define reg_debug(params...) \ 39 QDF_TRACE_DEBUG(QDF_MODULE_ID_REGULATORY, params) 40 #define reg_debug_rl(params...) \ 41 QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_REGULATORY, params) 42 43 #define reg_nofl_alert(params...) \ 44 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_REGULATORY, params) 45 #define reg_nofl_err(params...) \ 46 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_REGULATORY, params) 47 #define reg_nofl_warn(params...) \ 48 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_REGULATORY, params) 49 #define reg_nofl_info(params...) \ 50 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_REGULATORY, params) 51 #define reg_nofl_debug(params...) \ 52 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_REGULATORY, params) 53 54 /** 55 * typedef reg_chan_change_callback() - Regulatory channel change callback 56 * @psoc: Pointer to psoc 57 * @pdev: Pointer to pdev 58 * @chan_list: Pointer to regulatory channel list 59 * @avoid_freq_ind: Pointer to avoid frequencies 60 * @arg: list of arguments 61 */ 62 typedef void (*reg_chan_change_callback)( 63 struct wlan_objmgr_psoc *psoc, 64 struct wlan_objmgr_pdev *pdev, 65 struct regulatory_channel *chan_list, 66 struct avoid_freq_ind_data *avoid_freq_ind, 67 void *arg); 68 69 /** 70 * struct chan_change_cbk_entry - Channel change callback entry 71 * @cbk: Callback 72 * @arg: Arguments 73 */ 74 struct chan_change_cbk_entry { 75 reg_chan_change_callback cbk; 76 void *arg; 77 }; 78 79 /** 80 * struct wlan_regulatory_psoc_priv_obj - wlan regulatory psoc private object 81 * @new_user_ctry_pending: In this array, element[phy_id] is true if any user 82 * country update is pending for pdev (phy_id), used in case of MCL. 83 * @new_init_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 WIN. 85 * @new_11d_ctry_pending: In this array, element[phy_id] is true if any 11d 86 * country update is pending for pdev (phy_id). 87 * @world_country_pending: In this array, element[phy_id] is true if any world 88 * country update is pending for pdev (phy_id). 89 * @def_pdev_id: Default pdev id, used in case of MCL 90 */ 91 struct wlan_regulatory_psoc_priv_obj { 92 struct mas_chan_params mas_chan_params[PSOC_MAX_PHY_REG_CAP]; 93 bool offload_enabled; 94 uint8_t num_phy; 95 char cur_country[REG_ALPHA2_LEN + 1]; 96 char def_country[REG_ALPHA2_LEN + 1]; 97 uint16_t def_country_code; 98 uint16_t def_region_domain; 99 enum country_src cc_src; 100 struct wlan_objmgr_psoc *psoc_ptr; 101 bool new_user_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 102 bool new_init_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 103 bool new_11d_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 104 bool world_country_pending[PSOC_MAX_PHY_REG_CAP]; 105 bool dfs_enabled; 106 enum band_info band_capability; 107 bool indoor_chan_enabled; 108 bool enable_11d_supp_original; 109 bool enable_11d_supp; 110 bool is_11d_offloaded; 111 uint8_t vdev_id_for_11d_scan; 112 uint8_t master_vdev_cnt; 113 uint8_t vdev_cnt_11d; 114 uint32_t scan_11d_interval; 115 #ifdef HOST_11D_SCAN 116 bool is_host_11d_inited; 117 wlan_scan_requester scan_req_id; 118 uint32_t scan_id; 119 qdf_mc_timer_t timer; 120 #endif 121 uint8_t vdev_ids_11d[MAX_STA_VDEV_CNT]; 122 bool user_ctry_priority; 123 bool user_ctry_set; 124 struct chan_change_cbk_entry cbk_list[REG_MAX_CHAN_CHANGE_CBKS]; 125 uint8_t num_chan_change_cbks; 126 uint8_t ch_avoid_ind; 127 struct unsafe_ch_list unsafe_chan_list; 128 struct ch_avoid_ind_type avoid_freq_list; 129 enum restart_beaconing_on_ch_avoid_rule restart_beaconing; 130 struct wlan_psoc_host_hal_reg_capabilities_ext 131 reg_cap[PSOC_MAX_PHY_REG_CAP]; 132 bool force_ssc_disable_indoor_channel; 133 bool enable_srd_chan_in_master_mode; 134 bool enable_11d_in_world_mode; 135 int8_t def_pdev_id; 136 qdf_spinlock_t cbk_list_lock; 137 }; 138 139 struct wlan_regulatory_pdev_priv_obj { 140 struct regulatory_channel cur_chan_list[NUM_CHANNELS]; 141 struct regulatory_channel mas_chan_list[NUM_CHANNELS]; 142 #ifdef DISABLE_CHANNEL_LIST 143 struct regulatory_channel cache_disable_chan_list[NUM_CHANNELS]; 144 uint32_t num_cache_channels; 145 bool disable_cached_channels; 146 #endif 147 char default_country[REG_ALPHA2_LEN + 1]; 148 uint16_t def_region_domain; 149 uint16_t def_country_code; 150 char current_country[REG_ALPHA2_LEN + 1]; 151 uint16_t reg_dmn_pair; 152 uint16_t ctry_code; 153 enum dfs_reg dfs_region; 154 uint32_t phybitmap; 155 struct wlan_objmgr_pdev *pdev_ptr; 156 uint32_t range_2g_low; 157 uint32_t range_2g_high; 158 uint32_t range_5g_low; 159 uint32_t range_5g_high; 160 bool dfs_enabled; 161 bool set_fcc_channel; 162 enum band_info band_capability; 163 bool indoor_chan_enabled; 164 bool en_chan_144; 165 uint32_t wireless_modes; 166 struct ch_avoid_ind_type freq_avoid_list; 167 bool force_ssc_disable_indoor_channel; 168 bool sap_state; 169 struct reg_rule_info reg_rules; 170 qdf_spinlock_t reg_rules_lock; 171 }; 172 173 /** 174 * reg_get_psoc_obj() - Provides the reg component object pointer 175 * @psoc: pointer to psoc object. 176 * 177 * Return: reg component object pointer 178 */ 179 struct wlan_regulatory_psoc_priv_obj *reg_get_psoc_obj( 180 struct wlan_objmgr_psoc *psoc); 181 182 /** 183 * reg_get_pdev_obj() - Provides the reg component object pointer 184 * @psoc: pointer to psoc object. 185 * 186 * Return: reg component object pointer 187 */ 188 struct wlan_regulatory_pdev_priv_obj *reg_get_pdev_obj( 189 struct wlan_objmgr_pdev *pdev); 190 191 /** 192 * wlan_regulatory_psoc_obj_created_notification() - PSOC obj create callback 193 * @psoc: PSOC object 194 * @arg_list: Variable argument list 195 * 196 * This callback is registered with object manager during initialization to 197 * get notified when the object is created. 198 * 199 * Return: Success or Failure 200 */ 201 QDF_STATUS wlan_regulatory_psoc_obj_created_notification( 202 struct wlan_objmgr_psoc *psoc, void *arg_list); 203 204 /** 205 * wlan_regulatory_psoc_obj_destroyed_notification() - PSOC obj delete callback 206 * @psoc: PSOC object 207 * @arg_list: Variable argument list 208 * 209 * This callback is registered with object manager during initialization to 210 * get notified when the object is deleted. 211 * 212 * Return: Success or Failure 213 */ 214 QDF_STATUS wlan_regulatory_psoc_obj_destroyed_notification( 215 struct wlan_objmgr_psoc *psoc, void *arg_list); 216 217 /** 218 * wlan_regulatory_pdev_obj_created_notification() - PDEV obj create callback 219 * @pdev: pdev object 220 * @arg_list: Variable argument list 221 * 222 * This callback is registered with object manager during initialization to 223 * get notified when the pdev object is created. 224 * 225 * Return: Success or Failure 226 */ 227 QDF_STATUS wlan_regulatory_pdev_obj_created_notification( 228 struct wlan_objmgr_pdev *pdev, void *arg_list); 229 230 /** 231 * wlan_regulatory_pdev_obj_destroyed_notification() - PDEV obj destroy callback 232 * @pdev: pdev object 233 * @arg_list: Variable argument list 234 * 235 * This callback is registered with object manager during initialization to 236 * get notified when the pdev object is destroyed. 237 * 238 * Return: Success or Failure 239 */ 240 QDF_STATUS wlan_regulatory_pdev_obj_destroyed_notification( 241 struct wlan_objmgr_pdev *pdev, void *arg_list); 242 #endif 243