fw-api.h 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called COPYING.
  26. *
  27. * Contact Information:
  28. * Intel Linux Wireless <ilw@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. #ifndef __fw_api_h__
  64. #define __fw_api_h__
  65. #include "fw-api-rs.h"
  66. #include "fw-api-tx.h"
  67. #include "fw-api-sta.h"
  68. #include "fw-api-mac.h"
  69. #include "fw-api-power.h"
  70. #include "fw-api-d3.h"
  71. #include "fw-api-coex.h"
  72. #include "fw-api-scan.h"
  73. /* maximal number of Tx queues in any platform */
  74. #define IWL_MVM_MAX_QUEUES 20
  75. /* Tx queue numbers */
  76. enum {
  77. IWL_MVM_OFFCHANNEL_QUEUE = 8,
  78. IWL_MVM_CMD_QUEUE = 9,
  79. };
  80. #define IWL_MVM_CMD_FIFO 7
  81. #define IWL_MVM_STATION_COUNT 16
  82. /* commands */
  83. enum {
  84. MVM_ALIVE = 0x1,
  85. REPLY_ERROR = 0x2,
  86. INIT_COMPLETE_NOTIF = 0x4,
  87. /* PHY context commands */
  88. PHY_CONTEXT_CMD = 0x8,
  89. DBG_CFG = 0x9,
  90. ANTENNA_COUPLING_NOTIFICATION = 0xa,
  91. /* station table */
  92. ADD_STA_KEY = 0x17,
  93. ADD_STA = 0x18,
  94. REMOVE_STA = 0x19,
  95. /* TX */
  96. TX_CMD = 0x1c,
  97. TXPATH_FLUSH = 0x1e,
  98. MGMT_MCAST_KEY = 0x1f,
  99. /* global key */
  100. WEP_KEY = 0x20,
  101. /* MAC and Binding commands */
  102. MAC_CONTEXT_CMD = 0x28,
  103. TIME_EVENT_CMD = 0x29, /* both CMD and response */
  104. TIME_EVENT_NOTIFICATION = 0x2a,
  105. BINDING_CONTEXT_CMD = 0x2b,
  106. TIME_QUOTA_CMD = 0x2c,
  107. NON_QOS_TX_COUNTER_CMD = 0x2d,
  108. LQ_CMD = 0x4e,
  109. /* Calibration */
  110. TEMPERATURE_NOTIFICATION = 0x62,
  111. CALIBRATION_CFG_CMD = 0x65,
  112. CALIBRATION_RES_NOTIFICATION = 0x66,
  113. CALIBRATION_COMPLETE_NOTIFICATION = 0x67,
  114. RADIO_VERSION_NOTIFICATION = 0x68,
  115. /* Scan offload */
  116. SCAN_OFFLOAD_REQUEST_CMD = 0x51,
  117. SCAN_OFFLOAD_ABORT_CMD = 0x52,
  118. SCAN_OFFLOAD_COMPLETE = 0x6D,
  119. SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E,
  120. SCAN_OFFLOAD_CONFIG_CMD = 0x6f,
  121. MATCH_FOUND_NOTIFICATION = 0xd9,
  122. /* Phy */
  123. PHY_CONFIGURATION_CMD = 0x6a,
  124. CALIB_RES_NOTIF_PHY_DB = 0x6b,
  125. /* PHY_DB_CMD = 0x6c, */
  126. /* Power - legacy power table command */
  127. POWER_TABLE_CMD = 0x77,
  128. PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78,
  129. /* Thermal Throttling*/
  130. REPLY_THERMAL_MNG_BACKOFF = 0x7e,
  131. /* Scanning */
  132. SCAN_REQUEST_CMD = 0x80,
  133. SCAN_ABORT_CMD = 0x81,
  134. SCAN_START_NOTIFICATION = 0x82,
  135. SCAN_RESULTS_NOTIFICATION = 0x83,
  136. SCAN_COMPLETE_NOTIFICATION = 0x84,
  137. /* NVM */
  138. NVM_ACCESS_CMD = 0x88,
  139. SET_CALIB_DEFAULT_CMD = 0x8e,
  140. BEACON_NOTIFICATION = 0x90,
  141. BEACON_TEMPLATE_CMD = 0x91,
  142. TX_ANT_CONFIGURATION_CMD = 0x98,
  143. BT_CONFIG = 0x9b,
  144. STATISTICS_NOTIFICATION = 0x9d,
  145. EOSP_NOTIFICATION = 0x9e,
  146. REDUCE_TX_POWER_CMD = 0x9f,
  147. /* RF-KILL commands and notifications */
  148. CARD_STATE_CMD = 0xa0,
  149. CARD_STATE_NOTIFICATION = 0xa1,
  150. MISSED_BEACONS_NOTIFICATION = 0xa2,
  151. /* Power - new power table command */
  152. MAC_PM_POWER_TABLE = 0xa9,
  153. REPLY_RX_PHY_CMD = 0xc0,
  154. REPLY_RX_MPDU_CMD = 0xc1,
  155. BA_NOTIF = 0xc5,
  156. /* BT Coex */
  157. BT_COEX_PRIO_TABLE = 0xcc,
  158. BT_COEX_PROT_ENV = 0xcd,
  159. BT_PROFILE_NOTIFICATION = 0xce,
  160. BT_COEX_CI = 0x5d,
  161. REPLY_SF_CFG_CMD = 0xd1,
  162. REPLY_BEACON_FILTERING_CMD = 0xd2,
  163. REPLY_DEBUG_CMD = 0xf0,
  164. DEBUG_LOG_MSG = 0xf7,
  165. BCAST_FILTER_CMD = 0xcf,
  166. MCAST_FILTER_CMD = 0xd0,
  167. /* D3 commands/notifications */
  168. D3_CONFIG_CMD = 0xd3,
  169. PROT_OFFLOAD_CONFIG_CMD = 0xd4,
  170. OFFLOADS_QUERY_CMD = 0xd5,
  171. REMOTE_WAKE_CONFIG_CMD = 0xd6,
  172. D0I3_END_CMD = 0xed,
  173. /* for WoWLAN in particular */
  174. WOWLAN_PATTERNS = 0xe0,
  175. WOWLAN_CONFIGURATION = 0xe1,
  176. WOWLAN_TSC_RSC_PARAM = 0xe2,
  177. WOWLAN_TKIP_PARAM = 0xe3,
  178. WOWLAN_KEK_KCK_MATERIAL = 0xe4,
  179. WOWLAN_GET_STATUSES = 0xe5,
  180. WOWLAN_TX_POWER_PER_DB = 0xe6,
  181. /* and for NetDetect */
  182. NET_DETECT_CONFIG_CMD = 0x54,
  183. NET_DETECT_PROFILES_QUERY_CMD = 0x56,
  184. NET_DETECT_PROFILES_CMD = 0x57,
  185. NET_DETECT_HOTSPOTS_CMD = 0x58,
  186. NET_DETECT_HOTSPOTS_QUERY_CMD = 0x59,
  187. REPLY_MAX = 0xff,
  188. };
  189. /**
  190. * struct iwl_cmd_response - generic response struct for most commands
  191. * @status: status of the command asked, changes for each one
  192. */
  193. struct iwl_cmd_response {
  194. __le32 status;
  195. };
  196. /*
  197. * struct iwl_tx_ant_cfg_cmd
  198. * @valid: valid antenna configuration
  199. */
  200. struct iwl_tx_ant_cfg_cmd {
  201. __le32 valid;
  202. } __packed;
  203. /**
  204. * struct iwl_reduce_tx_power_cmd - TX power reduction command
  205. * REDUCE_TX_POWER_CMD = 0x9f
  206. * @flags: (reserved for future implementation)
  207. * @mac_context_id: id of the mac ctx for which we are reducing TX power.
  208. * @pwr_restriction: TX power restriction in dBms.
  209. */
  210. struct iwl_reduce_tx_power_cmd {
  211. u8 flags;
  212. u8 mac_context_id;
  213. __le16 pwr_restriction;
  214. } __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
  215. /*
  216. * Calibration control struct.
  217. * Sent as part of the phy configuration command.
  218. * @flow_trigger: bitmap for which calibrations to perform according to
  219. * flow triggers.
  220. * @event_trigger: bitmap for which calibrations to perform according to
  221. * event triggers.
  222. */
  223. struct iwl_calib_ctrl {
  224. __le32 flow_trigger;
  225. __le32 event_trigger;
  226. } __packed;
  227. /* This enum defines the bitmap of various calibrations to enable in both
  228. * init ucode and runtime ucode through CALIBRATION_CFG_CMD.
  229. */
  230. enum iwl_calib_cfg {
  231. IWL_CALIB_CFG_XTAL_IDX = BIT(0),
  232. IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(1),
  233. IWL_CALIB_CFG_VOLTAGE_READ_IDX = BIT(2),
  234. IWL_CALIB_CFG_PAPD_IDX = BIT(3),
  235. IWL_CALIB_CFG_TX_PWR_IDX = BIT(4),
  236. IWL_CALIB_CFG_DC_IDX = BIT(5),
  237. IWL_CALIB_CFG_BB_FILTER_IDX = BIT(6),
  238. IWL_CALIB_CFG_LO_LEAKAGE_IDX = BIT(7),
  239. IWL_CALIB_CFG_TX_IQ_IDX = BIT(8),
  240. IWL_CALIB_CFG_TX_IQ_SKEW_IDX = BIT(9),
  241. IWL_CALIB_CFG_RX_IQ_IDX = BIT(10),
  242. IWL_CALIB_CFG_RX_IQ_SKEW_IDX = BIT(11),
  243. IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(12),
  244. IWL_CALIB_CFG_CHAIN_NOISE_IDX = BIT(13),
  245. IWL_CALIB_CFG_DISCONNECTED_ANT_IDX = BIT(14),
  246. IWL_CALIB_CFG_ANT_COUPLING_IDX = BIT(15),
  247. IWL_CALIB_CFG_DAC_IDX = BIT(16),
  248. IWL_CALIB_CFG_ABS_IDX = BIT(17),
  249. IWL_CALIB_CFG_AGC_IDX = BIT(18),
  250. };
  251. /*
  252. * Phy configuration command.
  253. */
  254. struct iwl_phy_cfg_cmd {
  255. __le32 phy_cfg;
  256. struct iwl_calib_ctrl calib_control;
  257. } __packed;
  258. #define PHY_CFG_RADIO_TYPE (BIT(0) | BIT(1))
  259. #define PHY_CFG_RADIO_STEP (BIT(2) | BIT(3))
  260. #define PHY_CFG_RADIO_DASH (BIT(4) | BIT(5))
  261. #define PHY_CFG_PRODUCT_NUMBER (BIT(6) | BIT(7))
  262. #define PHY_CFG_TX_CHAIN_A BIT(8)
  263. #define PHY_CFG_TX_CHAIN_B BIT(9)
  264. #define PHY_CFG_TX_CHAIN_C BIT(10)
  265. #define PHY_CFG_RX_CHAIN_A BIT(12)
  266. #define PHY_CFG_RX_CHAIN_B BIT(13)
  267. #define PHY_CFG_RX_CHAIN_C BIT(14)
  268. /* Target of the NVM_ACCESS_CMD */
  269. enum {
  270. NVM_ACCESS_TARGET_CACHE = 0,
  271. NVM_ACCESS_TARGET_OTP = 1,
  272. NVM_ACCESS_TARGET_EEPROM = 2,
  273. };
  274. /* Section types for NVM_ACCESS_CMD */
  275. enum {
  276. NVM_SECTION_TYPE_SW = 1,
  277. NVM_SECTION_TYPE_REGULATORY = 3,
  278. NVM_SECTION_TYPE_CALIBRATION = 4,
  279. NVM_SECTION_TYPE_PRODUCTION = 5,
  280. NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
  281. NVM_MAX_NUM_SECTIONS = 12,
  282. };
  283. /**
  284. * struct iwl_nvm_access_cmd_ver2 - Request the device to send an NVM section
  285. * @op_code: 0 - read, 1 - write
  286. * @target: NVM_ACCESS_TARGET_*
  287. * @type: NVM_SECTION_TYPE_*
  288. * @offset: offset in bytes into the section
  289. * @length: in bytes, to read/write
  290. * @data: if write operation, the data to write. On read its empty
  291. */
  292. struct iwl_nvm_access_cmd {
  293. u8 op_code;
  294. u8 target;
  295. __le16 type;
  296. __le16 offset;
  297. __le16 length;
  298. u8 data[];
  299. } __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */
  300. /**
  301. * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD
  302. * @offset: offset in bytes into the section
  303. * @length: in bytes, either how much was written or read
  304. * @type: NVM_SECTION_TYPE_*
  305. * @status: 0 for success, fail otherwise
  306. * @data: if read operation, the data returned. Empty on write.
  307. */
  308. struct iwl_nvm_access_resp {
  309. __le16 offset;
  310. __le16 length;
  311. __le16 type;
  312. __le16 status;
  313. u8 data[];
  314. } __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */
  315. /* MVM_ALIVE 0x1 */
  316. /* alive response is_valid values */
  317. #define ALIVE_RESP_UCODE_OK BIT(0)
  318. #define ALIVE_RESP_RFKILL BIT(1)
  319. /* alive response ver_type values */
  320. enum {
  321. FW_TYPE_HW = 0,
  322. FW_TYPE_PROT = 1,
  323. FW_TYPE_AP = 2,
  324. FW_TYPE_WOWLAN = 3,
  325. FW_TYPE_TIMING = 4,
  326. FW_TYPE_WIPAN = 5
  327. };
  328. /* alive response ver_subtype values */
  329. enum {
  330. FW_SUBTYPE_FULL_FEATURE = 0,
  331. FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */
  332. FW_SUBTYPE_REDUCED = 2,
  333. FW_SUBTYPE_ALIVE_ONLY = 3,
  334. FW_SUBTYPE_WOWLAN = 4,
  335. FW_SUBTYPE_AP_SUBTYPE = 5,
  336. FW_SUBTYPE_WIPAN = 6,
  337. FW_SUBTYPE_INITIALIZE = 9
  338. };
  339. #define IWL_ALIVE_STATUS_ERR 0xDEAD
  340. #define IWL_ALIVE_STATUS_OK 0xCAFE
  341. #define IWL_ALIVE_FLG_RFKILL BIT(0)
  342. struct mvm_alive_resp {
  343. __le16 status;
  344. __le16 flags;
  345. u8 ucode_minor;
  346. u8 ucode_major;
  347. __le16 id;
  348. u8 api_minor;
  349. u8 api_major;
  350. u8 ver_subtype;
  351. u8 ver_type;
  352. u8 mac;
  353. u8 opt;
  354. __le16 reserved2;
  355. __le32 timestamp;
  356. __le32 error_event_table_ptr; /* SRAM address for error log */
  357. __le32 log_event_table_ptr; /* SRAM address for event log */
  358. __le32 cpu_register_ptr;
  359. __le32 dbgm_config_ptr;
  360. __le32 alive_counter_ptr;
  361. __le32 scd_base_ptr; /* SRAM address for SCD */
  362. } __packed; /* ALIVE_RES_API_S_VER_1 */
  363. struct mvm_alive_resp_ver2 {
  364. __le16 status;
  365. __le16 flags;
  366. u8 ucode_minor;
  367. u8 ucode_major;
  368. __le16 id;
  369. u8 api_minor;
  370. u8 api_major;
  371. u8 ver_subtype;
  372. u8 ver_type;
  373. u8 mac;
  374. u8 opt;
  375. __le16 reserved2;
  376. __le32 timestamp;
  377. __le32 error_event_table_ptr; /* SRAM address for error log */
  378. __le32 log_event_table_ptr; /* SRAM address for LMAC event log */
  379. __le32 cpu_register_ptr;
  380. __le32 dbgm_config_ptr;
  381. __le32 alive_counter_ptr;
  382. __le32 scd_base_ptr; /* SRAM address for SCD */
  383. __le32 st_fwrd_addr; /* pointer to Store and forward */
  384. __le32 st_fwrd_size;
  385. u8 umac_minor; /* UMAC version: minor */
  386. u8 umac_major; /* UMAC version: major */
  387. __le16 umac_id; /* UMAC version: id */
  388. __le32 error_info_addr; /* SRAM address for UMAC error log */
  389. __le32 dbg_print_buff_addr;
  390. } __packed; /* ALIVE_RES_API_S_VER_2 */
  391. /* Error response/notification */
  392. enum {
  393. FW_ERR_UNKNOWN_CMD = 0x0,
  394. FW_ERR_INVALID_CMD_PARAM = 0x1,
  395. FW_ERR_SERVICE = 0x2,
  396. FW_ERR_ARC_MEMORY = 0x3,
  397. FW_ERR_ARC_CODE = 0x4,
  398. FW_ERR_WATCH_DOG = 0x5,
  399. FW_ERR_WEP_GRP_KEY_INDX = 0x10,
  400. FW_ERR_WEP_KEY_SIZE = 0x11,
  401. FW_ERR_OBSOLETE_FUNC = 0x12,
  402. FW_ERR_UNEXPECTED = 0xFE,
  403. FW_ERR_FATAL = 0xFF
  404. };
  405. /**
  406. * struct iwl_error_resp - FW error indication
  407. * ( REPLY_ERROR = 0x2 )
  408. * @error_type: one of FW_ERR_*
  409. * @cmd_id: the command ID for which the error occured
  410. * @bad_cmd_seq_num: sequence number of the erroneous command
  411. * @error_service: which service created the error, applicable only if
  412. * error_type = 2, otherwise 0
  413. * @timestamp: TSF in usecs.
  414. */
  415. struct iwl_error_resp {
  416. __le32 error_type;
  417. u8 cmd_id;
  418. u8 reserved1;
  419. __le16 bad_cmd_seq_num;
  420. __le32 error_service;
  421. __le64 timestamp;
  422. } __packed;
  423. /* Common PHY, MAC and Bindings definitions */
  424. #define MAX_MACS_IN_BINDING (3)
  425. #define MAX_BINDINGS (4)
  426. #define AUX_BINDING_INDEX (3)
  427. #define MAX_PHYS (4)
  428. /* Used to extract ID and color from the context dword */
  429. #define FW_CTXT_ID_POS (0)
  430. #define FW_CTXT_ID_MSK (0xff << FW_CTXT_ID_POS)
  431. #define FW_CTXT_COLOR_POS (8)
  432. #define FW_CTXT_COLOR_MSK (0xff << FW_CTXT_COLOR_POS)
  433. #define FW_CTXT_INVALID (0xffffffff)
  434. #define FW_CMD_ID_AND_COLOR(_id, _color) ((_id << FW_CTXT_ID_POS) |\
  435. (_color << FW_CTXT_COLOR_POS))
  436. /* Possible actions on PHYs, MACs and Bindings */
  437. enum {
  438. FW_CTXT_ACTION_STUB = 0,
  439. FW_CTXT_ACTION_ADD,
  440. FW_CTXT_ACTION_MODIFY,
  441. FW_CTXT_ACTION_REMOVE,
  442. FW_CTXT_ACTION_NUM
  443. }; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */
  444. /* Time Events */
  445. /* Time Event types, according to MAC type */
  446. enum iwl_time_event_type {
  447. /* BSS Station Events */
  448. TE_BSS_STA_AGGRESSIVE_ASSOC,
  449. TE_BSS_STA_ASSOC,
  450. TE_BSS_EAP_DHCP_PROT,
  451. TE_BSS_QUIET_PERIOD,
  452. /* P2P Device Events */
  453. TE_P2P_DEVICE_DISCOVERABLE,
  454. TE_P2P_DEVICE_LISTEN,
  455. TE_P2P_DEVICE_ACTION_SCAN,
  456. TE_P2P_DEVICE_FULL_SCAN,
  457. /* P2P Client Events */
  458. TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
  459. TE_P2P_CLIENT_ASSOC,
  460. TE_P2P_CLIENT_QUIET_PERIOD,
  461. /* P2P GO Events */
  462. TE_P2P_GO_ASSOC_PROT,
  463. TE_P2P_GO_REPETITIVE_NOA,
  464. TE_P2P_GO_CT_WINDOW,
  465. /* WiDi Sync Events */
  466. TE_WIDI_TX_SYNC,
  467. TE_MAX
  468. }; /* MAC_EVENT_TYPE_API_E_VER_1 */
  469. /* Time event - defines for command API v1 */
  470. /*
  471. * @TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed.
  472. * @TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only
  473. * the first fragment is scheduled.
  474. * @TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only
  475. * the first 2 fragments are scheduled.
  476. * @TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
  477. * number of fragments are valid.
  478. *
  479. * Other than the constant defined above, specifying a fragmentation value 'x'
  480. * means that the event can be fragmented but only the first 'x' will be
  481. * scheduled.
  482. */
  483. enum {
  484. TE_V1_FRAG_NONE = 0,
  485. TE_V1_FRAG_SINGLE = 1,
  486. TE_V1_FRAG_DUAL = 2,
  487. TE_V1_FRAG_ENDLESS = 0xffffffff
  488. };
  489. /* If a Time Event can be fragmented, this is the max number of fragments */
  490. #define TE_V1_FRAG_MAX_MSK 0x0fffffff
  491. /* Repeat the time event endlessly (until removed) */
  492. #define TE_V1_REPEAT_ENDLESS 0xffffffff
  493. /* If a Time Event has bounded repetitions, this is the maximal value */
  494. #define TE_V1_REPEAT_MAX_MSK_V1 0x0fffffff
  495. /* Time Event dependencies: none, on another TE, or in a specific time */
  496. enum {
  497. TE_V1_INDEPENDENT = 0,
  498. TE_V1_DEP_OTHER = BIT(0),
  499. TE_V1_DEP_TSF = BIT(1),
  500. TE_V1_EVENT_SOCIOPATHIC = BIT(2),
  501. }; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
  502. /*
  503. * @TE_V1_NOTIF_NONE: no notifications
  504. * @TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start
  505. * @TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end
  506. * @TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use
  507. * @TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use.
  508. * @TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start
  509. * @TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end
  510. * @TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use.
  511. * @TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use.
  512. *
  513. * Supported Time event notifications configuration.
  514. * A notification (both event and fragment) includes a status indicating weather
  515. * the FW was able to schedule the event or not. For fragment start/end
  516. * notification the status is always success. There is no start/end fragment
  517. * notification for monolithic events.
  518. */
  519. enum {
  520. TE_V1_NOTIF_NONE = 0,
  521. TE_V1_NOTIF_HOST_EVENT_START = BIT(0),
  522. TE_V1_NOTIF_HOST_EVENT_END = BIT(1),
  523. TE_V1_NOTIF_INTERNAL_EVENT_START = BIT(2),
  524. TE_V1_NOTIF_INTERNAL_EVENT_END = BIT(3),
  525. TE_V1_NOTIF_HOST_FRAG_START = BIT(4),
  526. TE_V1_NOTIF_HOST_FRAG_END = BIT(5),
  527. TE_V1_NOTIF_INTERNAL_FRAG_START = BIT(6),
  528. TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7),
  529. }; /* MAC_EVENT_ACTION_API_E_VER_2 */
  530. /* Time event - defines for command API */
  531. /*
  532. * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.
  533. * @TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only
  534. * the first fragment is scheduled.
  535. * @TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only
  536. * the first 2 fragments are scheduled.
  537. * @TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
  538. * number of fragments are valid.
  539. *
  540. * Other than the constant defined above, specifying a fragmentation value 'x'
  541. * means that the event can be fragmented but only the first 'x' will be
  542. * scheduled.
  543. */
  544. enum {
  545. TE_V2_FRAG_NONE = 0,
  546. TE_V2_FRAG_SINGLE = 1,
  547. TE_V2_FRAG_DUAL = 2,
  548. TE_V2_FRAG_MAX = 0xfe,
  549. TE_V2_FRAG_ENDLESS = 0xff
  550. };
  551. /* Repeat the time event endlessly (until removed) */
  552. #define TE_V2_REPEAT_ENDLESS 0xff
  553. /* If a Time Event has bounded repetitions, this is the maximal value */
  554. #define TE_V2_REPEAT_MAX 0xfe
  555. #define TE_V2_PLACEMENT_POS 12
  556. #define TE_V2_ABSENCE_POS 15
  557. /* Time event policy values
  558. * A notification (both event and fragment) includes a status indicating weather
  559. * the FW was able to schedule the event or not. For fragment start/end
  560. * notification the status is always success. There is no start/end fragment
  561. * notification for monolithic events.
  562. *
  563. * @TE_V2_DEFAULT_POLICY: independent, social, present, unoticable
  564. * @TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start
  565. * @TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end
  566. * @TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use
  567. * @TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use.
  568. * @TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start
  569. * @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end
  570. * @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use.
  571. * @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use.
  572. * @TE_V2_DEP_OTHER: depends on another time event
  573. * @TE_V2_DEP_TSF: depends on a specific time
  574. * @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC
  575. * @TE_V2_ABSENCE: are we present or absent during the Time Event.
  576. */
  577. enum {
  578. TE_V2_DEFAULT_POLICY = 0x0,
  579. /* notifications (event start/stop, fragment start/stop) */
  580. TE_V2_NOTIF_HOST_EVENT_START = BIT(0),
  581. TE_V2_NOTIF_HOST_EVENT_END = BIT(1),
  582. TE_V2_NOTIF_INTERNAL_EVENT_START = BIT(2),
  583. TE_V2_NOTIF_INTERNAL_EVENT_END = BIT(3),
  584. TE_V2_NOTIF_HOST_FRAG_START = BIT(4),
  585. TE_V2_NOTIF_HOST_FRAG_END = BIT(5),
  586. TE_V2_NOTIF_INTERNAL_FRAG_START = BIT(6),
  587. TE_V2_NOTIF_INTERNAL_FRAG_END = BIT(7),
  588. T2_V2_START_IMMEDIATELY = BIT(11),
  589. TE_V2_NOTIF_MSK = 0xff,
  590. /* placement characteristics */
  591. TE_V2_DEP_OTHER = BIT(TE_V2_PLACEMENT_POS),
  592. TE_V2_DEP_TSF = BIT(TE_V2_PLACEMENT_POS + 1),
  593. TE_V2_EVENT_SOCIOPATHIC = BIT(TE_V2_PLACEMENT_POS + 2),
  594. /* are we present or absent during the Time Event. */
  595. TE_V2_ABSENCE = BIT(TE_V2_ABSENCE_POS),
  596. };
  597. /**
  598. * struct iwl_time_event_cmd_api - configuring Time Events
  599. * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also
  600. * with version 1. determined by IWL_UCODE_TLV_FLAGS)
  601. * ( TIME_EVENT_CMD = 0x29 )
  602. * @id_and_color: ID and color of the relevant MAC
  603. * @action: action to perform, one of FW_CTXT_ACTION_*
  604. * @id: this field has two meanings, depending on the action:
  605. * If the action is ADD, then it means the type of event to add.
  606. * For all other actions it is the unique event ID assigned when the
  607. * event was added by the FW.
  608. * @apply_time: When to start the Time Event (in GP2)
  609. * @max_delay: maximum delay to event's start (apply time), in TU
  610. * @depends_on: the unique ID of the event we depend on (if any)
  611. * @interval: interval between repetitions, in TU
  612. * @duration: duration of event in TU
  613. * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
  614. * @max_frags: maximal number of fragments the Time Event can be divided to
  615. * @policy: defines whether uCode shall notify the host or other uCode modules
  616. * on event and/or fragment start and/or end
  617. * using one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
  618. * TE_EVENT_SOCIOPATHIC
  619. * using TE_ABSENCE and using TE_NOTIF_*
  620. */
  621. struct iwl_time_event_cmd {
  622. /* COMMON_INDEX_HDR_API_S_VER_1 */
  623. __le32 id_and_color;
  624. __le32 action;
  625. __le32 id;
  626. /* MAC_TIME_EVENT_DATA_API_S_VER_2 */
  627. __le32 apply_time;
  628. __le32 max_delay;
  629. __le32 depends_on;
  630. __le32 interval;
  631. __le32 duration;
  632. u8 repeat;
  633. u8 max_frags;
  634. __le16 policy;
  635. } __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_2 */
  636. /**
  637. * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
  638. * @status: bit 0 indicates success, all others specify errors
  639. * @id: the Time Event type
  640. * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
  641. * @id_and_color: ID and color of the relevant MAC
  642. */
  643. struct iwl_time_event_resp {
  644. __le32 status;
  645. __le32 id;
  646. __le32 unique_id;
  647. __le32 id_and_color;
  648. } __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */
  649. /**
  650. * struct iwl_time_event_notif - notifications of time event start/stop
  651. * ( TIME_EVENT_NOTIFICATION = 0x2a )
  652. * @timestamp: action timestamp in GP2
  653. * @session_id: session's unique id
  654. * @unique_id: unique id of the Time Event itself
  655. * @id_and_color: ID and color of the relevant MAC
  656. * @action: one of TE_NOTIF_START or TE_NOTIF_END
  657. * @status: true if scheduled, false otherwise (not executed)
  658. */
  659. struct iwl_time_event_notif {
  660. __le32 timestamp;
  661. __le32 session_id;
  662. __le32 unique_id;
  663. __le32 id_and_color;
  664. __le32 action;
  665. __le32 status;
  666. } __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
  667. /* Bindings and Time Quota */
  668. /**
  669. * struct iwl_binding_cmd - configuring bindings
  670. * ( BINDING_CONTEXT_CMD = 0x2b )
  671. * @id_and_color: ID and color of the relevant Binding
  672. * @action: action to perform, one of FW_CTXT_ACTION_*
  673. * @macs: array of MAC id and colors which belong to the binding
  674. * @phy: PHY id and color which belongs to the binding
  675. */
  676. struct iwl_binding_cmd {
  677. /* COMMON_INDEX_HDR_API_S_VER_1 */
  678. __le32 id_and_color;
  679. __le32 action;
  680. /* BINDING_DATA_API_S_VER_1 */
  681. __le32 macs[MAX_MACS_IN_BINDING];
  682. __le32 phy;
  683. } __packed; /* BINDING_CMD_API_S_VER_1 */
  684. /* The maximal number of fragments in the FW's schedule session */
  685. #define IWL_MVM_MAX_QUOTA 128
  686. /**
  687. * struct iwl_time_quota_data - configuration of time quota per binding
  688. * @id_and_color: ID and color of the relevant Binding
  689. * @quota: absolute time quota in TU. The scheduler will try to divide the
  690. * remainig quota (after Time Events) according to this quota.
  691. * @max_duration: max uninterrupted context duration in TU
  692. */
  693. struct iwl_time_quota_data {
  694. __le32 id_and_color;
  695. __le32 quota;
  696. __le32 max_duration;
  697. } __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */
  698. /**
  699. * struct iwl_time_quota_cmd - configuration of time quota between bindings
  700. * ( TIME_QUOTA_CMD = 0x2c )
  701. * @quotas: allocations per binding
  702. */
  703. struct iwl_time_quota_cmd {
  704. struct iwl_time_quota_data quotas[MAX_BINDINGS];
  705. } __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */
  706. /* PHY context */
  707. /* Supported bands */
  708. #define PHY_BAND_5 (0)
  709. #define PHY_BAND_24 (1)
  710. /* Supported channel width, vary if there is VHT support */
  711. #define PHY_VHT_CHANNEL_MODE20 (0x0)
  712. #define PHY_VHT_CHANNEL_MODE40 (0x1)
  713. #define PHY_VHT_CHANNEL_MODE80 (0x2)
  714. #define PHY_VHT_CHANNEL_MODE160 (0x3)
  715. /*
  716. * Control channel position:
  717. * For legacy set bit means upper channel, otherwise lower.
  718. * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
  719. * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
  720. * center_freq
  721. * |
  722. * 40Mhz |_______|_______|
  723. * 80Mhz |_______|_______|_______|_______|
  724. * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______|
  725. * code 011 010 001 000 | 100 101 110 111
  726. */
  727. #define PHY_VHT_CTRL_POS_1_BELOW (0x0)
  728. #define PHY_VHT_CTRL_POS_2_BELOW (0x1)
  729. #define PHY_VHT_CTRL_POS_3_BELOW (0x2)
  730. #define PHY_VHT_CTRL_POS_4_BELOW (0x3)
  731. #define PHY_VHT_CTRL_POS_1_ABOVE (0x4)
  732. #define PHY_VHT_CTRL_POS_2_ABOVE (0x5)
  733. #define PHY_VHT_CTRL_POS_3_ABOVE (0x6)
  734. #define PHY_VHT_CTRL_POS_4_ABOVE (0x7)
  735. /*
  736. * @band: PHY_BAND_*
  737. * @channel: channel number
  738. * @width: PHY_[VHT|LEGACY]_CHANNEL_*
  739. * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_*
  740. */
  741. struct iwl_fw_channel_info {
  742. u8 band;
  743. u8 channel;
  744. u8 width;
  745. u8 ctrl_pos;
  746. } __packed;
  747. #define PHY_RX_CHAIN_DRIVER_FORCE_POS (0)
  748. #define PHY_RX_CHAIN_DRIVER_FORCE_MSK \
  749. (0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS)
  750. #define PHY_RX_CHAIN_VALID_POS (1)
  751. #define PHY_RX_CHAIN_VALID_MSK \
  752. (0x7 << PHY_RX_CHAIN_VALID_POS)
  753. #define PHY_RX_CHAIN_FORCE_SEL_POS (4)
  754. #define PHY_RX_CHAIN_FORCE_SEL_MSK \
  755. (0x7 << PHY_RX_CHAIN_FORCE_SEL_POS)
  756. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
  757. #define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \
  758. (0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS)
  759. #define PHY_RX_CHAIN_CNT_POS (10)
  760. #define PHY_RX_CHAIN_CNT_MSK \
  761. (0x3 << PHY_RX_CHAIN_CNT_POS)
  762. #define PHY_RX_CHAIN_MIMO_CNT_POS (12)
  763. #define PHY_RX_CHAIN_MIMO_CNT_MSK \
  764. (0x3 << PHY_RX_CHAIN_MIMO_CNT_POS)
  765. #define PHY_RX_CHAIN_MIMO_FORCE_POS (14)
  766. #define PHY_RX_CHAIN_MIMO_FORCE_MSK \
  767. (0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS)
  768. /* TODO: fix the value, make it depend on firmware at runtime? */
  769. #define NUM_PHY_CTX 3
  770. /* TODO: complete missing documentation */
  771. /**
  772. * struct iwl_phy_context_cmd - config of the PHY context
  773. * ( PHY_CONTEXT_CMD = 0x8 )
  774. * @id_and_color: ID and color of the relevant Binding
  775. * @action: action to perform, one of FW_CTXT_ACTION_*
  776. * @apply_time: 0 means immediate apply and context switch.
  777. * other value means apply new params after X usecs
  778. * @tx_param_color: ???
  779. * @channel_info:
  780. * @txchain_info: ???
  781. * @rxchain_info: ???
  782. * @acquisition_data: ???
  783. * @dsp_cfg_flags: set to 0
  784. */
  785. struct iwl_phy_context_cmd {
  786. /* COMMON_INDEX_HDR_API_S_VER_1 */
  787. __le32 id_and_color;
  788. __le32 action;
  789. /* PHY_CONTEXT_DATA_API_S_VER_1 */
  790. __le32 apply_time;
  791. __le32 tx_param_color;
  792. struct iwl_fw_channel_info ci;
  793. __le32 txchain_info;
  794. __le32 rxchain_info;
  795. __le32 acquisition_data;
  796. __le32 dsp_cfg_flags;
  797. } __packed; /* PHY_CONTEXT_CMD_API_VER_1 */
  798. #define IWL_RX_INFO_PHY_CNT 8
  799. #define IWL_RX_INFO_ENERGY_ANT_ABC_IDX 1
  800. #define IWL_RX_INFO_ENERGY_ANT_A_MSK 0x000000ff
  801. #define IWL_RX_INFO_ENERGY_ANT_B_MSK 0x0000ff00
  802. #define IWL_RX_INFO_ENERGY_ANT_C_MSK 0x00ff0000
  803. #define IWL_RX_INFO_ENERGY_ANT_A_POS 0
  804. #define IWL_RX_INFO_ENERGY_ANT_B_POS 8
  805. #define IWL_RX_INFO_ENERGY_ANT_C_POS 16
  806. #define IWL_RX_INFO_AGC_IDX 1
  807. #define IWL_RX_INFO_RSSI_AB_IDX 2
  808. #define IWL_OFDM_AGC_A_MSK 0x0000007f
  809. #define IWL_OFDM_AGC_A_POS 0
  810. #define IWL_OFDM_AGC_B_MSK 0x00003f80
  811. #define IWL_OFDM_AGC_B_POS 7
  812. #define IWL_OFDM_AGC_CODE_MSK 0x3fe00000
  813. #define IWL_OFDM_AGC_CODE_POS 20
  814. #define IWL_OFDM_RSSI_INBAND_A_MSK 0x00ff
  815. #define IWL_OFDM_RSSI_A_POS 0
  816. #define IWL_OFDM_RSSI_ALLBAND_A_MSK 0xff00
  817. #define IWL_OFDM_RSSI_ALLBAND_A_POS 8
  818. #define IWL_OFDM_RSSI_INBAND_B_MSK 0xff0000
  819. #define IWL_OFDM_RSSI_B_POS 16
  820. #define IWL_OFDM_RSSI_ALLBAND_B_MSK 0xff000000
  821. #define IWL_OFDM_RSSI_ALLBAND_B_POS 24
  822. /**
  823. * struct iwl_rx_phy_info - phy info
  824. * (REPLY_RX_PHY_CMD = 0xc0)
  825. * @non_cfg_phy_cnt: non configurable DSP phy data byte count
  826. * @cfg_phy_cnt: configurable DSP phy data byte count
  827. * @stat_id: configurable DSP phy data set ID
  828. * @reserved1:
  829. * @system_timestamp: GP2 at on air rise
  830. * @timestamp: TSF at on air rise
  831. * @beacon_time_stamp: beacon at on-air rise
  832. * @phy_flags: general phy flags: band, modulation, ...
  833. * @channel: channel number
  834. * @non_cfg_phy_buf: for various implementations of non_cfg_phy
  835. * @rate_n_flags: RATE_MCS_*
  836. * @byte_count: frame's byte-count
  837. * @frame_time: frame's time on the air, based on byte count and frame rate
  838. * calculation
  839. * @mac_active_msk: what MACs were active when the frame was received
  840. *
  841. * Before each Rx, the device sends this data. It contains PHY information
  842. * about the reception of the packet.
  843. */
  844. struct iwl_rx_phy_info {
  845. u8 non_cfg_phy_cnt;
  846. u8 cfg_phy_cnt;
  847. u8 stat_id;
  848. u8 reserved1;
  849. __le32 system_timestamp;
  850. __le64 timestamp;
  851. __le32 beacon_time_stamp;
  852. __le16 phy_flags;
  853. __le16 channel;
  854. __le32 non_cfg_phy[IWL_RX_INFO_PHY_CNT];
  855. __le32 rate_n_flags;
  856. __le32 byte_count;
  857. __le16 mac_active_msk;
  858. __le16 frame_time;
  859. } __packed;
  860. struct iwl_rx_mpdu_res_start {
  861. __le16 byte_count;
  862. __le16 reserved;
  863. } __packed;
  864. /**
  865. * enum iwl_rx_phy_flags - to parse %iwl_rx_phy_info phy_flags
  866. * @RX_RES_PHY_FLAGS_BAND_24: true if the packet was received on 2.4 band
  867. * @RX_RES_PHY_FLAGS_MOD_CCK:
  868. * @RX_RES_PHY_FLAGS_SHORT_PREAMBLE: true if packet's preamble was short
  869. * @RX_RES_PHY_FLAGS_NARROW_BAND:
  870. * @RX_RES_PHY_FLAGS_ANTENNA: antenna on which the packet was received
  871. * @RX_RES_PHY_FLAGS_AGG: set if the packet was part of an A-MPDU
  872. * @RX_RES_PHY_FLAGS_OFDM_HT: The frame was an HT frame
  873. * @RX_RES_PHY_FLAGS_OFDM_GF: The frame used GF preamble
  874. * @RX_RES_PHY_FLAGS_OFDM_VHT: The frame was a VHT frame
  875. */
  876. enum iwl_rx_phy_flags {
  877. RX_RES_PHY_FLAGS_BAND_24 = BIT(0),
  878. RX_RES_PHY_FLAGS_MOD_CCK = BIT(1),
  879. RX_RES_PHY_FLAGS_SHORT_PREAMBLE = BIT(2),
  880. RX_RES_PHY_FLAGS_NARROW_BAND = BIT(3),
  881. RX_RES_PHY_FLAGS_ANTENNA = (0x7 << 4),
  882. RX_RES_PHY_FLAGS_ANTENNA_POS = 4,
  883. RX_RES_PHY_FLAGS_AGG = BIT(7),
  884. RX_RES_PHY_FLAGS_OFDM_HT = BIT(8),
  885. RX_RES_PHY_FLAGS_OFDM_GF = BIT(9),
  886. RX_RES_PHY_FLAGS_OFDM_VHT = BIT(10),
  887. };
  888. /**
  889. * enum iwl_mvm_rx_status - written by fw for each Rx packet
  890. * @RX_MPDU_RES_STATUS_CRC_OK: CRC is fine
  891. * @RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow
  892. * @RX_MPDU_RES_STATUS_SRC_STA_FOUND:
  893. * @RX_MPDU_RES_STATUS_KEY_VALID:
  894. * @RX_MPDU_RES_STATUS_KEY_PARAM_OK:
  895. * @RX_MPDU_RES_STATUS_ICV_OK: ICV is fine, if not, the packet is destroyed
  896. * @RX_MPDU_RES_STATUS_MIC_OK: used for CCM alg only. TKIP MIC is checked
  897. * in the driver.
  898. * @RX_MPDU_RES_STATUS_TTAK_OK: TTAK is fine
  899. * @RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR: valid for alg = CCM_CMAC or
  900. * alg = CCM only. Checks replay attack for 11w frames. Relevant only if
  901. * %RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME is set.
  902. * @RX_MPDU_RES_STATUS_SEC_NO_ENC: this frame is not encrypted
  903. * @RX_MPDU_RES_STATUS_SEC_WEP_ENC: this frame is encrypted using WEP
  904. * @RX_MPDU_RES_STATUS_SEC_CCM_ENC: this frame is encrypted using CCM
  905. * @RX_MPDU_RES_STATUS_SEC_TKIP_ENC: this frame is encrypted using TKIP
  906. * @RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC: this frame is encrypted using CCM_CMAC
  907. * @RX_MPDU_RES_STATUS_SEC_ENC_ERR: this frame couldn't be decrypted
  908. * @RX_MPDU_RES_STATUS_SEC_ENC_MSK: bitmask of the encryption algorithm
  909. * @RX_MPDU_RES_STATUS_DEC_DONE: this frame has been successfully decrypted
  910. * @RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP:
  911. * @RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP:
  912. * @RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT:
  913. * @RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME: this frame is an 11w management frame
  914. * @RX_MPDU_RES_STATUS_HASH_INDEX_MSK:
  915. * @RX_MPDU_RES_STATUS_STA_ID_MSK:
  916. * @RX_MPDU_RES_STATUS_RRF_KILL:
  917. * @RX_MPDU_RES_STATUS_FILTERING_MSK:
  918. * @RX_MPDU_RES_STATUS2_FILTERING_MSK:
  919. */
  920. enum iwl_mvm_rx_status {
  921. RX_MPDU_RES_STATUS_CRC_OK = BIT(0),
  922. RX_MPDU_RES_STATUS_OVERRUN_OK = BIT(1),
  923. RX_MPDU_RES_STATUS_SRC_STA_FOUND = BIT(2),
  924. RX_MPDU_RES_STATUS_KEY_VALID = BIT(3),
  925. RX_MPDU_RES_STATUS_KEY_PARAM_OK = BIT(4),
  926. RX_MPDU_RES_STATUS_ICV_OK = BIT(5),
  927. RX_MPDU_RES_STATUS_MIC_OK = BIT(6),
  928. RX_MPDU_RES_STATUS_TTAK_OK = BIT(7),
  929. RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR = BIT(7),
  930. RX_MPDU_RES_STATUS_SEC_NO_ENC = (0 << 8),
  931. RX_MPDU_RES_STATUS_SEC_WEP_ENC = (1 << 8),
  932. RX_MPDU_RES_STATUS_SEC_CCM_ENC = (2 << 8),
  933. RX_MPDU_RES_STATUS_SEC_TKIP_ENC = (3 << 8),
  934. RX_MPDU_RES_STATUS_SEC_EXT_ENC = (4 << 8),
  935. RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC = (6 << 8),
  936. RX_MPDU_RES_STATUS_SEC_ENC_ERR = (7 << 8),
  937. RX_MPDU_RES_STATUS_SEC_ENC_MSK = (7 << 8),
  938. RX_MPDU_RES_STATUS_DEC_DONE = BIT(11),
  939. RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP = BIT(12),
  940. RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP = BIT(13),
  941. RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT = BIT(14),
  942. RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME = BIT(15),
  943. RX_MPDU_RES_STATUS_HASH_INDEX_MSK = (0x3F0000),
  944. RX_MPDU_RES_STATUS_STA_ID_MSK = (0x1f000000),
  945. RX_MPDU_RES_STATUS_RRF_KILL = BIT(29),
  946. RX_MPDU_RES_STATUS_FILTERING_MSK = (0xc00000),
  947. RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000),
  948. };
  949. /**
  950. * struct iwl_radio_version_notif - information on the radio version
  951. * ( RADIO_VERSION_NOTIFICATION = 0x68 )
  952. * @radio_flavor:
  953. * @radio_step:
  954. * @radio_dash:
  955. */
  956. struct iwl_radio_version_notif {
  957. __le32 radio_flavor;
  958. __le32 radio_step;
  959. __le32 radio_dash;
  960. } __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */
  961. enum iwl_card_state_flags {
  962. CARD_ENABLED = 0x00,
  963. HW_CARD_DISABLED = 0x01,
  964. SW_CARD_DISABLED = 0x02,
  965. CT_KILL_CARD_DISABLED = 0x04,
  966. HALT_CARD_DISABLED = 0x08,
  967. CARD_DISABLED_MSK = 0x0f,
  968. CARD_IS_RX_ON = 0x10,
  969. };
  970. /**
  971. * struct iwl_radio_version_notif - information on the radio version
  972. * ( CARD_STATE_NOTIFICATION = 0xa1 )
  973. * @flags: %iwl_card_state_flags
  974. */
  975. struct iwl_card_state_notif {
  976. __le32 flags;
  977. } __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
  978. /**
  979. * struct iwl_missed_beacons_notif - information on missed beacons
  980. * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
  981. * @mac_id: interface ID
  982. * @consec_missed_beacons_since_last_rx: number of consecutive missed
  983. * beacons since last RX.
  984. * @consec_missed_beacons: number of consecutive missed beacons
  985. * @num_expected_beacons:
  986. * @num_recvd_beacons:
  987. */
  988. struct iwl_missed_beacons_notif {
  989. __le32 mac_id;
  990. __le32 consec_missed_beacons_since_last_rx;
  991. __le32 consec_missed_beacons;
  992. __le32 num_expected_beacons;
  993. __le32 num_recvd_beacons;
  994. } __packed; /* MISSED_BEACON_NTFY_API_S_VER_3 */
  995. /**
  996. * struct iwl_set_calib_default_cmd - set default value for calibration.
  997. * ( SET_CALIB_DEFAULT_CMD = 0x8e )
  998. * @calib_index: the calibration to set value for
  999. * @length: of data
  1000. * @data: the value to set for the calibration result
  1001. */
  1002. struct iwl_set_calib_default_cmd {
  1003. __le16 calib_index;
  1004. __le16 length;
  1005. u8 data[0];
  1006. } __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */
  1007. #define MAX_PORT_ID_NUM 2
  1008. #define MAX_MCAST_FILTERING_ADDRESSES 256
  1009. /**
  1010. * struct iwl_mcast_filter_cmd - configure multicast filter.
  1011. * @filter_own: Set 1 to filter out multicast packets sent by station itself
  1012. * @port_id: Multicast MAC addresses array specifier. This is a strange way
  1013. * to identify network interface adopted in host-device IF.
  1014. * It is used by FW as index in array of addresses. This array has
  1015. * MAX_PORT_ID_NUM members.
  1016. * @count: Number of MAC addresses in the array
  1017. * @pass_all: Set 1 to pass all multicast packets.
  1018. * @bssid: current association BSSID.
  1019. * @addr_list: Place holder for array of MAC addresses.
  1020. * IMPORTANT: add padding if necessary to ensure DWORD alignment.
  1021. */
  1022. struct iwl_mcast_filter_cmd {
  1023. u8 filter_own;
  1024. u8 port_id;
  1025. u8 count;
  1026. u8 pass_all;
  1027. u8 bssid[6];
  1028. u8 reserved[2];
  1029. u8 addr_list[0];
  1030. } __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */
  1031. #define MAX_BCAST_FILTERS 8
  1032. #define MAX_BCAST_FILTER_ATTRS 2
  1033. /**
  1034. * enum iwl_mvm_bcast_filter_attr_offset - written by fw for each Rx packet
  1035. * @BCAST_FILTER_OFFSET_PAYLOAD_START: offset is from payload start.
  1036. * @BCAST_FILTER_OFFSET_IP_END: offset is from ip header end (i.e.
  1037. * start of ip payload).
  1038. */
  1039. enum iwl_mvm_bcast_filter_attr_offset {
  1040. BCAST_FILTER_OFFSET_PAYLOAD_START = 0,
  1041. BCAST_FILTER_OFFSET_IP_END = 1,
  1042. };
  1043. /**
  1044. * struct iwl_fw_bcast_filter_attr - broadcast filter attribute
  1045. * @offset_type: &enum iwl_mvm_bcast_filter_attr_offset.
  1046. * @offset: starting offset of this pattern.
  1047. * @val: value to match - big endian (MSB is the first
  1048. * byte to match from offset pos).
  1049. * @mask: mask to match (big endian).
  1050. */
  1051. struct iwl_fw_bcast_filter_attr {
  1052. u8 offset_type;
  1053. u8 offset;
  1054. __le16 reserved1;
  1055. __be32 val;
  1056. __be32 mask;
  1057. } __packed; /* BCAST_FILTER_ATT_S_VER_1 */
  1058. /**
  1059. * enum iwl_mvm_bcast_filter_frame_type - filter frame type
  1060. * @BCAST_FILTER_FRAME_TYPE_ALL: consider all frames.
  1061. * @BCAST_FILTER_FRAME_TYPE_IPV4: consider only ipv4 frames
  1062. */
  1063. enum iwl_mvm_bcast_filter_frame_type {
  1064. BCAST_FILTER_FRAME_TYPE_ALL = 0,
  1065. BCAST_FILTER_FRAME_TYPE_IPV4 = 1,
  1066. };
  1067. /**
  1068. * struct iwl_fw_bcast_filter - broadcast filter
  1069. * @discard: discard frame (1) or let it pass (0).
  1070. * @frame_type: &enum iwl_mvm_bcast_filter_frame_type.
  1071. * @num_attrs: number of valid attributes in this filter.
  1072. * @attrs: attributes of this filter. a filter is considered matched
  1073. * only when all its attributes are matched (i.e. AND relationship)
  1074. */
  1075. struct iwl_fw_bcast_filter {
  1076. u8 discard;
  1077. u8 frame_type;
  1078. u8 num_attrs;
  1079. u8 reserved1;
  1080. struct iwl_fw_bcast_filter_attr attrs[MAX_BCAST_FILTER_ATTRS];
  1081. } __packed; /* BCAST_FILTER_S_VER_1 */
  1082. /**
  1083. * struct iwl_fw_bcast_mac - per-mac broadcast filtering configuration.
  1084. * @default_discard: default action for this mac (discard (1) / pass (0)).
  1085. * @attached_filters: bitmap of relevant filters for this mac.
  1086. */
  1087. struct iwl_fw_bcast_mac {
  1088. u8 default_discard;
  1089. u8 reserved1;
  1090. __le16 attached_filters;
  1091. } __packed; /* BCAST_MAC_CONTEXT_S_VER_1 */
  1092. /**
  1093. * struct iwl_bcast_filter_cmd - broadcast filtering configuration
  1094. * @disable: enable (0) / disable (1)
  1095. * @max_bcast_filters: max number of filters (MAX_BCAST_FILTERS)
  1096. * @max_macs: max number of macs (NUM_MAC_INDEX_DRIVER)
  1097. * @filters: broadcast filters
  1098. * @macs: broadcast filtering configuration per-mac
  1099. */
  1100. struct iwl_bcast_filter_cmd {
  1101. u8 disable;
  1102. u8 max_bcast_filters;
  1103. u8 max_macs;
  1104. u8 reserved1;
  1105. struct iwl_fw_bcast_filter filters[MAX_BCAST_FILTERS];
  1106. struct iwl_fw_bcast_mac macs[NUM_MAC_INDEX_DRIVER];
  1107. } __packed; /* BCAST_FILTERING_HCMD_API_S_VER_1 */
  1108. struct mvm_statistics_dbg {
  1109. __le32 burst_check;
  1110. __le32 burst_count;
  1111. __le32 wait_for_silence_timeout_cnt;
  1112. __le32 reserved[3];
  1113. } __packed; /* STATISTICS_DEBUG_API_S_VER_2 */
  1114. struct mvm_statistics_div {
  1115. __le32 tx_on_a;
  1116. __le32 tx_on_b;
  1117. __le32 exec_time;
  1118. __le32 probe_time;
  1119. __le32 rssi_ant;
  1120. __le32 reserved2;
  1121. } __packed; /* STATISTICS_SLOW_DIV_API_S_VER_2 */
  1122. struct mvm_statistics_general_common {
  1123. __le32 temperature; /* radio temperature */
  1124. __le32 temperature_m; /* radio voltage */
  1125. struct mvm_statistics_dbg dbg;
  1126. __le32 sleep_time;
  1127. __le32 slots_out;
  1128. __le32 slots_idle;
  1129. __le32 ttl_timestamp;
  1130. struct mvm_statistics_div div;
  1131. __le32 rx_enable_counter;
  1132. /*
  1133. * num_of_sos_states:
  1134. * count the number of times we have to re-tune
  1135. * in order to get out of bad PHY status
  1136. */
  1137. __le32 num_of_sos_states;
  1138. } __packed; /* STATISTICS_GENERAL_API_S_VER_5 */
  1139. struct mvm_statistics_rx_non_phy {
  1140. __le32 bogus_cts; /* CTS received when not expecting CTS */
  1141. __le32 bogus_ack; /* ACK received when not expecting ACK */
  1142. __le32 non_bssid_frames; /* number of frames with BSSID that
  1143. * doesn't belong to the STA BSSID */
  1144. __le32 filtered_frames; /* count frames that were dumped in the
  1145. * filtering process */
  1146. __le32 non_channel_beacons; /* beacons with our bss id but not on
  1147. * our serving channel */
  1148. __le32 channel_beacons; /* beacons with our bss id and in our
  1149. * serving channel */
  1150. __le32 num_missed_bcon; /* number of missed beacons */
  1151. __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
  1152. * ADC was in saturation */
  1153. __le32 ina_detection_search_time;/* total time (in 0.8us) searched
  1154. * for INA */
  1155. __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
  1156. __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
  1157. __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
  1158. __le32 interference_data_flag; /* flag for interference data
  1159. * availability. 1 when data is
  1160. * available. */
  1161. __le32 channel_load; /* counts RX Enable time in uSec */
  1162. __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
  1163. * and CCK) counter */
  1164. __le32 beacon_rssi_a;
  1165. __le32 beacon_rssi_b;
  1166. __le32 beacon_rssi_c;
  1167. __le32 beacon_energy_a;
  1168. __le32 beacon_energy_b;
  1169. __le32 beacon_energy_c;
  1170. __le32 num_bt_kills;
  1171. __le32 mac_id;
  1172. __le32 directed_data_mpdu;
  1173. } __packed; /* STATISTICS_RX_NON_PHY_API_S_VER_3 */
  1174. struct mvm_statistics_rx_phy {
  1175. __le32 ina_cnt;
  1176. __le32 fina_cnt;
  1177. __le32 plcp_err;
  1178. __le32 crc32_err;
  1179. __le32 overrun_err;
  1180. __le32 early_overrun_err;
  1181. __le32 crc32_good;
  1182. __le32 false_alarm_cnt;
  1183. __le32 fina_sync_err_cnt;
  1184. __le32 sfd_timeout;
  1185. __le32 fina_timeout;
  1186. __le32 unresponded_rts;
  1187. __le32 rxe_frame_limit_overrun;
  1188. __le32 sent_ack_cnt;
  1189. __le32 sent_cts_cnt;
  1190. __le32 sent_ba_rsp_cnt;
  1191. __le32 dsp_self_kill;
  1192. __le32 mh_format_err;
  1193. __le32 re_acq_main_rssi_sum;
  1194. __le32 reserved;
  1195. } __packed; /* STATISTICS_RX_PHY_API_S_VER_2 */
  1196. struct mvm_statistics_rx_ht_phy {
  1197. __le32 plcp_err;
  1198. __le32 overrun_err;
  1199. __le32 early_overrun_err;
  1200. __le32 crc32_good;
  1201. __le32 crc32_err;
  1202. __le32 mh_format_err;
  1203. __le32 agg_crc32_good;
  1204. __le32 agg_mpdu_cnt;
  1205. __le32 agg_cnt;
  1206. __le32 unsupport_mcs;
  1207. } __packed; /* STATISTICS_HT_RX_PHY_API_S_VER_1 */
  1208. #define MAX_CHAINS 3
  1209. struct mvm_statistics_tx_non_phy_agg {
  1210. __le32 ba_timeout;
  1211. __le32 ba_reschedule_frames;
  1212. __le32 scd_query_agg_frame_cnt;
  1213. __le32 scd_query_no_agg;
  1214. __le32 scd_query_agg;
  1215. __le32 scd_query_mismatch;
  1216. __le32 frame_not_ready;
  1217. __le32 underrun;
  1218. __le32 bt_prio_kill;
  1219. __le32 rx_ba_rsp_cnt;
  1220. __s8 txpower[MAX_CHAINS];
  1221. __s8 reserved;
  1222. __le32 reserved2;
  1223. } __packed; /* STATISTICS_TX_NON_PHY_AGG_API_S_VER_1 */
  1224. struct mvm_statistics_tx_channel_width {
  1225. __le32 ext_cca_narrow_ch20[1];
  1226. __le32 ext_cca_narrow_ch40[2];
  1227. __le32 ext_cca_narrow_ch80[3];
  1228. __le32 ext_cca_narrow_ch160[4];
  1229. __le32 last_tx_ch_width_indx;
  1230. __le32 rx_detected_per_ch_width[4];
  1231. __le32 success_per_ch_width[4];
  1232. __le32 fail_per_ch_width[4];
  1233. }; /* STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */
  1234. struct mvm_statistics_tx {
  1235. __le32 preamble_cnt;
  1236. __le32 rx_detected_cnt;
  1237. __le32 bt_prio_defer_cnt;
  1238. __le32 bt_prio_kill_cnt;
  1239. __le32 few_bytes_cnt;
  1240. __le32 cts_timeout;
  1241. __le32 ack_timeout;
  1242. __le32 expected_ack_cnt;
  1243. __le32 actual_ack_cnt;
  1244. __le32 dump_msdu_cnt;
  1245. __le32 burst_abort_next_frame_mismatch_cnt;
  1246. __le32 burst_abort_missing_next_frame_cnt;
  1247. __le32 cts_timeout_collision;
  1248. __le32 ack_or_ba_timeout_collision;
  1249. struct mvm_statistics_tx_non_phy_agg agg;
  1250. struct mvm_statistics_tx_channel_width channel_width;
  1251. } __packed; /* STATISTICS_TX_API_S_VER_4 */
  1252. struct mvm_statistics_bt_activity {
  1253. __le32 hi_priority_tx_req_cnt;
  1254. __le32 hi_priority_tx_denied_cnt;
  1255. __le32 lo_priority_tx_req_cnt;
  1256. __le32 lo_priority_tx_denied_cnt;
  1257. __le32 hi_priority_rx_req_cnt;
  1258. __le32 hi_priority_rx_denied_cnt;
  1259. __le32 lo_priority_rx_req_cnt;
  1260. __le32 lo_priority_rx_denied_cnt;
  1261. } __packed; /* STATISTICS_BT_ACTIVITY_API_S_VER_1 */
  1262. struct mvm_statistics_general {
  1263. struct mvm_statistics_general_common common;
  1264. __le32 beacon_filtered;
  1265. __le32 missed_beacons;
  1266. __s8 beacon_filter_average_energy;
  1267. __s8 beacon_filter_reason;
  1268. __s8 beacon_filter_current_energy;
  1269. __s8 beacon_filter_reserved;
  1270. __le32 beacon_filter_delta_time;
  1271. struct mvm_statistics_bt_activity bt_activity;
  1272. } __packed; /* STATISTICS_GENERAL_API_S_VER_5 */
  1273. struct mvm_statistics_rx {
  1274. struct mvm_statistics_rx_phy ofdm;
  1275. struct mvm_statistics_rx_phy cck;
  1276. struct mvm_statistics_rx_non_phy general;
  1277. struct mvm_statistics_rx_ht_phy ofdm_ht;
  1278. } __packed; /* STATISTICS_RX_API_S_VER_3 */
  1279. /*
  1280. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  1281. *
  1282. * By default, uCode issues this notification after receiving a beacon
  1283. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  1284. * REPLY_STATISTICS_CMD 0x9c, above.
  1285. *
  1286. * Statistics counters continue to increment beacon after beacon, but are
  1287. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  1288. * 0x9c with CLEAR_STATS bit set (see above).
  1289. *
  1290. * uCode also issues this notification during scans. uCode clears statistics
  1291. * appropriately so that each notification contains statistics for only the
  1292. * one channel that has just been scanned.
  1293. */
  1294. struct iwl_notif_statistics { /* STATISTICS_NTFY_API_S_VER_8 */
  1295. __le32 flag;
  1296. struct mvm_statistics_rx rx;
  1297. struct mvm_statistics_tx tx;
  1298. struct mvm_statistics_general general;
  1299. } __packed;
  1300. /***********************************
  1301. * Smart Fifo API
  1302. ***********************************/
  1303. /* Smart Fifo state */
  1304. enum iwl_sf_state {
  1305. SF_LONG_DELAY_ON = 0, /* should never be called by driver */
  1306. SF_FULL_ON,
  1307. SF_UNINIT,
  1308. SF_INIT_OFF,
  1309. SF_HW_NUM_STATES
  1310. };
  1311. /* Smart Fifo possible scenario */
  1312. enum iwl_sf_scenario {
  1313. SF_SCENARIO_SINGLE_UNICAST,
  1314. SF_SCENARIO_AGG_UNICAST,
  1315. SF_SCENARIO_MULTICAST,
  1316. SF_SCENARIO_BA_RESP,
  1317. SF_SCENARIO_TX_RESP,
  1318. SF_NUM_SCENARIO
  1319. };
  1320. #define SF_TRANSIENT_STATES_NUMBER 2 /* SF_LONG_DELAY_ON and SF_FULL_ON */
  1321. #define SF_NUM_TIMEOUT_TYPES 2 /* Aging timer and Idle timer */
  1322. /* smart FIFO default values */
  1323. #define SF_W_MARK_SISO 4096
  1324. #define SF_W_MARK_MIMO2 8192
  1325. #define SF_W_MARK_MIMO3 6144
  1326. #define SF_W_MARK_LEGACY 4096
  1327. #define SF_W_MARK_SCAN 4096
  1328. /* SF Scenarios timers for FULL_ON state (aligned to 32 uSec) */
  1329. #define SF_SINGLE_UNICAST_IDLE_TIMER 320 /* 300 uSec */
  1330. #define SF_SINGLE_UNICAST_AGING_TIMER 2016 /* 2 mSec */
  1331. #define SF_AGG_UNICAST_IDLE_TIMER 320 /* 300 uSec */
  1332. #define SF_AGG_UNICAST_AGING_TIMER 2016 /* 2 mSec */
  1333. #define SF_MCAST_IDLE_TIMER 2016 /* 2 mSec */
  1334. #define SF_MCAST_AGING_TIMER 10016 /* 10 mSec */
  1335. #define SF_BA_IDLE_TIMER 320 /* 300 uSec */
  1336. #define SF_BA_AGING_TIMER 2016 /* 2 mSec */
  1337. #define SF_TX_RE_IDLE_TIMER 320 /* 300 uSec */
  1338. #define SF_TX_RE_AGING_TIMER 2016 /* 2 mSec */
  1339. #define SF_LONG_DELAY_AGING_TIMER 1000000 /* 1 Sec */
  1340. /**
  1341. * Smart Fifo configuration command.
  1342. * @state: smart fifo state, types listed in iwl_sf_sate.
  1343. * @watermark: Minimum allowed availabe free space in RXF for transient state.
  1344. * @long_delay_timeouts: aging and idle timer values for each scenario
  1345. * in long delay state.
  1346. * @full_on_timeouts: timer values for each scenario in full on state.
  1347. */
  1348. struct iwl_sf_cfg_cmd {
  1349. enum iwl_sf_state state;
  1350. __le32 watermark[SF_TRANSIENT_STATES_NUMBER];
  1351. __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
  1352. __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
  1353. } __packed; /* SF_CFG_API_S_VER_2 */
  1354. #endif /* __fw_api_h__ */