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