| .. | .. |
|---|
| 1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | 1 | /* |
|---|
| 3 | 2 | * Common stats definitions for clients of dongle |
|---|
| 4 | 3 | * ports |
|---|
| 5 | 4 | * |
|---|
| 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 | + * |
|---|
| 8 | 9 | * Unless you and Broadcom execute a separate written software license |
|---|
| 9 | 10 | * agreement governing use of this software, this software is licensed to you |
|---|
| 10 | 11 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
|---|
| 11 | 12 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
|---|
| 12 | 13 | * following added to such license: |
|---|
| 13 | | - * |
|---|
| 14 | + * |
|---|
| 14 | 15 | * As a special exception, the copyright holders of this software give you |
|---|
| 15 | 16 | * permission to link this software with independent modules, and to copy and |
|---|
| 16 | 17 | * distribute the resulting executable under terms of your choice, provided that |
|---|
| .. | .. |
|---|
| 18 | 19 | * the license of that module. An independent module is a module which is not |
|---|
| 19 | 20 | * derived from this software. The special exception does not apply to any |
|---|
| 20 | 21 | * modifications of the software. |
|---|
| 21 | | - * |
|---|
| 22 | + * |
|---|
| 22 | 23 | * Notwithstanding the above, under no circumstances may you combine this |
|---|
| 23 | 24 | * software in any way with any other Broadcom software provided under a license |
|---|
| 24 | 25 | * other than the GPL, without Broadcom's express prior written consent. |
|---|
| .. | .. |
|---|
| 26 | 27 | * |
|---|
| 27 | 28 | * <<Broadcom-WL-IPTag/Open:>> |
|---|
| 28 | 29 | * |
|---|
| 29 | | - * $Id: dngl_stats.h 598879 2015-11-11 09:05:57Z $ |
|---|
| 30 | + * $Id: dngl_stats.h 687039 2017-02-27 08:07:06Z $ |
|---|
| 30 | 31 | */ |
|---|
| 31 | 32 | |
|---|
| 32 | 33 | #ifndef _dngl_stats_h_ |
|---|
| 33 | 34 | #define _dngl_stats_h_ |
|---|
| 34 | 35 | |
|---|
| 35 | | -#include <proto/ethernet.h> |
|---|
| 36 | | -#include <proto/802.11.h> |
|---|
| 36 | +#include <ethernet.h> |
|---|
| 37 | +#include <802.11.h> |
|---|
| 37 | 38 | |
|---|
| 38 | 39 | typedef struct { |
|---|
| 39 | 40 | unsigned long rx_packets; /* total packets received */ |
|---|
| .. | .. |
|---|
| 47 | 48 | unsigned long multicast; /* multicast packets received */ |
|---|
| 48 | 49 | } dngl_stats_t; |
|---|
| 49 | 50 | |
|---|
| 50 | | -#ifdef LINKSTAT_SUPPORT |
|---|
| 51 | 51 | typedef int32 wifi_radio; |
|---|
| 52 | 52 | typedef int32 wifi_channel; |
|---|
| 53 | 53 | typedef int32 wifi_rssi; |
|---|
| .. | .. |
|---|
| 100 | 100 | * element UTF-8 SSID bit is set |
|---|
| 101 | 101 | */ |
|---|
| 102 | 102 | #define WIFI_CAPABILITY_COUNTRY 0x00000020 /* set is 802.11 Country Element is present */ |
|---|
| 103 | | - |
|---|
| 103 | +#define PACK_ATTRIBUTE __attribute__ ((packed)) |
|---|
| 104 | 104 | typedef struct { |
|---|
| 105 | 105 | wifi_interface_mode mode; /* interface mode */ |
|---|
| 106 | 106 | uint8 mac_addr[6]; /* interface mac address (self) */ |
|---|
| 107 | + uint8 PAD[2]; |
|---|
| 107 | 108 | wifi_connection_state state; /* connection state (valid for STA, CLI only) */ |
|---|
| 108 | 109 | wifi_roam_state roaming; /* roaming state */ |
|---|
| 109 | 110 | uint32 capabilities; /* WIFI_CAPABILITY_XXX (self) */ |
|---|
| 110 | 111 | uint8 ssid[DOT11_MAX_SSID_LEN+1]; /* null terminated SSID */ |
|---|
| 111 | 112 | uint8 bssid[ETHER_ADDR_LEN]; /* bssid */ |
|---|
| 113 | + uint8 PAD[1]; |
|---|
| 112 | 114 | uint8 ap_country_str[3]; /* country string advertised by AP */ |
|---|
| 113 | 115 | uint8 country_str[3]; /* country string for this association */ |
|---|
| 116 | + uint8 PAD[2]; |
|---|
| 114 | 117 | } wifi_interface_info; |
|---|
| 115 | 118 | |
|---|
| 116 | 119 | typedef wifi_interface_info *wifi_interface_handle; |
|---|
| .. | .. |
|---|
| 136 | 139 | uint32 bitrate; /* units of 100 Kbps */ |
|---|
| 137 | 140 | } wifi_rate; |
|---|
| 138 | 141 | |
|---|
| 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 | + |
|---|
| 139 | 154 | /* channel statistics */ |
|---|
| 140 | 155 | typedef struct { |
|---|
| 141 | 156 | 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 |
|---|
| 143 | 158 | * accruing over time) |
|---|
| 144 | 159 | */ |
|---|
| 145 | 160 | uint32 cca_busy_time; /* msecs the CCA register is busy (32 bits number |
|---|
| .. | .. |
|---|
| 185 | 200 | wifi_channel_stat channels[1]; /* channel statistics */ |
|---|
| 186 | 201 | } wifi_radio_stat; |
|---|
| 187 | 202 | |
|---|
| 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 | + |
|---|
| 188 | 217 | /* per rate statistics */ |
|---|
| 189 | 218 | typedef struct { |
|---|
| 190 | | - struct { |
|---|
| 191 | | - uint16 version; |
|---|
| 192 | | - uint16 length; |
|---|
| 193 | | - }; |
|---|
| 219 | + wifi_rate_v1 rate; /* rate information */ |
|---|
| 194 | 220 | uint32 tx_mpdu; /* number of successfully transmitted data pkts (ACK rcvd) */ |
|---|
| 195 | 221 | uint32 rx_mpdu; /* number of received data pkts */ |
|---|
| 196 | 222 | uint32 mpdu_lost; /* number of data packet losses (no ACK) */ |
|---|
| 197 | 223 | uint32 retries; /* total number of data pkt retries */ |
|---|
| 198 | 224 | uint32 retries_short; /* number of short data pkt retries */ |
|---|
| 199 | 225 | 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; |
|---|
| 201 | 238 | } wifi_rate_stat; |
|---|
| 202 | 239 | |
|---|
| 203 | 240 | /* access categories */ |
|---|
| .. | .. |
|---|
| 263 | 300 | uint32 beacon_rx; /* access point beacon received count from |
|---|
| 264 | 301 | * connected AP |
|---|
| 265 | 302 | */ |
|---|
| 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 | + */ |
|---|
| 266 | 322 | uint32 mgmt_rx; /* access point mgmt frames received count from |
|---|
| 267 | | - * connected AP (including Beacon) |
|---|
| 268 | | - */ |
|---|
| 323 | + * connected AP (including Beacon) |
|---|
| 324 | + */ |
|---|
| 269 | 325 | uint32 mgmt_action_rx; /* action frames received count */ |
|---|
| 270 | 326 | uint32 mgmt_action_tx; /* action frames transmit count */ |
|---|
| 271 | 327 | wifi_rssi rssi_mgmt; /* access Point Beacon and Management frames RSSI |
|---|
| .. | .. |
|---|
| 281 | 337 | uint32 num_peers; /* number of peers */ |
|---|
| 282 | 338 | wifi_peer_info peer_info[1]; /* per peer statistics */ |
|---|
| 283 | 339 | } wifi_iface_stat; |
|---|
| 284 | | -#endif /* LINKSTAT_SUPPORT */ |
|---|
| 285 | 340 | |
|---|
| 286 | 341 | #endif /* _dngl_stats_h_ */ |
|---|