Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2005-2011 Atheros Communications Inc. |
| 3 | * Copyright (c) 2011-2013 Qualcomm Atheros, Inc. |
| 4 | * |
| 5 | * Permission to use, copy, modify, and/or distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above |
| 7 | * copyright notice and this permission notice appear in all copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | */ |
| 17 | |
| 18 | #ifndef _CORE_H_ |
| 19 | #define _CORE_H_ |
| 20 | |
| 21 | #include <linux/completion.h> |
| 22 | #include <linux/if_ether.h> |
| 23 | #include <linux/types.h> |
| 24 | #include <linux/pci.h> |
| 25 | |
Michal Kazior | edb8236 | 2013-07-05 16:15:14 +0300 | [diff] [blame] | 26 | #include "htt.h" |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 27 | #include "htc.h" |
| 28 | #include "hw.h" |
| 29 | #include "targaddrs.h" |
| 30 | #include "wmi.h" |
| 31 | #include "../ath.h" |
| 32 | #include "../regd.h" |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 33 | #include "../dfs_pattern_detector.h" |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 34 | |
| 35 | #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB) |
| 36 | #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) |
| 37 | #define WO(_f) ((_f##_OFFSET) >> 2) |
| 38 | |
| 39 | #define ATH10K_SCAN_ID 0 |
| 40 | #define WMI_READY_TIMEOUT (5 * HZ) |
| 41 | #define ATH10K_FLUSH_TIMEOUT_HZ (5*HZ) |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 42 | #define ATH10K_NUM_CHANS 38 |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 43 | |
| 44 | /* Antenna noise floor */ |
| 45 | #define ATH10K_DEFAULT_NOISE_FLOOR -95 |
| 46 | |
Bartosz Markowski | 7109861 | 2013-11-14 09:01:15 +0100 | [diff] [blame] | 47 | #define ATH10K_MAX_NUM_MGMT_PENDING 128 |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 48 | |
Kalle Valo | 5a13e76 | 2014-01-20 11:01:46 +0200 | [diff] [blame] | 49 | /* number of failed packets */ |
| 50 | #define ATH10K_KICKOUT_THRESHOLD 50 |
| 51 | |
| 52 | /* |
| 53 | * Use insanely high numbers to make sure that the firmware implementation |
| 54 | * won't start, we have the same functionality already in hostapd. Unit |
| 55 | * is seconds. |
| 56 | */ |
| 57 | #define ATH10K_KEEPALIVE_MIN_IDLE 3747 |
| 58 | #define ATH10K_KEEPALIVE_MAX_IDLE 3895 |
| 59 | #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900 |
| 60 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 61 | struct ath10k; |
| 62 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 63 | struct ath10k_skb_cb { |
| 64 | dma_addr_t paddr; |
| 65 | bool is_mapped; |
| 66 | bool is_aborted; |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 67 | u8 vdev_id; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 68 | |
| 69 | struct { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 70 | u8 tid; |
| 71 | bool is_offchan; |
Michal Kazior | 1f8bb15 | 2013-09-18 14:43:22 +0200 | [diff] [blame] | 72 | |
| 73 | u8 frag_len; |
| 74 | u8 pad_len; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 75 | } __packed htt; |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame^] | 76 | |
| 77 | struct { |
| 78 | bool dtim_zero; |
| 79 | bool deliver_cab; |
| 80 | } bcn; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 81 | } __packed; |
| 82 | |
| 83 | static inline struct ath10k_skb_cb *ATH10K_SKB_CB(struct sk_buff *skb) |
| 84 | { |
| 85 | BUILD_BUG_ON(sizeof(struct ath10k_skb_cb) > |
| 86 | IEEE80211_TX_INFO_DRIVER_DATA_SIZE); |
| 87 | return (struct ath10k_skb_cb *)&IEEE80211_SKB_CB(skb)->driver_data; |
| 88 | } |
| 89 | |
| 90 | static inline int ath10k_skb_map(struct device *dev, struct sk_buff *skb) |
| 91 | { |
| 92 | if (ATH10K_SKB_CB(skb)->is_mapped) |
| 93 | return -EINVAL; |
| 94 | |
| 95 | ATH10K_SKB_CB(skb)->paddr = dma_map_single(dev, skb->data, skb->len, |
| 96 | DMA_TO_DEVICE); |
| 97 | |
| 98 | if (unlikely(dma_mapping_error(dev, ATH10K_SKB_CB(skb)->paddr))) |
| 99 | return -EIO; |
| 100 | |
| 101 | ATH10K_SKB_CB(skb)->is_mapped = true; |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | static inline int ath10k_skb_unmap(struct device *dev, struct sk_buff *skb) |
| 106 | { |
| 107 | if (!ATH10K_SKB_CB(skb)->is_mapped) |
| 108 | return -EINVAL; |
| 109 | |
| 110 | dma_unmap_single(dev, ATH10K_SKB_CB(skb)->paddr, skb->len, |
| 111 | DMA_TO_DEVICE); |
| 112 | ATH10K_SKB_CB(skb)->is_mapped = false; |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | static inline u32 host_interest_item_address(u32 item_offset) |
| 117 | { |
| 118 | return QCA988X_HOST_INTEREST_ADDRESS + item_offset; |
| 119 | } |
| 120 | |
| 121 | struct ath10k_bmi { |
| 122 | bool done_sent; |
| 123 | }; |
| 124 | |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 125 | #define ATH10K_MAX_MEM_REQS 16 |
| 126 | |
| 127 | struct ath10k_mem_chunk { |
| 128 | void *vaddr; |
| 129 | dma_addr_t paddr; |
| 130 | u32 len; |
| 131 | u32 req_id; |
| 132 | }; |
| 133 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 134 | struct ath10k_wmi { |
| 135 | enum ath10k_htc_ep_id eid; |
| 136 | struct completion service_ready; |
| 137 | struct completion unified_ready; |
Michal Kazior | be8b394 | 2013-09-13 14:16:54 +0200 | [diff] [blame] | 138 | wait_queue_head_t tx_credits_wq; |
Bartosz Markowski | ce42870 | 2013-09-26 17:47:05 +0200 | [diff] [blame] | 139 | struct wmi_cmd_map *cmd; |
Bartosz Markowski | 6d1506e | 2013-09-26 17:47:15 +0200 | [diff] [blame] | 140 | struct wmi_vdev_param_map *vdev_param; |
Bartosz Markowski | 226a339 | 2013-09-26 17:47:16 +0200 | [diff] [blame] | 141 | struct wmi_pdev_param_map *pdev_param; |
Bartosz Markowski | b3effe6 | 2013-09-26 17:47:11 +0200 | [diff] [blame] | 142 | |
| 143 | u32 num_mem_chunks; |
| 144 | struct ath10k_mem_chunk mem_chunks[ATH10K_MAX_MEM_REQS]; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 145 | }; |
| 146 | |
| 147 | struct ath10k_peer_stat { |
| 148 | u8 peer_macaddr[ETH_ALEN]; |
| 149 | u32 peer_rssi; |
| 150 | u32 peer_tx_rate; |
| 151 | }; |
| 152 | |
| 153 | struct ath10k_target_stats { |
| 154 | /* PDEV stats */ |
| 155 | s32 ch_noise_floor; |
| 156 | u32 tx_frame_count; |
| 157 | u32 rx_frame_count; |
| 158 | u32 rx_clear_count; |
| 159 | u32 cycle_count; |
| 160 | u32 phy_err_count; |
| 161 | u32 chan_tx_power; |
| 162 | |
| 163 | /* PDEV TX stats */ |
| 164 | s32 comp_queued; |
| 165 | s32 comp_delivered; |
| 166 | s32 msdu_enqued; |
| 167 | s32 mpdu_enqued; |
| 168 | s32 wmm_drop; |
| 169 | s32 local_enqued; |
| 170 | s32 local_freed; |
| 171 | s32 hw_queued; |
| 172 | s32 hw_reaped; |
| 173 | s32 underrun; |
| 174 | s32 tx_abort; |
| 175 | s32 mpdus_requed; |
| 176 | u32 tx_ko; |
| 177 | u32 data_rc; |
| 178 | u32 self_triggers; |
| 179 | u32 sw_retry_failure; |
| 180 | u32 illgl_rate_phy_err; |
| 181 | u32 pdev_cont_xretry; |
| 182 | u32 pdev_tx_timeout; |
| 183 | u32 pdev_resets; |
| 184 | u32 phy_underrun; |
| 185 | u32 txop_ovf; |
| 186 | |
| 187 | /* PDEV RX stats */ |
| 188 | s32 mid_ppdu_route_change; |
| 189 | s32 status_rcvd; |
| 190 | s32 r0_frags; |
| 191 | s32 r1_frags; |
| 192 | s32 r2_frags; |
| 193 | s32 r3_frags; |
| 194 | s32 htt_msdus; |
| 195 | s32 htt_mpdus; |
| 196 | s32 loc_msdus; |
| 197 | s32 loc_mpdus; |
| 198 | s32 oversize_amsdu; |
| 199 | s32 phy_errs; |
| 200 | s32 phy_err_drop; |
| 201 | s32 mpdu_errs; |
| 202 | |
| 203 | /* VDEV STATS */ |
| 204 | |
| 205 | /* PEER STATS */ |
| 206 | u8 peers; |
| 207 | struct ath10k_peer_stat peer_stat[TARGET_NUM_PEERS]; |
| 208 | |
| 209 | /* TODO: Beacon filter stats */ |
| 210 | |
| 211 | }; |
| 212 | |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 213 | struct ath10k_dfs_stats { |
| 214 | u32 phy_errors; |
| 215 | u32 pulses_total; |
| 216 | u32 pulses_detected; |
| 217 | u32 pulses_discarded; |
| 218 | u32 radar_detected; |
| 219 | }; |
| 220 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 221 | #define ATH10K_MAX_NUM_PEER_IDS (1 << 11) /* htt rx_desc limit */ |
| 222 | |
| 223 | struct ath10k_peer { |
| 224 | struct list_head list; |
| 225 | int vdev_id; |
| 226 | u8 addr[ETH_ALEN]; |
| 227 | DECLARE_BITMAP(peer_ids, ATH10K_MAX_NUM_PEER_IDS); |
| 228 | struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1]; |
| 229 | }; |
| 230 | |
| 231 | #define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5*HZ) |
| 232 | |
| 233 | struct ath10k_vif { |
Michal Kazior | 0579119 | 2013-10-16 15:44:45 +0300 | [diff] [blame] | 234 | struct list_head list; |
| 235 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 236 | u32 vdev_id; |
| 237 | enum wmi_vdev_type vdev_type; |
| 238 | enum wmi_vdev_subtype vdev_subtype; |
| 239 | u32 beacon_interval; |
| 240 | u32 dtim_period; |
Michal Kazior | ed54388 | 2013-09-13 14:16:56 +0200 | [diff] [blame] | 241 | struct sk_buff *beacon; |
Michal Kazior | 748afc4 | 2014-01-23 12:48:21 +0100 | [diff] [blame^] | 242 | /* protected by data_lock */ |
| 243 | bool beacon_sent; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 244 | |
| 245 | struct ath10k *ar; |
| 246 | struct ieee80211_vif *vif; |
| 247 | |
Michal Kazior | c930f74 | 2014-01-23 11:38:25 +0100 | [diff] [blame] | 248 | bool is_started; |
| 249 | bool is_up; |
| 250 | u32 aid; |
| 251 | u8 bssid[ETH_ALEN]; |
| 252 | |
Michal Kazior | cc4827b | 2013-10-16 15:44:45 +0300 | [diff] [blame] | 253 | struct work_struct wep_key_work; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 254 | struct ieee80211_key_conf *wep_keys[WMI_MAX_KEY_INDEX + 1]; |
Michal Kazior | cc4827b | 2013-10-16 15:44:45 +0300 | [diff] [blame] | 255 | u8 def_wep_key_idx; |
| 256 | u8 def_wep_key_newidx; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 257 | |
| 258 | u16 tx_seq_no; |
| 259 | |
| 260 | union { |
| 261 | struct { |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 262 | u32 uapsd; |
| 263 | } sta; |
| 264 | struct { |
| 265 | /* 127 stations; wmi limit */ |
| 266 | u8 tim_bitmap[16]; |
| 267 | u8 tim_len; |
| 268 | u32 ssid_len; |
| 269 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
| 270 | bool hidden_ssid; |
| 271 | /* P2P_IE with NoA attribute for P2P_GO case */ |
| 272 | u32 noa_len; |
| 273 | u8 *noa_data; |
| 274 | } ap; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 275 | } u; |
Janusz Dziedzic | 51ab1a0 | 2014-01-08 09:08:33 +0100 | [diff] [blame] | 276 | |
| 277 | u8 fixed_rate; |
| 278 | u8 fixed_nss; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 279 | }; |
| 280 | |
| 281 | struct ath10k_vif_iter { |
| 282 | u32 vdev_id; |
| 283 | struct ath10k_vif *arvif; |
| 284 | }; |
| 285 | |
| 286 | struct ath10k_debug { |
| 287 | struct dentry *debugfs_phy; |
| 288 | |
| 289 | struct ath10k_target_stats target_stats; |
| 290 | u32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE]; |
| 291 | |
| 292 | struct completion event_stats_compl; |
Kalle Valo | a3d135e | 2013-09-03 11:44:10 +0300 | [diff] [blame] | 293 | |
| 294 | unsigned long htt_stats_mask; |
| 295 | struct delayed_work htt_stats_dwork; |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 296 | struct ath10k_dfs_stats dfs_stats; |
| 297 | struct ath_dfs_pool_stats dfs_pool_stats; |
Kalle Valo | f118a3e | 2014-01-03 12:59:31 +0200 | [diff] [blame] | 298 | |
| 299 | u32 fw_dbglog_mask; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 300 | }; |
| 301 | |
Michal Kazior | f7843d7 | 2013-07-16 09:38:52 +0200 | [diff] [blame] | 302 | enum ath10k_state { |
| 303 | ATH10K_STATE_OFF = 0, |
| 304 | ATH10K_STATE_ON, |
Michal Kazior | affd321 | 2013-07-16 09:54:35 +0200 | [diff] [blame] | 305 | |
| 306 | /* When doing firmware recovery the device is first powered down. |
| 307 | * mac80211 is supposed to call in to start() hook later on. It is |
| 308 | * however possible that driver unloading and firmware crash overlap. |
| 309 | * mac80211 can wait on conf_mutex in stop() while the device is |
| 310 | * stopped in ath10k_core_restart() work holding conf_mutex. The state |
| 311 | * RESTARTED means that the device is up and mac80211 has started hw |
| 312 | * reconfiguration. Once mac80211 is done with the reconfiguration we |
| 313 | * set the state to STATE_ON in restart_complete(). */ |
| 314 | ATH10K_STATE_RESTARTING, |
| 315 | ATH10K_STATE_RESTARTED, |
| 316 | |
| 317 | /* The device has crashed while restarting hw. This state is like ON |
| 318 | * but commands are blocked in HTC and -ECOMM response is given. This |
| 319 | * prevents completion timeouts and makes the driver more responsive to |
| 320 | * userspace commands. This is also prevents recursive recovery. */ |
| 321 | ATH10K_STATE_WEDGED, |
Michal Kazior | f7843d7 | 2013-07-16 09:38:52 +0200 | [diff] [blame] | 322 | }; |
| 323 | |
Michal Kazior | 0d9b043 | 2013-08-09 10:13:33 +0200 | [diff] [blame] | 324 | enum ath10k_fw_features { |
| 325 | /* wmi_mgmt_rx_hdr contains extra RSSI information */ |
| 326 | ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX = 0, |
| 327 | |
Bartosz Markowski | ce42870 | 2013-09-26 17:47:05 +0200 | [diff] [blame] | 328 | /* firmware from 10X branch */ |
| 329 | ATH10K_FW_FEATURE_WMI_10X = 1, |
| 330 | |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 331 | /* firmware support tx frame management over WMI, otherwise it's HTT */ |
| 332 | ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX = 2, |
| 333 | |
Bartosz Markowski | d354181 | 2013-12-10 16:20:40 +0100 | [diff] [blame] | 334 | /* Firmware does not support P2P */ |
| 335 | ATH10K_FW_FEATURE_NO_P2P = 3, |
| 336 | |
Michal Kazior | 0d9b043 | 2013-08-09 10:13:33 +0200 | [diff] [blame] | 337 | /* keep last */ |
| 338 | ATH10K_FW_FEATURE_COUNT, |
| 339 | }; |
| 340 | |
Marek Puzyniak | e8a50f8 | 2013-11-20 09:59:47 +0200 | [diff] [blame] | 341 | enum ath10k_dev_flags { |
| 342 | /* Indicates that ath10k device is during CAC phase of DFS */ |
| 343 | ATH10K_CAC_RUNNING, |
Kalle Valo | 650b91f | 2013-11-20 10:00:49 +0200 | [diff] [blame] | 344 | ATH10K_FLAG_FIRST_BOOT_DONE, |
Marek Puzyniak | e8a50f8 | 2013-11-20 09:59:47 +0200 | [diff] [blame] | 345 | }; |
| 346 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 347 | struct ath10k { |
| 348 | struct ath_common ath_common; |
| 349 | struct ieee80211_hw *hw; |
| 350 | struct device *dev; |
| 351 | u8 mac_addr[ETH_ALEN]; |
| 352 | |
Kalle Valo | e01ae68 | 2013-09-01 11:22:14 +0300 | [diff] [blame] | 353 | u32 chip_id; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 354 | u32 target_version; |
| 355 | u8 fw_version_major; |
| 356 | u32 fw_version_minor; |
| 357 | u16 fw_version_release; |
| 358 | u16 fw_version_build; |
| 359 | u32 phy_capability; |
| 360 | u32 hw_min_tx_power; |
| 361 | u32 hw_max_tx_power; |
| 362 | u32 ht_cap_info; |
| 363 | u32 vht_cap_info; |
Michal Kazior | 8865bee4 | 2013-07-24 12:36:46 +0200 | [diff] [blame] | 364 | u32 num_rf_chains; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 365 | |
Michal Kazior | 0d9b043 | 2013-08-09 10:13:33 +0200 | [diff] [blame] | 366 | DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT); |
| 367 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 368 | struct targetdef *targetdef; |
| 369 | struct hostdef *hostdef; |
| 370 | |
| 371 | bool p2p; |
| 372 | |
| 373 | struct { |
| 374 | void *priv; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 375 | const struct ath10k_hif_ops *ops; |
| 376 | } hif; |
| 377 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 378 | wait_queue_head_t event_queue; |
| 379 | bool is_target_paused; |
| 380 | |
| 381 | struct ath10k_bmi bmi; |
Michal Kazior | edb8236 | 2013-07-05 16:15:14 +0300 | [diff] [blame] | 382 | struct ath10k_wmi wmi; |
Michal Kazior | cd003fa | 2013-07-05 16:15:13 +0300 | [diff] [blame] | 383 | struct ath10k_htc htc; |
Michal Kazior | edb8236 | 2013-07-05 16:15:14 +0300 | [diff] [blame] | 384 | struct ath10k_htt htt; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 385 | |
| 386 | struct ath10k_hw_params { |
| 387 | u32 id; |
| 388 | const char *name; |
| 389 | u32 patch_load_addr; |
| 390 | |
| 391 | struct ath10k_hw_params_fw { |
| 392 | const char *dir; |
| 393 | const char *fw; |
| 394 | const char *otp; |
| 395 | const char *board; |
| 396 | } fw; |
| 397 | } hw_params; |
| 398 | |
Kalle Valo | 3652791 | 2013-09-27 19:54:55 +0300 | [diff] [blame] | 399 | const struct firmware *board; |
Kalle Valo | 958df3a | 2013-09-27 19:55:01 +0300 | [diff] [blame] | 400 | const void *board_data; |
| 401 | size_t board_len; |
| 402 | |
Michal Kazior | 2938505 | 2013-07-16 09:38:58 +0200 | [diff] [blame] | 403 | const struct firmware *otp; |
Kalle Valo | 958df3a | 2013-09-27 19:55:01 +0300 | [diff] [blame] | 404 | const void *otp_data; |
| 405 | size_t otp_len; |
| 406 | |
Michal Kazior | 2938505 | 2013-07-16 09:38:58 +0200 | [diff] [blame] | 407 | const struct firmware *firmware; |
Kalle Valo | 958df3a | 2013-09-27 19:55:01 +0300 | [diff] [blame] | 408 | const void *firmware_data; |
| 409 | size_t firmware_len; |
Michal Kazior | 2938505 | 2013-07-16 09:38:58 +0200 | [diff] [blame] | 410 | |
Kalle Valo | 1a22243 | 2013-09-27 19:55:07 +0300 | [diff] [blame] | 411 | int fw_api; |
| 412 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 413 | struct { |
| 414 | struct completion started; |
| 415 | struct completion completed; |
| 416 | struct completion on_channel; |
| 417 | struct timer_list timeout; |
| 418 | bool is_roc; |
| 419 | bool in_progress; |
| 420 | bool aborting; |
| 421 | int vdev_id; |
| 422 | int roc_freq; |
| 423 | } scan; |
| 424 | |
| 425 | struct { |
| 426 | struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; |
| 427 | } mac; |
| 428 | |
| 429 | /* should never be NULL; needed for regular htt rx */ |
| 430 | struct ieee80211_channel *rx_channel; |
| 431 | |
| 432 | /* valid during scan; needed for mgmt rx during scan */ |
| 433 | struct ieee80211_channel *scan_channel; |
| 434 | |
Michal Kazior | c930f74 | 2014-01-23 11:38:25 +0100 | [diff] [blame] | 435 | /* current operating channel definition */ |
| 436 | struct cfg80211_chan_def chandef; |
| 437 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 438 | int free_vdev_map; |
| 439 | int monitor_vdev_id; |
| 440 | bool monitor_enabled; |
| 441 | bool monitor_present; |
| 442 | unsigned int filter_flags; |
Marek Puzyniak | e8a50f8 | 2013-11-20 09:59:47 +0200 | [diff] [blame] | 443 | unsigned long dev_flags; |
Marek Puzyniak | 7d9b40b | 2013-11-20 10:00:28 +0200 | [diff] [blame] | 444 | u32 dfs_block_radar_events; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 445 | |
| 446 | struct wmi_pdev_set_wmm_params_arg wmm_params; |
| 447 | struct completion install_key_done; |
| 448 | |
| 449 | struct completion vdev_setup_done; |
| 450 | |
| 451 | struct workqueue_struct *workqueue; |
| 452 | |
| 453 | /* prevents concurrent FW reconfiguration */ |
| 454 | struct mutex conf_mutex; |
| 455 | |
| 456 | /* protects shared structure data */ |
| 457 | spinlock_t data_lock; |
| 458 | |
Michal Kazior | 0579119 | 2013-10-16 15:44:45 +0300 | [diff] [blame] | 459 | struct list_head arvifs; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 460 | struct list_head peers; |
| 461 | wait_queue_head_t peer_mapping_wq; |
| 462 | |
Bartosz Markowski | 0e759f3 | 2014-01-02 14:38:33 +0100 | [diff] [blame] | 463 | /* number of created peers; protected by data_lock */ |
| 464 | int num_peers; |
| 465 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 466 | struct work_struct offchan_tx_work; |
| 467 | struct sk_buff_head offchan_tx_queue; |
| 468 | struct completion offchan_tx_completed; |
| 469 | struct sk_buff *offchan_tx_skb; |
| 470 | |
Bartosz Markowski | 5e00d31 | 2013-09-26 17:47:12 +0200 | [diff] [blame] | 471 | struct work_struct wmi_mgmt_tx_work; |
| 472 | struct sk_buff_head wmi_mgmt_tx_queue; |
| 473 | |
Michal Kazior | f7843d7 | 2013-07-16 09:38:52 +0200 | [diff] [blame] | 474 | enum ath10k_state state; |
| 475 | |
Michal Kazior | affd321 | 2013-07-16 09:54:35 +0200 | [diff] [blame] | 476 | struct work_struct restart_work; |
| 477 | |
Michal Kazior | 2e1dea4 | 2013-07-31 10:32:40 +0200 | [diff] [blame] | 478 | /* cycle count is reported twice for each visited channel during scan. |
| 479 | * access protected by data_lock */ |
| 480 | u32 survey_last_rx_clear_count; |
| 481 | u32 survey_last_cycle_count; |
| 482 | struct survey_info survey[ATH10K_NUM_CHANS]; |
| 483 | |
Janusz Dziedzic | 9702c68 | 2013-11-20 09:59:41 +0200 | [diff] [blame] | 484 | struct dfs_pattern_detector *dfs_detector; |
| 485 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 486 | #ifdef CONFIG_ATH10K_DEBUGFS |
| 487 | struct ath10k_debug debug; |
| 488 | #endif |
| 489 | }; |
| 490 | |
| 491 | struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 492 | const struct ath10k_hif_ops *hif_ops); |
| 493 | void ath10k_core_destroy(struct ath10k *ar); |
| 494 | |
Michal Kazior | dd30a36 | 2013-07-16 09:38:51 +0200 | [diff] [blame] | 495 | int ath10k_core_start(struct ath10k *ar); |
| 496 | void ath10k_core_stop(struct ath10k *ar); |
Kalle Valo | e01ae68 | 2013-09-01 11:22:14 +0300 | [diff] [blame] | 497 | int ath10k_core_register(struct ath10k *ar, u32 chip_id); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 498 | void ath10k_core_unregister(struct ath10k *ar); |
| 499 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 500 | #endif /* _CORE_H_ */ |