forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/dngl_stats.h
....@@ -1,16 +1,17 @@
1
-/* SPDX-License-Identifier: GPL-2.0 */
21 /*
32 * Common stats definitions for clients of dongle
43 * ports
54 *
6
- * Copyright (C) 1999-2019, Broadcom Corporation
7
- *
5
+ * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
6
+ *
7
+ * Copyright (C) 1999-2017, Broadcom Corporation
8
+ *
89 * Unless you and Broadcom execute a separate written software license
910 * agreement governing use of this software, this software is licensed to you
1011 * under the terms of the GNU General Public License version 2 (the "GPL"),
1112 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
1213 * following added to such license:
13
- *
14
+ *
1415 * As a special exception, the copyright holders of this software give you
1516 * permission to link this software with independent modules, and to copy and
1617 * distribute the resulting executable under terms of your choice, provided that
....@@ -18,7 +19,7 @@
1819 * the license of that module. An independent module is a module which is not
1920 * derived from this software. The special exception does not apply to any
2021 * modifications of the software.
21
- *
22
+ *
2223 * Notwithstanding the above, under no circumstances may you combine this
2324 * software in any way with any other Broadcom software provided under a license
2425 * other than the GPL, without Broadcom's express prior written consent.
....@@ -26,14 +27,14 @@
2627 *
2728 * <<Broadcom-WL-IPTag/Open:>>
2829 *
29
- * $Id: dngl_stats.h 598879 2015-11-11 09:05:57Z $
30
+ * $Id: dngl_stats.h 687039 2017-02-27 08:07:06Z $
3031 */
3132
3233 #ifndef _dngl_stats_h_
3334 #define _dngl_stats_h_
3435
35
-#include <proto/ethernet.h>
36
-#include <proto/802.11.h>
36
+#include <ethernet.h>
37
+#include <802.11.h>
3738
3839 typedef struct {
3940 unsigned long rx_packets; /* total packets received */
....@@ -47,7 +48,6 @@
4748 unsigned long multicast; /* multicast packets received */
4849 } dngl_stats_t;
4950
50
-#ifdef LINKSTAT_SUPPORT
5151 typedef int32 wifi_radio;
5252 typedef int32 wifi_channel;
5353 typedef int32 wifi_rssi;
....@@ -100,17 +100,20 @@
100100 * element UTF-8 SSID bit is set
101101 */
102102 #define WIFI_CAPABILITY_COUNTRY 0x00000020 /* set is 802.11 Country Element is present */
103
-
103
+#define PACK_ATTRIBUTE __attribute__ ((packed))
104104 typedef struct {
105105 wifi_interface_mode mode; /* interface mode */
106106 uint8 mac_addr[6]; /* interface mac address (self) */
107
+ uint8 PAD[2];
107108 wifi_connection_state state; /* connection state (valid for STA, CLI only) */
108109 wifi_roam_state roaming; /* roaming state */
109110 uint32 capabilities; /* WIFI_CAPABILITY_XXX (self) */
110111 uint8 ssid[DOT11_MAX_SSID_LEN+1]; /* null terminated SSID */
111112 uint8 bssid[ETHER_ADDR_LEN]; /* bssid */
113
+ uint8 PAD[1];
112114 uint8 ap_country_str[3]; /* country string advertised by AP */
113115 uint8 country_str[3]; /* country string for this association */
116
+ uint8 PAD[2];
114117 } wifi_interface_info;
115118
116119 typedef wifi_interface_info *wifi_interface_handle;
....@@ -136,10 +139,22 @@
136139 uint32 bitrate; /* units of 100 Kbps */
137140 } wifi_rate;
138141
142
+typedef struct {
143
+ uint32 preamble :3; /* 0: OFDM, 1:CCK, 2:HT 3:VHT 4..7 reserved */
144
+ uint32 nss :2; /* 0:1x1, 1:2x2, 3:3x3, 4:4x4 */
145
+ uint32 bw :3; /* 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz */
146
+ uint32 rateMcsIdx :8; /* OFDM/CCK rate code would be as per ieee std
147
+ * in the units of 0.5mbps HT/VHT it would be
148
+ * mcs index
149
+ */
150
+ uint32 reserved :16; /* reserved */
151
+ uint32 bitrate; /* units of 100 Kbps */
152
+} wifi_rate_v1;
153
+
139154 /* channel statistics */
140155 typedef struct {
141156 wifi_channel_info channel; /* channel */
142
- uint32 on_time; /* msecs the radio is awake (32 bits number
157
+ uint32 on_time; /* msecs the radio is awake (32 bits number
143158 * accruing over time)
144159 */
145160 uint32 cca_busy_time; /* msecs the CCA register is busy (32 bits number
....@@ -185,19 +200,41 @@
185200 wifi_channel_stat channels[1]; /* channel statistics */
186201 } wifi_radio_stat;
187202
203
+typedef struct {
204
+ wifi_radio radio;
205
+ uint32 on_time;
206
+ uint32 tx_time;
207
+ uint32 rx_time;
208
+ uint32 on_time_scan;
209
+ uint32 on_time_nbd;
210
+ uint32 on_time_gscan;
211
+ uint32 on_time_roam_scan;
212
+ uint32 on_time_pno_scan;
213
+ uint32 on_time_hs20;
214
+ uint32 num_channels;
215
+} wifi_radio_stat_h;
216
+
188217 /* per rate statistics */
189218 typedef struct {
190
- struct {
191
- uint16 version;
192
- uint16 length;
193
- };
219
+ wifi_rate_v1 rate; /* rate information */
194220 uint32 tx_mpdu; /* number of successfully transmitted data pkts (ACK rcvd) */
195221 uint32 rx_mpdu; /* number of received data pkts */
196222 uint32 mpdu_lost; /* number of data packet losses (no ACK) */
197223 uint32 retries; /* total number of data pkt retries */
198224 uint32 retries_short; /* number of short data pkt retries */
199225 uint32 retries_long; /* number of long data pkt retries */
200
- wifi_rate rate; /* rate information */
226
+} wifi_rate_stat_v1;
227
+
228
+typedef struct {
229
+ uint16 version;
230
+ uint16 length;
231
+ uint32 tx_mpdu; /* number of successfully transmitted data pkts (ACK rcvd) */
232
+ uint32 rx_mpdu; /* number of received data pkts */
233
+ uint32 mpdu_lost; /* number of data packet losses (no ACK) */
234
+ uint32 retries; /* total number of data pkt retries */
235
+ uint32 retries_short; /* number of short data pkt retries */
236
+ uint32 retries_long; /* number of long data pkt retries */
237
+ wifi_rate rate;
201238 } wifi_rate_stat;
202239
203240 /* access categories */
....@@ -263,9 +300,28 @@
263300 uint32 beacon_rx; /* access point beacon received count from
264301 * connected AP
265302 */
303
+ uint64 average_tsf_offset; /* average beacon offset encountered (beacon_TSF - TBTT)
304
+ * The average_tsf_offset field is used so as to calculate
305
+ * the typical beacon contention time on the channel as well
306
+ * may be used to debug beacon synchronization and related
307
+ * power consumption issue
308
+ */
309
+ uint32 leaky_ap_detected; /* indicate that this AP
310
+ * typically leaks packets beyond
311
+ * the driver guard time.
312
+ */
313
+ uint32 leaky_ap_avg_num_frames_leaked; /* average number of frame leaked by AP after
314
+ * frame with PM bit set was ACK'ed by AP
315
+ */
316
+ uint32 leaky_ap_guard_time; /* guard time currently in force
317
+ * (when implementing IEEE power management
318
+ * based on frame control PM bit), How long
319
+ * driver waits before shutting down the radio and after
320
+ * receiving an ACK for a data frame with PM bit set)
321
+ */
266322 uint32 mgmt_rx; /* access point mgmt frames received count from
267
- * connected AP (including Beacon)
268
- */
323
+ * connected AP (including Beacon)
324
+ */
269325 uint32 mgmt_action_rx; /* action frames received count */
270326 uint32 mgmt_action_tx; /* action frames transmit count */
271327 wifi_rssi rssi_mgmt; /* access Point Beacon and Management frames RSSI
....@@ -281,6 +337,5 @@
281337 uint32 num_peers; /* number of peers */
282338 wifi_peer_info peer_info[1]; /* per peer statistics */
283339 } wifi_iface_stat;
284
-#endif /* LINKSTAT_SUPPORT */
285340
286341 #endif /* _dngl_stats_h_ */