rs.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  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. * Copyright(c) 2017 Intel Deutschland GmbH
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of version 2 of the GNU General Public License as
  13. * published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * The full GNU General Public License is included in this distribution
  21. * in the file called COPYING.
  22. *
  23. * Contact Information:
  24. * Intel Linux Wireless <linuxwifi@intel.com>
  25. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  26. *
  27. * BSD LICENSE
  28. *
  29. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  30. * Copyright(c) 2017 Intel Deutschland GmbH
  31. * All rights reserved.
  32. *
  33. * Redistribution and use in source and binary forms, with or without
  34. * modification, are permitted provided that the following conditions
  35. * are met:
  36. *
  37. * * Redistributions of source code must retain the above copyright
  38. * notice, this list of conditions and the following disclaimer.
  39. * * Redistributions in binary form must reproduce the above copyright
  40. * notice, this list of conditions and the following disclaimer in
  41. * the documentation and/or other materials provided with the
  42. * distribution.
  43. * * Neither the name Intel Corporation nor the names of its
  44. * contributors may be used to endorse or promote products derived
  45. * from this software without specific prior written permission.
  46. *
  47. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  48. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  49. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  50. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  51. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  52. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  53. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  54. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  55. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  56. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  57. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  58. *****************************************************************************/
  59. #ifndef __iwl_fw_api_rs_h__
  60. #define __iwl_fw_api_rs_h__
  61. #include "mac.h"
  62. /**
  63. * enum iwl_tlc_mng_cfg_flags_enum - options for TLC config flags
  64. * @IWL_TLC_MNG_CFG_FLAGS_CCK_MSK: CCK support
  65. * @IWL_TLC_MNG_CFG_FLAGS_DD_MSK: enable DD
  66. * @IWL_TLC_MNG_CFG_FLAGS_STBC_MSK: enable STBC
  67. * @IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK: enable LDPC
  68. * @IWL_TLC_MNG_CFG_FLAGS_BF_MSK: enable BFER
  69. * @IWL_TLC_MNG_CFG_FLAGS_DCM_MSK: enable DCM
  70. */
  71. enum iwl_tlc_mng_cfg_flags {
  72. IWL_TLC_MNG_CFG_FLAGS_CCK_MSK = BIT(0),
  73. IWL_TLC_MNG_CFG_FLAGS_DD_MSK = BIT(1),
  74. IWL_TLC_MNG_CFG_FLAGS_STBC_MSK = BIT(2),
  75. IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK = BIT(3),
  76. IWL_TLC_MNG_CFG_FLAGS_BF_MSK = BIT(4),
  77. IWL_TLC_MNG_CFG_FLAGS_DCM_MSK = BIT(5),
  78. };
  79. /**
  80. * enum iwl_tlc_mng_cfg_cw - channel width options
  81. * @IWL_TLC_MNG_MAX_CH_WIDTH_20MHZ: 20MHZ channel
  82. * @IWL_TLC_MNG_MAX_CH_WIDTH_40MHZ: 40MHZ channel
  83. * @IWL_TLC_MNG_MAX_CH_WIDTH_80MHZ: 80MHZ channel
  84. * @IWL_TLC_MNG_MAX_CH_WIDTH_160MHZ: 160MHZ channel
  85. * @IWL_TLC_MNG_MAX_CH_WIDTH_LAST: maximum value
  86. */
  87. enum iwl_tlc_mng_cfg_cw {
  88. IWL_TLC_MNG_MAX_CH_WIDTH_20MHZ,
  89. IWL_TLC_MNG_MAX_CH_WIDTH_40MHZ,
  90. IWL_TLC_MNG_MAX_CH_WIDTH_80MHZ,
  91. IWL_TLC_MNG_MAX_CH_WIDTH_160MHZ,
  92. IWL_TLC_MNG_MAX_CH_WIDTH_LAST = IWL_TLC_MNG_MAX_CH_WIDTH_160MHZ,
  93. };
  94. /**
  95. * enum iwl_tlc_mng_cfg_chains - possible chains
  96. * @IWL_TLC_MNG_CHAIN_A_MSK: chain A
  97. * @IWL_TLC_MNG_CHAIN_B_MSK: chain B
  98. * @IWL_TLC_MNG_CHAIN_C_MSK: chain C
  99. */
  100. enum iwl_tlc_mng_cfg_chains {
  101. IWL_TLC_MNG_CHAIN_A_MSK = BIT(0),
  102. IWL_TLC_MNG_CHAIN_B_MSK = BIT(1),
  103. IWL_TLC_MNG_CHAIN_C_MSK = BIT(2),
  104. };
  105. /**
  106. * enum iwl_tlc_mng_cfg_gi - guard interval options
  107. * @IWL_TLC_MNG_SGI_20MHZ_MSK: enable short GI for 20MHZ
  108. * @IWL_TLC_MNG_SGI_40MHZ_MSK: enable short GI for 40MHZ
  109. * @IWL_TLC_MNG_SGI_80MHZ_MSK: enable short GI for 80MHZ
  110. * @IWL_TLC_MNG_SGI_160MHZ_MSK: enable short GI for 160MHZ
  111. */
  112. enum iwl_tlc_mng_cfg_gi {
  113. IWL_TLC_MNG_SGI_20MHZ_MSK = BIT(0),
  114. IWL_TLC_MNG_SGI_40MHZ_MSK = BIT(1),
  115. IWL_TLC_MNG_SGI_80MHZ_MSK = BIT(2),
  116. IWL_TLC_MNG_SGI_160MHZ_MSK = BIT(3),
  117. };
  118. /**
  119. * enum iwl_tlc_mng_cfg_mode - supported modes
  120. * @IWL_TLC_MNG_MODE_CCK: enable CCK
  121. * @IWL_TLC_MNG_MODE_OFDM_NON_HT: enable OFDM (non HT)
  122. * @IWL_TLC_MNG_MODE_NON_HT: enable non HT
  123. * @IWL_TLC_MNG_MODE_HT: enable HT
  124. * @IWL_TLC_MNG_MODE_VHT: enable VHT
  125. * @IWL_TLC_MNG_MODE_HE: enable HE
  126. * @IWL_TLC_MNG_MODE_INVALID: invalid value
  127. * @IWL_TLC_MNG_MODE_NUM: a count of possible modes
  128. */
  129. enum iwl_tlc_mng_cfg_mode {
  130. IWL_TLC_MNG_MODE_CCK = 0,
  131. IWL_TLC_MNG_MODE_OFDM_NON_HT = IWL_TLC_MNG_MODE_CCK,
  132. IWL_TLC_MNG_MODE_NON_HT = IWL_TLC_MNG_MODE_CCK,
  133. IWL_TLC_MNG_MODE_HT,
  134. IWL_TLC_MNG_MODE_VHT,
  135. IWL_TLC_MNG_MODE_HE,
  136. IWL_TLC_MNG_MODE_INVALID,
  137. IWL_TLC_MNG_MODE_NUM = IWL_TLC_MNG_MODE_INVALID,
  138. };
  139. /**
  140. * enum iwl_tlc_mng_vht_he_types - VHT HE types
  141. * @IWL_TLC_MNG_VALID_VHT_HE_TYPES_SU: VHT HT single user
  142. * @IWL_TLC_MNG_VALID_VHT_HE_TYPES_SU_EXT: VHT HT single user extended
  143. * @IWL_TLC_MNG_VALID_VHT_HE_TYPES_MU: VHT HT multiple users
  144. * @IWL_TLC_MNG_VALID_VHT_HE_TYPES_TRIG_BASED: trigger based
  145. * @IWL_TLC_MNG_VALID_VHT_HE_TYPES_NUM: a count of possible types
  146. */
  147. enum iwl_tlc_mng_vht_he_types {
  148. IWL_TLC_MNG_VALID_VHT_HE_TYPES_SU = 0,
  149. IWL_TLC_MNG_VALID_VHT_HE_TYPES_SU_EXT,
  150. IWL_TLC_MNG_VALID_VHT_HE_TYPES_MU,
  151. IWL_TLC_MNG_VALID_VHT_HE_TYPES_TRIG_BASED,
  152. IWL_TLC_MNG_VALID_VHT_HE_TYPES_NUM =
  153. IWL_TLC_MNG_VALID_VHT_HE_TYPES_TRIG_BASED,
  154. };
  155. /**
  156. * enum iwl_tlc_mng_ht_rates - HT/VHT rates
  157. * @IWL_TLC_MNG_HT_RATE_MCS0: index of MCS0
  158. * @IWL_TLC_MNG_HT_RATE_MCS1: index of MCS1
  159. * @IWL_TLC_MNG_HT_RATE_MCS2: index of MCS2
  160. * @IWL_TLC_MNG_HT_RATE_MCS3: index of MCS3
  161. * @IWL_TLC_MNG_HT_RATE_MCS4: index of MCS4
  162. * @IWL_TLC_MNG_HT_RATE_MCS5: index of MCS5
  163. * @IWL_TLC_MNG_HT_RATE_MCS6: index of MCS6
  164. * @IWL_TLC_MNG_HT_RATE_MCS7: index of MCS7
  165. * @IWL_TLC_MNG_HT_RATE_MCS8: index of MCS8
  166. * @IWL_TLC_MNG_HT_RATE_MCS9: index of MCS9
  167. * @IWL_TLC_MNG_HT_RATE_MAX: maximal rate for HT/VHT
  168. */
  169. enum iwl_tlc_mng_ht_rates {
  170. IWL_TLC_MNG_HT_RATE_MCS0 = 0,
  171. IWL_TLC_MNG_HT_RATE_MCS1,
  172. IWL_TLC_MNG_HT_RATE_MCS2,
  173. IWL_TLC_MNG_HT_RATE_MCS3,
  174. IWL_TLC_MNG_HT_RATE_MCS4,
  175. IWL_TLC_MNG_HT_RATE_MCS5,
  176. IWL_TLC_MNG_HT_RATE_MCS6,
  177. IWL_TLC_MNG_HT_RATE_MCS7,
  178. IWL_TLC_MNG_HT_RATE_MCS8,
  179. IWL_TLC_MNG_HT_RATE_MCS9,
  180. IWL_TLC_MNG_HT_RATE_MAX = IWL_TLC_MNG_HT_RATE_MCS9,
  181. };
  182. /* Maximum supported tx antennas number */
  183. #define MAX_RS_ANT_NUM 3
  184. /**
  185. * struct tlc_config_cmd - TLC configuration
  186. * @sta_id: station id
  187. * @reserved1: reserved
  188. * @max_supp_ch_width: channel width
  189. * @flags: bitmask of &enum iwl_tlc_mng_cfg_flags
  190. * @chains: bitmask of &enum iwl_tlc_mng_cfg_chains
  191. * @max_supp_ss: valid values are 0-3, 0 - spatial streams are not supported
  192. * @valid_vht_he_types: bitmap of &enum iwl_tlc_mng_vht_he_types
  193. * @non_ht_supp_rates: bitmap of supported legacy rates
  194. * @ht_supp_rates: bitmap of supported HT/VHT rates, valid bits are 0-9
  195. * @mode: &enum iwl_tlc_mng_cfg_mode
  196. * @reserved2: reserved
  197. * @he_supp_rates: bitmap of supported HE rates
  198. * @sgi_ch_width_supp: bitmap of SGI support per channel width
  199. * @he_gi_support: 11ax HE guard interval
  200. * @max_ampdu_cnt: max AMPDU size (frames count)
  201. */
  202. struct iwl_tlc_config_cmd {
  203. u8 sta_id;
  204. u8 reserved1[3];
  205. u8 max_supp_ch_width;
  206. u8 chains;
  207. u8 max_supp_ss;
  208. u8 valid_vht_he_types;
  209. __le16 flags;
  210. __le16 non_ht_supp_rates;
  211. __le16 ht_supp_rates[MAX_RS_ANT_NUM];
  212. u8 mode;
  213. u8 reserved2;
  214. __le16 he_supp_rates;
  215. u8 sgi_ch_width_supp;
  216. u8 he_gi_support;
  217. __le32 max_ampdu_cnt;
  218. } __packed; /* TLC_MNG_CONFIG_CMD_API_S_VER_1 */
  219. #define IWL_TLC_NOTIF_INIT_RATE_POS 0
  220. #define IWL_TLC_NOTIF_INIT_RATE_MSK BIT(IWL_TLC_NOTIF_INIT_RATE_POS)
  221. #define IWL_TLC_NOTIF_REQ_INTERVAL (500)
  222. /**
  223. * struct iwl_tlc_notif_req_config_cmd - request notif on specific changes
  224. * @sta_id: relevant station
  225. * @reserved1: reserved
  226. * @flags: bitmap of requested notifications %IWL_TLC_NOTIF_INIT_\*
  227. * @interval: minimum time between notifications from TLC to the driver (msec)
  228. * @reserved2: reserved
  229. */
  230. struct iwl_tlc_notif_req_config_cmd {
  231. u8 sta_id;
  232. u8 reserved1;
  233. __le16 flags;
  234. __le16 interval;
  235. __le16 reserved2;
  236. } __packed; /* TLC_MNG_NOTIF_REQ_CMD_API_S_VER_1 */
  237. /**
  238. * struct iwl_tlc_update_notif - TLC notification from FW
  239. * @sta_id: station id
  240. * @reserved: reserved
  241. * @flags: bitmap of notifications reported
  242. * @values: field per flag in struct iwl_tlc_notif_req_config_cmd
  243. */
  244. struct iwl_tlc_update_notif {
  245. u8 sta_id;
  246. u8 reserved;
  247. __le16 flags;
  248. __le32 values[16];
  249. } __packed; /* TLC_MNG_UPDATE_NTFY_API_S_VER_1 */
  250. /**
  251. * enum iwl_tlc_debug_flags - debug options
  252. * @IWL_TLC_DEBUG_FIXED_RATE: set fixed rate for rate scaling
  253. * @IWL_TLC_DEBUG_STATS_TH: threshold for sending statistics to the driver, in
  254. * frames
  255. * @IWL_TLC_DEBUG_STATS_TIME_TH: threshold for sending statistics to the
  256. * driver, in msec
  257. * @IWL_TLC_DEBUG_AGG_TIME_LIM: time limit for a BA session
  258. * @IWL_TLC_DEBUG_AGG_DIS_START_TH: frame with try-count greater than this
  259. * threshold should not start an aggregation session
  260. * @IWL_TLC_DEBUG_AGG_FRAME_CNT_LIM: set max number of frames in an aggregation
  261. * @IWL_TLC_DEBUG_RENEW_ADDBA_DELAY: delay between retries of ADD BA
  262. * @IWL_TLC_DEBUG_START_AC_RATE_IDX: frames per second to start a BA session
  263. * @IWL_TLC_DEBUG_NO_FAR_RANGE_TWEAK: disable BW scaling
  264. */
  265. enum iwl_tlc_debug_flags {
  266. IWL_TLC_DEBUG_FIXED_RATE,
  267. IWL_TLC_DEBUG_STATS_TH,
  268. IWL_TLC_DEBUG_STATS_TIME_TH,
  269. IWL_TLC_DEBUG_AGG_TIME_LIM,
  270. IWL_TLC_DEBUG_AGG_DIS_START_TH,
  271. IWL_TLC_DEBUG_AGG_FRAME_CNT_LIM,
  272. IWL_TLC_DEBUG_RENEW_ADDBA_DELAY,
  273. IWL_TLC_DEBUG_START_AC_RATE_IDX,
  274. IWL_TLC_DEBUG_NO_FAR_RANGE_TWEAK,
  275. }; /* TLC_MNG_DEBUG_FLAGS_API_E_VER_1 */
  276. /**
  277. * struct iwl_dhc_tlc_dbg - fixed debug config
  278. * @sta_id: bit 0 - enable/disable, bits 1 - 7 hold station id
  279. * @reserved1: reserved
  280. * @flags: bitmap of %IWL_TLC_DEBUG_\*
  281. * @fixed_rate: rate value
  282. * @stats_threshold: if number of tx-ed frames is greater, send statistics
  283. * @time_threshold: statistics threshold in usec
  284. * @agg_time_lim: max agg time
  285. * @agg_dis_start_threshold: frames with try-cont greater than this count will
  286. * not be aggregated
  287. * @agg_frame_count_lim: agg size
  288. * @addba_retry_delay: delay between retries of ADD BA
  289. * @start_ac_rate_idx: frames per second to start a BA session
  290. * @no_far_range_tweak: disable BW scaling
  291. * @reserved2: reserved
  292. */
  293. struct iwl_dhc_tlc_cmd {
  294. u8 sta_id;
  295. u8 reserved1[3];
  296. __le32 flags;
  297. __le32 fixed_rate;
  298. __le16 stats_threshold;
  299. __le16 time_threshold;
  300. __le16 agg_time_lim;
  301. __le16 agg_dis_start_threshold;
  302. __le16 agg_frame_count_lim;
  303. __le16 addba_retry_delay;
  304. u8 start_ac_rate_idx[IEEE80211_NUM_ACS];
  305. u8 no_far_range_tweak;
  306. u8 reserved2[3];
  307. } __packed;
  308. /*
  309. * These serve as indexes into
  310. * struct iwl_rate_info fw_rate_idx_to_plcp[IWL_RATE_COUNT];
  311. * TODO: avoid overlap between legacy and HT rates
  312. */
  313. enum {
  314. IWL_RATE_1M_INDEX = 0,
  315. IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX,
  316. IWL_RATE_2M_INDEX,
  317. IWL_RATE_5M_INDEX,
  318. IWL_RATE_11M_INDEX,
  319. IWL_LAST_CCK_RATE = IWL_RATE_11M_INDEX,
  320. IWL_RATE_6M_INDEX,
  321. IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX,
  322. IWL_RATE_MCS_0_INDEX = IWL_RATE_6M_INDEX,
  323. IWL_FIRST_HT_RATE = IWL_RATE_MCS_0_INDEX,
  324. IWL_FIRST_VHT_RATE = IWL_RATE_MCS_0_INDEX,
  325. IWL_RATE_9M_INDEX,
  326. IWL_RATE_12M_INDEX,
  327. IWL_RATE_MCS_1_INDEX = IWL_RATE_12M_INDEX,
  328. IWL_RATE_18M_INDEX,
  329. IWL_RATE_MCS_2_INDEX = IWL_RATE_18M_INDEX,
  330. IWL_RATE_24M_INDEX,
  331. IWL_RATE_MCS_3_INDEX = IWL_RATE_24M_INDEX,
  332. IWL_RATE_36M_INDEX,
  333. IWL_RATE_MCS_4_INDEX = IWL_RATE_36M_INDEX,
  334. IWL_RATE_48M_INDEX,
  335. IWL_RATE_MCS_5_INDEX = IWL_RATE_48M_INDEX,
  336. IWL_RATE_54M_INDEX,
  337. IWL_RATE_MCS_6_INDEX = IWL_RATE_54M_INDEX,
  338. IWL_LAST_NON_HT_RATE = IWL_RATE_54M_INDEX,
  339. IWL_RATE_60M_INDEX,
  340. IWL_RATE_MCS_7_INDEX = IWL_RATE_60M_INDEX,
  341. IWL_LAST_HT_RATE = IWL_RATE_MCS_7_INDEX,
  342. IWL_RATE_MCS_8_INDEX,
  343. IWL_RATE_MCS_9_INDEX,
  344. IWL_LAST_VHT_RATE = IWL_RATE_MCS_9_INDEX,
  345. IWL_RATE_COUNT_LEGACY = IWL_LAST_NON_HT_RATE + 1,
  346. IWL_RATE_COUNT = IWL_LAST_VHT_RATE + 1,
  347. };
  348. #define IWL_RATE_BIT_MSK(r) BIT(IWL_RATE_##r##M_INDEX)
  349. /* fw API values for legacy bit rates, both OFDM and CCK */
  350. enum {
  351. IWL_RATE_6M_PLCP = 13,
  352. IWL_RATE_9M_PLCP = 15,
  353. IWL_RATE_12M_PLCP = 5,
  354. IWL_RATE_18M_PLCP = 7,
  355. IWL_RATE_24M_PLCP = 9,
  356. IWL_RATE_36M_PLCP = 11,
  357. IWL_RATE_48M_PLCP = 1,
  358. IWL_RATE_54M_PLCP = 3,
  359. IWL_RATE_1M_PLCP = 10,
  360. IWL_RATE_2M_PLCP = 20,
  361. IWL_RATE_5M_PLCP = 55,
  362. IWL_RATE_11M_PLCP = 110,
  363. IWL_RATE_INVM_PLCP = -1,
  364. };
  365. /*
  366. * rate_n_flags bit fields
  367. *
  368. * The 32-bit value has different layouts in the low 8 bites depending on the
  369. * format. There are three formats, HT, VHT and legacy (11abg, with subformats
  370. * for CCK and OFDM).
  371. *
  372. * High-throughput (HT) rate format
  373. * bit 8 is 1, bit 26 is 0, bit 9 is 0 (OFDM)
  374. * Very High-throughput (VHT) rate format
  375. * bit 8 is 0, bit 26 is 1, bit 9 is 0 (OFDM)
  376. * Legacy OFDM rate format for bits 7:0
  377. * bit 8 is 0, bit 26 is 0, bit 9 is 0 (OFDM)
  378. * Legacy CCK rate format for bits 7:0:
  379. * bit 8 is 0, bit 26 is 0, bit 9 is 1 (CCK)
  380. */
  381. /* Bit 8: (1) HT format, (0) legacy or VHT format */
  382. #define RATE_MCS_HT_POS 8
  383. #define RATE_MCS_HT_MSK (1 << RATE_MCS_HT_POS)
  384. /* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
  385. #define RATE_MCS_CCK_POS 9
  386. #define RATE_MCS_CCK_MSK (1 << RATE_MCS_CCK_POS)
  387. /* Bit 26: (1) VHT format, (0) legacy format in bits 8:0 */
  388. #define RATE_MCS_VHT_POS 26
  389. #define RATE_MCS_VHT_MSK (1 << RATE_MCS_VHT_POS)
  390. /*
  391. * High-throughput (HT) rate format for bits 7:0
  392. *
  393. * 2-0: MCS rate base
  394. * 0) 6 Mbps
  395. * 1) 12 Mbps
  396. * 2) 18 Mbps
  397. * 3) 24 Mbps
  398. * 4) 36 Mbps
  399. * 5) 48 Mbps
  400. * 6) 54 Mbps
  401. * 7) 60 Mbps
  402. * 4-3: 0) Single stream (SISO)
  403. * 1) Dual stream (MIMO)
  404. * 2) Triple stream (MIMO)
  405. * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
  406. * (bits 7-6 are zero)
  407. *
  408. * Together the low 5 bits work out to the MCS index because we don't
  409. * support MCSes above 15/23, and 0-7 have one stream, 8-15 have two
  410. * streams and 16-23 have three streams. We could also support MCS 32
  411. * which is the duplicate 20 MHz MCS (bit 5 set, all others zero.)
  412. */
  413. #define RATE_HT_MCS_RATE_CODE_MSK 0x7
  414. #define RATE_HT_MCS_NSS_POS 3
  415. #define RATE_HT_MCS_NSS_MSK (3 << RATE_HT_MCS_NSS_POS)
  416. /* Bit 10: (1) Use Green Field preamble */
  417. #define RATE_HT_MCS_GF_POS 10
  418. #define RATE_HT_MCS_GF_MSK (1 << RATE_HT_MCS_GF_POS)
  419. #define RATE_HT_MCS_INDEX_MSK 0x3f
  420. /*
  421. * Very High-throughput (VHT) rate format for bits 7:0
  422. *
  423. * 3-0: VHT MCS (0-9)
  424. * 5-4: number of streams - 1:
  425. * 0) Single stream (SISO)
  426. * 1) Dual stream (MIMO)
  427. * 2) Triple stream (MIMO)
  428. */
  429. /* Bit 4-5: (0) SISO, (1) MIMO2 (2) MIMO3 */
  430. #define RATE_VHT_MCS_RATE_CODE_MSK 0xf
  431. #define RATE_VHT_MCS_NSS_POS 4
  432. #define RATE_VHT_MCS_NSS_MSK (3 << RATE_VHT_MCS_NSS_POS)
  433. /*
  434. * Legacy OFDM rate format for bits 7:0
  435. *
  436. * 3-0: 0xD) 6 Mbps
  437. * 0xF) 9 Mbps
  438. * 0x5) 12 Mbps
  439. * 0x7) 18 Mbps
  440. * 0x9) 24 Mbps
  441. * 0xB) 36 Mbps
  442. * 0x1) 48 Mbps
  443. * 0x3) 54 Mbps
  444. * (bits 7-4 are 0)
  445. *
  446. * Legacy CCK rate format for bits 7:0:
  447. * bit 8 is 0, bit 26 is 0, bit 9 is 1 (CCK):
  448. *
  449. * 6-0: 10) 1 Mbps
  450. * 20) 2 Mbps
  451. * 55) 5.5 Mbps
  452. * 110) 11 Mbps
  453. * (bit 7 is 0)
  454. */
  455. #define RATE_LEGACY_RATE_MSK 0xff
  456. /* Bit 10 - OFDM HE */
  457. #define RATE_MCS_OFDM_HE_POS 10
  458. #define RATE_MCS_OFDM_HE_MSK BIT(RATE_MCS_OFDM_HE_POS)
  459. /*
  460. * Bit 11-12: (0) 20MHz, (1) 40MHz, (2) 80MHz, (3) 160MHz
  461. * 0 and 1 are valid for HT and VHT, 2 and 3 only for VHT
  462. */
  463. #define RATE_MCS_CHAN_WIDTH_POS 11
  464. #define RATE_MCS_CHAN_WIDTH_MSK (3 << RATE_MCS_CHAN_WIDTH_POS)
  465. #define RATE_MCS_CHAN_WIDTH_20 (0 << RATE_MCS_CHAN_WIDTH_POS)
  466. #define RATE_MCS_CHAN_WIDTH_40 (1 << RATE_MCS_CHAN_WIDTH_POS)
  467. #define RATE_MCS_CHAN_WIDTH_80 (2 << RATE_MCS_CHAN_WIDTH_POS)
  468. #define RATE_MCS_CHAN_WIDTH_160 (3 << RATE_MCS_CHAN_WIDTH_POS)
  469. /* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
  470. #define RATE_MCS_SGI_POS 13
  471. #define RATE_MCS_SGI_MSK (1 << RATE_MCS_SGI_POS)
  472. /* Bit 14-16: Antenna selection (1) Ant A, (2) Ant B, (4) Ant C */
  473. #define RATE_MCS_ANT_POS 14
  474. #define RATE_MCS_ANT_A_MSK (1 << RATE_MCS_ANT_POS)
  475. #define RATE_MCS_ANT_B_MSK (2 << RATE_MCS_ANT_POS)
  476. #define RATE_MCS_ANT_C_MSK (4 << RATE_MCS_ANT_POS)
  477. #define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | \
  478. RATE_MCS_ANT_B_MSK)
  479. #define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | \
  480. RATE_MCS_ANT_C_MSK)
  481. #define RATE_MCS_ANT_MSK RATE_MCS_ANT_ABC_MSK
  482. /* Bit 17: (0) SS, (1) SS*2 */
  483. #define RATE_MCS_STBC_POS 17
  484. #define RATE_MCS_STBC_MSK BIT(RATE_MCS_STBC_POS)
  485. /* Bit 18: OFDM-HE dual carrier mode */
  486. #define RATE_HE_DUAL_CARRIER_MODE 18
  487. #define RATE_HE_DUAL_CARRIER_MODE_MSK BIT(RATE_HE_DUAL_CARRIER_MODE)
  488. /* Bit 19: (0) Beamforming is off, (1) Beamforming is on */
  489. #define RATE_MCS_BF_POS 19
  490. #define RATE_MCS_BF_MSK (1 << RATE_MCS_BF_POS)
  491. /*
  492. * Bit 20-21: HE guard interval and LTF type.
  493. * (0) 1xLTF+1.6us, (1) 2xLTF+0.8us,
  494. * (2) 2xLTF+1.6us, (3) 4xLTF+3.2us
  495. */
  496. #define RATE_MCS_HE_GI_LTF_POS 20
  497. #define RATE_MCS_HE_GI_LTF_MSK (3 << RATE_MCS_HE_GI_LTF_POS)
  498. /* Bit 22-23: HE type. (0) SU, (1) SU_EXT, (2) MU, (3) trigger based */
  499. #define RATE_MCS_HE_TYPE_POS 22
  500. #define RATE_MCS_HE_TYPE_MSK (3 << RATE_MCS_HE_TYPE_POS)
  501. /* Bit 24-25: (0) 20MHz (no dup), (1) 2x20MHz, (2) 4x20MHz, 3 8x20MHz */
  502. #define RATE_MCS_DUP_POS 24
  503. #define RATE_MCS_DUP_MSK (3 << RATE_MCS_DUP_POS)
  504. /* Bit 27: (1) LDPC enabled, (0) LDPC disabled */
  505. #define RATE_MCS_LDPC_POS 27
  506. #define RATE_MCS_LDPC_MSK (1 << RATE_MCS_LDPC_POS)
  507. /* Link Quality definitions */
  508. /* # entries in rate scale table to support Tx retries */
  509. #define LQ_MAX_RETRY_NUM 16
  510. /* Link quality command flags bit fields */
  511. /* Bit 0: (0) Don't use RTS (1) Use RTS */
  512. #define LQ_FLAG_USE_RTS_POS 0
  513. #define LQ_FLAG_USE_RTS_MSK (1 << LQ_FLAG_USE_RTS_POS)
  514. /* Bit 1-3: LQ command color. Used to match responses to LQ commands */
  515. #define LQ_FLAG_COLOR_POS 1
  516. #define LQ_FLAG_COLOR_MSK (7 << LQ_FLAG_COLOR_POS)
  517. #define LQ_FLAG_COLOR_GET(_f) (((_f) & LQ_FLAG_COLOR_MSK) >>\
  518. LQ_FLAG_COLOR_POS)
  519. #define LQ_FLAGS_COLOR_INC(_c) ((((_c) + 1) << LQ_FLAG_COLOR_POS) &\
  520. LQ_FLAG_COLOR_MSK)
  521. #define LQ_FLAG_COLOR_SET(_f, _c) ((_c) | ((_f) & ~LQ_FLAG_COLOR_MSK))
  522. /* Bit 4-5: Tx RTS BW Signalling
  523. * (0) No RTS BW signalling
  524. * (1) Static BW signalling
  525. * (2) Dynamic BW signalling
  526. */
  527. #define LQ_FLAG_RTS_BW_SIG_POS 4
  528. #define LQ_FLAG_RTS_BW_SIG_NONE (0 << LQ_FLAG_RTS_BW_SIG_POS)
  529. #define LQ_FLAG_RTS_BW_SIG_STATIC (1 << LQ_FLAG_RTS_BW_SIG_POS)
  530. #define LQ_FLAG_RTS_BW_SIG_DYNAMIC (2 << LQ_FLAG_RTS_BW_SIG_POS)
  531. /* Bit 6: (0) No dynamic BW selection (1) Allow dynamic BW selection
  532. * Dyanmic BW selection allows Tx with narrower BW then requested in rates
  533. */
  534. #define LQ_FLAG_DYNAMIC_BW_POS 6
  535. #define LQ_FLAG_DYNAMIC_BW_MSK (1 << LQ_FLAG_DYNAMIC_BW_POS)
  536. /* Single Stream Tx Parameters (lq_cmd->ss_params)
  537. * Flags to control a smart FW decision about whether BFER/STBC/SISO will be
  538. * used for single stream Tx.
  539. */
  540. /* Bit 0-1: Max STBC streams allowed. Can be 0-3.
  541. * (0) - No STBC allowed
  542. * (1) - 2x1 STBC allowed (HT/VHT)
  543. * (2) - 4x2 STBC allowed (HT/VHT)
  544. * (3) - 3x2 STBC allowed (HT only)
  545. * All our chips are at most 2 antennas so only (1) is valid for now.
  546. */
  547. #define LQ_SS_STBC_ALLOWED_POS 0
  548. #define LQ_SS_STBC_ALLOWED_MSK (3 << LQ_SS_STBC_ALLOWED_MSK)
  549. /* 2x1 STBC is allowed */
  550. #define LQ_SS_STBC_1SS_ALLOWED (1 << LQ_SS_STBC_ALLOWED_POS)
  551. /* Bit 2: Beamformer (VHT only) is allowed */
  552. #define LQ_SS_BFER_ALLOWED_POS 2
  553. #define LQ_SS_BFER_ALLOWED (1 << LQ_SS_BFER_ALLOWED_POS)
  554. /* Bit 3: Force BFER or STBC for testing
  555. * If this is set:
  556. * If BFER is allowed then force the ucode to choose BFER else
  557. * If STBC is allowed then force the ucode to choose STBC over SISO
  558. */
  559. #define LQ_SS_FORCE_POS 3
  560. #define LQ_SS_FORCE (1 << LQ_SS_FORCE_POS)
  561. /* Bit 31: ss_params field is valid. Used for FW backward compatibility
  562. * with other drivers which don't support the ss_params API yet
  563. */
  564. #define LQ_SS_PARAMS_VALID_POS 31
  565. #define LQ_SS_PARAMS_VALID (1 << LQ_SS_PARAMS_VALID_POS)
  566. /**
  567. * struct iwl_lq_cmd - link quality command
  568. * @sta_id: station to update
  569. * @reduced_tpc: reduced transmit power control value
  570. * @control: not used
  571. * @flags: combination of LQ_FLAG_*
  572. * @mimo_delim: the first SISO index in rs_table, which separates MIMO
  573. * and SISO rates
  574. * @single_stream_ant_msk: best antenna for SISO (can be dual in CDD).
  575. * Should be ANT_[ABC]
  576. * @dual_stream_ant_msk: best antennas for MIMO, combination of ANT_[ABC]
  577. * @initial_rate_index: first index from rs_table per AC category
  578. * @agg_time_limit: aggregation max time threshold in usec/100, meaning
  579. * value of 100 is one usec. Range is 100 to 8000
  580. * @agg_disable_start_th: try-count threshold for starting aggregation.
  581. * If a frame has higher try-count, it should not be selected for
  582. * starting an aggregation sequence.
  583. * @agg_frame_cnt_limit: max frame count in an aggregation.
  584. * 0: no limit
  585. * 1: no aggregation (one frame per aggregation)
  586. * 2 - 0x3f: maximal number of frames (up to 3f == 63)
  587. * @reserved2: reserved
  588. * @rs_table: array of rates for each TX try, each is rate_n_flags,
  589. * meaning it is a combination of RATE_MCS_* and IWL_RATE_*_PLCP
  590. * @ss_params: single stream features. declare whether STBC or BFER are allowed.
  591. */
  592. struct iwl_lq_cmd {
  593. u8 sta_id;
  594. u8 reduced_tpc;
  595. __le16 control;
  596. /* LINK_QUAL_GENERAL_PARAMS_API_S_VER_1 */
  597. u8 flags;
  598. u8 mimo_delim;
  599. u8 single_stream_ant_msk;
  600. u8 dual_stream_ant_msk;
  601. u8 initial_rate_index[AC_NUM];
  602. /* LINK_QUAL_AGG_PARAMS_API_S_VER_1 */
  603. __le16 agg_time_limit;
  604. u8 agg_disable_start_th;
  605. u8 agg_frame_cnt_limit;
  606. __le32 reserved2;
  607. __le32 rs_table[LQ_MAX_RETRY_NUM];
  608. __le32 ss_params;
  609. }; /* LINK_QUALITY_CMD_API_S_VER_1 */
  610. #endif /* __iwl_fw_api_rs_h__ */