1 /* $OpenBSD: if_iwmvar.h,v 1.78 2022/05/14 05:47:04 stsp Exp $ */
2
3 /*
4 * Copyright (c) 2014 genua mbh <info@genua.de>
5 * Copyright (c) 2014 Fixup Software Ltd.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /*-
21 * Based on BSD-licensed source modules in the Linux iwlwifi driver,
22 * which were used as the reference documentation for this implementation.
23 *
24 * Driver version we are currently based off of is
25 * Linux 3.14.3 (tag id a2df521e42b1d9a23f620ac79dbfe8655a8391dd)
26 *
27 ***********************************************************************
28 *
29 * This file is provided under a dual BSD/GPLv2 license. When using or
30 * redistributing this file, you may do so under either license.
31 *
32 * GPL LICENSE SUMMARY
33 *
34 * Copyright(c) 2007 - 2013 Intel Corporation. All rights reserved.
35 *
36 * This program is free software; you can redistribute it and/or modify
37 * it under the terms of version 2 of the GNU General Public License as
38 * published by the Free Software Foundation.
39 *
40 * This program is distributed in the hope that it will be useful, but
41 * WITHOUT ANY WARRANTY; without even the implied warranty of
42 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
43 * General Public License for more details.
44 *
45 * You should have received a copy of the GNU General Public License
46 * along with this program; if not, write to the Free Software
47 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
48 * USA
49 *
50 * The full GNU General Public License is included in this distribution
51 * in the file called COPYING.
52 *
53 * Contact Information:
54 * Intel Linux Wireless <ilw@linux.intel.com>
55 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
56 *
57 *
58 * BSD LICENSE
59 *
60 * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved.
61 * All rights reserved.
62 *
63 * Redistribution and use in source and binary forms, with or without
64 * modification, are permitted provided that the following conditions
65 * are met:
66 *
67 * * Redistributions of source code must retain the above copyright
68 * notice, this list of conditions and the following disclaimer.
69 * * Redistributions in binary form must reproduce the above copyright
70 * notice, this list of conditions and the following disclaimer in
71 * the documentation and/or other materials provided with the
72 * distribution.
73 * * Neither the name Intel Corporation nor the names of its
74 * contributors may be used to endorse or promote products derived
75 * from this software without specific prior written permission.
76 *
77 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
78 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
79 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
80 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
81 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
82 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
83 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
84 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
85 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
86 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
87 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88 */
89
90 /*-
91 * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
92 *
93 * Permission to use, copy, modify, and distribute this software for any
94 * purpose with or without fee is hereby granted, provided that the above
95 * copyright notice and this permission notice appear in all copies.
96 *
97 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
98 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
99 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
100 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
101 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
102 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
103 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
104 */
105
106 struct iwm_rx_radiotap_header {
107 struct ieee80211_radiotap_header wr_ihdr;
108 uint64_t wr_tsft;
109 uint8_t wr_flags;
110 uint8_t wr_rate;
111 uint16_t wr_chan_freq;
112 uint16_t wr_chan_flags;
113 int8_t wr_dbm_antsignal;
114 int8_t wr_dbm_antnoise;
115 } __packed;
116
117 #define IWM_RX_RADIOTAP_PRESENT \
118 ((1 << IEEE80211_RADIOTAP_TSFT) | \
119 (1 << IEEE80211_RADIOTAP_FLAGS) | \
120 (1 << IEEE80211_RADIOTAP_RATE) | \
121 (1 << IEEE80211_RADIOTAP_CHANNEL) | \
122 (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \
123 (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE))
124
125 struct iwm_tx_radiotap_header {
126 struct ieee80211_radiotap_header wt_ihdr;
127 uint8_t wt_flags;
128 uint8_t wt_rate;
129 uint16_t wt_chan_freq;
130 uint16_t wt_chan_flags;
131 } __packed;
132
133 #define IWM_TX_RADIOTAP_PRESENT \
134 ((1 << IEEE80211_RADIOTAP_FLAGS) | \
135 (1 << IEEE80211_RADIOTAP_RATE) | \
136 (1 << IEEE80211_RADIOTAP_CHANNEL))
137
138 #define IWM_UCODE_SECT_MAX 16
139 #define IWM_FWDMASEGSZ (192*1024)
140 #define IWM_FWDMASEGSZ_8000 (320*1024)
141 /* sanity check value */
142 #define IWM_FWMAXSIZE (2*1024*1024)
143
144 /*
145 * fw_status is used to determine if we've already parsed the firmware file
146 *
147 * In addition to the following, status < 0 ==> -error
148 */
149 #define IWM_FW_STATUS_NONE 0
150 #define IWM_FW_STATUS_INPROGRESS 1
151 #define IWM_FW_STATUS_DONE 2
152
153 enum iwm_ucode_type {
154 IWM_UCODE_TYPE_REGULAR,
155 IWM_UCODE_TYPE_INIT,
156 IWM_UCODE_TYPE_WOW,
157 IWM_UCODE_TYPE_REGULAR_USNIFFER,
158 IWM_UCODE_TYPE_MAX
159 };
160
161 struct iwm_fw_info {
162 void *fw_rawdata;
163 size_t fw_rawsize;
164 int fw_status;
165
166 struct iwm_fw_sects {
167 struct iwm_fw_onesect {
168 void *fws_data;
169 uint32_t fws_len;
170 uint32_t fws_devoff;
171 } fw_sect[IWM_UCODE_SECT_MAX];
172 size_t fw_totlen;
173 int fw_count;
174 uint32_t paging_mem_size;
175 } fw_sects[IWM_UCODE_TYPE_MAX];
176 };
177
178 struct iwm_nvm_data {
179 int n_hw_addrs;
180 uint8_t hw_addr[ETHER_ADDR_LEN];
181
182 uint8_t calib_version;
183 uint16_t calib_voltage;
184
185 uint16_t raw_temperature;
186 uint16_t kelvin_temperature;
187 uint16_t kelvin_voltage;
188 uint16_t xtal_calib[2];
189
190 int sku_cap_band_24GHz_enable;
191 int sku_cap_band_52GHz_enable;
192 int sku_cap_11n_enable;
193 int sku_cap_11ac_enable;
194 int sku_cap_amt_enable;
195 int sku_cap_ipan_enable;
196 int sku_cap_mimo_disable;
197
198 uint8_t radio_cfg_type;
199 uint8_t radio_cfg_step;
200 uint8_t radio_cfg_dash;
201 uint8_t radio_cfg_pnum;
202 uint8_t valid_tx_ant, valid_rx_ant;
203
204 uint16_t nvm_version;
205 uint8_t max_tx_pwr_half_dbm;
206
207 int lar_enabled;
208 };
209
210 /* max bufs per tfd the driver will use */
211 #define IWM_MAX_CMD_TBS_PER_TFD 2
212
213 struct iwm_host_cmd {
214 const void *data[IWM_MAX_CMD_TBS_PER_TFD];
215 struct iwm_rx_packet *resp_pkt;
216 size_t resp_pkt_len;
217 unsigned long _rx_page_addr;
218 uint32_t _rx_page_order;
219 int handler_status;
220
221 uint32_t flags;
222 uint16_t len[IWM_MAX_CMD_TBS_PER_TFD];
223 uint8_t dataflags[IWM_MAX_CMD_TBS_PER_TFD];
224 uint32_t id;
225 };
226
227 /*
228 * DMA glue is from iwn
229 */
230
231 struct iwm_dma_info {
232 bus_dma_tag_t tag;
233 bus_dmamap_t map;
234 bus_dma_segment_t seg;
235 bus_addr_t paddr;
236 void *vaddr;
237 bus_size_t size;
238 };
239
240 /**
241 * struct iwm_fw_paging
242 * @fw_paging_block: dma memory info
243 * @fw_paging_size: page size
244 */
245 struct iwm_fw_paging {
246 struct iwm_dma_info fw_paging_block;
247 uint32_t fw_paging_size;
248 };
249
250 #define IWM_TX_RING_COUNT 256
251 #define IWM_TX_RING_LOMARK 192
252 #define IWM_TX_RING_HIMARK 224
253
254 /* For aggregation queues, index must be aligned to frame sequence number. */
255 #define IWM_AGG_SSN_TO_TXQ_IDX(x) ((x) & (IWM_TX_RING_COUNT - 1))
256
257 struct iwm_tx_data {
258 bus_dmamap_t map;
259 bus_addr_t cmd_paddr;
260 bus_addr_t scratch_paddr;
261 struct mbuf *m;
262 struct iwm_node *in;
263 int txmcs;
264 int txrate;
265
266 /* A-MPDU subframes */
267 int ampdu_txmcs;
268 int ampdu_txnss;
269 int ampdu_nframes;
270 };
271
272 struct iwm_tx_ring {
273 struct iwm_dma_info desc_dma;
274 struct iwm_dma_info cmd_dma;
275 struct iwm_tfd *desc;
276 struct iwm_device_cmd *cmd;
277 struct iwm_tx_data data[IWM_TX_RING_COUNT];
278 int qid;
279 int queued;
280 int cur;
281 int tail;
282 };
283
284 #define IWM_RX_MQ_RING_COUNT 512
285 #define IWM_RX_RING_COUNT 256
286 /* Linux driver optionally uses 8k buffer */
287 #define IWM_RBUF_SIZE 4096
288
289 struct iwm_rx_data {
290 struct mbuf *m;
291 bus_dmamap_t map;
292 };
293
294 struct iwm_rx_ring {
295 struct iwm_dma_info free_desc_dma;
296 struct iwm_dma_info stat_dma;
297 struct iwm_dma_info used_desc_dma;
298 void *desc;
299 struct iwm_rb_status *stat;
300 struct iwm_rx_data data[IWM_RX_MQ_RING_COUNT];
301 int cur;
302 };
303
304 #define IWM_FLAG_USE_ICT 0x01 /* using Interrupt Cause Table */
305 #define IWM_FLAG_RFKILL 0x02 /* radio kill switch is set */
306 #define IWM_FLAG_SCANNING 0x04 /* scan in progress */
307 #define IWM_FLAG_MAC_ACTIVE 0x08 /* MAC context added to firmware */
308 #define IWM_FLAG_BINDING_ACTIVE 0x10 /* MAC->PHY binding added to firmware */
309 #define IWM_FLAG_STA_ACTIVE 0x20 /* AP added to firmware station table */
310 #define IWM_FLAG_TE_ACTIVE 0x40 /* time event is scheduled */
311 #define IWM_FLAG_HW_ERR 0x80 /* hardware error occurred */
312 #define IWM_FLAG_SHUTDOWN 0x100 /* shutting down; new tasks forbidden */
313 #define IWM_FLAG_BGSCAN 0x200 /* background scan in progress */
314 #define IWM_FLAG_TXFLUSH 0x400 /* Tx queue flushing in progress */
315
316 struct iwm_ucode_status {
317 uint32_t uc_error_event_table;
318 uint32_t uc_umac_error_event_table;
319 uint32_t uc_log_event_table;
320
321 int uc_ok;
322 int uc_intr;
323 };
324
325 #define IWM_CMD_RESP_MAX PAGE_SIZE
326
327 /* lower blocks contain EEPROM image and calibration data */
328 #define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_7000 16384
329 #define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000 32768
330
331 #define IWM_TE_SESSION_PROTECTION_MAX_TIME_MS 1000
332 #define IWM_TE_SESSION_PROTECTION_MIN_TIME_MS 400
333
334 enum IWM_CMD_MODE {
335 IWM_CMD_ASYNC = (1 << 0),
336 IWM_CMD_WANT_RESP = (1 << 1),
337 IWM_CMD_SEND_IN_RFKILL = (1 << 2),
338 };
339 enum iwm_hcmd_dataflag {
340 IWM_HCMD_DFL_NOCOPY = (1 << 0),
341 IWM_HCMD_DFL_DUP = (1 << 1),
342 };
343
344 #define IWM_NUM_PAPD_CH_GROUPS 9
345 #define IWM_NUM_TXP_CH_GROUPS 9
346
347 struct iwm_phy_db_entry {
348 uint16_t size;
349 uint8_t *data;
350 };
351
352 struct iwm_phy_db {
353 struct iwm_phy_db_entry cfg;
354 struct iwm_phy_db_entry calib_nch;
355 struct iwm_phy_db_entry calib_ch_group_papd[IWM_NUM_PAPD_CH_GROUPS];
356 struct iwm_phy_db_entry calib_ch_group_txp[IWM_NUM_TXP_CH_GROUPS];
357 };
358
359 struct iwm_phy_ctxt {
360 uint16_t id;
361 uint16_t color;
362 uint32_t ref;
363 struct ieee80211_channel *channel;
364 uint8_t sco; /* 40 MHz secondary channel offset */
365 uint8_t vht_chan_width;
366 };
367
368 struct iwm_bf_data {
369 int bf_enabled; /* filtering */
370 int ba_enabled; /* abort */
371 int ave_beacon_signal;
372 int last_cqm_event;
373 };
374
375 /**
376 * struct iwm_reorder_buffer - per ra/tid/queue reorder buffer
377 * @head_sn: reorder window head sn
378 * @num_stored: number of mpdus stored in the buffer
379 * @buf_size: the reorder buffer size as set by the last addba request
380 * @queue: queue of this reorder buffer
381 * @last_amsdu: track last ASMDU SN for duplication detection
382 * @last_sub_index: track ASMDU sub frame index for duplication detection
383 * @reorder_timer: timer for frames are in the reorder buffer. For AMSDU
384 * it is the time of last received sub-frame
385 * @removed: prevent timer re-arming
386 * @valid: reordering is valid for this queue
387 * @consec_oldsn_drops: consecutive drops due to old SN
388 * @consec_oldsn_ampdu_gp2: A-MPDU GP2 timestamp to track
389 * when to apply old SN consecutive drop workaround
390 * @consec_oldsn_prev_drop: track whether or not an MPDU
391 * that was single/part of the previous A-MPDU was
392 * dropped due to old SN
393 */
394 struct iwm_reorder_buffer {
395 uint16_t head_sn;
396 uint16_t num_stored;
397 uint16_t buf_size;
398 uint16_t last_amsdu;
399 uint8_t last_sub_index;
400 struct timeout reorder_timer;
401 int removed;
402 int valid;
403 unsigned int consec_oldsn_drops;
404 uint32_t consec_oldsn_ampdu_gp2;
405 unsigned int consec_oldsn_prev_drop;
406 #define IWM_AMPDU_CONSEC_DROPS_DELBA 10
407 };
408
409 /**
410 * struct iwm_reorder_buf_entry - reorder buffer entry per frame sequence number
411 * @frames: list of mbufs stored (A-MSDU subframes share a sequence number)
412 * @reorder_time: time the packet was stored in the reorder buffer
413 */
414 struct iwm_reorder_buf_entry {
415 struct mbuf_list frames;
416 struct timeval reorder_time;
417 uint32_t rx_pkt_status;
418 int chanidx;
419 int is_shortpre;
420 uint32_t rate_n_flags;
421 uint32_t device_timestamp;
422 struct ieee80211_rxinfo rxi;
423 };
424
425 /**
426 * struct iwm_rxba_data - BA session data
427 * @sta_id: station id
428 * @tid: tid of the session
429 * @baid: baid of the session
430 * @timeout: the timeout set in the addba request
431 * @entries_per_queue: # of buffers per queue
432 * @last_rx: last rx timestamp, updated only if timeout passed from last update
433 * @session_timer: timer to check if BA session expired, runs at 2 * timeout
434 * @sc: softc pointer, needed for timer context
435 * @reorder_buf: reorder buffer
436 * @reorder_buf_data: buffered frames, one entry per sequence number
437 */
438 struct iwm_rxba_data {
439 uint8_t sta_id;
440 uint8_t tid;
441 uint8_t baid;
442 uint16_t timeout;
443 uint16_t entries_per_queue;
444 struct timeval last_rx;
445 struct timeout session_timer;
446 struct iwm_softc *sc;
447 struct iwm_reorder_buffer reorder_buf;
448 struct iwm_reorder_buf_entry entries[IEEE80211_BA_MAX_WINSZ];
449 };
450
451 static inline struct iwm_rxba_data *
iwm_rxba_data_from_reorder_buf(struct iwm_reorder_buffer * buf)452 iwm_rxba_data_from_reorder_buf(struct iwm_reorder_buffer *buf)
453 {
454 return (void *)((uint8_t *)buf -
455 offsetof(struct iwm_rxba_data, reorder_buf));
456 }
457
458 /**
459 * struct iwm_rxq_dup_data - per station per rx queue data
460 * @last_seq: last sequence per tid for duplicate packet detection
461 * @last_sub_frame: last subframe packet
462 */
463 struct iwm_rxq_dup_data {
464 uint16_t last_seq[IWM_MAX_TID_COUNT + 1];
465 uint8_t last_sub_frame[IWM_MAX_TID_COUNT + 1];
466 };
467
468 struct iwm_ba_task_data {
469 uint32_t start_tidmask;
470 uint32_t stop_tidmask;
471 };
472
473 struct iwm_softc {
474 struct device sc_dev;
475 struct ieee80211com sc_ic;
476 int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int);
477 int sc_newstate_pending;
478 int attached;
479
480 struct ieee80211_amrr sc_amrr;
481 struct timeout sc_calib_to;
482 struct timeout sc_led_blink_to;
483
484 struct task init_task; /* NB: not reference-counted */
485 struct refcnt task_refs;
486 struct task newstate_task;
487 enum ieee80211_state ns_nstate;
488 int ns_arg;
489
490 /* Task for firmware BlockAck setup/teardown and its arguments. */
491 struct task ba_task;
492 struct iwm_ba_task_data ba_rx;
493 struct iwm_ba_task_data ba_tx;
494
495 /* Task for ERP/HT prot/slot-time/EDCA updates. */
496 struct task mac_ctxt_task;
497
498 /* Task for HT 20/40 MHz channel width updates. */
499 struct task phy_ctxt_task;
500
501 bus_space_tag_t sc_st;
502 bus_space_handle_t sc_sh;
503 bus_size_t sc_sz;
504 bus_dma_tag_t sc_dmat;
505 pci_chipset_tag_t sc_pct;
506 pcitag_t sc_pcitag;
507 const void *sc_ih;
508 int sc_msix;
509
510 /* TX scheduler rings. */
511 struct iwm_dma_info sched_dma;
512 uint32_t sched_base;
513
514 /* TX/RX rings. */
515 struct iwm_tx_ring txq[IWM_MAX_QUEUES];
516 struct iwm_rx_ring rxq;
517 int qfullmsk;
518 int qenablemsk;
519 int cmdqid;
520
521 int sc_sf_state;
522
523 /* ICT table. */
524 struct iwm_dma_info ict_dma;
525 int ict_cur;
526
527 int sc_hw_rev;
528 #define IWM_SILICON_A_STEP 0
529 #define IWM_SILICON_B_STEP 1
530 #define IWM_SILICON_C_STEP 2
531 #define IWM_SILICON_D_STEP 3
532 int sc_hw_id;
533 int sc_device_family;
534 #define IWM_DEVICE_FAMILY_7000 1
535 #define IWM_DEVICE_FAMILY_8000 2
536 #define IWM_DEVICE_FAMILY_9000 3
537
538 struct iwm_dma_info kw_dma;
539 struct iwm_dma_info fw_dma;
540
541 int sc_fw_chunk_done;
542 int sc_init_complete;
543 #define IWM_INIT_COMPLETE 0x01
544 #define IWM_CALIB_COMPLETE 0x02
545
546 struct iwm_ucode_status sc_uc;
547 enum iwm_ucode_type sc_uc_current;
548 char sc_fwver[32];
549
550 int sc_capaflags;
551 int sc_capa_max_probe_len;
552 int sc_capa_n_scan_channels;
553 uint8_t sc_ucode_api[howmany(IWM_NUM_UCODE_TLV_API, NBBY)];
554 uint8_t sc_enabled_capa[howmany(IWM_NUM_UCODE_TLV_CAPA, NBBY)];
555 #define IWM_MAX_FW_CMD_VERSIONS 64
556 struct iwm_fw_cmd_version cmd_versions[IWM_MAX_FW_CMD_VERSIONS];
557 int n_cmd_versions;
558
559 int sc_intmask;
560 int sc_flags;
561
562 uint32_t sc_fh_init_mask;
563 uint32_t sc_hw_init_mask;
564 uint32_t sc_fh_mask;
565 uint32_t sc_hw_mask;
566
567 /*
568 * So why do we need a separate stopped flag and a generation?
569 * the former protects the device from issuing commands when it's
570 * stopped (duh). The latter protects against race from a very
571 * fast stop/unstop cycle where threads waiting for responses do
572 * not have a chance to run in between. Notably: we want to stop
573 * the device from interrupt context when it craps out, so we
574 * don't have the luxury of waiting for quiescence.
575 */
576 int sc_generation;
577
578 struct rwlock ioctl_rwl;
579
580 int sc_cap_off; /* PCIe caps */
581
582 const char *sc_fwname;
583 bus_size_t sc_fwdmasegsz;
584 size_t sc_nvm_max_section_size;
585 struct iwm_fw_info sc_fw;
586 uint32_t sc_fw_phy_config;
587 uint32_t sc_extra_phy_config;
588 struct iwm_tlv_calib_ctrl sc_default_calib[IWM_UCODE_TYPE_MAX];
589
590 struct iwm_nvm_data sc_nvm;
591 struct iwm_phy_db sc_phy_db;
592
593 struct iwm_bf_data sc_bf;
594
595 int sc_tx_timer[IWM_MAX_QUEUES];
596 int sc_rx_ba_sessions;
597 int tx_ba_queue_mask;
598
599 struct task bgscan_done_task;
600 struct ieee80211_node_switch_bss_arg *bgscan_unref_arg;
601 size_t bgscan_unref_arg_size;
602
603 int sc_scan_last_antenna;
604
605 int sc_fixed_ridx;
606
607 int sc_staid;
608 int sc_nodecolor;
609
610 uint8_t *sc_cmd_resp_pkt[IWM_TX_RING_COUNT];
611 size_t sc_cmd_resp_len[IWM_TX_RING_COUNT];
612 int sc_nic_locks;
613
614 struct taskq *sc_nswq;
615
616 struct iwm_rx_phy_info sc_last_phy_info;
617 int sc_ampdu_ref;
618 #define IWM_MAX_BAID 32
619 struct iwm_rxba_data sc_rxba_data[IWM_MAX_BAID];
620
621 uint32_t sc_time_event_uid;
622
623 /* phy contexts. we only use the first one */
624 struct iwm_phy_ctxt sc_phyctxt[IWM_NUM_PHY_CTX];
625
626 struct iwm_notif_statistics sc_stats;
627 int sc_noise;
628
629 int host_interrupt_operation_mode;
630 int sc_ltr_enabled;
631 enum iwm_nvm_type nvm_type;
632
633 int sc_mqrx_supported;
634 int sc_integrated;
635 int sc_ltr_delay;
636 int sc_xtal_latency;
637 int sc_low_latency_xtal;
638
639 /*
640 * Paging parameters - All of the parameters should be set by the
641 * opmode when paging is enabled
642 */
643 struct iwm_fw_paging fw_paging_db[IWM_NUM_OF_FW_PAGING_BLOCKS];
644 uint16_t num_of_paging_blk;
645 uint16_t num_of_pages_in_last_blk;
646
647 #if NBPFILTER > 0
648 caddr_t sc_drvbpf;
649
650 union {
651 struct iwm_rx_radiotap_header th;
652 uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
653 } sc_rxtapu;
654 #define sc_rxtap sc_rxtapu.th
655 int sc_rxtap_len;
656
657 union {
658 struct iwm_tx_radiotap_header th;
659 uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
660 } sc_txtapu;
661 #define sc_txtap sc_txtapu.th
662 int sc_txtap_len;
663 #endif
664 };
665
666 struct iwm_node {
667 struct ieee80211_node in_ni;
668 struct iwm_phy_ctxt *in_phyctxt;
669 uint8_t in_macaddr[ETHER_ADDR_LEN];
670
671 uint16_t in_id;
672 uint16_t in_color;
673
674 struct ieee80211_amrr_node in_amn;
675 struct ieee80211_ra_node in_rn;
676 struct ieee80211_ra_vht_node in_rn_vht;
677 int lq_rate_mismatch;
678
679 struct iwm_rxq_dup_data dup_data;
680
681 /* For use with the ADD_STA command. */
682 uint32_t tfd_queue_msk;
683 uint16_t tid_disable_ampdu;
684 };
685 #define IWM_STATION_ID 0
686 #define IWM_AUX_STA_ID 1
687 #define IWM_MONITOR_STA_ID 2
688
689 #define IWM_ICT_SIZE 4096
690 #define IWM_ICT_COUNT (IWM_ICT_SIZE / sizeof (uint32_t))
691 #define IWM_ICT_PADDR_SHIFT 12
692