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 * @band_capability: bitmap of bands enabled, using enum reg_wifi_band as the 95 * bit position value 96 * @ignore_fw_reg_offload_ind: Ignore FW reg offload indication 97 * @six_ghz_supported: whether 6ghz is supported 98 * @five_dot_nine_ghz_supported: whether 5.9ghz is supported 99 * (service bit WMI_SERVICE_5_DOT_9GHZ_SUPPORT) 100 * @enable_5dot9_ghz_chan_in_master_mode: 5.9 GHz channel support in 101 * master mode (ini fcc_5dot9_ghz_chan_in_master_mode) 102 * @retain_nol_across_regdmn_update: Retain the NOL list across the regdomain 103 * changes. 104 */ 105 struct wlan_regulatory_psoc_priv_obj { 106 struct mas_chan_params mas_chan_params[PSOC_MAX_PHY_REG_CAP]; 107 bool chan_list_recvd[PSOC_MAX_PHY_REG_CAP]; 108 bool offload_enabled; 109 bool six_ghz_supported; 110 bool five_dot_nine_ghz_supported; 111 uint8_t num_phy; 112 char cur_country[REG_ALPHA2_LEN + 1]; 113 char def_country[REG_ALPHA2_LEN + 1]; 114 uint16_t def_country_code; 115 uint16_t def_region_domain; 116 enum country_src cc_src; 117 struct wlan_objmgr_psoc *psoc_ptr; 118 bool new_user_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 119 bool new_init_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 120 bool new_11d_ctry_pending[PSOC_MAX_PHY_REG_CAP]; 121 bool world_country_pending[PSOC_MAX_PHY_REG_CAP]; 122 bool dfs_enabled; 123 uint32_t band_capability; 124 bool indoor_chan_enabled; 125 bool ignore_fw_reg_offload_ind; 126 bool enable_11d_supp_original; 127 bool enable_11d_supp; 128 bool is_11d_offloaded; 129 uint8_t vdev_id_for_11d_scan; 130 uint8_t master_vdev_cnt; 131 uint8_t vdev_cnt_11d; 132 uint32_t scan_11d_interval; 133 #ifdef HOST_11D_SCAN 134 bool is_host_11d_inited; 135 wlan_scan_requester scan_req_id; 136 uint32_t scan_id; 137 qdf_mc_timer_t timer; 138 #endif 139 uint8_t vdev_ids_11d[MAX_STA_VDEV_CNT]; 140 bool user_ctry_priority; 141 bool user_ctry_set; 142 struct chan_change_cbk_entry cbk_list[REG_MAX_CHAN_CHANGE_CBKS]; 143 uint8_t num_chan_change_cbks; 144 uint8_t ch_avoid_ind; 145 struct unsafe_ch_list unsafe_chan_list; 146 struct ch_avoid_ind_type avoid_freq_list; 147 enum restart_beaconing_on_ch_avoid_rule restart_beaconing; 148 struct wlan_psoc_host_hal_reg_capabilities_ext 149 reg_cap[PSOC_MAX_PHY_REG_CAP]; 150 bool force_ssc_disable_indoor_channel; 151 uint8_t enable_srd_chan_in_master_mode; 152 bool enable_11d_in_world_mode; 153 bool enable_5dot9_ghz_chan_in_master_mode; 154 qdf_spinlock_t cbk_list_lock; 155 bool retain_nol_across_regdmn_update; 156 }; 157 158 /** 159 * struct wlan_regulatory_pdev_priv_obj - wlan regulatory pdev private object 160 * @pdev_opened: whether pdev has been opened by application 161 * @band_capability: bitmap of bands enabled, using enum reg_wifi_band as the 162 * bit position value 163 * @reg_6g_superid: 6Ghz super domain id 164 * @reg_cur_6g_ap_pwr_type: 6G AP type ie VLP/SP/LPI. 165 * @reg_cur_6g_client_mobility_type: 6G client type ie Default/Subordinate. 166 * @reg_rnr_tpe_usable: Indicates whether RNR IE is applicable for current reg 167 * domain. 168 * @reg_unspecified_ap_usable: Indicates if the AP type mentioned is not part of 169 * 802.11 standard. 170 */ 171 struct wlan_regulatory_pdev_priv_obj { 172 struct regulatory_channel cur_chan_list[NUM_CHANNELS]; 173 struct regulatory_channel mas_chan_list[NUM_CHANNELS]; 174 #ifdef DISABLE_CHANNEL_LIST 175 struct regulatory_channel cache_disable_chan_list[NUM_CHANNELS]; 176 uint32_t num_cache_channels; 177 bool disable_cached_channels; 178 #endif 179 char default_country[REG_ALPHA2_LEN + 1]; 180 uint16_t def_region_domain; 181 uint16_t def_country_code; 182 char current_country[REG_ALPHA2_LEN + 1]; 183 uint16_t reg_dmn_pair; 184 uint16_t reg_6g_superid; 185 uint16_t ctry_code; 186 #ifdef DISABLE_UNII_SHARED_BANDS 187 uint8_t unii_5g_bitmap; 188 #endif 189 enum dfs_reg dfs_region; 190 uint32_t phybitmap; 191 struct wlan_objmgr_pdev *pdev_ptr; 192 qdf_freq_t range_2g_low; 193 qdf_freq_t range_2g_high; 194 qdf_freq_t range_5g_low; 195 qdf_freq_t range_5g_high; 196 bool dfs_enabled; 197 bool set_fcc_channel; 198 uint32_t band_capability; 199 bool indoor_chan_enabled; 200 bool en_chan_144; 201 uint32_t wireless_modes; 202 struct ch_avoid_ind_type freq_avoid_list; 203 bool force_ssc_disable_indoor_channel; 204 bool sap_state; 205 struct reg_rule_info reg_rules; 206 qdf_spinlock_t reg_rules_lock; 207 bool chan_list_recvd; 208 bool pdev_opened; 209 #if defined(CONFIG_BAND_6GHZ) 210 enum reg_6g_ap_type reg_cur_6g_ap_pwr_type; 211 enum reg_6g_client_type reg_cur_6g_client_mobility_type; 212 bool reg_rnr_tpe_usable; 213 bool reg_unspecified_ap_usable; 214 #endif 215 }; 216 217 /** 218 * reg_get_psoc_obj() - Provides the reg component object pointer 219 * @psoc: pointer to psoc object. 220 * 221 * Return: reg component object pointer 222 */ 223 struct wlan_regulatory_psoc_priv_obj *reg_get_psoc_obj( 224 struct wlan_objmgr_psoc *psoc); 225 226 /** 227 * reg_get_pdev_obj() - Provides the reg component object pointer 228 * @psoc: pointer to psoc object. 229 * 230 * Return: reg component object pointer 231 */ 232 struct wlan_regulatory_pdev_priv_obj *reg_get_pdev_obj( 233 struct wlan_objmgr_pdev *pdev); 234 235 /** 236 * wlan_regulatory_psoc_obj_created_notification() - PSOC obj create callback 237 * @psoc: PSOC object 238 * @arg_list: Variable argument list 239 * 240 * This callback is registered with object manager during initialization to 241 * get notified when the object is created. 242 * 243 * Return: Success or Failure 244 */ 245 QDF_STATUS wlan_regulatory_psoc_obj_created_notification( 246 struct wlan_objmgr_psoc *psoc, void *arg_list); 247 248 /** 249 * wlan_regulatory_psoc_obj_destroyed_notification() - PSOC obj delete callback 250 * @psoc: PSOC object 251 * @arg_list: Variable argument list 252 * 253 * This callback is registered with object manager during initialization to 254 * get notified when the object is deleted. 255 * 256 * Return: Success or Failure 257 */ 258 QDF_STATUS wlan_regulatory_psoc_obj_destroyed_notification( 259 struct wlan_objmgr_psoc *psoc, void *arg_list); 260 261 /** 262 * wlan_regulatory_pdev_obj_created_notification() - PDEV obj create callback 263 * @pdev: pdev object 264 * @arg_list: Variable argument list 265 * 266 * This callback is registered with object manager during initialization to 267 * get notified when the pdev object is created. 268 * 269 * Return: Success or Failure 270 */ 271 QDF_STATUS wlan_regulatory_pdev_obj_created_notification( 272 struct wlan_objmgr_pdev *pdev, void *arg_list); 273 274 /** 275 * wlan_regulatory_pdev_obj_destroyed_notification() - PDEV obj destroy callback 276 * @pdev: pdev object 277 * @arg_list: Variable argument list 278 * 279 * This callback is registered with object manager during initialization to 280 * get notified when the pdev object is destroyed. 281 * 282 * Return: Success or Failure 283 */ 284 QDF_STATUS wlan_regulatory_pdev_obj_destroyed_notification( 285 struct wlan_objmgr_pdev *pdev, void *arg_list); 286 #endif 287