Linux-libre 4.9.189-gnu
[librecmc/linux-libre.git] / drivers / net / wireless / intel / iwlwifi / mvm / fw-api-stats.h
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 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  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24  * USA
25  *
26  * The full GNU General Public License is included in this distribution
27  * in the file called COPYING.
28  *
29  * Contact Information:
30  *  Intel Linux Wireless <linuxwifi@intel.com>
31  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
32  *
33  * BSD LICENSE
34  *
35  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
36  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
37  * All rights reserved.
38  *
39  * Redistribution and use in source and binary forms, with or without
40  * modification, are permitted provided that the following conditions
41  * are met:
42  *
43  *  * Redistributions of source code must retain the above copyright
44  *    notice, this list of conditions and the following disclaimer.
45  *  * Redistributions in binary form must reproduce the above copyright
46  *    notice, this list of conditions and the following disclaimer in
47  *    the documentation and/or other materials provided with the
48  *    distribution.
49  *  * Neither the name Intel Corporation nor the names of its
50  *    contributors may be used to endorse or promote products derived
51  *    from this software without specific prior written permission.
52  *
53  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
54  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
55  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
56  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
57  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
58  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
59  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
60  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
61  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
62  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
63  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64  *
65  *****************************************************************************/
66
67 #ifndef __fw_api_stats_h__
68 #define __fw_api_stats_h__
69 #include "fw-api-mac.h"
70
71 struct mvm_statistics_dbg {
72         __le32 burst_check;
73         __le32 burst_count;
74         __le32 wait_for_silence_timeout_cnt;
75         __le32 reserved[3];
76 } __packed; /* STATISTICS_DEBUG_API_S_VER_2 */
77
78 struct mvm_statistics_div {
79         __le32 tx_on_a;
80         __le32 tx_on_b;
81         __le32 exec_time;
82         __le32 probe_time;
83         __le32 rssi_ant;
84         __le32 reserved2;
85 } __packed; /* STATISTICS_SLOW_DIV_API_S_VER_2 */
86
87 struct mvm_statistics_rx_non_phy {
88         __le32 bogus_cts;       /* CTS received when not expecting CTS */
89         __le32 bogus_ack;       /* ACK received when not expecting ACK */
90         __le32 non_bssid_frames;        /* number of frames with BSSID that
91                                          * doesn't belong to the STA BSSID */
92         __le32 filtered_frames; /* count frames that were dumped in the
93                                  * filtering process */
94         __le32 non_channel_beacons;     /* beacons with our bss id but not on
95                                          * our serving channel */
96         __le32 channel_beacons; /* beacons with our bss id and in our
97                                  * serving channel */
98         __le32 num_missed_bcon; /* number of missed beacons */
99         __le32 adc_rx_saturation_time;  /* count in 0.8us units the time the
100                                          * ADC was in saturation */
101         __le32 ina_detection_search_time;/* total time (in 0.8us) searched
102                                           * for INA */
103         __le32 beacon_silence_rssi_a;   /* RSSI silence after beacon frame */
104         __le32 beacon_silence_rssi_b;   /* RSSI silence after beacon frame */
105         __le32 beacon_silence_rssi_c;   /* RSSI silence after beacon frame */
106         __le32 interference_data_flag;  /* flag for interference data
107                                          * availability. 1 when data is
108                                          * available. */
109         __le32 channel_load;            /* counts RX Enable time in uSec */
110         __le32 dsp_false_alarms;        /* DSP false alarm (both OFDM
111                                          * and CCK) counter */
112         __le32 beacon_rssi_a;
113         __le32 beacon_rssi_b;
114         __le32 beacon_rssi_c;
115         __le32 beacon_energy_a;
116         __le32 beacon_energy_b;
117         __le32 beacon_energy_c;
118         __le32 num_bt_kills;
119         __le32 mac_id;
120         __le32 directed_data_mpdu;
121 } __packed; /* STATISTICS_RX_NON_PHY_API_S_VER_3 */
122
123 struct mvm_statistics_rx_phy {
124         __le32 ina_cnt;
125         __le32 fina_cnt;
126         __le32 plcp_err;
127         __le32 crc32_err;
128         __le32 overrun_err;
129         __le32 early_overrun_err;
130         __le32 crc32_good;
131         __le32 false_alarm_cnt;
132         __le32 fina_sync_err_cnt;
133         __le32 sfd_timeout;
134         __le32 fina_timeout;
135         __le32 unresponded_rts;
136         __le32 rxe_frame_lmt_overrun;
137         __le32 sent_ack_cnt;
138         __le32 sent_cts_cnt;
139         __le32 sent_ba_rsp_cnt;
140         __le32 dsp_self_kill;
141         __le32 mh_format_err;
142         __le32 re_acq_main_rssi_sum;
143         __le32 reserved;
144 } __packed; /* STATISTICS_RX_PHY_API_S_VER_2 */
145
146 struct mvm_statistics_rx_ht_phy {
147         __le32 plcp_err;
148         __le32 overrun_err;
149         __le32 early_overrun_err;
150         __le32 crc32_good;
151         __le32 crc32_err;
152         __le32 mh_format_err;
153         __le32 agg_crc32_good;
154         __le32 agg_mpdu_cnt;
155         __le32 agg_cnt;
156         __le32 unsupport_mcs;
157 } __packed;  /* STATISTICS_HT_RX_PHY_API_S_VER_1 */
158
159 struct mvm_statistics_tx_non_phy {
160         __le32 preamble_cnt;
161         __le32 rx_detected_cnt;
162         __le32 bt_prio_defer_cnt;
163         __le32 bt_prio_kill_cnt;
164         __le32 few_bytes_cnt;
165         __le32 cts_timeout;
166         __le32 ack_timeout;
167         __le32 expected_ack_cnt;
168         __le32 actual_ack_cnt;
169         __le32 dump_msdu_cnt;
170         __le32 burst_abort_next_frame_mismatch_cnt;
171         __le32 burst_abort_missing_next_frame_cnt;
172         __le32 cts_timeout_collision;
173         __le32 ack_or_ba_timeout_collision;
174 } __packed; /* STATISTICS_TX_NON_PHY_API_S_VER_3 */
175
176 #define MAX_CHAINS 3
177
178 struct mvm_statistics_tx_non_phy_agg {
179         __le32 ba_timeout;
180         __le32 ba_reschedule_frames;
181         __le32 scd_query_agg_frame_cnt;
182         __le32 scd_query_no_agg;
183         __le32 scd_query_agg;
184         __le32 scd_query_mismatch;
185         __le32 frame_not_ready;
186         __le32 underrun;
187         __le32 bt_prio_kill;
188         __le32 rx_ba_rsp_cnt;
189         __s8 txpower[MAX_CHAINS];
190         __s8 reserved;
191         __le32 reserved2;
192 } __packed; /* STATISTICS_TX_NON_PHY_AGG_API_S_VER_1 */
193
194 struct mvm_statistics_tx_channel_width {
195         __le32 ext_cca_narrow_ch20[1];
196         __le32 ext_cca_narrow_ch40[2];
197         __le32 ext_cca_narrow_ch80[3];
198         __le32 ext_cca_narrow_ch160[4];
199         __le32 last_tx_ch_width_indx;
200         __le32 rx_detected_per_ch_width[4];
201         __le32 success_per_ch_width[4];
202         __le32 fail_per_ch_width[4];
203 }; /* STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */
204
205 struct mvm_statistics_tx {
206         struct mvm_statistics_tx_non_phy general;
207         struct mvm_statistics_tx_non_phy_agg agg;
208         struct mvm_statistics_tx_channel_width channel_width;
209 } __packed; /* STATISTICS_TX_API_S_VER_4 */
210
211
212 struct mvm_statistics_bt_activity {
213         __le32 hi_priority_tx_req_cnt;
214         __le32 hi_priority_tx_denied_cnt;
215         __le32 lo_priority_tx_req_cnt;
216         __le32 lo_priority_tx_denied_cnt;
217         __le32 hi_priority_rx_req_cnt;
218         __le32 hi_priority_rx_denied_cnt;
219         __le32 lo_priority_rx_req_cnt;
220         __le32 lo_priority_rx_denied_cnt;
221 } __packed;  /* STATISTICS_BT_ACTIVITY_API_S_VER_1 */
222
223 struct mvm_statistics_general_v8 {
224         __le32 radio_temperature;
225         __le32 radio_voltage;
226         struct mvm_statistics_dbg dbg;
227         __le32 sleep_time;
228         __le32 slots_out;
229         __le32 slots_idle;
230         __le32 ttl_timestamp;
231         struct mvm_statistics_div slow_div;
232         __le32 rx_enable_counter;
233         /*
234          * num_of_sos_states:
235          *  count the number of times we have to re-tune
236          *  in order to get out of bad PHY status
237          */
238         __le32 num_of_sos_states;
239         __le32 beacon_filtered;
240         __le32 missed_beacons;
241         u8 beacon_filter_average_energy;
242         u8 beacon_filter_reason;
243         u8 beacon_filter_current_energy;
244         u8 beacon_filter_reserved;
245         __le32 beacon_filter_delta_time;
246         struct mvm_statistics_bt_activity bt_activity;
247         __le64 rx_time;
248         __le64 on_time_rf;
249         __le64 on_time_scan;
250         __le64 tx_time;
251         __le32 beacon_counter[NUM_MAC_INDEX];
252         u8 beacon_average_energy[NUM_MAC_INDEX];
253         u8 reserved[4 - (NUM_MAC_INDEX % 4)];
254 } __packed; /* STATISTICS_GENERAL_API_S_VER_8 */
255
256 /**
257  * struct mvm_statistics_load - RX statistics for multi-queue devices
258  * @air_time: accumulated air time, per mac
259  * @byte_count: accumulated byte count, per mac
260  * @pkt_count: accumulated packet count, per mac
261  * @avg_energy: average RSSI, per station
262  */
263 struct mvm_statistics_load {
264         __le32 air_time[NUM_MAC_INDEX];
265         __le32 byte_count[NUM_MAC_INDEX];
266         __le32 pkt_count[NUM_MAC_INDEX];
267         u8 avg_energy[IWL_MVM_STATION_COUNT];
268 } __packed; /* STATISTICS_RX_MAC_STATION_S_VER_1 */
269
270 struct mvm_statistics_rx {
271         struct mvm_statistics_rx_phy ofdm;
272         struct mvm_statistics_rx_phy cck;
273         struct mvm_statistics_rx_non_phy general;
274         struct mvm_statistics_rx_ht_phy ofdm_ht;
275 } __packed; /* STATISTICS_RX_API_S_VER_3 */
276
277 /*
278  * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
279  *
280  * By default, uCode issues this notification after receiving a beacon
281  * while associated.  To disable this behavior, set DISABLE_NOTIF flag in the
282  * STATISTICS_CMD (0x9c), below.
283  */
284 struct iwl_notif_statistics_v10 {
285         __le32 flag;
286         struct mvm_statistics_rx rx;
287         struct mvm_statistics_tx tx;
288         struct mvm_statistics_general_v8 general;
289 } __packed; /* STATISTICS_NTFY_API_S_VER_10 */
290
291 struct iwl_notif_statistics_v11 {
292         __le32 flag;
293         struct mvm_statistics_rx rx;
294         struct mvm_statistics_tx tx;
295         struct mvm_statistics_general_v8 general;
296         struct mvm_statistics_load load_stats;
297 } __packed; /* STATISTICS_NTFY_API_S_VER_11 */
298
299 #define IWL_STATISTICS_FLG_CLEAR                0x1
300 #define IWL_STATISTICS_FLG_DISABLE_NOTIF        0x2
301
302 struct iwl_statistics_cmd {
303         __le32 flags;
304 } __packed; /* STATISTICS_CMD_API_S_VER_1 */
305
306 #endif /* __fw_api_stats_h__ */