hif_api_cmd.h 13 KB

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