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 * @chan_list_recvd: whether channel list has been received 84 * @new_user_ctry_pending: In this array, element[phy_id] is true if any user 85 * country update is pending for pdev (phy_id), used in case of MCL. 86 * @new_init_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 WIN. 88 * @new_11d_ctry_pending: In this array, element[phy_id] is true if any 11d 89 * country update is pending for pdev (phy_id). 90 * @world_country_pending: In this array, element[phy_id] is true if any world 91 * country update is pending for pdev (phy_id). 92 * @ignore_fw_reg_offload_ind: Ignore FW reg offload indication 93 * @six_ghz_supported: whether 6ghz is supported 94 */ 95 struct wlan_regulatory_psoc_priv_obj { 96 struct mas_chan_params mas_chan_params[PSOC_MAX_PHY_REG_CAP]; 97 bool chan_list_recvd[PSOC_MAX_PHY_REG_CAP]; 98 bool offload_enabled; 99 bool six_ghz_supported; 100 uint8_t num_phy; 101 char cur_country[REG_ALPHA2_LEN + 1]; 102 char def_country[REG_ALPHA2_LEN + 1]; 103 uint16_t def_country_code; 104 uint16_t def_region_domain; 105 enum country_src cc_src; 106 struct wlan_objmgr_psoc *psoc_ptr; 107 bool new_user_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 108 bool new_init_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 109 bool new_11d_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 110 bool world_country_pending[PSOC_MAX_PHY_REG_CAP]; 111 bool dfs_enabled; 112 enum band_info band_capability; 113 bool indoor_chan_enabled; 114 bool ignore_fw_reg_offload_ind; 115 bool enable_11d_supp_original; 116 bool enable_11d_supp; 117 bool is_11d_offloaded; 118 uint8_t vdev_id_for_11d_scan; 119 uint8_t master_vdev_cnt; 120 uint8_t vdev_cnt_11d; 121 uint32_t scan_11d_interval; 122 #ifdef HOST_11D_SCAN 123 bool is_host_11d_inited; 124 wlan_scan_requester scan_req_id; 125 uint32_t scan_id; 126 qdf_mc_timer_t timer; 127 #endif 128 uint8_t vdev_ids_11d[MAX_STA_VDEV_CNT]; 129 bool user_ctry_priority; 130 bool user_ctry_set; 131 struct chan_change_cbk_entry cbk_list[REG_MAX_CHAN_CHANGE_CBKS]; 132 uint8_t num_chan_change_cbks; 133 uint8_t ch_avoid_ind; 134 struct unsafe_ch_list unsafe_chan_list; 135 struct ch_avoid_ind_type avoid_freq_list; 136 enum restart_beaconing_on_ch_avoid_rule restart_beaconing; 137 struct wlan_psoc_host_hal_reg_capabilities_ext 138 reg_cap[PSOC_MAX_PHY_REG_CAP]; 139 bool force_ssc_disable_indoor_channel; 140 bool enable_srd_chan_in_master_mode; 141 bool enable_11d_in_world_mode; 142 qdf_spinlock_t cbk_list_lock; 143 }; 144 145 struct wlan_regulatory_pdev_priv_obj { 146 struct regulatory_channel cur_chan_list[NUM_CHANNELS]; 147 struct regulatory_channel mas_chan_list[NUM_CHANNELS]; 148 #ifdef DISABLE_CHANNEL_LIST 149 struct regulatory_channel cache_disable_chan_list[NUM_CHANNELS]; 150 uint32_t num_cache_channels; 151 bool disable_cached_channels; 152 #endif 153 char default_country[REG_ALPHA2_LEN + 1]; 154 uint16_t def_region_domain; 155 uint16_t def_country_code; 156 char current_country[REG_ALPHA2_LEN + 1]; 157 uint16_t reg_dmn_pair; 158 uint16_t ctry_code; 159 #ifdef DISABLE_UNII_SHARED_BANDS 160 uint8_t unii_5g_bitmap; 161 #endif 162 enum dfs_reg dfs_region; 163 uint32_t phybitmap; 164 struct wlan_objmgr_pdev *pdev_ptr; 165 qdf_freq_t range_2g_low; 166 qdf_freq_t range_2g_high; 167 qdf_freq_t range_5g_low; 168 qdf_freq_t range_5g_high; 169 bool dfs_enabled; 170 bool set_fcc_channel; 171 enum band_info band_capability; 172 bool indoor_chan_enabled; 173 bool en_chan_144; 174 uint32_t wireless_modes; 175 struct ch_avoid_ind_type freq_avoid_list; 176 bool force_ssc_disable_indoor_channel; 177 bool sap_state; 178 struct reg_rule_info reg_rules; 179 qdf_spinlock_t reg_rules_lock; 180 bool chan_list_recvd; 181 }; 182 183 /** 184 * reg_get_psoc_obj() - Provides the reg component object pointer 185 * @psoc: pointer to psoc object. 186 * 187 * Return: reg component object pointer 188 */ 189 struct wlan_regulatory_psoc_priv_obj *reg_get_psoc_obj( 190 struct wlan_objmgr_psoc *psoc); 191 192 /** 193 * reg_get_pdev_obj() - Provides the reg component object pointer 194 * @psoc: pointer to psoc object. 195 * 196 * Return: reg component object pointer 197 */ 198 struct wlan_regulatory_pdev_priv_obj *reg_get_pdev_obj( 199 struct wlan_objmgr_pdev *pdev); 200 201 /** 202 * wlan_regulatory_psoc_obj_created_notification() - PSOC obj create callback 203 * @psoc: PSOC object 204 * @arg_list: Variable argument list 205 * 206 * This callback is registered with object manager during initialization to 207 * get notified when the object is created. 208 * 209 * Return: Success or Failure 210 */ 211 QDF_STATUS wlan_regulatory_psoc_obj_created_notification( 212 struct wlan_objmgr_psoc *psoc, void *arg_list); 213 214 /** 215 * wlan_regulatory_psoc_obj_destroyed_notification() - PSOC obj delete callback 216 * @psoc: PSOC object 217 * @arg_list: Variable argument list 218 * 219 * This callback is registered with object manager during initialization to 220 * get notified when the object is deleted. 221 * 222 * Return: Success or Failure 223 */ 224 QDF_STATUS wlan_regulatory_psoc_obj_destroyed_notification( 225 struct wlan_objmgr_psoc *psoc, void *arg_list); 226 227 /** 228 * wlan_regulatory_pdev_obj_created_notification() - PDEV obj create callback 229 * @pdev: pdev object 230 * @arg_list: Variable argument list 231 * 232 * This callback is registered with object manager during initialization to 233 * get notified when the pdev object is created. 234 * 235 * Return: Success or Failure 236 */ 237 QDF_STATUS wlan_regulatory_pdev_obj_created_notification( 238 struct wlan_objmgr_pdev *pdev, void *arg_list); 239 240 /** 241 * wlan_regulatory_pdev_obj_destroyed_notification() - PDEV obj destroy callback 242 * @pdev: pdev object 243 * @arg_list: Variable argument list 244 * 245 * This callback is registered with object manager during initialization to 246 * get notified when the pdev object is destroyed. 247 * 248 * Return: Success or Failure 249 */ 250 QDF_STATUS wlan_regulatory_pdev_obj_destroyed_notification( 251 struct wlan_objmgr_pdev *pdev, void *arg_list); 252 #endif 253