1 /* SPDX-License-Identifier: Apache-2.0 */ 2 /* 3 * WFx 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 <linux/ieee80211.h> 12 13 #include "hif_api_general.h" 14 15 enum hif_requests_ids { 16 HIF_REQ_ID_RESET = 0x0a, 17 HIF_REQ_ID_READ_MIB = 0x05, 18 HIF_REQ_ID_WRITE_MIB = 0x06, 19 HIF_REQ_ID_START_SCAN = 0x07, 20 HIF_REQ_ID_STOP_SCAN = 0x08, 21 HIF_REQ_ID_TX = 0x04, 22 HIF_REQ_ID_JOIN = 0x0b, 23 HIF_REQ_ID_SET_PM_MODE = 0x10, 24 HIF_REQ_ID_SET_BSS_PARAMS = 0x11, 25 HIF_REQ_ID_ADD_KEY = 0x0c, 26 HIF_REQ_ID_REMOVE_KEY = 0x0d, 27 HIF_REQ_ID_EDCA_QUEUE_PARAMS = 0x13, 28 HIF_REQ_ID_START = 0x17, 29 HIF_REQ_ID_BEACON_TRANSMIT = 0x18, 30 HIF_REQ_ID_UPDATE_IE = 0x1b, 31 HIF_REQ_ID_MAP_LINK = 0x1c, 32 }; 33 34 enum hif_confirmations_ids { 35 HIF_CNF_ID_RESET = 0x0a, 36 HIF_CNF_ID_READ_MIB = 0x05, 37 HIF_CNF_ID_WRITE_MIB = 0x06, 38 HIF_CNF_ID_START_SCAN = 0x07, 39 HIF_CNF_ID_STOP_SCAN = 0x08, 40 HIF_CNF_ID_TX = 0x04, 41 HIF_CNF_ID_MULTI_TRANSMIT = 0x1e, 42 HIF_CNF_ID_JOIN = 0x0b, 43 HIF_CNF_ID_SET_PM_MODE = 0x10, 44 HIF_CNF_ID_SET_BSS_PARAMS = 0x11, 45 HIF_CNF_ID_ADD_KEY = 0x0c, 46 HIF_CNF_ID_REMOVE_KEY = 0x0d, 47 HIF_CNF_ID_EDCA_QUEUE_PARAMS = 0x13, 48 HIF_CNF_ID_START = 0x17, 49 HIF_CNF_ID_BEACON_TRANSMIT = 0x18, 50 HIF_CNF_ID_UPDATE_IE = 0x1b, 51 HIF_CNF_ID_MAP_LINK = 0x1c, 52 }; 53 54 enum hif_indications_ids { 55 HIF_IND_ID_RX = 0x84, 56 HIF_IND_ID_SCAN_CMPL = 0x86, 57 HIF_IND_ID_JOIN_COMPLETE = 0x8f, 58 HIF_IND_ID_SET_PM_MODE_CMPL = 0x89, 59 HIF_IND_ID_SUSPEND_RESUME_TX = 0x8c, 60 HIF_IND_ID_EVENT = 0x85 61 }; 62 63 struct hif_req_reset { 64 u8 reset_stat:1; 65 u8 reset_all_int:1; 66 u8 reserved1:6; 67 u8 reserved2[3]; 68 } __packed; 69 70 struct hif_cnf_reset { 71 __le32 status; 72 } __packed; 73 74 struct hif_req_read_mib { 75 __le16 mib_id; 76 __le16 reserved; 77 } __packed; 78 79 struct hif_cnf_read_mib { 80 __le32 status; 81 __le16 mib_id; 82 __le16 length; 83 u8 mib_data[]; 84 } __packed; 85 86 struct hif_req_write_mib { 87 __le16 mib_id; 88 __le16 length; 89 u8 mib_data[]; 90 } __packed; 91 92 struct hif_cnf_write_mib { 93 __le32 status; 94 } __packed; 95 96 struct hif_req_update_ie { 97 u8 beacon:1; 98 u8 probe_resp:1; 99 u8 probe_req:1; 100 u8 reserved1:5; 101 u8 reserved2; 102 __le16 num_ies; 103 struct element ie[]; 104 } __packed; 105 106 struct hif_cnf_update_ie { 107 __le32 status; 108 } __packed; 109 110 struct hif_ssid_def { 111 __le32 ssid_length; 112 u8 ssid[IEEE80211_MAX_SSID_LEN]; 113 } __packed; 114 115 #define HIF_API_MAX_NB_SSIDS 2 116 #define HIF_API_MAX_NB_CHANNELS 14 117 118 struct hif_req_start_scan_alt { 119 u8 band; 120 u8 maintain_current_bss:1; 121 u8 periodic:1; 122 u8 reserved1:6; 123 u8 disallow_ps:1; 124 u8 reserved2:1; 125 u8 short_preamble:1; 126 u8 reserved3:5; 127 u8 max_transmit_rate; 128 __le16 periodic_interval; 129 u8 reserved4; 130 s8 periodic_rssi_thr; 131 u8 num_of_probe_requests; 132 u8 probe_delay; 133 u8 num_of_ssids; 134 u8 num_of_channels; 135 __le32 min_channel_time; 136 __le32 max_channel_time; 137 __le32 tx_power_level; // signed value 138 struct hif_ssid_def ssid_def[HIF_API_MAX_NB_SSIDS]; 139 u8 channel_list[]; 140 } __packed; 141 142 struct hif_cnf_start_scan { 143 __le32 status; 144 } __packed; 145 146 struct hif_cnf_stop_scan { 147 __le32 status; 148 } __packed; 149 150 enum hif_pm_mode_status { 151 HIF_PM_MODE_ACTIVE = 0x0, 152 HIF_PM_MODE_PS = 0x1, 153 HIF_PM_MODE_UNDETERMINED = 0x2 154 }; 155 156 struct hif_ind_scan_cmpl { 157 __le32 status; 158 u8 pm_mode; 159 u8 num_channels_completed; 160 __le16 reserved; 161 } __packed; 162 163 enum hif_queue_id { 164 HIF_QUEUE_ID_BACKGROUND = 0x0, 165 HIF_QUEUE_ID_BESTEFFORT = 0x1, 166 HIF_QUEUE_ID_VIDEO = 0x2, 167 HIF_QUEUE_ID_VOICE = 0x3 168 }; 169 170 enum hif_frame_format { 171 HIF_FRAME_FORMAT_NON_HT = 0x0, 172 HIF_FRAME_FORMAT_MIXED_FORMAT_HT = 0x1, 173 HIF_FRAME_FORMAT_GF_HT_11N = 0x2 174 }; 175 176 struct hif_req_tx { 177 // packet_id is not interpreted by the device, so it is not necessary to 178 // declare it little endian 179 u32 packet_id; 180 u8 max_tx_rate; 181 u8 queue_id:2; 182 u8 peer_sta_id:4; 183 u8 reserved1:2; 184 u8 more:1; 185 u8 fc_offset:3; 186 u8 after_dtim:1; 187 u8 reserved2:3; 188 u8 start_exp:1; 189 u8 reserved3:3; 190 u8 retry_policy_index:4; 191 __le32 reserved4; 192 __le32 expire_time; 193 u8 frame_format:4; 194 u8 fec_coding:1; 195 u8 short_gi:1; 196 u8 reserved5:1; 197 u8 stbc:1; 198 u8 reserved6; 199 u8 aggregation:1; 200 u8 reserved7:7; 201 u8 reserved8; 202 u8 frame[]; 203 } __packed; 204 205 enum hif_qos_ackplcy { 206 HIF_QOS_ACKPLCY_NORMAL = 0x0, 207 HIF_QOS_ACKPLCY_TXNOACK = 0x1, 208 HIF_QOS_ACKPLCY_NOEXPACK = 0x2, 209 HIF_QOS_ACKPLCY_BLCKACK = 0x3 210 }; 211 212 struct hif_cnf_tx { 213 __le32 status; 214 // packet_id is copied from struct hif_req_tx without been interpreted 215 // by the device, so it is not necessary to declare it little endian 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 hif_cnf_multi_transmit { 230 u8 num_tx_confs; 231 u8 reserved[3]; 232 struct hif_cnf_tx tx_conf_payload[]; 233 } __packed; 234 235 enum 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 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 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 hif_cnf_edca_queue_params { 288 __le32 status; 289 } __packed; 290 291 struct 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 hif_cnf_join { 314 __le32 status; 315 } __packed; 316 317 struct hif_ind_join_complete { 318 __le32 status; 319 } __packed; 320 321 struct 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 hif_cnf_set_bss_params { 330 __le32 status; 331 } __packed; 332 333 struct 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 hif_cnf_set_pm_mode { 343 __le32 status; 344 } __packed; 345 346 struct hif_ind_set_pm_mode_cmpl { 347 __le32 status; 348 u8 pm_mode; 349 u8 reserved[3]; 350 } __packed; 351 352 struct 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 hif_cnf_start { 369 __le32 status; 370 } __packed; 371 372 struct hif_req_beacon_transmit { 373 u8 enable_beaconing; 374 u8 reserved[3]; 375 } __packed; 376 377 struct 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 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 hif_cnf_map_link { 393 __le32 status; 394 } __packed; 395 396 struct 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 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 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 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 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 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 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 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 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 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 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 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 hif_wep_pairwise_key wep_pairwise_key; 504 struct hif_wep_group_key wep_group_key; 505 struct hif_tkip_pairwise_key tkip_pairwise_key; 506 struct hif_tkip_group_key tkip_group_key; 507 struct hif_aes_pairwise_key aes_pairwise_key; 508 struct hif_aes_group_key aes_group_key; 509 struct hif_wapi_pairwise_key wapi_pairwise_key; 510 struct hif_wapi_group_key wapi_group_key; 511 struct hif_igtk_group_key igtk_group_key; 512 } key; 513 } __packed; 514 515 struct hif_cnf_add_key { 516 __le32 status; 517 } __packed; 518 519 struct hif_req_remove_key { 520 u8 entry_index; 521 u8 reserved[3]; 522 } __packed; 523 524 struct hif_cnf_remove_key { 525 __le32 status; 526 } __packed; 527 528 enum 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 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 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