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