stats.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  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) 2013 - 2015 Intel Mobile Communications GmbH
  10. * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of version 2 of the GNU General Public License as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called COPYING.
  23. *
  24. * Contact Information:
  25. * Intel Linux Wireless <linuxwifi@intel.com>
  26. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  27. *
  28. * BSD LICENSE
  29. *
  30. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  31. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  32. * All rights reserved.
  33. *
  34. * Redistribution and use in source and binary forms, with or without
  35. * modification, are permitted provided that the following conditions
  36. * are met:
  37. *
  38. * * Redistributions of source code must retain the above copyright
  39. * notice, this list of conditions and the following disclaimer.
  40. * * Redistributions in binary form must reproduce the above copyright
  41. * notice, this list of conditions and the following disclaimer in
  42. * the documentation and/or other materials provided with the
  43. * distribution.
  44. * * Neither the name Intel Corporation nor the names of its
  45. * contributors may be used to endorse or promote products derived
  46. * from this software without specific prior written permission.
  47. *
  48. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  49. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  50. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  51. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  52. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  53. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  54. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  55. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  56. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  57. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  58. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  59. *
  60. *****************************************************************************/
  61. #ifndef __iwl_fw_api_stats_h__
  62. #define __iwl_fw_api_stats_h__
  63. #include "mac.h"
  64. struct mvm_statistics_dbg {
  65. __le32 burst_check;
  66. __le32 burst_count;
  67. __le32 wait_for_silence_timeout_cnt;
  68. u8 reserved[12];
  69. } __packed; /* STATISTICS_DEBUG_API_S_VER_2 */
  70. struct mvm_statistics_div {
  71. __le32 tx_on_a;
  72. __le32 tx_on_b;
  73. __le32 exec_time;
  74. __le32 probe_time;
  75. __le32 rssi_ant;
  76. __le32 reserved2;
  77. } __packed; /* STATISTICS_SLOW_DIV_API_S_VER_2 */
  78. /**
  79. * struct mvm_statistics_rx_non_phy
  80. * @bogus_cts: CTS received when not expecting CTS
  81. * @bogus_ack: ACK received when not expecting ACK
  82. * @non_channel_beacons: beacons with our bss id but not on our serving channel
  83. * @channel_beacons: beacons with our bss id and in our serving channel
  84. * @num_missed_bcon: number of missed beacons
  85. * @adc_rx_saturation_time: count in 0.8us units the time the ADC was in
  86. * saturation
  87. * @ina_detection_search_time: total time (in 0.8us) searched for INA
  88. * @beacon_silence_rssi_a: RSSI silence after beacon frame
  89. * @beacon_silence_rssi_b: RSSI silence after beacon frame
  90. * @beacon_silence_rssi_c: RSSI silence after beacon frame
  91. * @interference_data_flag: flag for interference data availability. 1 when data
  92. * is available.
  93. * @channel_load: counts RX Enable time in uSec
  94. * @beacon_rssi_a: beacon RSSI on anntena A
  95. * @beacon_rssi_b: beacon RSSI on antenna B
  96. * @beacon_rssi_c: beacon RSSI on antenna C
  97. * @beacon_energy_a: beacon energy on antenna A
  98. * @beacon_energy_b: beacon energy on antenna B
  99. * @beacon_energy_c: beacon energy on antenna C
  100. * @num_bt_kills: number of BT "kills" (frame TX aborts)
  101. * @mac_id: mac ID
  102. */
  103. struct mvm_statistics_rx_non_phy {
  104. __le32 bogus_cts;
  105. __le32 bogus_ack;
  106. __le32 non_channel_beacons;
  107. __le32 channel_beacons;
  108. __le32 num_missed_bcon;
  109. __le32 adc_rx_saturation_time;
  110. __le32 ina_detection_search_time;
  111. __le32 beacon_silence_rssi_a;
  112. __le32 beacon_silence_rssi_b;
  113. __le32 beacon_silence_rssi_c;
  114. __le32 interference_data_flag;
  115. __le32 channel_load;
  116. __le32 beacon_rssi_a;
  117. __le32 beacon_rssi_b;
  118. __le32 beacon_rssi_c;
  119. __le32 beacon_energy_a;
  120. __le32 beacon_energy_b;
  121. __le32 beacon_energy_c;
  122. __le32 num_bt_kills;
  123. __le32 mac_id;
  124. } __packed; /* STATISTICS_RX_NON_PHY_API_S_VER_4 */
  125. struct mvm_statistics_rx_non_phy_v3 {
  126. __le32 bogus_cts; /* CTS received when not expecting CTS */
  127. __le32 bogus_ack; /* ACK received when not expecting ACK */
  128. __le32 non_bssid_frames; /* number of frames with BSSID that
  129. * doesn't belong to the STA BSSID */
  130. __le32 filtered_frames; /* count frames that were dumped in the
  131. * filtering process */
  132. __le32 non_channel_beacons; /* beacons with our bss id but not on
  133. * our serving channel */
  134. __le32 channel_beacons; /* beacons with our bss id and in our
  135. * serving channel */
  136. __le32 num_missed_bcon; /* number of missed beacons */
  137. __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
  138. * ADC was in saturation */
  139. __le32 ina_detection_search_time;/* total time (in 0.8us) searched
  140. * for INA */
  141. __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
  142. __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
  143. __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
  144. __le32 interference_data_flag; /* flag for interference data
  145. * availability. 1 when data is
  146. * available. */
  147. __le32 channel_load; /* counts RX Enable time in uSec */
  148. __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
  149. * and CCK) counter */
  150. __le32 beacon_rssi_a;
  151. __le32 beacon_rssi_b;
  152. __le32 beacon_rssi_c;
  153. __le32 beacon_energy_a;
  154. __le32 beacon_energy_b;
  155. __le32 beacon_energy_c;
  156. __le32 num_bt_kills;
  157. __le32 mac_id;
  158. __le32 directed_data_mpdu;
  159. } __packed; /* STATISTICS_RX_NON_PHY_API_S_VER_3 */
  160. struct mvm_statistics_rx_phy {
  161. __le32 unresponded_rts;
  162. __le32 rxe_frame_lmt_overrun;
  163. __le32 sent_ba_rsp_cnt;
  164. __le32 dsp_self_kill;
  165. __le32 reserved;
  166. } __packed; /* STATISTICS_RX_PHY_API_S_VER_3 */
  167. struct mvm_statistics_rx_phy_v2 {
  168. __le32 ina_cnt;
  169. __le32 fina_cnt;
  170. __le32 plcp_err;
  171. __le32 crc32_err;
  172. __le32 overrun_err;
  173. __le32 early_overrun_err;
  174. __le32 crc32_good;
  175. __le32 false_alarm_cnt;
  176. __le32 fina_sync_err_cnt;
  177. __le32 sfd_timeout;
  178. __le32 fina_timeout;
  179. __le32 unresponded_rts;
  180. __le32 rxe_frame_lmt_overrun;
  181. __le32 sent_ack_cnt;
  182. __le32 sent_cts_cnt;
  183. __le32 sent_ba_rsp_cnt;
  184. __le32 dsp_self_kill;
  185. __le32 mh_format_err;
  186. __le32 re_acq_main_rssi_sum;
  187. __le32 reserved;
  188. } __packed; /* STATISTICS_RX_PHY_API_S_VER_2 */
  189. struct mvm_statistics_rx_ht_phy_v1 {
  190. __le32 plcp_err;
  191. __le32 overrun_err;
  192. __le32 early_overrun_err;
  193. __le32 crc32_good;
  194. __le32 crc32_err;
  195. __le32 mh_format_err;
  196. __le32 agg_crc32_good;
  197. __le32 agg_mpdu_cnt;
  198. __le32 agg_cnt;
  199. __le32 unsupport_mcs;
  200. } __packed; /* STATISTICS_HT_RX_PHY_API_S_VER_1 */
  201. struct mvm_statistics_rx_ht_phy {
  202. __le32 mh_format_err;
  203. __le32 agg_mpdu_cnt;
  204. __le32 agg_cnt;
  205. __le32 unsupport_mcs;
  206. } __packed; /* STATISTICS_HT_RX_PHY_API_S_VER_2 */
  207. struct mvm_statistics_tx_non_phy_v3 {
  208. __le32 preamble_cnt;
  209. __le32 rx_detected_cnt;
  210. __le32 bt_prio_defer_cnt;
  211. __le32 bt_prio_kill_cnt;
  212. __le32 few_bytes_cnt;
  213. __le32 cts_timeout;
  214. __le32 ack_timeout;
  215. __le32 expected_ack_cnt;
  216. __le32 actual_ack_cnt;
  217. __le32 dump_msdu_cnt;
  218. __le32 burst_abort_next_frame_mismatch_cnt;
  219. __le32 burst_abort_missing_next_frame_cnt;
  220. __le32 cts_timeout_collision;
  221. __le32 ack_or_ba_timeout_collision;
  222. } __packed; /* STATISTICS_TX_NON_PHY_API_S_VER_3 */
  223. struct mvm_statistics_tx_non_phy {
  224. __le32 bt_prio_defer_cnt;
  225. __le32 bt_prio_kill_cnt;
  226. __le32 few_bytes_cnt;
  227. __le32 cts_timeout;
  228. __le32 ack_timeout;
  229. __le32 dump_msdu_cnt;
  230. __le32 burst_abort_next_frame_mismatch_cnt;
  231. __le32 burst_abort_missing_next_frame_cnt;
  232. __le32 cts_timeout_collision;
  233. __le32 ack_or_ba_timeout_collision;
  234. } __packed; /* STATISTICS_TX_NON_PHY_API_S_VER_4 */
  235. #define MAX_CHAINS 3
  236. struct mvm_statistics_tx_non_phy_agg {
  237. __le32 ba_timeout;
  238. __le32 ba_reschedule_frames;
  239. __le32 scd_query_agg_frame_cnt;
  240. __le32 scd_query_no_agg;
  241. __le32 scd_query_agg;
  242. __le32 scd_query_mismatch;
  243. __le32 frame_not_ready;
  244. __le32 underrun;
  245. __le32 bt_prio_kill;
  246. __le32 rx_ba_rsp_cnt;
  247. __s8 txpower[MAX_CHAINS];
  248. __s8 reserved;
  249. __le32 reserved2;
  250. } __packed; /* STATISTICS_TX_NON_PHY_AGG_API_S_VER_1 */
  251. struct mvm_statistics_tx_channel_width {
  252. __le32 ext_cca_narrow_ch20[1];
  253. __le32 ext_cca_narrow_ch40[2];
  254. __le32 ext_cca_narrow_ch80[3];
  255. __le32 ext_cca_narrow_ch160[4];
  256. __le32 last_tx_ch_width_indx;
  257. __le32 rx_detected_per_ch_width[4];
  258. __le32 success_per_ch_width[4];
  259. __le32 fail_per_ch_width[4];
  260. }; /* STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */
  261. struct mvm_statistics_tx_v4 {
  262. struct mvm_statistics_tx_non_phy_v3 general;
  263. struct mvm_statistics_tx_non_phy_agg agg;
  264. struct mvm_statistics_tx_channel_width channel_width;
  265. } __packed; /* STATISTICS_TX_API_S_VER_4 */
  266. struct mvm_statistics_tx {
  267. struct mvm_statistics_tx_non_phy general;
  268. struct mvm_statistics_tx_non_phy_agg agg;
  269. struct mvm_statistics_tx_channel_width channel_width;
  270. } __packed; /* STATISTICS_TX_API_S_VER_5 */
  271. struct mvm_statistics_bt_activity {
  272. __le32 hi_priority_tx_req_cnt;
  273. __le32 hi_priority_tx_denied_cnt;
  274. __le32 lo_priority_tx_req_cnt;
  275. __le32 lo_priority_tx_denied_cnt;
  276. __le32 hi_priority_rx_req_cnt;
  277. __le32 hi_priority_rx_denied_cnt;
  278. __le32 lo_priority_rx_req_cnt;
  279. __le32 lo_priority_rx_denied_cnt;
  280. } __packed; /* STATISTICS_BT_ACTIVITY_API_S_VER_1 */
  281. struct mvm_statistics_general_common_v19 {
  282. __le32 radio_temperature;
  283. __le32 radio_voltage;
  284. struct mvm_statistics_dbg dbg;
  285. __le32 sleep_time;
  286. __le32 slots_out;
  287. __le32 slots_idle;
  288. __le32 ttl_timestamp;
  289. struct mvm_statistics_div slow_div;
  290. __le32 rx_enable_counter;
  291. /*
  292. * num_of_sos_states:
  293. * count the number of times we have to re-tune
  294. * in order to get out of bad PHY status
  295. */
  296. __le32 num_of_sos_states;
  297. __le32 beacon_filtered;
  298. __le32 missed_beacons;
  299. u8 beacon_filter_average_energy;
  300. u8 beacon_filter_reason;
  301. u8 beacon_filter_current_energy;
  302. u8 beacon_filter_reserved;
  303. __le32 beacon_filter_delta_time;
  304. struct mvm_statistics_bt_activity bt_activity;
  305. __le64 rx_time;
  306. __le64 on_time_rf;
  307. __le64 on_time_scan;
  308. __le64 tx_time;
  309. } __packed;
  310. struct mvm_statistics_general_common {
  311. __le32 radio_temperature;
  312. struct mvm_statistics_dbg dbg;
  313. __le32 sleep_time;
  314. __le32 slots_out;
  315. __le32 slots_idle;
  316. __le32 ttl_timestamp;
  317. struct mvm_statistics_div slow_div;
  318. __le32 rx_enable_counter;
  319. /*
  320. * num_of_sos_states:
  321. * count the number of times we have to re-tune
  322. * in order to get out of bad PHY status
  323. */
  324. __le32 num_of_sos_states;
  325. __le32 beacon_filtered;
  326. __le32 missed_beacons;
  327. u8 beacon_filter_average_energy;
  328. u8 beacon_filter_reason;
  329. u8 beacon_filter_current_energy;
  330. u8 beacon_filter_reserved;
  331. __le32 beacon_filter_delta_time;
  332. struct mvm_statistics_bt_activity bt_activity;
  333. __le64 rx_time;
  334. __le64 on_time_rf;
  335. __le64 on_time_scan;
  336. __le64 tx_time;
  337. } __packed; /* STATISTICS_GENERAL_API_S_VER_10 */
  338. struct mvm_statistics_general_v8 {
  339. struct mvm_statistics_general_common_v19 common;
  340. __le32 beacon_counter[NUM_MAC_INDEX];
  341. u8 beacon_average_energy[NUM_MAC_INDEX];
  342. u8 reserved[4 - (NUM_MAC_INDEX % 4)];
  343. } __packed; /* STATISTICS_GENERAL_API_S_VER_8 */
  344. struct mvm_statistics_general_cdb_v9 {
  345. struct mvm_statistics_general_common_v19 common;
  346. __le32 beacon_counter[NUM_MAC_INDEX_CDB];
  347. u8 beacon_average_energy[NUM_MAC_INDEX_CDB];
  348. u8 reserved[4 - (NUM_MAC_INDEX_CDB % 4)];
  349. } __packed; /* STATISTICS_GENERAL_API_S_VER_9 */
  350. struct mvm_statistics_general_cdb {
  351. struct mvm_statistics_general_common common;
  352. __le32 beacon_counter[MAC_INDEX_AUX];
  353. u8 beacon_average_energy[MAC_INDEX_AUX];
  354. u8 reserved[8 - MAC_INDEX_AUX];
  355. } __packed; /* STATISTICS_GENERAL_API_S_VER_10 */
  356. /**
  357. * struct mvm_statistics_load - RX statistics for multi-queue devices
  358. * @air_time: accumulated air time, per mac
  359. * @byte_count: accumulated byte count, per mac
  360. * @pkt_count: accumulated packet count, per mac
  361. * @avg_energy: average RSSI, per station
  362. */
  363. struct mvm_statistics_load {
  364. __le32 air_time[MAC_INDEX_AUX];
  365. __le32 byte_count[MAC_INDEX_AUX];
  366. __le32 pkt_count[MAC_INDEX_AUX];
  367. u8 avg_energy[IWL_MVM_STATION_COUNT];
  368. } __packed; /* STATISTICS_RX_MAC_STATION_S_VER_3 */
  369. struct mvm_statistics_load_v1 {
  370. __le32 air_time[NUM_MAC_INDEX];
  371. __le32 byte_count[NUM_MAC_INDEX];
  372. __le32 pkt_count[NUM_MAC_INDEX];
  373. u8 avg_energy[IWL_MVM_STATION_COUNT];
  374. } __packed; /* STATISTICS_RX_MAC_STATION_S_VER_1 */
  375. struct mvm_statistics_rx {
  376. struct mvm_statistics_rx_phy ofdm;
  377. struct mvm_statistics_rx_phy cck;
  378. struct mvm_statistics_rx_non_phy general;
  379. struct mvm_statistics_rx_ht_phy ofdm_ht;
  380. } __packed; /* STATISTICS_RX_API_S_VER_4 */
  381. struct mvm_statistics_rx_v3 {
  382. struct mvm_statistics_rx_phy_v2 ofdm;
  383. struct mvm_statistics_rx_phy_v2 cck;
  384. struct mvm_statistics_rx_non_phy_v3 general;
  385. struct mvm_statistics_rx_ht_phy_v1 ofdm_ht;
  386. } __packed; /* STATISTICS_RX_API_S_VER_3 */
  387. /*
  388. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  389. *
  390. * By default, uCode issues this notification after receiving a beacon
  391. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  392. * STATISTICS_CMD (0x9c), below.
  393. */
  394. struct iwl_notif_statistics_v10 {
  395. __le32 flag;
  396. struct mvm_statistics_rx_v3 rx;
  397. struct mvm_statistics_tx_v4 tx;
  398. struct mvm_statistics_general_v8 general;
  399. } __packed; /* STATISTICS_NTFY_API_S_VER_10 */
  400. struct iwl_notif_statistics_v11 {
  401. __le32 flag;
  402. struct mvm_statistics_rx_v3 rx;
  403. struct mvm_statistics_tx_v4 tx;
  404. struct mvm_statistics_general_v8 general;
  405. struct mvm_statistics_load_v1 load_stats;
  406. } __packed; /* STATISTICS_NTFY_API_S_VER_11 */
  407. struct iwl_notif_statistics_cdb {
  408. __le32 flag;
  409. struct mvm_statistics_rx rx;
  410. struct mvm_statistics_tx tx;
  411. struct mvm_statistics_general_cdb general;
  412. struct mvm_statistics_load load_stats;
  413. } __packed; /* STATISTICS_NTFY_API_S_VER_13 */
  414. /**
  415. * enum iwl_statistics_notif_flags - flags used in statistics notification
  416. * @IWL_STATISTICS_REPLY_FLG_CLEAR: statistics were cleared after this report
  417. */
  418. enum iwl_statistics_notif_flags {
  419. IWL_STATISTICS_REPLY_FLG_CLEAR = 0x1,
  420. };
  421. /**
  422. * enum iwl_statistics_cmd_flags - flags used in statistics command
  423. * @IWL_STATISTICS_FLG_CLEAR: request to clear statistics after the report
  424. * that's sent after this command
  425. * @IWL_STATISTICS_FLG_DISABLE_NOTIF: disable unilateral statistics
  426. * notifications
  427. */
  428. enum iwl_statistics_cmd_flags {
  429. IWL_STATISTICS_FLG_CLEAR = 0x1,
  430. IWL_STATISTICS_FLG_DISABLE_NOTIF = 0x2,
  431. };
  432. /**
  433. * struct iwl_statistics_cmd - statistics config command
  434. * @flags: flags from &enum iwl_statistics_cmd_flags
  435. */
  436. struct iwl_statistics_cmd {
  437. __le32 flags;
  438. } __packed; /* STATISTICS_CMD_API_S_VER_1 */
  439. #endif /* __iwl_fw_api_stats_h__ */