1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * NXP Wireless LAN device driver: ioctl data structures & APIs
4 *
5 * Copyright 2011-2024 NXP
6 */
7
8 #ifndef _NXPWIFI_CFG_H_
9 #define _NXPWIFI_CFG_H_
10
11 #include <linux/wait.h>
12 #include <linux/timer.h>
13 #include <linux/ieee80211.h>
14 #include <uapi/linux/if_arp.h>
15 #include <net/cfg80211.h>
16
17 #define NUM_WEP_KEYS 4
18
19 #define NXPWIFI_BSS_COEX_COUNT 2
20 #define NXPWIFI_MAX_BSS_NUM (3)
21
22 #define NXPWIFI_MAX_CSA_COUNTERS 5
23
24 #define NXPWIFI_DMA_ALIGN_SZ 64
25 #define NXPWIFI_RX_HEADROOM 64
26 #define MAX_TXPD_SZ 32
27 #define INTF_HDR_ALIGN 4
28 /* special FW 4 address management header */
29 #define NXPWIFI_MIN_DATA_HEADER_LEN (NXPWIFI_DMA_ALIGN_SZ + INTF_HDR_ALIGN + \
30 MAX_TXPD_SZ)
31
32 #define NXPWIFI_MGMT_FRAME_HEADER_SIZE 8 /* sizeof(pkt_type)
33 * + sizeof(tx_control)
34 */
35
36 #define FRMCTL_LEN 2
37 #define DURATION_LEN 2
38 #define SEQCTL_LEN 2
39 #define NXPWIFI_MGMT_HEADER_LEN (FRMCTL_LEN + FRMCTL_LEN + ETH_ALEN + \
40 ETH_ALEN + ETH_ALEN + SEQCTL_LEN + ETH_ALEN)
41
42 #define AUTH_ALG_LEN 2
43 #define AUTH_TRANSACTION_LEN 2
44 #define AUTH_STATUS_LEN 2
45 #define NXPWIFI_AUTH_BODY_LEN (AUTH_ALG_LEN + AUTH_TRANSACTION_LEN + \
46 AUTH_STATUS_LEN)
47
48 #define HOST_MLME_AUTH_PENDING BIT(0)
49 #define HOST_MLME_AUTH_DONE BIT(1)
50
51 #define HOST_MLME_MGMT_MASK (BIT(IEEE80211_STYPE_AUTH >> 4) | \
52 BIT(IEEE80211_STYPE_DEAUTH >> 4) | \
53 BIT(IEEE80211_STYPE_DISASSOC >> 4))
54
55 #define AUTH_TX_DEFAULT_WAIT_TIME 2400
56
57 #define WLAN_AUTH_NONE 0xFFFF
58
59 #define NXPWIFI_MAX_TX_BASTREAM_SUPPORTED 2
60 #define NXPWIFI_MAX_RX_BASTREAM_SUPPORTED 16
61
62 #define NXPWIFI_STA_AMPDU_DEF_TXWINSIZE 64
63 #define NXPWIFI_STA_AMPDU_DEF_RXWINSIZE 64
64 #define NXPWIFI_STA_COEX_AMPDU_DEF_RXWINSIZE 16
65
66 #define NXPWIFI_UAP_AMPDU_DEF_TXWINSIZE 32
67
68 #define NXPWIFI_UAP_COEX_AMPDU_DEF_RXWINSIZE 16
69
70 #define NXPWIFI_UAP_AMPDU_DEF_RXWINSIZE 16
71 #define NXPWIFI_11AC_STA_AMPDU_DEF_TXWINSIZE 64
72 #define NXPWIFI_11AC_STA_AMPDU_DEF_RXWINSIZE 64
73 #define NXPWIFI_11AC_UAP_AMPDU_DEF_TXWINSIZE 64
74 #define NXPWIFI_11AC_UAP_AMPDU_DEF_RXWINSIZE 64
75
76 #define NXPWIFI_DEFAULT_BLOCK_ACK_TIMEOUT 0xffff
77
78 #define NXPWIFI_RATE_BITMAP_MCS0 32
79
80 #define NXPWIFI_RX_DATA_BUF_SIZE (4 * 1024)
81 #define NXPWIFI_RX_CMD_BUF_SIZE (2 * 1024)
82
83 #define NXPWIFI_BEACON_PERIOD_MAX (4000)
84 #define NXPWIFI_BEACON_PERIOD_MIN (50)
85 #define NXPWIFI_INVALID_BEACON_PERIOD (NXPWIFI_BEACON_PERIOD_MAX + 1)
86 #define NXPWIFI_MAX_DTIM_PERIOD (100)
87 #define NXPWIFI_MIN_DTIM_PERIOD (1)
88 #define NXPWIFI_INVALID_DTIM_PERIOD (NXPWIFI_MAX_DTIM_PERIOD + 1)
89 #define NXPWIFI_RTS_THRESHOLD_MIN (0)
90 #define NXPWIFI_RTS_THRESHOLD_MAX (2347)
91 #define NXPWIFI_INVALID_RTS (NXPWIFI_RTS_THRESHOLD_MAX + 1)
92 #define NXPWIFI_FRAG_THRESHOLD_MIN (256)
93 #define NXPWIFI_FRAG_THRESHOLD_MAX (2346)
94 #define NXPWIFI_INVALID_FRAG (NXPWIFI_FRAG_THRESHOLD_MAX + 1)
95 #define NXPWIFI_RETRY_LIMIT_MAX 14
96 #define NXPWIFI_INVALID_RETRY_LIMI (NXPWIFI_RETRY_LIMIT_MAX + 1)
97
98 enum nxpwifi_bcast_ssid_ctl {
99 /* Hide SSID in beacons (SSID length = 0) */
100 NXPWIFI_BCAST_SSID_HIDE_LEN_ZERO = 0,
101 /* Do not hide SSID (normal broadcast) */
102 NXPWIFI_BCAST_SSID_VISIBLE,
103 /* Hide SSID, clear SSID content (ASCII 0),
104 * but keep the original SSID length
105 */
106 NXPWIFI_BCAST_SSID_HIDE_LEN_RETAIN,
107 };
108
109 enum nxpwifi_radio_ctl {
110 NXPWIFI_RADIO_CTL_DISABLE = 0,
111 NXPWIFI_RADIO_CTL_ENABLE,
112 __NXPWIFI_RADIO_CTL_MAX,
113 };
114
nxpwifi_radio_ctl_valid(enum nxpwifi_radio_ctl v)115 static inline bool nxpwifi_radio_ctl_valid(enum nxpwifi_radio_ctl v)
116 {
117 return v < __NXPWIFI_RADIO_CTL_MAX;
118 }
119
120 #define NXPWIFI_WMM_VERSION 0x01
121 #define NXPWIFI_WMM_SUBTYPE 0x01
122
123 #define NXPWIFI_SDIO_BLOCK_SIZE 256
124
125 #define NXPWIFI_BUF_FLAG_REQUEUED_PKT BIT(0)
126 #define NXPWIFI_BUF_FLAG_BRIDGED_PKT BIT(1)
127 #define NXPWIFI_BUF_FLAG_EAPOL_TX_STATUS BIT(3)
128 #define NXPWIFI_BUF_FLAG_ACTION_TX_STATUS BIT(4)
129 #define NXPWIFI_BUF_FLAG_AGGR_PKT BIT(5)
130
131 #define NXPWIFI_BRIDGED_PKTS_THR_HIGH 1024
132 #define NXPWIFI_BRIDGED_PKTS_THR_LOW 128
133
134 /* 54M rates, index from 0 to 11 */
135 #define NXPWIFI_RATE_INDEX_MCS0 12
136 /* 12-27=MCS0-15(BW20) */
137 #define NXPWIFI_BW20_MCS_NUM 15
138
139 /* Rate index for OFDM 0 */
140 #define NXPWIFI_RATE_INDEX_OFDM0 4
141
142 #define NXPWIFI_MAX_STA_NUM 3
143 #define NXPWIFI_MAX_UAP_NUM 3
144
145 #define NXPWIFI_A_BAND_START_FREQ 5000
146
147 /* SDIO Aggr data packet special info */
148 #define SDIO_MAX_AGGR_BUF_SIZE (256 * 255)
149 #define BLOCK_NUMBER_OFFSET 15
150 #define SDIO_HEADER_OFFSET 28
151
152 #define NXPWIFI_SIZE_4K 0x4000
153 #define NXPWIFI_EXT_CAPAB_IE_LEN 10
154
155 enum nxpwifi_bss_type {
156 NXPWIFI_BSS_TYPE_STA = 0,
157 NXPWIFI_BSS_TYPE_UAP = 1,
158 NXPWIFI_BSS_TYPE_ANY = 0xff,
159 };
160
161 enum nxpwifi_bss_role {
162 NXPWIFI_BSS_ROLE_STA = 0,
163 NXPWIFI_BSS_ROLE_UAP = 1,
164 NXPWIFI_BSS_ROLE_ANY = 0xff,
165 };
166
167 #define BSS_ROLE_BIT_MASK BIT(0)
168
169 #define GET_BSS_ROLE(priv) ((priv)->bss_role & BSS_ROLE_BIT_MASK)
170
171 enum nxpwifi_data_frame_type {
172 NXPWIFI_DATA_FRAME_TYPE_ETH_II = 0,
173 NXPWIFI_DATA_FRAME_TYPE_802_11,
174 };
175
176 struct nxpwifi_fw_image {
177 u8 *helper_buf;
178 u32 helper_len;
179 u8 *fw_buf;
180 u32 fw_len;
181 };
182
183 struct nxpwifi_802_11_ssid {
184 u32 ssid_len;
185 u8 ssid[IEEE80211_MAX_SSID_LEN];
186 };
187
188 struct nxpwifi_wait_queue {
189 wait_queue_head_t wait;
190 int status;
191 };
192
193 struct nxpwifi_rxinfo {
194 struct sk_buff *parent;
195 u8 bss_num;
196 u8 bss_type;
197 u8 use_count;
198 u8 buf_type;
199 u16 pkt_len;
200 };
201
202 struct nxpwifi_txinfo {
203 u8 flags;
204 u8 bss_num;
205 u8 bss_type;
206 u8 aggr_num;
207 u32 pkt_len;
208 u8 ack_frame_id;
209 u64 cookie;
210 };
211
212 enum nxpwifi_wmm_ac_e {
213 WMM_AC_BK,
214 WMM_AC_BE,
215 WMM_AC_VI,
216 WMM_AC_VO
217 } __packed;
218
219 struct nxpwifi_types_wmm_info {
220 u8 oui[4];
221 u8 subtype;
222 u8 version;
223 u8 qos_info;
224 u8 reserved;
225 struct ieee80211_wmm_ac_param ac[IEEE80211_NUM_ACS];
226 } __packed;
227
228 struct nxpwifi_arp_eth_header {
229 struct arphdr hdr;
230 u8 ar_sha[ETH_ALEN];
231 u8 ar_sip[4];
232 u8 ar_tha[ETH_ALEN];
233 u8 ar_tip[4];
234 } __packed;
235
236 struct nxpwifi_chan_stats {
237 u8 chan_num;
238 u8 bandcfg;
239 u8 flags;
240 s8 noise;
241 u16 total_bss;
242 u16 cca_scan_dur;
243 u16 cca_busy_dur;
244 } __packed;
245
246 #define NXPWIFI_HIST_MAX_SAMPLES 1048576
247 #define NXPWIFI_MAX_RX_RATES 44
248 #define NXPWIFI_MAX_AC_RX_RATES 74
249 #define NXPWIFI_MAX_SNR 256
250 #define NXPWIFI_MAX_NOISE_FLR 256
251 #define NXPWIFI_MAX_SIG_STRENGTH 256
252
253 struct nxpwifi_histogram_data {
254 atomic_t rx_rate[NXPWIFI_MAX_AC_RX_RATES];
255 atomic_t snr[NXPWIFI_MAX_SNR];
256 atomic_t noise_flr[NXPWIFI_MAX_NOISE_FLR];
257 atomic_t sig_str[NXPWIFI_MAX_SIG_STRENGTH];
258 atomic_t num_samples;
259 };
260
261 struct nxpwifi_iface_comb {
262 u8 sta_intf;
263 u8 uap_intf;
264 };
265
266 struct nxpwifi_radar_params {
267 struct cfg80211_chan_def *chandef;
268 u32 cac_time_ms;
269 } __packed;
270
271 struct nxpwifi_11h_intf_state {
272 bool is_11h_enabled;
273 bool is_11h_active;
274 } __packed;
275
276 #define NXPWIFI_FW_DUMP_IDX 0xff
277 #define NXPWIFI_FW_DUMP_MAX_MEMSIZE 0x160000
278 #define NXPWIFI_DRV_INFO_IDX 20
279 #define FW_DUMP_MAX_NAME_LEN 8
280 #define FW_DUMP_HOST_READY 0xEE
281 #define FW_DUMP_DONE 0xFF
282 #define FW_DUMP_READ_DONE 0xFE
283
284 /* Channel bandwidth */
285 #define CHANNEL_BW_20MHZ 0
286 #define CHANNEL_BW_40MHZ_ABOVE 1
287 #define CHANNEL_BW_40MHZ_BELOW 3
288 /* secondary channel is 80MHz bandwidth for 11ac */
289 #define CHANNEL_BW_80MHZ 4
290 #define CHANNEL_BW_160MHZ 5
291
292 struct memory_type_mapping {
293 u8 mem_name[FW_DUMP_MAX_NAME_LEN];
294 u8 *mem_ptr;
295 u32 mem_size;
296 u8 done_flag;
297 };
298
299 enum rdwr_status {
300 RDWR_STATUS_SUCCESS = 0,
301 RDWR_STATUS_FAILURE = 1,
302 RDWR_STATUS_DONE = 2
303 };
304
305 enum nxpwifi_chan_band {
306 BAND_2GHZ = 0,
307 BAND_5GHZ,
308 BAND_6GHZ,
309 BAND_4GHZ,
310 };
311
312 enum nxpwifi_chan_width {
313 CHAN_BW_20MHZ = 0,
314 CHAN_BW_10MHZ,
315 CHAN_BW_40MHZ,
316 CHAN_BW_80MHZ,
317 CHAN_BW_8080MHZ,
318 CHAN_BW_160MHZ,
319 CHAN_BW_5MHZ,
320 };
321
322 enum {
323 NXPWIFI_SCAN_TYPE_UNCHANGED = 0,
324 NXPWIFI_SCAN_TYPE_ACTIVE,
325 NXPWIFI_SCAN_TYPE_PASSIVE
326 };
327
328 #define NXPWIFI_PROMISC_MODE 1
329 #define NXPWIFI_MULTICAST_MODE 2
330 #define NXPWIFI_ALL_MULTI_MODE 4
331 #define NXPWIFI_MAX_MULTICAST_LIST_SIZE 32
332
333 struct nxpwifi_multicast_list {
334 u32 mode;
335 u32 num_multicast_addr;
336 u8 mac_list[NXPWIFI_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
337 };
338
339 struct nxpwifi_chan_freq {
340 u32 channel;
341 u32 freq;
342 };
343
344 struct nxpwifi_ssid_bssid {
345 struct cfg80211_ssid ssid;
346 u8 bssid[ETH_ALEN];
347 };
348
349 enum {
350 BAND_B = 1,
351 BAND_G = 2,
352 BAND_A = 4,
353 BAND_GN = 8,
354 BAND_AN = 16,
355 BAND_GAC = 32,
356 BAND_AAC = 64,
357 BAND_GAX = 256,
358 BAND_AAX = 512,
359 };
360
361 #define NXPWIFI_WPA_PASSHPHRASE_LEN 64
362 struct wpa_param {
363 u8 pairwise_cipher_wpa;
364 u8 pairwise_cipher_wpa2;
365 u8 group_cipher;
366 u32 length;
367 u8 passphrase[NXPWIFI_WPA_PASSHPHRASE_LEN];
368 };
369
370 struct wep_key {
371 u8 key_index;
372 u8 is_default;
373 u16 length;
374 u8 key[WLAN_KEY_LEN_WEP104];
375 };
376
377 #define KEY_MGMT_ON_HOST 0x03
378 #define NXPWIFI_AUTH_MODE_AUTO 0xFF
379 #define BAND_CONFIG_BG 0x00
380 #define BAND_CONFIG_A 0x01
381 #define NXPWIFI_SEC_CHAN_BELOW 0x03
382 #define NXPWIFI_SEC_CHAN_ABOVE 0x01
383 #define NXPWIFI_SUPPORTED_RATES 14
384 #define NXPWIFI_SUPPORTED_RATES_EXT 32
385 #define NXPWIFI_PRIO_BK 2
386 #define NXPWIFI_PRIO_VI 5
387 #define NXPWIFI_SUPPORTED_CHANNELS 2
388 #define NXPWIFI_OPERATING_CLASSES 16
389
390 struct nxpwifi_uap_bss_param {
391 u8 mac_addr[ETH_ALEN];
392 u8 channel;
393 u8 band_cfg;
394 u16 rts_threshold;
395 u16 frag_threshold;
396 u8 retry_limit;
397 struct nxpwifi_802_11_ssid ssid;
398 u8 bcast_ssid_ctl;
399 u8 radio_ctl;
400 u8 dtim_period;
401 u16 beacon_period;
402 u16 auth_mode;
403 u16 protocol;
404 u16 key_mgmt;
405 u16 key_mgmt_operation;
406 struct wpa_param wpa_cfg;
407 struct wep_key wep_cfg[NUM_WEP_KEYS];
408 struct ieee80211_ht_cap ht_cap;
409 struct ieee80211_vht_cap vht_cap;
410 u8 rates[NXPWIFI_SUPPORTED_RATES];
411 u32 sta_ao_timer;
412 u32 ps_sta_ao_timer;
413 u8 power_constraint;
414 struct ieee80211_wmm_param_ie wmm_element;
415 };
416
417 struct nxpwifi_ds_get_stats {
418 u32 mcast_tx_frame;
419 u32 failed;
420 u32 retry;
421 u32 multi_retry;
422 u32 frame_dup;
423 u32 rts_success;
424 u32 rts_failure;
425 u32 ack_failure;
426 u32 rx_frag;
427 u32 mcast_rx_frame;
428 u32 fcs_error;
429 u32 tx_frame;
430 u32 wep_icv_error[4];
431 u32 bcn_rcv_cnt;
432 u32 bcn_miss_cnt;
433 };
434
435 #define NXPWIFI_MAX_VER_STR_LEN 128
436
437 struct nxpwifi_ver_ext {
438 u32 version_str_sel;
439 char version_str[NXPWIFI_MAX_VER_STR_LEN];
440 };
441
442 struct nxpwifi_bss_info {
443 u32 bss_mode;
444 struct cfg80211_ssid ssid;
445 u32 bss_chan;
446 u8 country_code[3];
447 u32 media_connected;
448 u32 max_power_level;
449 u32 min_power_level;
450 signed int bcn_nf_last;
451 u32 wep_status;
452 u32 is_hs_configured;
453 u32 is_deep_sleep;
454 u8 bssid[ETH_ALEN];
455 };
456
457 struct nxpwifi_sta_info {
458 u8 peer_mac[ETH_ALEN];
459 struct station_parameters *params;
460 };
461
462 #define MAX_NUM_TID 8
463
464 #define MAX_RX_WINSIZE 64
465
466 struct nxpwifi_ds_rx_reorder_tbl {
467 u16 tid;
468 u8 ta[ETH_ALEN];
469 u32 start_win;
470 u32 win_size;
471 u32 buffer[MAX_RX_WINSIZE];
472 };
473
474 struct nxpwifi_ds_tx_ba_stream_tbl {
475 u16 tid;
476 u8 ra[ETH_ALEN];
477 u8 amsdu;
478 };
479
480 #define DBG_CMD_NUM 5
481 #define NXPWIFI_DBG_SDIO_MP_NUM 10
482
483 struct nxpwifi_debug_info {
484 unsigned int debug_mask;
485 u32 int_counter;
486 u32 packets_out[MAX_NUM_TID];
487 u32 tx_buf_size;
488 u32 curr_tx_buf_size;
489 u32 tx_tbl_num;
490 struct nxpwifi_ds_tx_ba_stream_tbl
491 tx_tbl[NXPWIFI_MAX_TX_BASTREAM_SUPPORTED];
492 u32 rx_tbl_num;
493 struct nxpwifi_ds_rx_reorder_tbl rx_tbl
494 [NXPWIFI_MAX_RX_BASTREAM_SUPPORTED];
495 u16 ps_mode;
496 u32 ps_state;
497 u8 is_deep_sleep;
498 u8 pm_wakeup_card_req;
499 u32 pm_wakeup_fw_try;
500 u8 is_hs_configured;
501 u8 hs_activated;
502 u32 num_cmd_host_to_card_failure;
503 u32 num_cmd_sleep_cfm_host_to_card_failure;
504 u32 num_tx_host_to_card_failure;
505 u32 num_event_deauth;
506 u32 num_event_disassoc;
507 u32 num_event_link_lost;
508 u32 num_cmd_deauth;
509 u32 num_cmd_assoc_success;
510 u32 num_cmd_assoc_failure;
511 u32 num_tx_timeout;
512 u8 is_cmd_timedout;
513 u16 timeout_cmd_id;
514 u16 timeout_cmd_act;
515 u16 last_cmd_id[DBG_CMD_NUM];
516 u16 last_cmd_act[DBG_CMD_NUM];
517 u16 last_cmd_index;
518 u16 last_cmd_resp_id[DBG_CMD_NUM];
519 u16 last_cmd_resp_index;
520 u16 last_event[DBG_CMD_NUM];
521 u16 last_event_index;
522 u8 data_sent;
523 u8 cmd_sent;
524 u8 cmd_resp_received;
525 u8 event_received;
526 u32 last_mp_wr_bitmap[NXPWIFI_DBG_SDIO_MP_NUM];
527 u32 last_mp_wr_ports[NXPWIFI_DBG_SDIO_MP_NUM];
528 u32 last_mp_wr_len[NXPWIFI_DBG_SDIO_MP_NUM];
529 u32 last_mp_curr_wr_port[NXPWIFI_DBG_SDIO_MP_NUM];
530 u8 last_sdio_mp_index;
531 };
532
533 #define NXPWIFI_KEY_INDEX_UNICAST 0x40000000
534 #define PN_LEN 16
535
536 struct nxpwifi_ds_encrypt_key {
537 u32 key_disable;
538 u32 key_index;
539 u32 key_len;
540 u32 key_cipher;
541 u8 key_material[WLAN_MAX_KEY_LEN];
542 u8 mac_addr[ETH_ALEN];
543 u8 pn[PN_LEN]; /* packet number */
544 u8 pn_len;
545 u8 is_igtk_key;
546 u8 is_current_wep_key;
547 u8 is_rx_seq_valid;
548 u8 is_igtk_def_key;
549 };
550
551 struct nxpwifi_power_cfg {
552 u32 is_power_auto;
553 u32 is_power_fixed;
554 u32 power_level;
555 };
556
557 struct nxpwifi_ds_hs_cfg {
558 u32 is_invoke_hostcmd;
559 /*
560 * Bit0: non-unicast data
561 * Bit1: unicast data
562 * Bit2: mac events
563 * Bit3: magic packet
564 */
565 u32 conditions;
566 u32 gpio;
567 u32 gap;
568 };
569
570 struct nxpwifi_ds_wakeup_reason {
571 u16 hs_wakeup_reason;
572 };
573
574 #define DEEP_SLEEP_ON 1
575 #define DEEP_SLEEP_OFF 0
576 #define DEEP_SLEEP_IDLE_TIME 100
577 #define PS_MODE_AUTO 1
578
579 struct nxpwifi_ds_auto_ds {
580 u16 auto_ds;
581 u16 idle_time;
582 };
583
584 struct nxpwifi_ds_pm_cfg {
585 union {
586 u32 ps_mode;
587 struct nxpwifi_ds_hs_cfg hs_cfg;
588 struct nxpwifi_ds_auto_ds auto_deep_sleep;
589 u32 sleep_period;
590 } param;
591 };
592
593 struct nxpwifi_11ac_vht_cfg {
594 u8 band_config;
595 u8 misc_config;
596 u32 cap_info;
597 u32 mcs_tx_set;
598 u32 mcs_rx_set;
599 };
600
601 struct nxpwifi_ds_11n_tx_cfg {
602 u16 tx_htcap;
603 u16 tx_htinfo;
604 u16 misc_config; /* Needed for 802.11AC cards only */
605 };
606
607 struct nxpwifi_ds_11n_amsdu_aggr_ctrl {
608 u16 enable;
609 u16 curr_buf_size;
610 };
611
612 struct nxpwifi_ds_ant_cfg {
613 u32 tx_ant;
614 u32 rx_ant;
615 };
616
617 #define NXPWIFI_NUM_OF_CMD_BUFFER 50
618 #define NXPWIFI_SIZE_OF_CMD_BUFFER 2048
619
620 enum {
621 NXPWIFI_IE_TYPE_GEN_IE = 0,
622 NXPWIFI_IE_TYPE_ARP_FILTER,
623 };
624
625 enum {
626 NXPWIFI_REG_MAC = 1,
627 NXPWIFI_REG_BBP,
628 NXPWIFI_REG_RF,
629 NXPWIFI_REG_PMIC,
630 NXPWIFI_REG_CAU,
631 };
632
633 struct nxpwifi_ds_reg_rw {
634 u32 type;
635 u32 offset;
636 u32 value;
637 };
638
639 #define MAX_EEPROM_DATA 256
640
641 struct nxpwifi_ds_read_eeprom {
642 u16 offset;
643 u16 byte_count;
644 u8 value[MAX_EEPROM_DATA];
645 };
646
647 struct nxpwifi_ds_mem_rw {
648 u32 addr;
649 u32 value;
650 };
651
652 #define IEEE_MAX_IE_SIZE 256
653
654 #define NXPWIFI_IE_HDR_SIZE (sizeof(struct nxpwifi_ie) - IEEE_MAX_IE_SIZE)
655
656 struct nxpwifi_ds_misc_gen_ie {
657 u32 type;
658 u32 len;
659 u8 ie_data[IEEE_MAX_IE_SIZE];
660 };
661
662 struct nxpwifi_ds_misc_cmd {
663 u32 len;
664 u8 cmd[NXPWIFI_SIZE_OF_CMD_BUFFER];
665 };
666
667 #define BITMASK_BCN_RSSI_LOW BIT(0)
668 #define BITMASK_BCN_RSSI_HIGH BIT(4)
669
670 enum subsc_evt_rssi_state {
671 EVENT_HANDLED,
672 RSSI_LOW_RECVD,
673 RSSI_HIGH_RECVD
674 };
675
676 struct subsc_evt_cfg {
677 u8 abs_value;
678 u8 evt_freq;
679 };
680
681 struct nxpwifi_ds_misc_subsc_evt {
682 u16 action;
683 u16 events;
684 struct subsc_evt_cfg bcn_l_rssi_cfg;
685 struct subsc_evt_cfg bcn_h_rssi_cfg;
686 };
687
688 #define NXPWIFI_MEF_MAX_BYTESEQ 6 /* non-adjustable */
689 #define NXPWIFI_MEF_MAX_FILTERS 10
690
691 struct nxpwifi_mef_filter {
692 u16 repeat;
693 u16 offset;
694 s8 byte_seq[NXPWIFI_MEF_MAX_BYTESEQ + 1];
695 u8 filt_type;
696 u8 filt_action;
697 };
698
699 struct nxpwifi_mef_entry {
700 u8 mode;
701 u8 action;
702 struct nxpwifi_mef_filter filter[NXPWIFI_MEF_MAX_FILTERS];
703 };
704
705 struct nxpwifi_ds_mef_cfg {
706 u32 criteria;
707 u16 num_entries;
708 struct nxpwifi_mef_entry *mef_entry;
709 };
710
711 #define NXPWIFI_MAX_VSIE_LEN (256)
712 #define NXPWIFI_MAX_VSIE_NUM (8)
713 #define NXPWIFI_VSIE_MASK_CLEAR 0x00
714 #define NXPWIFI_VSIE_MASK_SCAN 0x01
715 #define NXPWIFI_VSIE_MASK_ASSOC 0x02
716 #define NXPWIFI_VSIE_MASK_BGSCAN 0x08
717
718 enum {
719 NXPWIFI_FUNC_INIT = 1,
720 NXPWIFI_FUNC_SHUTDOWN,
721 };
722
723 enum COALESCE_OPERATION {
724 RECV_FILTER_MATCH_TYPE_EQ = 0x80,
725 RECV_FILTER_MATCH_TYPE_NE,
726 };
727
728 enum COALESCE_PACKET_TYPE {
729 PACKET_TYPE_UNICAST = 1,
730 PACKET_TYPE_MULTICAST = 2,
731 PACKET_TYPE_BROADCAST = 3
732 };
733
734 #define NXPWIFI_COALESCE_MAX_RULES 8
735 #define NXPWIFI_COALESCE_MAX_BYTESEQ 4 /* non-adjustable */
736 #define NXPWIFI_COALESCE_MAX_FILTERS 4
737 #define NXPWIFI_MAX_COALESCING_DELAY 100 /* in msecs */
738
739 struct filt_field_param {
740 u8 operation;
741 u8 operand_len;
742 u16 offset;
743 u8 operand_byte_stream[NXPWIFI_COALESCE_MAX_BYTESEQ];
744 };
745
746 struct nxpwifi_coalesce_rule {
747 u16 max_coalescing_delay;
748 u8 num_of_fields;
749 u8 pkt_type;
750 struct filt_field_param params[NXPWIFI_COALESCE_MAX_FILTERS];
751 };
752
753 struct nxpwifi_ds_coalesce_cfg {
754 u16 num_of_rules;
755 struct nxpwifi_coalesce_rule rule[NXPWIFI_COALESCE_MAX_RULES];
756 };
757
758 struct nxpwifi_11ax_he_cap_cfg {
759 u16 id;
760 u16 len;
761 u8 ext_id;
762 struct ieee80211_he_cap_elem cap_elem;
763 u8 he_txrx_mcs_support[4];
764 u8 val[28];
765 };
766
767 #define HE_CAP_MAX_SIZE 54
768
769 struct nxpwifi_11ax_he_cfg {
770 u8 band;
771 union {
772 struct nxpwifi_11ax_he_cap_cfg he_cap_cfg;
773 u8 data[HE_CAP_MAX_SIZE];
774 };
775 };
776
777 #define NXPWIFI_11AXCMD_CFG_ID_SR_OBSS_PD_OFFSET 1
778 #define NXPWIFI_11AXCMD_CFG_ID_SR_ENABLE 2
779 #define NXPWIFI_11AXCMD_CFG_ID_BEAM_CHANGE 3
780 #define NXPWIFI_11AXCMD_CFG_ID_HTC_ENABLE 4
781 #define NXPWIFI_11AXCMD_CFG_ID_TXOP_RTS 5
782 #define NXPWIFI_11AXCMD_CFG_ID_TX_OMI 6
783 #define NXPWIFI_11AXCMD_CFG_ID_OBSSNBRU_TOLTIME 7
784 #define NXPWIFI_11AXCMD_CFG_ID_SET_BSRP 8
785 #define NXPWIFI_11AXCMD_CFG_ID_LLDE 9
786
787 #define NXPWIFI_11AXCMD_SR_SUBID 0x102
788 #define NXPWIFI_11AXCMD_BEAM_SUBID 0x103
789 #define NXPWIFI_11AXCMD_HTC_SUBID 0x104
790 #define NXPWIFI_11AXCMD_TXOMI_SUBID 0x105
791 #define NXPWIFI_11AXCMD_OBSS_TOLTIME_SUBID 0x106
792 #define NXPWIFI_11AXCMD_TXOPRTS_SUBID 0x108
793 #define NXPWIFI_11AXCMD_SET_BSRP_SUBID 0x109
794 #define NXPWIFI_11AXCMD_LLDE_SUBID 0x110
795
796 #define NXPWIFI_11AX_TWT_SETUP_SUBID 0x114
797 #define NXPWIFI_11AX_TWT_TEARDOWN_SUBID 0x115
798 #define NXPWIFI_11AX_TWT_REPORT_SUBID 0x116
799 #define NXPWIFI_11AX_TWT_INFORMATION_SUBID 0x119
800 #define NXPWIFI_11AX_BTWT_AP_CONFIG_SUBID 0x120
801 #define BTWT_AGREEMENT_MAX 5
802
803 struct nxpwifi_11axcmdcfg_obss_pd_offset {
804 /* <NON_SRG_OffSET, SRG_OFFSET> */
805 u8 offset[2];
806 };
807
808 struct nxpwifi_11axcmdcfg_sr_control {
809 /* 1 enable, 0 disable */
810 u8 control;
811 };
812
813 struct nxpwifi_11ax_sr_cmd {
814 /* type */
815 u16 type;
816 /* length of TLV */
817 u16 len;
818 /* value */
819 union {
820 struct nxpwifi_11axcmdcfg_obss_pd_offset obss_pd_offset;
821 struct nxpwifi_11axcmdcfg_sr_control sr_control;
822 } param;
823 };
824
825 struct nxpwifi_11ax_beam_cmd {
826 /* command value: 1 is disable, 0 is enable */
827 u8 value;
828 };
829
830 struct nxpwifi_11ax_htc_cmd {
831 /* command value: 1 is enable, 0 is disable */
832 u8 value;
833 };
834
835 struct nxpwifi_11ax_txomi_cmd {
836 /* 11ax spec 9.2.4.6a.2 OM Control 12 bits. Bit 0 to bit 11 */
837 u16 omi;
838 /*
839 * tx option
840 * 0: send OMI in QoS NULL; 1: send OMI in QoS data; 0xFF: set OMI in
841 * both
842 */
843 u8 tx_option;
844 /*
845 * if OMI is sent in QoS data, specify the number of consecutive data
846 * packets containing the OMI
847 */
848 u8 num_data_pkts;
849 };
850
851 struct nxpwifi_11ax_toltime_cmd {
852 /* OBSS Narrow Bandwidth RU Tolerance Time */
853 u32 tol_time;
854 };
855
856 struct nxpwifi_11ax_txop_cmd {
857 /*
858 * Two byte rts threshold value of which only 10 bits, bit 0 to bit 9
859 * are valid
860 */
861 u16 rts_thres;
862 };
863
864 struct nxpwifi_11ax_set_bsrp_cmd {
865 /* command value: 1 is enable, 0 is disable */
866 u8 value;
867 };
868
869 struct nxpwifi_11ax_llde_cmd {
870 /* Uplink LLDE: enable=1,disable=0 */
871 u8 llde;
872 /* operation mode: default=0,carplay=1,gameplay=2 */
873 u8 mode;
874 /* trigger frame rate: auto=0xff */
875 u8 fixrate;
876 /* cap airtime limit index: auto=0xff */
877 u8 trigger_limit;
878 /* cap peak UL rate */
879 u8 peak_ul_rate;
880 /* Downlink LLDE: enable=1,disable=0 */
881 u8 dl_llde;
882 /* Set trigger frame interval(us): auto=0 */
883 u16 poll_interval;
884 /* Set TxOp duration */
885 u16 tx_op_duration;
886 /* for other configurations */
887 u16 llde_ctrl;
888 u16 mu_rts_successcnt;
889 u16 mu_rts_failcnt;
890 u16 basic_trigger_successcnt;
891 u16 basic_trigger_failcnt;
892 u16 tbppdu_nullcnt;
893 u16 tbppdu_datacnt;
894 };
895
896 struct nxpwifi_11ax_cmd_cfg {
897 u32 sub_command;
898 u32 sub_id;
899 union {
900 struct nxpwifi_11ax_sr_cmd sr_cfg;
901 struct nxpwifi_11ax_beam_cmd beam_cfg;
902 struct nxpwifi_11ax_htc_cmd htc_cfg;
903 struct nxpwifi_11ax_txomi_cmd txomi_cfg;
904 struct nxpwifi_11ax_toltime_cmd toltime_cfg;
905 struct nxpwifi_11ax_txop_cmd txop_cfg;
906 struct nxpwifi_11ax_set_bsrp_cmd setbsrp_cfg;
907 struct nxpwifi_11ax_llde_cmd llde_cfg;
908 } param;
909 };
910
911 struct nxpwifi_twt_setup {
912 /** Implicit, 0: TWT session is explicit, 1: Session is implicit */
913 u8 implicit;
914 /** Announced, 0: Unannounced, 1: Announced TWT */
915 u8 announced;
916 /** Trigger Enabled, 0: Non-Trigger enabled, 1: Trigger enabled TWT */
917 u8 trigger_enabled;
918 /** TWT Information Disabled, 0: TWT info enabled, 1: TWT info disabled */
919 u8 twt_info_disabled;
920 /*
921 * Negotiation Type, 0: Future Individual TWT SP start time, 1:
922 * Next Wake TBTT time
923 */
924 u8 negotiation_type;
925 /*
926 * TWT Wakeup Duration, time after which the TWT requesting STA can
927 * transition to doze state
928 */
929 u8 twt_wakeup_duration;
930 /** Flow Identifier. Range: [0-7]*/
931 u8 flow_identifier;
932 /*
933 * Hard Constraint, 0: FW can tweak the TWT setup parameters if it is
934 * rejected by AP.
935 * 1: Firmware should not tweak any parameters.
936 */
937 u8 hard_constraint;
938 /** TWT Exponent, Range: [0-63] */
939 u8 twt_exponent;
940 /** TWT Mantissa Range: [0-sizeof(UINT16)] */
941 __le16 twt_mantissa;
942 /** TWT Request Type, 0: REQUEST_TWT, 1: SUGGEST_TWT*/
943 u8 twt_request;
944 /** TWT Setup State. Set to 0 by driver, filled by FW in response*/
945 u8 twt_setup_state;
946 /** TWT link lost timeout threshold */
947 __le16 bcn_miss_threshold;
948 } __packed;
949
950 struct nxpwifi_twt_teardown {
951 /** TWT Flow Identifier. Range: [0-7] */
952 u8 flow_identifier;
953 /*
954 * Negotiation Type. 0: Future Individual TWT SP start time, 1: Next
955 * Wake TBTT time
956 */
957 u8 negotiation_type;
958 /** Tear down all TWT. 1: To teardown all TWT, 0 otherwise */
959 u8 teardown_all_twt;
960 /** TWT Teardown State. Set to 0 by driver, filled by FW in response */
961 u8 twt_teardown_state;
962 /** Reserved, set to 0. */
963 u8 reserved[3];
964 } __packed;
965
966 #define NXPWIFI_BTWT_REPORT_LEN 9
967 #define NXPWIFI_BTWT_REPORT_MAX_NUM 4
968 struct nxpwifi_twt_report {
969 /** TWT report type, 0: BTWT id */
970 u8 type;
971 /** TWT report length of value in data */
972 u8 length;
973 u8 reserve[2];
974 /** TWT report payload for FW response to fill */
975 u8 data[NXPWIFI_BTWT_REPORT_LEN * NXPWIFI_BTWT_REPORT_MAX_NUM];
976 } __packed;
977
978 struct nxpwifi_twt_information {
979 /** TWT Flow Identifier. Range: [0-7] */
980 u8 flow_identifier;
981 /*
982 * Suspend Duration. Range: [0-UINT32_MAX]
983 * 0:Suspend forever;
984 * Else:Suspend agreement for specific duration in milli seconds,
985 * after than resume the agreement and enter SP immediately
986 */
987 __le32 suspend_duration;
988 /** TWT Information State. Set to 0 by driver, filled by FW in response */
989 u8 twt_information_state;
990 } __packed;
991
992 struct btwt_set {
993 u8 btwt_id;
994 __le16 ap_bcast_mantissa;
995 u8 ap_bcast_exponent;
996 u8 nominalwake;
997 } __packed;
998
999 #define BTWT_AGREEMENT_MAX 5
1000 struct nxpwifi_btwt_ap_config {
1001 u8 ap_bcast_bet_sta_wait;
1002 __le16 ap_bcast_offset;
1003 u8 bcast_twtli;
1004 u8 count;
1005 struct btwt_set btwt_sets[BTWT_AGREEMENT_MAX];
1006 } __packed;
1007
1008 struct nxpwifi_twt_cfg {
1009 u16 action;
1010 u16 sub_id;
1011 union {
1012 struct nxpwifi_twt_setup twt_setup;
1013 struct nxpwifi_twt_teardown twt_teardown;
1014 struct nxpwifi_twt_report twt_report;
1015 struct nxpwifi_twt_information twt_information;
1016 struct nxpwifi_btwt_ap_config btwt_ap_config;
1017 } param;
1018 };
1019 #endif /* !_NXPWIFI_CFG_H_ */
1020