1 /* SPDX-License-Identifier: 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 <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 u8 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 */ 180 u32 packet_id; 181 u8 max_tx_rate; 182 u8 queue_id:2; 183 u8 peer_sta_id:4; 184 u8 reserved1:2; 185 u8 more:1; 186 u8 fc_offset:3; 187 u8 after_dtim:1; 188 u8 reserved2:3; 189 u8 start_exp:1; 190 u8 reserved3:3; 191 u8 retry_policy_index:4; 192 __le32 reserved4; 193 __le32 expire_time; 194 u8 frame_format:4; 195 u8 fec_coding:1; 196 u8 short_gi:1; 197 u8 reserved5:1; 198 u8 stbc:1; 199 u8 reserved6; 200 u8 aggregation:1; 201 u8 reserved7:7; 202 u8 reserved8; 203 u8 frame[]; 204 } __packed; 205 206 enum hif_qos_ackplcy { 207 HIF_QOS_ACKPLCY_NORMAL = 0x0, 208 HIF_QOS_ACKPLCY_TXNOACK = 0x1, 209 HIF_QOS_ACKPLCY_NOEXPACK = 0x2, 210 HIF_QOS_ACKPLCY_BLCKACK = 0x3 211 }; 212 213 struct hif_cnf_tx { 214 __le32 status; 215 /* packet_id is copied from struct hif_req_tx without been interpreted 216 * by the device, so it is not necessary to declare it little endian 217 */ 218 u32 packet_id; 219 u8 txed_rate; 220 u8 ack_failures; 221 u8 aggr:1; 222 u8 requeue:1; 223 u8 ack_policy:2; 224 u8 txop_limit:1; 225 u8 reserved1:3; 226 u8 reserved2; 227 __le32 media_delay; 228 __le32 tx_queue_delay; 229 } __packed; 230 231 struct hif_cnf_multi_transmit { 232 u8 num_tx_confs; 233 u8 reserved[3]; 234 struct hif_cnf_tx tx_conf_payload[]; 235 } __packed; 236 237 enum hif_ri_flags_encrypt { 238 HIF_RI_FLAGS_UNENCRYPTED = 0x0, 239 HIF_RI_FLAGS_WEP_ENCRYPTED = 0x1, 240 HIF_RI_FLAGS_TKIP_ENCRYPTED = 0x2, 241 HIF_RI_FLAGS_AES_ENCRYPTED = 0x3, 242 HIF_RI_FLAGS_WAPI_ENCRYPTED = 0x4 243 }; 244 245 struct hif_ind_rx { 246 __le32 status; 247 u8 channel_number; 248 u8 reserved1; 249 u8 rxed_rate; 250 u8 rcpi_rssi; 251 u8 encryp:3; 252 u8 in_aggr:1; 253 u8 first_aggr:1; 254 u8 last_aggr:1; 255 u8 defrag:1; 256 u8 beacon:1; 257 u8 tim:1; 258 u8 bitmap:1; 259 u8 match_ssid:1; 260 u8 match_bssid:1; 261 u8 more:1; 262 u8 reserved2:1; 263 u8 ht:1; 264 u8 stbc:1; 265 u8 match_uc_addr:1; 266 u8 match_mc_addr:1; 267 u8 match_bc_addr:1; 268 u8 key_type:1; 269 u8 key_index:4; 270 u8 reserved3:1; 271 u8 peer_sta_id:4; 272 u8 reserved4:2; 273 u8 reserved5:1; 274 u8 frame[]; 275 } __packed; 276 277 struct hif_req_edca_queue_params { 278 u8 queue_id; 279 u8 reserved1; 280 u8 aifsn; 281 u8 reserved2; 282 __le16 cw_min; 283 __le16 cw_max; 284 __le16 tx_op_limit; 285 __le16 allowed_medium_time; 286 __le32 reserved3; 287 } __packed; 288 289 struct hif_cnf_edca_queue_params { 290 __le32 status; 291 } __packed; 292 293 struct hif_req_join { 294 u8 infrastructure_bss_mode:1; 295 u8 reserved1:7; 296 u8 band; 297 u8 channel_number; 298 u8 reserved2; 299 u8 bssid[ETH_ALEN]; 300 __le16 atim_window; 301 u8 short_preamble:1; 302 u8 reserved3:7; 303 u8 probe_for_join; 304 u8 reserved4; 305 u8 reserved5:2; 306 u8 force_no_beacon:1; 307 u8 force_with_ind:1; 308 u8 reserved6:4; 309 __le32 ssid_length; 310 u8 ssid[IEEE80211_MAX_SSID_LEN]; 311 __le32 beacon_interval; 312 __le32 basic_rate_set; 313 } __packed; 314 315 struct hif_cnf_join { 316 __le32 status; 317 } __packed; 318 319 struct hif_ind_join_complete { 320 __le32 status; 321 } __packed; 322 323 struct hif_req_set_bss_params { 324 u8 lost_count_only:1; 325 u8 reserved:7; 326 u8 beacon_lost_count; 327 __le16 aid; 328 __le32 operational_rate_set; 329 } __packed; 330 331 struct hif_cnf_set_bss_params { 332 __le32 status; 333 } __packed; 334 335 struct hif_req_set_pm_mode { 336 u8 enter_psm:1; 337 u8 reserved:6; 338 u8 fast_psm:1; 339 u8 fast_psm_idle_period; 340 u8 ap_psm_change_period; 341 u8 min_auto_ps_poll_period; 342 } __packed; 343 344 struct hif_cnf_set_pm_mode { 345 __le32 status; 346 } __packed; 347 348 struct hif_ind_set_pm_mode_cmpl { 349 __le32 status; 350 u8 pm_mode; 351 u8 reserved[3]; 352 } __packed; 353 354 struct hif_req_start { 355 u8 mode; 356 u8 band; 357 u8 channel_number; 358 u8 reserved1; 359 __le32 reserved2; 360 __le32 beacon_interval; 361 u8 dtim_period; 362 u8 short_preamble:1; 363 u8 reserved3:7; 364 u8 reserved4; 365 u8 ssid_length; 366 u8 ssid[IEEE80211_MAX_SSID_LEN]; 367 __le32 basic_rate_set; 368 } __packed; 369 370 struct hif_cnf_start { 371 __le32 status; 372 } __packed; 373 374 struct hif_req_beacon_transmit { 375 u8 enable_beaconing; 376 u8 reserved[3]; 377 } __packed; 378 379 struct hif_cnf_beacon_transmit { 380 __le32 status; 381 } __packed; 382 383 #define HIF_LINK_ID_MAX 14 384 #define HIF_LINK_ID_NOT_ASSOCIATED (HIF_LINK_ID_MAX + 1) 385 386 struct hif_req_map_link { 387 u8 mac_addr[ETH_ALEN]; 388 u8 unmap:1; 389 u8 mfpc:1; 390 u8 reserved:6; 391 u8 peer_sta_id; 392 } __packed; 393 394 struct hif_cnf_map_link { 395 __le32 status; 396 } __packed; 397 398 struct hif_ind_suspend_resume_tx { 399 u8 resume:1; 400 u8 reserved1:2; 401 u8 bc_mc_only:1; 402 u8 reserved2:4; 403 u8 reserved3; 404 __le16 peer_sta_set; 405 } __packed; 406 407 408 #define MAX_KEY_ENTRIES 24 409 #define HIF_API_WEP_KEY_DATA_SIZE 16 410 #define HIF_API_TKIP_KEY_DATA_SIZE 16 411 #define HIF_API_RX_MIC_KEY_SIZE 8 412 #define HIF_API_TX_MIC_KEY_SIZE 8 413 #define HIF_API_AES_KEY_DATA_SIZE 16 414 #define HIF_API_WAPI_KEY_DATA_SIZE 16 415 #define HIF_API_MIC_KEY_DATA_SIZE 16 416 #define HIF_API_IGTK_KEY_DATA_SIZE 16 417 #define HIF_API_RX_SEQUENCE_COUNTER_SIZE 8 418 #define HIF_API_IPN_SIZE 8 419 420 enum hif_key_type { 421 HIF_KEY_TYPE_WEP_DEFAULT = 0x0, 422 HIF_KEY_TYPE_WEP_PAIRWISE = 0x1, 423 HIF_KEY_TYPE_TKIP_GROUP = 0x2, 424 HIF_KEY_TYPE_TKIP_PAIRWISE = 0x3, 425 HIF_KEY_TYPE_AES_GROUP = 0x4, 426 HIF_KEY_TYPE_AES_PAIRWISE = 0x5, 427 HIF_KEY_TYPE_WAPI_GROUP = 0x6, 428 HIF_KEY_TYPE_WAPI_PAIRWISE = 0x7, 429 HIF_KEY_TYPE_IGTK_GROUP = 0x8, 430 HIF_KEY_TYPE_NONE = 0x9 431 }; 432 433 struct hif_wep_pairwise_key { 434 u8 peer_address[ETH_ALEN]; 435 u8 reserved; 436 u8 key_length; 437 u8 key_data[HIF_API_WEP_KEY_DATA_SIZE]; 438 } __packed; 439 440 struct hif_wep_group_key { 441 u8 key_id; 442 u8 key_length; 443 u8 reserved[2]; 444 u8 key_data[HIF_API_WEP_KEY_DATA_SIZE]; 445 } __packed; 446 447 struct hif_tkip_pairwise_key { 448 u8 peer_address[ETH_ALEN]; 449 u8 reserved[2]; 450 u8 tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE]; 451 u8 rx_mic_key[HIF_API_RX_MIC_KEY_SIZE]; 452 u8 tx_mic_key[HIF_API_TX_MIC_KEY_SIZE]; 453 } __packed; 454 455 struct hif_tkip_group_key { 456 u8 tkip_key_data[HIF_API_TKIP_KEY_DATA_SIZE]; 457 u8 rx_mic_key[HIF_API_RX_MIC_KEY_SIZE]; 458 u8 key_id; 459 u8 reserved[3]; 460 u8 rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE]; 461 } __packed; 462 463 struct hif_aes_pairwise_key { 464 u8 peer_address[ETH_ALEN]; 465 u8 reserved[2]; 466 u8 aes_key_data[HIF_API_AES_KEY_DATA_SIZE]; 467 } __packed; 468 469 struct hif_aes_group_key { 470 u8 aes_key_data[HIF_API_AES_KEY_DATA_SIZE]; 471 u8 key_id; 472 u8 reserved[3]; 473 u8 rx_sequence_counter[HIF_API_RX_SEQUENCE_COUNTER_SIZE]; 474 } __packed; 475 476 struct hif_wapi_pairwise_key { 477 u8 peer_address[ETH_ALEN]; 478 u8 key_id; 479 u8 reserved; 480 u8 wapi_key_data[HIF_API_WAPI_KEY_DATA_SIZE]; 481 u8 mic_key_data[HIF_API_MIC_KEY_DATA_SIZE]; 482 } __packed; 483 484 struct hif_wapi_group_key { 485 u8 wapi_key_data[HIF_API_WAPI_KEY_DATA_SIZE]; 486 u8 mic_key_data[HIF_API_MIC_KEY_DATA_SIZE]; 487 u8 key_id; 488 u8 reserved[3]; 489 } __packed; 490 491 struct hif_igtk_group_key { 492 u8 igtk_key_data[HIF_API_IGTK_KEY_DATA_SIZE]; 493 u8 key_id; 494 u8 reserved[3]; 495 u8 ipn[HIF_API_IPN_SIZE]; 496 } __packed; 497 498 struct hif_req_add_key { 499 u8 type; 500 u8 entry_index; 501 u8 int_id:2; 502 u8 reserved1:6; 503 u8 reserved2; 504 union { 505 struct hif_wep_pairwise_key wep_pairwise_key; 506 struct hif_wep_group_key wep_group_key; 507 struct hif_tkip_pairwise_key tkip_pairwise_key; 508 struct hif_tkip_group_key tkip_group_key; 509 struct hif_aes_pairwise_key aes_pairwise_key; 510 struct hif_aes_group_key aes_group_key; 511 struct hif_wapi_pairwise_key wapi_pairwise_key; 512 struct hif_wapi_group_key wapi_group_key; 513 struct hif_igtk_group_key igtk_group_key; 514 } key; 515 } __packed; 516 517 struct hif_cnf_add_key { 518 __le32 status; 519 } __packed; 520 521 struct hif_req_remove_key { 522 u8 entry_index; 523 u8 reserved[3]; 524 } __packed; 525 526 struct hif_cnf_remove_key { 527 __le32 status; 528 } __packed; 529 530 enum hif_event_ind { 531 HIF_EVENT_IND_BSSLOST = 0x1, 532 HIF_EVENT_IND_BSSREGAINED = 0x2, 533 HIF_EVENT_IND_RCPI_RSSI = 0x3, 534 HIF_EVENT_IND_PS_MODE_ERROR = 0x4, 535 HIF_EVENT_IND_INACTIVITY = 0x5 536 }; 537 538 enum hif_ps_mode_error { 539 HIF_PS_ERROR_NO_ERROR = 0, 540 HIF_PS_ERROR_AP_NOT_RESP_TO_POLL = 1, 541 HIF_PS_ERROR_AP_NOT_RESP_TO_UAPSD_TRIGGER = 2, 542 HIF_PS_ERROR_AP_SENT_UNICAST_IN_DOZE = 3, 543 HIF_PS_ERROR_AP_NO_DATA_AFTER_TIM = 4 544 }; 545 546 struct hif_ind_event { 547 __le32 event_id; 548 union { 549 u8 rcpi_rssi; 550 __le32 ps_mode_error; 551 __le32 peer_sta_set; 552 } event_data; 553 } __packed; 554 555 #endif 556