xref: /linux/drivers/net/wireless/silabs/wfx/hif_api_cmd.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1 /* SPDX-License-Identifier: GPL-2.0-only or Apache-2.0 */
2 /*
3  * WF200 hardware interface definitions
4  *
5  * Copyright (c) 2018-2020, Silicon Laboratories Inc.
6  */
7 
8 #ifndef WFX_HIF_API_CMD_H
9 #define WFX_HIF_API_CMD_H
10 
11 #include "hif_api_general.h"
12 
13 enum wfx_hif_requests_ids {
14 	HIF_REQ_ID_RESET                = 0x0a,
15 	HIF_REQ_ID_READ_MIB             = 0x05,
16 	HIF_REQ_ID_WRITE_MIB            = 0x06,
17 	HIF_REQ_ID_START_SCAN           = 0x07,
18 	HIF_REQ_ID_STOP_SCAN            = 0x08,
19 	HIF_REQ_ID_TX                   = 0x04,
20 	HIF_REQ_ID_JOIN                 = 0x0b,
21 	HIF_REQ_ID_SET_PM_MODE          = 0x10,
22 	HIF_REQ_ID_SET_BSS_PARAMS       = 0x11,
23 	HIF_REQ_ID_ADD_KEY              = 0x0c,
24 	HIF_REQ_ID_REMOVE_KEY           = 0x0d,
25 	HIF_REQ_ID_EDCA_QUEUE_PARAMS    = 0x13,
26 	HIF_REQ_ID_START                = 0x17,
27 	HIF_REQ_ID_BEACON_TRANSMIT      = 0x18,
28 	HIF_REQ_ID_UPDATE_IE            = 0x1b,
29 	HIF_REQ_ID_MAP_LINK             = 0x1c,
30 };
31 
32 enum wfx_hif_confirmations_ids {
33 	HIF_CNF_ID_RESET                = 0x0a,
34 	HIF_CNF_ID_READ_MIB             = 0x05,
35 	HIF_CNF_ID_WRITE_MIB            = 0x06,
36 	HIF_CNF_ID_START_SCAN           = 0x07,
37 	HIF_CNF_ID_STOP_SCAN            = 0x08,
38 	HIF_CNF_ID_TX                   = 0x04,
39 	HIF_CNF_ID_MULTI_TRANSMIT       = 0x1e,
40 	HIF_CNF_ID_JOIN                 = 0x0b,
41 	HIF_CNF_ID_SET_PM_MODE          = 0x10,
42 	HIF_CNF_ID_SET_BSS_PARAMS       = 0x11,
43 	HIF_CNF_ID_ADD_KEY              = 0x0c,
44 	HIF_CNF_ID_REMOVE_KEY           = 0x0d,
45 	HIF_CNF_ID_EDCA_QUEUE_PARAMS    = 0x13,
46 	HIF_CNF_ID_START                = 0x17,
47 	HIF_CNF_ID_BEACON_TRANSMIT      = 0x18,
48 	HIF_CNF_ID_UPDATE_IE            = 0x1b,
49 	HIF_CNF_ID_MAP_LINK             = 0x1c,
50 };
51 
52 enum wfx_hif_indications_ids {
53 	HIF_IND_ID_RX                   = 0x84,
54 	HIF_IND_ID_SCAN_CMPL            = 0x86,
55 	HIF_IND_ID_JOIN_COMPLETE        = 0x8f,
56 	HIF_IND_ID_SET_PM_MODE_CMPL     = 0x89,
57 	HIF_IND_ID_SUSPEND_RESUME_TX    = 0x8c,
58 	HIF_IND_ID_EVENT                = 0x85
59 };
60 
61 struct wfx_hif_req_reset {
62 	u8     reset_stat:1;
63 	u8     reset_all_int:1;
64 	u8     reserved1:6;
65 	u8     reserved2[3];
66 } __packed;
67 
68 struct wfx_hif_cnf_reset {
69 	__le32 status;
70 } __packed;
71 
72 struct wfx_hif_req_read_mib {
73 	__le16 mib_id;
74 	__le16 reserved;
75 } __packed;
76 
77 struct wfx_hif_cnf_read_mib {
78 	__le32 status;
79 	__le16 mib_id;
80 	__le16 length;
81 	u8     mib_data[];
82 } __packed;
83 
84 struct wfx_hif_req_write_mib {
85 	__le16 mib_id;
86 	__le16 length;
87 	u8     mib_data[];
88 } __packed;
89 
90 struct wfx_hif_cnf_write_mib {
91 	__le32 status;
92 } __packed;
93 
94 struct wfx_hif_req_update_ie {
95 	u8     beacon:1;
96 	u8     probe_resp:1;
97 	u8     probe_req:1;
98 	u8     reserved1:5;
99 	u8     reserved2;
100 	__le16 num_ies;
101 	u8     ie[];
102 } __packed;
103 
104 struct wfx_hif_cnf_update_ie {
105 	__le32 status;
106 } __packed;
107 
108 struct wfx_hif_ssid_def {
109 	__le32 ssid_length;
110 	u8     ssid[IEEE80211_MAX_SSID_LEN];
111 } __packed;
112 
113 #define HIF_API_MAX_NB_SSIDS                           2
114 #define HIF_API_MAX_NB_CHANNELS                       14
115 
116 struct wfx_hif_req_start_scan_alt {
117 	u8     band;
118 	u8     maintain_current_bss:1;
119 	u8     periodic:1;
120 	u8     reserved1:6;
121 	u8     disallow_ps:1;
122 	u8     reserved2:1;
123 	u8     short_preamble:1;
124 	u8     reserved3:5;
125 	u8     max_transmit_rate;
126 	__le16 periodic_interval;
127 	u8     reserved4;
128 	s8     periodic_rssi_thr;
129 	u8     num_of_probe_requests;
130 	u8     probe_delay;
131 	u8     num_of_ssids;
132 	u8     num_of_channels;
133 	__le32 min_channel_time;
134 	__le32 max_channel_time;
135 	__le32 tx_power_level; /* signed value */
136 	struct wfx_hif_ssid_def ssid_def[HIF_API_MAX_NB_SSIDS];
137 	u8     channel_list[];
138 } __packed;
139 
140 struct wfx_hif_cnf_start_scan {
141 	__le32 status;
142 } __packed;
143 
144 struct wfx_hif_cnf_stop_scan {
145 	__le32 status;
146 } __packed;
147 
148 enum wfx_hif_pm_mode_status {
149 	HIF_PM_MODE_ACTIVE                         = 0x0,
150 	HIF_PM_MODE_PS                             = 0x1,
151 	HIF_PM_MODE_UNDETERMINED                   = 0x2
152 };
153 
154 struct wfx_hif_ind_scan_cmpl {
155 	__le32 status;
156 	u8     pm_mode;
157 	u8     num_channels_completed;
158 	__le16 reserved;
159 } __packed;
160 
161 enum wfx_hif_queue_id {
162 	HIF_QUEUE_ID_BACKGROUND                    = 0x0,
163 	HIF_QUEUE_ID_BESTEFFORT                    = 0x1,
164 	HIF_QUEUE_ID_VIDEO                         = 0x2,
165 	HIF_QUEUE_ID_VOICE                         = 0x3
166 };
167 
168 enum wfx_hif_frame_format {
169 	HIF_FRAME_FORMAT_NON_HT                    = 0x0,
170 	HIF_FRAME_FORMAT_MIXED_FORMAT_HT           = 0x1,
171 	HIF_FRAME_FORMAT_GF_HT_11N                 = 0x2
172 };
173 
174 struct wfx_hif_req_tx {
175 	/* packet_id is not interpreted by the device, so it is not necessary to declare it little
176 	 * endian
177 	 */
178 	u32    packet_id;
179 	u8     max_tx_rate;
180 	u8     queue_id:2;
181 	u8     peer_sta_id:4;
182 	u8     reserved1:2;
183 	u8     more:1;
184 	u8     fc_offset:3;
185 	u8     after_dtim:1;
186 	u8     reserved2:3;
187 	u8     start_exp:1;
188 	u8     reserved3:3;
189 	u8     retry_policy_index:4;
190 	__le32 reserved4;
191 	__le32 expire_time;
192 	u8     frame_format:4;
193 	u8     fec_coding:1;
194 	u8     short_gi:1;
195 	u8     reserved5:1;
196 	u8     stbc:1;
197 	u8     reserved6;
198 	u8     aggregation:1;
199 	u8     reserved7:7;
200 	u8     reserved8;
201 	u8     frame[];
202 } __packed;
203 
204 enum wfx_hif_qos_ackplcy {
205 	HIF_QOS_ACKPLCY_NORMAL                         = 0x0,
206 	HIF_QOS_ACKPLCY_TXNOACK                        = 0x1,
207 	HIF_QOS_ACKPLCY_NOEXPACK                       = 0x2,
208 	HIF_QOS_ACKPLCY_BLCKACK                        = 0x3
209 };
210 
211 struct wfx_hif_cnf_tx {
212 	__le32 status;
213 	/* packet_id is copied from struct wfx_hif_req_tx without been interpreted by the device, so
214 	 * it is not necessary to declare it little endian
215 	 */
216 	u32    packet_id;
217 	u8     txed_rate;
218 	u8     ack_failures;
219 	u8     aggr:1;
220 	u8     requeue:1;
221 	u8     ack_policy:2;
222 	u8     txop_limit:1;
223 	u8     reserved1:3;
224 	u8     reserved2;
225 	__le32 media_delay;
226 	__le32 tx_queue_delay;
227 } __packed;
228 
229 struct wfx_hif_cnf_multi_transmit {
230 	u8     num_tx_confs;
231 	u8     reserved[3];
232 	struct wfx_hif_cnf_tx tx_conf_payload[];
233 } __packed;
234 
235 enum wfx_hif_ri_flags_encrypt {
236 	HIF_RI_FLAGS_UNENCRYPTED                   = 0x0,
237 	HIF_RI_FLAGS_WEP_ENCRYPTED                 = 0x1,
238 	HIF_RI_FLAGS_TKIP_ENCRYPTED                = 0x2,
239 	HIF_RI_FLAGS_AES_ENCRYPTED                 = 0x3,
240 	HIF_RI_FLAGS_WAPI_ENCRYPTED                = 0x4
241 };
242 
243 struct wfx_hif_ind_rx {
244 	__le32 status;
245 	u8     channel_number;
246 	u8     reserved1;
247 	u8     rxed_rate;
248 	u8     rcpi_rssi;
249 	u8     encryp:3;
250 	u8     in_aggr:1;
251 	u8     first_aggr:1;
252 	u8     last_aggr:1;
253 	u8     defrag:1;
254 	u8     beacon:1;
255 	u8     tim:1;
256 	u8     bitmap:1;
257 	u8     match_ssid:1;
258 	u8     match_bssid:1;
259 	u8     more:1;
260 	u8     reserved2:1;
261 	u8     ht:1;
262 	u8     stbc:1;
263 	u8     match_uc_addr:1;
264 	u8     match_mc_addr:1;
265 	u8     match_bc_addr:1;
266 	u8     key_type:1;
267 	u8     key_index:4;
268 	u8     reserved3:1;
269 	u8     peer_sta_id:4;
270 	u8     reserved4:2;
271 	u8     reserved5:1;
272 	u8     frame[];
273 } __packed;
274 
275 struct wfx_hif_req_edca_queue_params {
276 	u8     queue_id;
277 	u8     reserved1;
278 	u8     aifsn;
279 	u8     reserved2;
280 	__le16 cw_min;
281 	__le16 cw_max;
282 	__le16 tx_op_limit;
283 	__le16 allowed_medium_time;
284 	__le32 reserved3;
285 } __packed;
286 
287 struct wfx_hif_cnf_edca_queue_params {
288 	__le32 status;
289 } __packed;
290 
291 struct wfx_hif_req_join {
292 	u8     infrastructure_bss_mode:1;
293 	u8     reserved1:7;
294 	u8     band;
295 	u8     channel_number;
296 	u8     reserved2;
297 	u8     bssid[ETH_ALEN];
298 	__le16 atim_window;
299 	u8     short_preamble:1;
300 	u8     reserved3:7;
301 	u8     probe_for_join;
302 	u8     reserved4;
303 	u8     reserved5:2;
304 	u8     force_no_beacon:1;
305 	u8     force_with_ind:1;
306 	u8     reserved6:4;
307 	__le32 ssid_length;
308 	u8     ssid[IEEE80211_MAX_SSID_LEN];
309 	__le32 beacon_interval;
310 	__le32 basic_rate_set;
311 } __packed;
312 
313 struct wfx_hif_cnf_join {
314 	__le32 status;
315 } __packed;
316 
317 struct wfx_hif_ind_join_complete {
318 	__le32 status;
319 } __packed;
320 
321 struct wfx_hif_req_set_bss_params {
322 	u8     lost_count_only:1;
323 	u8     reserved:7;
324 	u8     beacon_lost_count;
325 	__le16 aid;
326 	__le32 operational_rate_set;
327 } __packed;
328 
329 struct wfx_hif_cnf_set_bss_params {
330 	__le32 status;
331 } __packed;
332 
333 struct wfx_hif_req_set_pm_mode {
334 	u8     enter_psm:1;
335 	u8     reserved:6;
336 	u8     fast_psm:1;
337 	u8     fast_psm_idle_period;
338 	u8     ap_psm_change_period;
339 	u8     min_auto_ps_poll_period;
340 } __packed;
341 
342 struct wfx_hif_cnf_set_pm_mode {
343 	__le32 status;
344 } __packed;
345 
346 struct wfx_hif_ind_set_pm_mode_cmpl {
347 	__le32 status;
348 	u8     pm_mode;
349 	u8     reserved[3];
350 } __packed;
351 
352 struct wfx_hif_req_start {
353 	u8     mode;
354 	u8     band;
355 	u8     channel_number;
356 	u8     reserved1;
357 	__le32 reserved2;
358 	__le32 beacon_interval;
359 	u8     dtim_period;
360 	u8     short_preamble:1;
361 	u8     reserved3:7;
362 	u8     reserved4;
363 	u8     ssid_length;
364 	u8     ssid[IEEE80211_MAX_SSID_LEN];
365 	__le32 basic_rate_set;
366 } __packed;
367 
368 struct wfx_hif_cnf_start {
369 	__le32 status;
370 } __packed;
371 
372 struct wfx_hif_req_beacon_transmit {
373 	u8     enable_beaconing;
374 	u8     reserved[3];
375 } __packed;
376 
377 struct wfx_hif_cnf_beacon_transmit {
378 	__le32 status;
379 } __packed;
380 
381 #define HIF_LINK_ID_MAX            14
382 #define HIF_LINK_ID_NOT_ASSOCIATED (HIF_LINK_ID_MAX + 1)
383 
384 struct wfx_hif_req_map_link {
385 	u8     mac_addr[ETH_ALEN];
386 	u8     unmap:1;
387 	u8     mfpc:1;
388 	u8     reserved:6;
389 	u8     peer_sta_id;
390 } __packed;
391 
392 struct wfx_hif_cnf_map_link {
393 	__le32 status;
394 } __packed;
395 
396 struct wfx_hif_ind_suspend_resume_tx {
397 	u8     resume:1;
398 	u8     reserved1:2;
399 	u8     bc_mc_only:1;
400 	u8     reserved2:4;
401 	u8     reserved3;
402 	__le16 peer_sta_set;
403 } __packed;
404 
405 
406 #define MAX_KEY_ENTRIES         24
407 #define HIF_API_WEP_KEY_DATA_SIZE                       16
408 #define HIF_API_TKIP_KEY_DATA_SIZE                      16
409 #define HIF_API_RX_MIC_KEY_SIZE                         8
410 #define HIF_API_TX_MIC_KEY_SIZE                         8
411 #define HIF_API_AES_KEY_DATA_SIZE                       16
412 #define HIF_API_WAPI_KEY_DATA_SIZE                      16
413 #define HIF_API_MIC_KEY_DATA_SIZE                       16
414 #define HIF_API_IGTK_KEY_DATA_SIZE                      16
415 #define HIF_API_RX_SEQUENCE_COUNTER_SIZE                8
416 #define HIF_API_IPN_SIZE                                8
417 
418 enum wfx_hif_key_type {
419 	HIF_KEY_TYPE_WEP_DEFAULT                   = 0x0,
420 	HIF_KEY_TYPE_WEP_PAIRWISE                  = 0x1,
421 	HIF_KEY_TYPE_TKIP_GROUP                    = 0x2,
422 	HIF_KEY_TYPE_TKIP_PAIRWISE                 = 0x3,
423 	HIF_KEY_TYPE_AES_GROUP                     = 0x4,
424 	HIF_KEY_TYPE_AES_PAIRWISE                  = 0x5,
425 	HIF_KEY_TYPE_WAPI_GROUP                    = 0x6,
426 	HIF_KEY_TYPE_WAPI_PAIRWISE                 = 0x7,
427 	HIF_KEY_TYPE_IGTK_GROUP                    = 0x8,
428 	HIF_KEY_TYPE_NONE                          = 0x9
429 };
430 
431 struct wfx_hif_wep_pairwise_key {
432 	u8     peer_address[ETH_ALEN];
433 	u8     reserved;
434 	u8     key_length;
435 	u8     key_data[HIF_API_WEP_KEY_DATA_SIZE];
436 } __packed;
437 
438 struct wfx_hif_wep_group_key {
439 	u8     key_id;
440 	u8     key_length;
441 	u8     reserved[2];
442 	u8     key_data[HIF_API_WEP_KEY_DATA_SIZE];
443 } __packed;
444 
445 struct wfx_hif_tkip_pairwise_key {
446 	u8     peer_address[ETH_ALEN];
447 	u8     reserved[2];
448 	u8     tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE];
449 	u8     rx_mic_key[HIF_API_RX_MIC_KEY_SIZE];
450 	u8     tx_mic_key[HIF_API_TX_MIC_KEY_SIZE];
451 } __packed;
452 
453 struct wfx_hif_tkip_group_key {
454 	u8     tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE];
455 	u8     rx_mic_key[HIF_API_RX_MIC_KEY_SIZE];
456 	u8     key_id;
457 	u8     reserved[3];
458 	u8     rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE];
459 } __packed;
460 
461 struct wfx_hif_aes_pairwise_key {
462 	u8     peer_address[ETH_ALEN];
463 	u8     reserved[2];
464 	u8     aes_key_data[HIF_API_AES_KEY_DATA_SIZE];
465 } __packed;
466 
467 struct wfx_hif_aes_group_key {
468 	u8     aes_key_data[HIF_API_AES_KEY_DATA_SIZE];
469 	u8     key_id;
470 	u8     reserved[3];
471 	u8     rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE];
472 } __packed;
473 
474 struct wfx_hif_wapi_pairwise_key {
475 	u8     peer_address[ETH_ALEN];
476 	u8     key_id;
477 	u8     reserved;
478 	u8     wapi_key_data[HIF_API_WAPI_KEY_DATA_SIZE];
479 	u8     mic_key_data[HIF_API_MIC_KEY_DATA_SIZE];
480 } __packed;
481 
482 struct wfx_hif_wapi_group_key {
483 	u8     wapi_key_data[HIF_API_WAPI_KEY_DATA_SIZE];
484 	u8     mic_key_data[HIF_API_MIC_KEY_DATA_SIZE];
485 	u8     key_id;
486 	u8     reserved[3];
487 } __packed;
488 
489 struct wfx_hif_igtk_group_key {
490 	u8     igtk_key_data[HIF_API_IGTK_KEY_DATA_SIZE];
491 	u8     key_id;
492 	u8     reserved[3];
493 	u8     ipn[HIF_API_IPN_SIZE];
494 } __packed;
495 
496 struct wfx_hif_req_add_key {
497 	u8     type;
498 	u8     entry_index;
499 	u8     int_id:2;
500 	u8     reserved1:6;
501 	u8     reserved2;
502 	union {
503 		struct wfx_hif_wep_pairwise_key  wep_pairwise_key;
504 		struct wfx_hif_wep_group_key     wep_group_key;
505 		struct wfx_hif_tkip_pairwise_key tkip_pairwise_key;
506 		struct wfx_hif_tkip_group_key    tkip_group_key;
507 		struct wfx_hif_aes_pairwise_key  aes_pairwise_key;
508 		struct wfx_hif_aes_group_key     aes_group_key;
509 		struct wfx_hif_wapi_pairwise_key wapi_pairwise_key;
510 		struct wfx_hif_wapi_group_key    wapi_group_key;
511 		struct wfx_hif_igtk_group_key    igtk_group_key;
512 	} key;
513 } __packed;
514 
515 struct wfx_hif_cnf_add_key {
516 	__le32 status;
517 } __packed;
518 
519 struct wfx_hif_req_remove_key {
520 	u8     entry_index;
521 	u8     reserved[3];
522 } __packed;
523 
524 struct wfx_hif_cnf_remove_key {
525 	__le32 status;
526 } __packed;
527 
528 enum wfx_hif_event_ind {
529 	HIF_EVENT_IND_BSSLOST                      = 0x1,
530 	HIF_EVENT_IND_BSSREGAINED                  = 0x2,
531 	HIF_EVENT_IND_RCPI_RSSI                    = 0x3,
532 	HIF_EVENT_IND_PS_MODE_ERROR                = 0x4,
533 	HIF_EVENT_IND_INACTIVITY                   = 0x5
534 };
535 
536 enum wfx_hif_ps_mode_error {
537 	HIF_PS_ERROR_NO_ERROR                      = 0,
538 	HIF_PS_ERROR_AP_NOT_RESP_TO_POLL           = 1,
539 	HIF_PS_ERROR_AP_NOT_RESP_TO_UAPSD_TRIGGER  = 2,
540 	HIF_PS_ERROR_AP_SENT_UNICAST_IN_DOZE       = 3,
541 	HIF_PS_ERROR_AP_NO_DATA_AFTER_TIM          = 4
542 };
543 
544 struct wfx_hif_ind_event {
545 	__le32 event_id;
546 	union {
547 		u8     rcpi_rssi;
548 		__le32 ps_mode_error;
549 		__le32 peer_sta_set;
550 	} event_data;
551 } __packed;
552 
553 #endif
554