xref: /freebsd/sys/contrib/dev/iwlwifi/fw/api/stats.h (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2012-2014, 2018, 2020 - 2021 Intel Corporation
4  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5  * Copyright (C) 2016-2017 Intel Deutschland GmbH
6  */
7 #ifndef __iwl_fw_api_stats_h__
8 #define __iwl_fw_api_stats_h__
9 #include "mac.h"
10 
11 struct mvm_statistics_dbg {
12 	__le32 burst_check;
13 	__le32 burst_count;
14 	__le32 wait_for_silence_timeout_cnt;
15 	u8 reserved[12];
16 } __packed; /* STATISTICS_DEBUG_API_S_VER_2 */
17 
18 struct mvm_statistics_div {
19 	__le32 tx_on_a;
20 	__le32 tx_on_b;
21 	__le32 exec_time;
22 	__le32 probe_time;
23 	__le32 rssi_ant;
24 	__le32 reserved2;
25 } __packed; /* STATISTICS_SLOW_DIV_API_S_VER_2 */
26 
27 /**
28  * struct mvm_statistics_rx_non_phy
29  * @bogus_cts: CTS received when not expecting CTS
30  * @bogus_ack: ACK received when not expecting ACK
31  * @non_channel_beacons: beacons with our bss id but not on our serving channel
32  * @channel_beacons: beacons with our bss id and in our serving channel
33  * @num_missed_bcon: number of missed beacons
34  * @adc_rx_saturation_time: count in 0.8us units the time the ADC was in
35  *	saturation
36  * @ina_detection_search_time: total time (in 0.8us) searched for INA
37  * @beacon_silence_rssi_a: RSSI silence after beacon frame
38  * @beacon_silence_rssi_b: RSSI silence after beacon frame
39  * @beacon_silence_rssi_c: RSSI silence after beacon frame
40  * @interference_data_flag: flag for interference data availability. 1 when data
41  *	is available.
42  * @channel_load: counts RX Enable time in uSec
43  * @beacon_rssi_a: beacon RSSI on antenna A
44  * @beacon_rssi_b: beacon RSSI on antenna B
45  * @beacon_rssi_c: beacon RSSI on antenna C
46  * @beacon_energy_a: beacon energy on antenna A
47  * @beacon_energy_b: beacon energy on antenna B
48  * @beacon_energy_c: beacon energy on antenna C
49  * @num_bt_kills: number of BT "kills" (frame TX aborts)
50  * @mac_id: mac ID
51  */
52 struct mvm_statistics_rx_non_phy {
53 	__le32 bogus_cts;
54 	__le32 bogus_ack;
55 	__le32 non_channel_beacons;
56 	__le32 channel_beacons;
57 	__le32 num_missed_bcon;
58 	__le32 adc_rx_saturation_time;
59 	__le32 ina_detection_search_time;
60 	__le32 beacon_silence_rssi_a;
61 	__le32 beacon_silence_rssi_b;
62 	__le32 beacon_silence_rssi_c;
63 	__le32 interference_data_flag;
64 	__le32 channel_load;
65 	__le32 beacon_rssi_a;
66 	__le32 beacon_rssi_b;
67 	__le32 beacon_rssi_c;
68 	__le32 beacon_energy_a;
69 	__le32 beacon_energy_b;
70 	__le32 beacon_energy_c;
71 	__le32 num_bt_kills;
72 	__le32 mac_id;
73 } __packed; /* STATISTICS_RX_NON_PHY_API_S_VER_4 */
74 
75 struct mvm_statistics_rx_non_phy_v3 {
76 	__le32 bogus_cts;	/* CTS received when not expecting CTS */
77 	__le32 bogus_ack;	/* ACK received when not expecting ACK */
78 	__le32 non_bssid_frames;	/* number of frames with BSSID that
79 					 * doesn't belong to the STA BSSID */
80 	__le32 filtered_frames;	/* count frames that were dumped in the
81 				 * filtering process */
82 	__le32 non_channel_beacons;	/* beacons with our bss id but not on
83 					 * our serving channel */
84 	__le32 channel_beacons;	/* beacons with our bss id and in our
85 				 * serving channel */
86 	__le32 num_missed_bcon;	/* number of missed beacons */
87 	__le32 adc_rx_saturation_time;	/* count in 0.8us units the time the
88 					 * ADC was in saturation */
89 	__le32 ina_detection_search_time;/* total time (in 0.8us) searched
90 					  * for INA */
91 	__le32 beacon_silence_rssi_a;	/* RSSI silence after beacon frame */
92 	__le32 beacon_silence_rssi_b;	/* RSSI silence after beacon frame */
93 	__le32 beacon_silence_rssi_c;	/* RSSI silence after beacon frame */
94 	__le32 interference_data_flag;	/* flag for interference data
95 					 * availability. 1 when data is
96 					 * available. */
97 	__le32 channel_load;		/* counts RX Enable time in uSec */
98 	__le32 dsp_false_alarms;	/* DSP false alarm (both OFDM
99 					 * and CCK) counter */
100 	__le32 beacon_rssi_a;
101 	__le32 beacon_rssi_b;
102 	__le32 beacon_rssi_c;
103 	__le32 beacon_energy_a;
104 	__le32 beacon_energy_b;
105 	__le32 beacon_energy_c;
106 	__le32 num_bt_kills;
107 	__le32 mac_id;
108 	__le32 directed_data_mpdu;
109 } __packed; /* STATISTICS_RX_NON_PHY_API_S_VER_3 */
110 
111 struct mvm_statistics_rx_phy {
112 	__le32 unresponded_rts;
113 	__le32 rxe_frame_lmt_overrun;
114 	__le32 sent_ba_rsp_cnt;
115 	__le32 dsp_self_kill;
116 	__le32 reserved;
117 } __packed; /* STATISTICS_RX_PHY_API_S_VER_3 */
118 
119 struct mvm_statistics_rx_phy_v2 {
120 	__le32 ina_cnt;
121 	__le32 fina_cnt;
122 	__le32 plcp_err;
123 	__le32 crc32_err;
124 	__le32 overrun_err;
125 	__le32 early_overrun_err;
126 	__le32 crc32_good;
127 	__le32 false_alarm_cnt;
128 	__le32 fina_sync_err_cnt;
129 	__le32 sfd_timeout;
130 	__le32 fina_timeout;
131 	__le32 unresponded_rts;
132 	__le32 rxe_frame_lmt_overrun;
133 	__le32 sent_ack_cnt;
134 	__le32 sent_cts_cnt;
135 	__le32 sent_ba_rsp_cnt;
136 	__le32 dsp_self_kill;
137 	__le32 mh_format_err;
138 	__le32 re_acq_main_rssi_sum;
139 	__le32 reserved;
140 } __packed; /* STATISTICS_RX_PHY_API_S_VER_2 */
141 
142 struct mvm_statistics_rx_ht_phy_v1 {
143 	__le32 plcp_err;
144 	__le32 overrun_err;
145 	__le32 early_overrun_err;
146 	__le32 crc32_good;
147 	__le32 crc32_err;
148 	__le32 mh_format_err;
149 	__le32 agg_crc32_good;
150 	__le32 agg_mpdu_cnt;
151 	__le32 agg_cnt;
152 	__le32 unsupport_mcs;
153 } __packed;  /* STATISTICS_HT_RX_PHY_API_S_VER_1 */
154 
155 struct mvm_statistics_rx_ht_phy {
156 	__le32 mh_format_err;
157 	__le32 agg_mpdu_cnt;
158 	__le32 agg_cnt;
159 	__le32 unsupport_mcs;
160 } __packed;  /* STATISTICS_HT_RX_PHY_API_S_VER_2 */
161 
162 struct mvm_statistics_tx_non_phy_v3 {
163 	__le32 preamble_cnt;
164 	__le32 rx_detected_cnt;
165 	__le32 bt_prio_defer_cnt;
166 	__le32 bt_prio_kill_cnt;
167 	__le32 few_bytes_cnt;
168 	__le32 cts_timeout;
169 	__le32 ack_timeout;
170 	__le32 expected_ack_cnt;
171 	__le32 actual_ack_cnt;
172 	__le32 dump_msdu_cnt;
173 	__le32 burst_abort_next_frame_mismatch_cnt;
174 	__le32 burst_abort_missing_next_frame_cnt;
175 	__le32 cts_timeout_collision;
176 	__le32 ack_or_ba_timeout_collision;
177 } __packed; /* STATISTICS_TX_NON_PHY_API_S_VER_3 */
178 
179 struct mvm_statistics_tx_non_phy {
180 	__le32 bt_prio_defer_cnt;
181 	__le32 bt_prio_kill_cnt;
182 	__le32 few_bytes_cnt;
183 	__le32 cts_timeout;
184 	__le32 ack_timeout;
185 	__le32 dump_msdu_cnt;
186 	__le32 burst_abort_next_frame_mismatch_cnt;
187 	__le32 burst_abort_missing_next_frame_cnt;
188 	__le32 cts_timeout_collision;
189 	__le32 ack_or_ba_timeout_collision;
190 } __packed; /* STATISTICS_TX_NON_PHY_API_S_VER_4 */
191 
192 #define MAX_CHAINS 3
193 
194 struct mvm_statistics_tx_non_phy_agg {
195 	__le32 ba_timeout;
196 	__le32 ba_reschedule_frames;
197 	__le32 scd_query_agg_frame_cnt;
198 	__le32 scd_query_no_agg;
199 	__le32 scd_query_agg;
200 	__le32 scd_query_mismatch;
201 	__le32 frame_not_ready;
202 	__le32 underrun;
203 	__le32 bt_prio_kill;
204 	__le32 rx_ba_rsp_cnt;
205 	__s8 txpower[MAX_CHAINS];
206 	__s8 reserved;
207 	__le32 reserved2;
208 } __packed; /* STATISTICS_TX_NON_PHY_AGG_API_S_VER_1 */
209 
210 struct mvm_statistics_tx_channel_width {
211 	__le32 ext_cca_narrow_ch20[1];
212 	__le32 ext_cca_narrow_ch40[2];
213 	__le32 ext_cca_narrow_ch80[3];
214 	__le32 ext_cca_narrow_ch160[4];
215 	__le32 last_tx_ch_width_indx;
216 	__le32 rx_detected_per_ch_width[4];
217 	__le32 success_per_ch_width[4];
218 	__le32 fail_per_ch_width[4];
219 }; /* STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */
220 
221 struct mvm_statistics_tx_v4 {
222 	struct mvm_statistics_tx_non_phy_v3 general;
223 	struct mvm_statistics_tx_non_phy_agg agg;
224 	struct mvm_statistics_tx_channel_width channel_width;
225 } __packed; /* STATISTICS_TX_API_S_VER_4 */
226 
227 struct mvm_statistics_tx {
228 	struct mvm_statistics_tx_non_phy general;
229 	struct mvm_statistics_tx_non_phy_agg agg;
230 	struct mvm_statistics_tx_channel_width channel_width;
231 } __packed; /* STATISTICS_TX_API_S_VER_5 */
232 
233 
234 struct mvm_statistics_bt_activity {
235 	__le32 hi_priority_tx_req_cnt;
236 	__le32 hi_priority_tx_denied_cnt;
237 	__le32 lo_priority_tx_req_cnt;
238 	__le32 lo_priority_tx_denied_cnt;
239 	__le32 hi_priority_rx_req_cnt;
240 	__le32 hi_priority_rx_denied_cnt;
241 	__le32 lo_priority_rx_req_cnt;
242 	__le32 lo_priority_rx_denied_cnt;
243 } __packed;  /* STATISTICS_BT_ACTIVITY_API_S_VER_1 */
244 
245 struct mvm_statistics_general_common_v19 {
246 	__le32 radio_temperature;
247 	__le32 radio_voltage;
248 	struct mvm_statistics_dbg dbg;
249 	__le32 sleep_time;
250 	__le32 slots_out;
251 	__le32 slots_idle;
252 	__le32 ttl_timestamp;
253 	struct mvm_statistics_div slow_div;
254 	__le32 rx_enable_counter;
255 	/*
256 	 * num_of_sos_states:
257 	 *  count the number of times we have to re-tune
258 	 *  in order to get out of bad PHY status
259 	 */
260 	__le32 num_of_sos_states;
261 	__le32 beacon_filtered;
262 	__le32 missed_beacons;
263 	u8 beacon_filter_average_energy;
264 	u8 beacon_filter_reason;
265 	u8 beacon_filter_current_energy;
266 	u8 beacon_filter_reserved;
267 	__le32 beacon_filter_delta_time;
268 	struct mvm_statistics_bt_activity bt_activity;
269 	__le64 rx_time;
270 	__le64 on_time_rf;
271 	__le64 on_time_scan;
272 	__le64 tx_time;
273 } __packed;
274 
275 struct mvm_statistics_general_common {
276 	__le32 radio_temperature;
277 	struct mvm_statistics_dbg dbg;
278 	__le32 sleep_time;
279 	__le32 slots_out;
280 	__le32 slots_idle;
281 	__le32 ttl_timestamp;
282 	struct mvm_statistics_div slow_div;
283 	__le32 rx_enable_counter;
284 	/*
285 	 * num_of_sos_states:
286 	 *  count the number of times we have to re-tune
287 	 *  in order to get out of bad PHY status
288 	 */
289 	__le32 num_of_sos_states;
290 	__le32 beacon_filtered;
291 	__le32 missed_beacons;
292 	u8 beacon_filter_average_energy;
293 	u8 beacon_filter_reason;
294 	u8 beacon_filter_current_energy;
295 	u8 beacon_filter_reserved;
296 	__le32 beacon_filter_delta_time;
297 	struct mvm_statistics_bt_activity bt_activity;
298 	__le64 rx_time;
299 	__le64 on_time_rf;
300 	__le64 on_time_scan;
301 	__le64 tx_time;
302 } __packed; /* STATISTICS_GENERAL_API_S_VER_10 */
303 
304 struct mvm_statistics_general_v8 {
305 	struct mvm_statistics_general_common_v19 common;
306 	__le32 beacon_counter[NUM_MAC_INDEX];
307 	u8 beacon_average_energy[NUM_MAC_INDEX];
308 	u8 reserved[4 - (NUM_MAC_INDEX % 4)];
309 } __packed; /* STATISTICS_GENERAL_API_S_VER_8 */
310 
311 struct mvm_statistics_general {
312 	struct mvm_statistics_general_common common;
313 	__le32 beacon_counter[MAC_INDEX_AUX];
314 	u8 beacon_average_energy[MAC_INDEX_AUX];
315 	u8 reserved[8 - MAC_INDEX_AUX];
316 } __packed; /* STATISTICS_GENERAL_API_S_VER_10 */
317 
318 /**
319  * struct mvm_statistics_load - RX statistics for multi-queue devices
320  * @air_time: accumulated air time, per mac
321  * @byte_count: accumulated byte count, per mac
322  * @pkt_count: accumulated packet count, per mac
323  * @avg_energy: average RSSI, per station
324  */
325 struct mvm_statistics_load {
326 	__le32 air_time[MAC_INDEX_AUX];
327 	__le32 byte_count[MAC_INDEX_AUX];
328 	__le32 pkt_count[MAC_INDEX_AUX];
329 	u8 avg_energy[IWL_MVM_STATION_COUNT_MAX];
330 } __packed; /* STATISTICS_RX_MAC_STATION_S_VER_3 */
331 
332 struct mvm_statistics_load_v1 {
333 	__le32 air_time[NUM_MAC_INDEX];
334 	__le32 byte_count[NUM_MAC_INDEX];
335 	__le32 pkt_count[NUM_MAC_INDEX];
336 	u8 avg_energy[IWL_MVM_STATION_COUNT_MAX];
337 } __packed; /* STATISTICS_RX_MAC_STATION_S_VER_1 */
338 
339 struct mvm_statistics_rx {
340 	struct mvm_statistics_rx_phy ofdm;
341 	struct mvm_statistics_rx_phy cck;
342 	struct mvm_statistics_rx_non_phy general;
343 	struct mvm_statistics_rx_ht_phy ofdm_ht;
344 } __packed; /* STATISTICS_RX_API_S_VER_4 */
345 
346 struct mvm_statistics_rx_v3 {
347 	struct mvm_statistics_rx_phy_v2 ofdm;
348 	struct mvm_statistics_rx_phy_v2 cck;
349 	struct mvm_statistics_rx_non_phy_v3 general;
350 	struct mvm_statistics_rx_ht_phy_v1 ofdm_ht;
351 } __packed; /* STATISTICS_RX_API_S_VER_3 */
352 
353 /*
354  * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
355  *
356  * By default, uCode issues this notification after receiving a beacon
357  * while associated.  To disable this behavior, set DISABLE_NOTIF flag in the
358  * STATISTICS_CMD (0x9c), below.
359  */
360 
361 struct iwl_notif_statistics_v10 {
362 	__le32 flag;
363 	struct mvm_statistics_rx_v3 rx;
364 	struct mvm_statistics_tx_v4 tx;
365 	struct mvm_statistics_general_v8 general;
366 } __packed; /* STATISTICS_NTFY_API_S_VER_10 */
367 
368 struct iwl_notif_statistics_v11 {
369 	__le32 flag;
370 	struct mvm_statistics_rx_v3 rx;
371 	struct mvm_statistics_tx_v4 tx;
372 	struct mvm_statistics_general_v8 general;
373 	struct mvm_statistics_load_v1 load_stats;
374 } __packed; /* STATISTICS_NTFY_API_S_VER_11 */
375 
376 struct iwl_notif_statistics {
377 	__le32 flag;
378 	struct mvm_statistics_rx rx;
379 	struct mvm_statistics_tx tx;
380 	struct mvm_statistics_general general;
381 	struct mvm_statistics_load load_stats;
382 } __packed; /* STATISTICS_NTFY_API_S_VER_13 */
383 
384 /**
385  * enum iwl_statistics_notif_flags - flags used in statistics notification
386  * @IWL_STATISTICS_REPLY_FLG_CLEAR: statistics were cleared after this report
387  */
388 enum iwl_statistics_notif_flags {
389 	IWL_STATISTICS_REPLY_FLG_CLEAR		= 0x1,
390 };
391 
392 /**
393  * enum iwl_statistics_cmd_flags - flags used in statistics command
394  * @IWL_STATISTICS_FLG_CLEAR: request to clear statistics after the report
395  *	that's sent after this command
396  * @IWL_STATISTICS_FLG_DISABLE_NOTIF: disable unilateral statistics
397  *	notifications
398  */
399 enum iwl_statistics_cmd_flags {
400 	IWL_STATISTICS_FLG_CLEAR		= 0x1,
401 	IWL_STATISTICS_FLG_DISABLE_NOTIF	= 0x2,
402 };
403 
404 /**
405  * struct iwl_statistics_cmd - statistics config command
406  * @flags: flags from &enum iwl_statistics_cmd_flags
407  */
408 struct iwl_statistics_cmd {
409 	__le32 flags;
410 } __packed; /* STATISTICS_CMD_API_S_VER_1 */
411 
412 #define MAX_BCAST_FILTER_NUM		8
413 
414 /**
415  * enum iwl_fw_statistics_type
416  *
417  * @FW_STATISTICS_OPERATIONAL: operational statistics
418  * @FW_STATISTICS_PHY: phy statistics
419  * @FW_STATISTICS_MAC: mac statistics
420  * @FW_STATISTICS_RX: rx statistics
421  * @FW_STATISTICS_TX: tx statistics
422  * @FW_STATISTICS_DURATION: duration statistics
423  * @FW_STATISTICS_HE: he statistics
424  */
425 enum iwl_fw_statistics_type {
426 	FW_STATISTICS_OPERATIONAL,
427 	FW_STATISTICS_PHY,
428 	FW_STATISTICS_MAC,
429 	FW_STATISTICS_RX,
430 	FW_STATISTICS_TX,
431 	FW_STATISTICS_DURATION,
432 	FW_STATISTICS_HE,
433 }; /* FW_STATISTICS_TYPE_API_E_VER_1 */
434 
435 #define IWL_STATISTICS_TYPE_MSK 0x7f
436 /**
437  * struct iwl_statistics_ntfy_hdr
438  *
439  * @type: struct type
440  * @version: version of the struct
441  * @size: size in bytes
442  */
443 struct iwl_statistics_ntfy_hdr {
444 	u8 type;
445 	u8 version;
446 	__le16 size;
447 }; /* STATISTICS_NTFY_HDR_API_S_VER_1 */
448 
449 /**
450  * struct iwl_statistics_ntfy_per_mac
451  *
452  * @beacon_filter_average_energy: Average energy [-dBm] of the 2
453  *	 antennas.
454  * @air_time: air time
455  * @beacon_counter: all beacons (both filtered and not filtered)
456  * @beacon_average_energy: all beacons (both filtered and not
457  *	 filtered)
458  * @beacon_rssi_a: beacon RSSI on antenna A
459  * @beacon_rssi_b: beacon RSSI on antenna B
460  * @rx_bytes: RX byte count
461  */
462 struct iwl_statistics_ntfy_per_mac {
463 	__le32 beacon_filter_average_energy;
464 	__le32 air_time;
465 	__le32 beacon_counter;
466 	__le32 beacon_average_energy;
467 	__le32 beacon_rssi_a;
468 	__le32 beacon_rssi_b;
469 	__le32 rx_bytes;
470 } __packed; /* STATISTICS_NTFY_PER_MAC_API_S_VER_1 */
471 
472 #define IWL_STATS_MAX_BW_INDEX 5
473 /** struct iwl_statistics_ntfy_per_phy
474  * @channel_load: channel load
475  * @channel_load_by_us: device contribution to MCLM
476  * @channel_load_not_by_us: other devices' contribution to MCLM
477  * @clt: CLT HW timer (TIM_CH_LOAD2)
478  * @act: active accumulator SW
479  * @elp: elapsed time accumulator SW
480  * @rx_detected_per_ch_width: number of deferred TX per channel width,
481  *	0 - 20, 1/2/3 - 40/80/160
482  * @success_per_ch_width: number of frames that got ACK/BACK/CTS
483  *	per channel BW. note, BACK counted as 1
484  * @fail_per_ch_width: number of frames that didn't get ACK/BACK/CTS
485  *	per channel BW. note BACK counted as 1
486  * @last_tx_ch_width_indx: last txed frame channel width index
487  */
488 struct iwl_statistics_ntfy_per_phy {
489 	__le32 channel_load;
490 	__le32 channel_load_by_us;
491 	__le32 channel_load_not_by_us;
492 	__le32 clt;
493 	__le32 act;
494 	__le32 elp;
495 	__le32 rx_detected_per_ch_width[IWL_STATS_MAX_BW_INDEX];
496 	__le32 success_per_ch_width[IWL_STATS_MAX_BW_INDEX];
497 	__le32 fail_per_ch_width[IWL_STATS_MAX_BW_INDEX];
498 	__le32 last_tx_ch_width_indx;
499 } __packed; /* STATISTICS_NTFY_PER_PHY_API_S_VER_1 */
500 
501 /**
502  * struct iwl_statistics_ntfy_per_sta
503  *
504  * @average_energy: in fact it is minus the energy..
505  */
506 struct iwl_statistics_ntfy_per_sta {
507 	__le32 average_energy;
508 } __packed; /* STATISTICS_NTFY_PER_STA_API_S_VER_1 */
509 
510 #define IWL_STATS_MAX_PHY_OPERTINAL 3
511 /**
512  * struct iwl_statistics_operational_ntfy
513  *
514  * @hdr: general statistics header
515  * @flags: bitmap of possible notification structures
516  * @per_mac_stats: per mac statistics, &struct iwl_statistics_ntfy_per_mac
517  * @per_phy_stats: per phy statistics, &struct iwl_statistics_ntfy_per_phy
518  * @per_sta_stats: per sta statistics, &struct iwl_statistics_ntfy_per_sta
519  * @rx_time: rx time
520  * @tx_time: usec the radio is transmitting.
521  * @on_time_rf: The total time in usec the RF is awake.
522  * @on_time_scan: usec the radio is awake due to scan.
523  */
524 struct iwl_statistics_operational_ntfy {
525 	struct iwl_statistics_ntfy_hdr hdr;
526 	__le32 flags;
527 	struct iwl_statistics_ntfy_per_mac per_mac_stats[MAC_INDEX_AUX];
528 	struct iwl_statistics_ntfy_per_phy per_phy_stats[IWL_STATS_MAX_PHY_OPERTINAL];
529 	struct iwl_statistics_ntfy_per_sta per_sta_stats[IWL_MVM_STATION_COUNT_MAX];
530 	__le64 rx_time;
531 	__le64 tx_time;
532 	__le64 on_time_rf;
533 	__le64 on_time_scan;
534 } __packed; /* STATISTICS_OPERATIONAL_NTFY_API_S_VER_15 */
535 
536 /**
537  * struct iwl_statistics_operational_ntfy_ver_14
538  *
539  * @hdr: general statistics header
540  * @flags: bitmap of possible notification structures
541  * @mac_id: mac on which the beacon was received
542  * @beacon_filter_average_energy: Average energy [-dBm] of the 2
543  *	 antennas.
544  * @beacon_filter_reason: beacon filter reason
545  * @radio_temperature: radio temperature
546  * @air_time: air time
547  * @beacon_counter: all beacons (both filtered and not filtered)
548  * @beacon_average_energy: all beacons (both filtered and not
549  *	 filtered)
550  * @beacon_rssi_a: beacon RSSI on antenna A
551  * @beacon_rssi_b: beacon RSSI on antenna B
552  * @rx_bytes: per MAC RX byte count
553  * @rx_time: rx time
554  * @tx_time: usec the radio is transmitting.
555  * @on_time_rf: The total time in usec the RF is awake.
556  * @on_time_scan: usec the radio is awake due to scan.
557  * @average_energy: in fact it is minus the energy..
558  * @reserved: reserved
559  */
560 struct iwl_statistics_operational_ntfy_ver_14 {
561 	struct iwl_statistics_ntfy_hdr hdr;
562 	__le32 flags;
563 	__le32 mac_id;
564 	__le32 beacon_filter_average_energy;
565 	__le32 beacon_filter_reason;
566 	__le32 radio_temperature;
567 	__le32 air_time[MAC_INDEX_AUX];
568 	__le32 beacon_counter[MAC_INDEX_AUX];
569 	__le32 beacon_average_energy[MAC_INDEX_AUX];
570 	__le32 beacon_rssi_a;
571 	__le32 beacon_rssi_b;
572 	__le32 rx_bytes[MAC_INDEX_AUX];
573 	__le64 rx_time;
574 	__le64 tx_time;
575 	__le64 on_time_rf;
576 	__le64 on_time_scan;
577 	__le32 average_energy[IWL_MVM_STATION_COUNT_MAX];
578 	__le32 reserved;
579 } __packed; /* STATISTICS_OPERATIONAL_NTFY_API_S_VER_14 */
580 
581 /**
582  * struct iwl_statistics_phy_ntfy
583  *
584  * @hdr: general statistics header
585  * RX PHY related statistics
586  * @energy_and_config: ???
587  * @rssi_band: @31:24 rssiAllBand_B, 23:16 rssiInBand_B, 15:8
588  *	 rssiAllBand_A, 7:0 rssiInBand_A
589  * @agc_word: @31:16 agcWord_B, 15:0 agcWord_A
590  * @agc_gain: @19:10 agcGain_B, 9:0 agcGain_A
591  * @dfe_gain: @19:10 dfeGain_B, 9:0 dfeGain_A
592  * @snr_calc_main: @18:0 snrCalcMain
593  * @energy_calc_main: @18:0 energyCalcMain
594  * @snr_calc_aux: @18:0 snrCalcAux
595  * @dsp_dc_estim_a: @27:14 dspDcEstimQA, 13:0 dspDcEstimIA
596  * @dsp_dc_estim_b: @27:14 dspDcEstimQB, 13:0 dspDcEstimIB
597  * @ina_detec_type_and_ofdm_corr_comb: @31:31 inaDetectCckMrc,
598  *	 30:27 inaDetectType, 26:0 ofdmCorrComb
599  * @cw_corr_comb: @26:0 cwCorrComb
600  * @rssi_comb: @25:0 rssiComb
601  * @auto_corr_cck: @23:12 autoCck, 11:00 crossCck
602  * @ofdm_fine_freq_and_pina_freq_err: @18:7 ofdmFineFreq, 6:0
603  *	 ofdmPinaFreqErr
604  * @snrm_evm_main: @31:0 snrmEvmMain
605  * @snrm_evm_aux: @31:0 snrmEvmAux
606  * @rx_rate: @31:0 rate
607  * TX PHY related statistics
608  * @per_chain_enums_and_dsp_atten_a: @perChainEnumsAndDspAtten
609  *	 (per version)
610  * @target_power_and_power_meas_a: @31:16 targetPower_A, 15:0
611  *	 powerMeasuredCalc_A
612  * @tx_config_as_i_and_ac_a: @31:16 txConfigAsI_A, 15:0
613  *	 txConfigAc_A
614  * @predist_dcq_and_dci_a: @31:16 predist_dci_A, 15:0
615  *	 predist_dcq_A
616  * @per_chain_enums_and_dsp_atten_b: @perChainEnumsAndDspAtten
617  *	 (per version)
618  * @target_power_and_power_meas_b: @31:16 targetPower_B, 15:0
619  *	 powerMeasuredCalc_B
620  * @tx_config_as_i_and_ac_b: @31:16 txConfigAsI_B, 15:0
621  *	 txConfigAc_B
622  * @predist_dcq_and_dci_b: @31:16 predist_dci_B, 15:0
623  *	 predist_dcq_B
624  * @tx_rate: @31:0 rate
625  * @tlc_backoff: @31:0 tlcBackoff
626  * @mpapd_calib_mode_mpapd_calib_type_a: @31:16
627  *	 mpapdCalibMode_A, 15:0 mpapdCalibType_A
628  * @psat_and_phy_power_limit_a: @31:16 psat_A, 15:0
629  *	 phyPowerLimit_A
630  * @sar_and_regulatory_power_limit_a: @31:16 sarPowerLimit_A,
631  *	 15:0 regulatoryPowerLimit_A
632  * @mpapd_calib_mode_mpapd_calib_type_b: @31:16
633  *	 mpapdCalibMode_B, 15:0 mpapdCalibType_B
634  * @psat_and_phy_power_limit_b: @31:16 psat_B, 15:0
635  *	 phyPowerLimit_B
636  * @sar_and_regulatory_power_limit_b: @31:16 sarPowerLimit_B,
637  *	 15:0 regulatoryPowerLimit_B
638  * @srd_and_driver_power_limits: @31:16 srdPowerLimit, 15:0
639  *	 driverPowerLimit
640  * @reserved: reserved
641  */
642 struct iwl_statistics_phy_ntfy {
643 	struct iwl_statistics_ntfy_hdr hdr;
644 	__le32 energy_and_config;
645 	__le32 rssi_band;
646 	__le32 agc_word;
647 	__le32 agc_gain;
648 	__le32 dfe_gain;
649 	__le32 snr_calc_main;
650 	__le32 energy_calc_main;
651 	__le32 snr_calc_aux;
652 	__le32 dsp_dc_estim_a;
653 	__le32 dsp_dc_estim_b;
654 	__le32 ina_detec_type_and_ofdm_corr_comb;
655 	__le32 cw_corr_comb;
656 	__le32 rssi_comb;
657 	__le32 auto_corr_cck;
658 	__le32 ofdm_fine_freq_and_pina_freq_err;
659 	__le32 snrm_evm_main;
660 	__le32 snrm_evm_aux;
661 	__le32 rx_rate;
662 	__le32 per_chain_enums_and_dsp_atten_a;
663 	__le32 target_power_and_power_meas_a;
664 	__le32 tx_config_as_i_and_ac_a;
665 	__le32 predist_dcq_and_dci_a;
666 	__le32 per_chain_enums_and_dsp_atten_b;
667 	__le32 target_power_and_power_meas_b;
668 	__le32 tx_config_as_i_and_ac_b;
669 	__le32 predist_dcq_and_dci_b;
670 	__le32 tx_rate;
671 	__le32 tlc_backoff;
672 	__le32 mpapd_calib_mode_mpapd_calib_type_a;
673 	__le32 psat_and_phy_power_limit_a;
674 	__le32 sar_and_regulatory_power_limit_a;
675 	__le32 mpapd_calib_mode_mpapd_calib_type_b;
676 	__le32 psat_and_phy_power_limit_b;
677 	__le32 sar_and_regulatory_power_limit_b;
678 	__le32 srd_and_driver_power_limits;
679 	__le32 reserved;
680 } __packed; /* STATISTICS_PHY_NTFY_API_S_VER_1 */
681 
682 /**
683  * struct iwl_statistics_mac_ntfy
684  *
685  * @hdr: general statistics header
686  * @bcast_filter_passed_per_mac: bcast filter passed per mac
687  * @bcast_filter_dropped_per_mac: bcast filter dropped per mac
688  * @bcast_filter_passed_per_filter: bcast filter passed per filter
689  * @bcast_filter_dropped_per_filter: bcast filter dropped per filter
690  * @reserved: reserved
691  */
692 struct iwl_statistics_mac_ntfy {
693 	struct iwl_statistics_ntfy_hdr hdr;
694 	__le32 bcast_filter_passed_per_mac[NUM_MAC_INDEX_CDB];
695 	__le32 bcast_filter_dropped_per_mac[NUM_MAC_INDEX_CDB];
696 	__le32 bcast_filter_passed_per_filter[MAX_BCAST_FILTER_NUM];
697 	__le32 bcast_filter_dropped_per_filter[MAX_BCAST_FILTER_NUM];
698 	__le32 reserved;
699 } __packed; /* STATISTICS_MAC_NTFY_API_S_VER_1 */
700 
701 /**
702  * struct iwl_statistics_rx_ntfy
703  *
704  * @hdr: general statistics header
705  * @rx_agg_mpdu_cnt: aggregation frame count (number of
706  *	 delimiters)
707  * @rx_agg_cnt: number of RX Aggregations
708  * @unsupported_mcs: number of PLCP headers that have rate which
709  *	 is unsupported by DSP
710  * @bogus_cts: CTS received when not expecting CTS
711  * @bogus_ack: ACK received when not expecting ACK
712  * @rx_byte_count: ???
713  * @rx_packet_count: ???
714  * @missed_beacons: ???
715  * @unresponded_rts: un-responded RTS, due to NAV not zero
716  * @rxe_frame_limit_overrun: RXE got frame limit overrun
717  * @sent_ba_rsp_cnt: BA response TX count
718  * @late_rx_handle: count the number of times the RX path was
719  *	 aborted due to late entry
720  * @num_bt_kills: ???
721  * @reserved: reserved
722  */
723 struct iwl_statistics_rx_ntfy {
724 	struct iwl_statistics_ntfy_hdr hdr;
725 	__le32 rx_agg_mpdu_cnt;
726 	__le32 rx_agg_cnt;
727 	__le32 unsupported_mcs;
728 	__le32 bogus_cts;
729 	__le32 bogus_ack;
730 	__le32 rx_byte_count[MAC_INDEX_AUX];
731 	__le32 rx_packet_count[MAC_INDEX_AUX];
732 	__le32 missed_beacons;
733 	__le32 unresponded_rts;
734 	__le32 rxe_frame_limit_overrun;
735 	__le32 sent_ba_rsp_cnt;
736 	__le32 late_rx_handle;
737 	__le32 num_bt_kills;
738 	__le32 reserved;
739 } __packed; /* STATISTICS_RX_NTFY_API_S_VER_1 */
740 
741 /**
742  * struct iwl_statistics_tx_ntfy
743  *
744  * @hdr: general statistics header
745  * @cts_timeout: timeout when waiting for CTS
746  * @ack_timeout: timeout when waiting for ACK
747  * @dump_msdu_cnt: number of MSDUs that were dumped due to any
748  *	 reason
749  * @burst_abort_missing_next_frame_cnt: number of times a burst
750  *	 was aborted due to missing next frame bytes in txfifo
751  * number of times got timeout when waiting for CTS/ACK/BA and energy was
752  * detected just after sending the RTS/DATA. this statistics may help getting
753  * interesting indicators, like the likelihood of collision (so the benefit of
754  * protection may be estimated Vs. its cost). Or how many of the failures are
755  * due to collision and how many due to SNR.
756  * For Link-quality the CTS collision indication is more reliable then the ACK
757  * collision indication as the RTS frame is short and has more chance that the
758  * frame/s which caused the collision continue after the RTS was sent.
759  * @cts_timeout_collision: ???
760  * ACK/BA failed and energy as detected after DATA
761  * Note: to get the collision ratio need to:
762  * ackOrBaTimeoutCollision / (ack_timeout + ba_timeout)
763  * @ack_or_ba_timeout_collision: ???
764  * @ba_timeout: timeout when waiting for immediate BA response
765  * @ba_reschedule_frames: failed to get BA response and
766  *	 rescheduled all the non-ACKed frames
767  * gives the avarage number of frames inside aggregation
768  * @scd_query_agg_frame_cnt: ???
769  * @scd_query_no_agg: scheduler query prevented aggregation
770  * @scd_query_agg: scheduler query allowed aggregation
771  * @scd_query_mismatch: scheduler query inaccurate, either too
772  *	 short or too long
773  * @agg_terminated_underrun: aggregation was terminated due to
774  *	 underrun
775  * @agg_terminated_bt_prio_kill: aggregation was terminated due
776  *	 to BT
777  * @tx_kill_on_long_retry: count the tx frames dropped due to
778  *	 long retry limit (DATA frame failed)
779  * @tx_kill_on_short_retry: count the tx frames dropped due to
780  *	 short retry limit (RTS frame failed)
781  * TX deffer on energy. This counter is reset on each successful transmit.
782  * When timer exceed TX deffer limit than will be uCode assert.
783  * @tx_deffer_counter: ???
784  * @tx_deffer_base_time: Keep the time of the last successful
785  *	 transmit
786  * @tx_underrun: TX killed due to underrun
787  * @bt_defer: TX deferred due to BT priority, so probably TX was
788  *	 not started.
789  * @tx_kill_on_dsp_timeout: TX killed on DSP problem detected
790  * @tx_kill_on_immediate_quiet: TX killed due to immediate quiet
791  * @kill_ba_cnt: number of times sending BA failed
792  * @kill_ack_cnt: number of times sending ACK failed
793  * @kill_cts_cnt: number of times sending CTS failed
794  * @burst_terminated: Count burst or fragmentation termination
795  *	 occurrence
796  * @late_tx_vec_wr_cnt: ???
797  * TX is not sent because ucode failed to notify the TRM in SIFS-delta from
798  * ON_AIR deassertion.
799  * @late_rx2_tx_cnt: ???
800  * @scd_query_cnt: count the times SCD query was done to check
801  *	 for TX AGG
802  * @tx_frames_acked_in_agg: count the number of frames
803  *	 transmitted inside AGG and were successful
804  * @last_tx_ch_width_indx: ???
805  * number of deferred TX per channel width, 0 - 20, 1/2/3 - 40/80/160
806  * @rx_detected_per_ch_width: ???
807  * @success_per_ch_width: ???
808  * @fail_per_ch_width: ???
809  * @reserved: reserved
810  */
811 struct iwl_statistics_tx_ntfy {
812 	struct iwl_statistics_ntfy_hdr hdr;
813 	__le32 cts_timeout;
814 	__le32 ack_timeout;
815 	__le32 dump_msdu_cnt;
816 	__le32 burst_abort_missing_next_frame_cnt;
817 	__le32 cts_timeout_collision;
818 	__le32 ack_or_ba_timeout_collision;
819 	__le32 ba_timeout;
820 	__le32 ba_reschedule_frames;
821 	__le32 scd_query_agg_frame_cnt;
822 	__le32 scd_query_no_agg;
823 	__le32 scd_query_agg;
824 	__le32 scd_query_mismatch;
825 	__le32 agg_terminated_underrun;
826 	__le32 agg_terminated_bt_prio_kill;
827 	__le32 tx_kill_on_long_retry;
828 	__le32 tx_kill_on_short_retry;
829 	__le32 tx_deffer_counter;
830 	__le32 tx_deffer_base_time;
831 	__le32 tx_underrun;
832 	__le32 bt_defer;
833 	__le32 tx_kill_on_dsp_timeout;
834 	__le32 tx_kill_on_immediate_quiet;
835 	__le32 kill_ba_cnt;
836 	__le32 kill_ack_cnt;
837 	__le32 kill_cts_cnt;
838 	__le32 burst_terminated;
839 	__le32 late_tx_vec_wr_cnt;
840 	__le32 late_rx2_tx_cnt;
841 	__le32 scd_query_cnt;
842 	__le32 tx_frames_acked_in_agg;
843 	__le32 last_tx_ch_width_indx;
844 	__le32 rx_detected_per_ch_width[4];
845 	__le32 success_per_ch_width[4];
846 	__le32 fail_per_ch_width[4];
847 	__le32 reserved;
848 } __packed; /* STATISTICS_TX_NTFY_API_S_VER_1 */
849 
850 /**
851  * struct iwl_statistics_duration_ntfy
852  *
853  * @hdr: general statistics header
854  * @cont_burst_chk_cnt: number of times continuation or
855  *	 fragmentation or bursting was checked
856  * @cont_burst_cnt: number of times continuation or fragmentation
857  *	 or bursting was successful
858  * @wait_for_silence_timeout_cnt: ???
859  * @reserved: reserved
860  */
861 struct iwl_statistics_duration_ntfy {
862 	struct iwl_statistics_ntfy_hdr hdr;
863 	__le32 cont_burst_chk_cnt;
864 	__le32 cont_burst_cnt;
865 	__le32 wait_for_silence_timeout_cnt;
866 	__le32 reserved;
867 } __packed; /* STATISTICS_DURATION_NTFY_API_S_VER_1 */
868 
869 /**
870  * struct iwl_statistics_he_ntfy
871  *
872  * @hdr: general statistics header
873  * received HE frames
874  * @rx_siga_valid_cnt: rx HE SIG-A valid
875  * @rx_siga_invalid_cnt: rx HE SIG-A invalid
876  * received HE frames w/ valid Sig-A
877  * @rx_trig_based_frame_cnt: rx HE-TB (trig-based)
878  * @rx_su_frame_cnt: rx HE-SU
879  * @rx_sigb_invalid_cnt: rx (suspected) HE-MU w/ bad SIG-B
880  * @rx_our_bss_color_cnt: rx valid HE SIG-A w/ our BSS color
881  * @rx_other_bss_color_cnt: rx valid HE SIG-A w/ other BSS color
882  * @rx_zero_bss_color_cnt: ???
883  * received HE-MU frames w/ good Sig-B
884  * @rx_mu_for_us_cnt: match AID
885  * @rx_mu_not_for_us_cnt: no matched AID
886  * received HE-MU frames for us (w/ our AID)
887  * @rx_mu_nss_ar: 0 - SISO, 1 - MIMO2
888  * @rx_mu_mimo_cnt: full BW RU, compressed SIG-B
889  * @rx_mu_ru_bw_ar: MU alloc, MHz: 0 - 2, 1 - 5, 2 - 10, 3 - 20,
890  *	 4 - 40, 5 - 80, 6 - 160
891  * received trigger frames
892  * @rx_trig_for_us_cnt: ???
893  * @rx_trig_not_for_us_cnt: ???
894  * trigger for us
895  * @rx_trig_with_cs_req_cnt: ???
896  * @rx_trig_type_ar: ???
897  * @rx_trig_in_agg_cnt: ???
898  * basic trigger for us allocations
899  * @rx_basic_trig_alloc_nss_ar: ???
900  * @rx_basic_trig_alloc_mu_mimo_cnt: ???
901  * @rx_basic_trig_alloc_ru_bw_ar: ???
902  * @rx_basic_trig_total_byte_cnt: ???
903  * trig-based TX
904  * @tx_trig_based_cs_req_fail_cnt: ???
905  * @tx_trig_based_sifs_ok_cnt: ???
906  * @tx_trig_based_sifs_fail_cnt: ???
907  * @tx_trig_based_byte_cnt: ???
908  * @tx_trig_based_pad_byte_cnt: ???
909  * @tx_trig_based_frame_cnt: ???
910  * @tx_trig_based_acked_frame_cnt: ???
911  * @tx_trig_based_ack_timeout_cnt: ???
912  * HE-SU TX
913  * @tx_su_frame_cnt: ???
914  * EDCA <--> MU-EDCA transitions
915  * @tx_edca_to_mu_edca_cnt: ???
916  * @tx_mu_edca_to_edca_by_timeout_cnt: ???
917  * @tx_mu_edca_to_edca_by_ack_fail_cnt: ???
918  * @tx_mu_edca_to_edca_by_small_alloc_cnt: ???
919  * @reserved: reserved
920  */
921 struct iwl_statistics_he_ntfy {
922 	struct iwl_statistics_ntfy_hdr hdr;
923 	__le32 rx_siga_valid_cnt;
924 	__le32 rx_siga_invalid_cnt;
925 	__le32 rx_trig_based_frame_cnt;
926 	__le32 rx_su_frame_cnt;
927 	__le32 rx_sigb_invalid_cnt;
928 	__le32 rx_our_bss_color_cnt;
929 	__le32 rx_other_bss_color_cnt;
930 	__le32 rx_zero_bss_color_cnt;
931 	__le32 rx_mu_for_us_cnt;
932 	__le32 rx_mu_not_for_us_cnt;
933 	__le32 rx_mu_nss_ar[2];
934 	__le32 rx_mu_mimo_cnt;
935 	__le32 rx_mu_ru_bw_ar[7];
936 	__le32 rx_trig_for_us_cnt;
937 	__le32 rx_trig_not_for_us_cnt;
938 	__le32 rx_trig_with_cs_req_cnt;
939 	__le32 rx_trig_type_ar[8 + 1];
940 	__le32 rx_trig_in_agg_cnt;
941 	__le32 rx_basic_trig_alloc_nss_ar[2];
942 	__le32 rx_basic_trig_alloc_mu_mimo_cnt;
943 	__le32 rx_basic_trig_alloc_ru_bw_ar[7];
944 	__le32 rx_basic_trig_total_byte_cnt;
945 	__le32 tx_trig_based_cs_req_fail_cnt;
946 	__le32 tx_trig_based_sifs_ok_cnt;
947 	__le32 tx_trig_based_sifs_fail_cnt;
948 	__le32 tx_trig_based_byte_cnt;
949 	__le32 tx_trig_based_pad_byte_cnt;
950 	__le32 tx_trig_based_frame_cnt;
951 	__le32 tx_trig_based_acked_frame_cnt;
952 	__le32 tx_trig_based_ack_timeout_cnt;
953 	__le32 tx_su_frame_cnt;
954 	__le32 tx_edca_to_mu_edca_cnt;
955 	__le32 tx_mu_edca_to_edca_by_timeout_cnt;
956 	__le32 tx_mu_edca_to_edca_by_ack_fail_cnt;
957 	__le32 tx_mu_edca_to_edca_by_small_alloc_cnt;
958 	__le32 reserved;
959 } __packed; /* STATISTICS_HE_NTFY_API_S_VER_1 */
960 
961 #endif /* __iwl_fw_api_stats_h__ */
962