From cde9070d9970eef1f7ec2360586c802a16230ad8 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Fri, 10 May 2024 07:43:50 +0000
Subject: [PATCH] rtl88x2CE_WiFi_linux driver

---
 kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/dngl_stats.h |   93 +++++++++++++++++++++++++++++++++++++---------
 1 files changed, 74 insertions(+), 19 deletions(-)

diff --git a/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/dngl_stats.h b/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/dngl_stats.h
index f480eed..2b0d65b 100644
--- a/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/dngl_stats.h
+++ b/kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/dngl_stats.h
@@ -1,16 +1,17 @@
-/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Common stats definitions for clients of dongle
  * ports
  *
- * Copyright (C) 1999-2019, Broadcom Corporation
- * 
+ * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
+ *
+ * Copyright (C) 1999-2017, Broadcom Corporation
+ *
  *      Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
  * under the terms of the GNU General Public License version 2 (the "GPL"),
  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  * following added to such license:
- * 
+ *
  *      As a special exception, the copyright holders of this software give you
  * permission to link this software with independent modules, and to copy and
  * distribute the resulting executable under terms of your choice, provided that
@@ -18,7 +19,7 @@
  * the license of that module.  An independent module is a module which is not
  * derived from this software.  The special exception does not apply to any
  * modifications of the software.
- * 
+ *
  *      Notwithstanding the above, under no circumstances may you combine this
  * software in any way with any other Broadcom software provided under a license
  * other than the GPL, without Broadcom's express prior written consent.
@@ -26,14 +27,14 @@
  *
  * <<Broadcom-WL-IPTag/Open:>>
  *
- * $Id: dngl_stats.h 598879 2015-11-11 09:05:57Z $
+ * $Id: dngl_stats.h 687039 2017-02-27 08:07:06Z $
  */
 
 #ifndef _dngl_stats_h_
 #define _dngl_stats_h_
 
-#include <proto/ethernet.h>
-#include <proto/802.11.h>
+#include <ethernet.h>
+#include <802.11.h>
 
 typedef struct {
 	unsigned long	rx_packets;		/* total packets received */
@@ -47,7 +48,6 @@
 	unsigned long   multicast;      /* multicast packets received */
 } dngl_stats_t;
 
-#ifdef LINKSTAT_SUPPORT
 typedef int32 wifi_radio;
 typedef int32 wifi_channel;
 typedef int32 wifi_rssi;
@@ -100,17 +100,20 @@
 						     * element UTF-8 SSID bit is set
 						     */
 #define WIFI_CAPABILITY_COUNTRY      0x00000020     /* set is 802.11 Country Element is present */
-
+#define PACK_ATTRIBUTE __attribute__ ((packed))
 typedef struct {
 	wifi_interface_mode mode;     /* interface mode */
 	uint8 mac_addr[6];               /* interface mac address (self) */
+	uint8 PAD[2];
 	wifi_connection_state state;  /* connection state (valid for STA, CLI only) */
 	wifi_roam_state roaming;      /* roaming state */
 	uint32 capabilities;             /* WIFI_CAPABILITY_XXX (self) */
 	uint8 ssid[DOT11_MAX_SSID_LEN+1]; /* null terminated SSID */
 	uint8 bssid[ETHER_ADDR_LEN];     /* bssid */
+	uint8 PAD[1];
 	uint8 ap_country_str[3];         /* country string advertised by AP */
 	uint8 country_str[3];            /* country string for this association */
+	uint8 PAD[2];
 } wifi_interface_info;
 
 typedef wifi_interface_info *wifi_interface_handle;
@@ -136,10 +139,22 @@
 	uint32 bitrate;    /* units of 100 Kbps */
 } wifi_rate;
 
+typedef struct {
+	uint32 preamble   :3;   /* 0: OFDM, 1:CCK, 2:HT 3:VHT 4..7 reserved */
+	uint32 nss        :2;   /* 0:1x1, 1:2x2, 3:3x3, 4:4x4 */
+	uint32 bw         :3;   /* 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz */
+	uint32 rateMcsIdx :8;   /* OFDM/CCK rate code would be as per ieee std
+					* in the units of 0.5mbps HT/VHT it would be
+					* mcs index
+					*/
+	uint32 reserved  :16;   /* reserved */
+	uint32 bitrate;         /* units of 100 Kbps */
+} wifi_rate_v1;
+
 /* channel statistics */
 typedef struct {
 	wifi_channel_info channel;  /* channel */
-	uint32 on_time;         	/* msecs the radio is awake (32 bits number
+	uint32 on_time;			/* msecs the radio is awake (32 bits number
 				         * accruing over time)
 					 */
 	uint32 cca_busy_time;          /* msecs the CCA register is busy (32 bits number
@@ -185,19 +200,41 @@
 	wifi_channel_stat channels[1];   /* channel statistics */
 } wifi_radio_stat;
 
+typedef struct {
+	wifi_radio radio;
+	uint32 on_time;
+	uint32 tx_time;
+	uint32 rx_time;
+	uint32 on_time_scan;
+	uint32 on_time_nbd;
+	uint32 on_time_gscan;
+	uint32 on_time_roam_scan;
+	uint32 on_time_pno_scan;
+	uint32 on_time_hs20;
+	uint32 num_channels;
+} wifi_radio_stat_h;
+
 /* per rate statistics */
 typedef struct {
-	struct {
-		uint16 version;
-		uint16 length;
-	};
+	wifi_rate_v1 rate;     /* rate information */
 	uint32 tx_mpdu;        /* number of successfully transmitted data pkts (ACK rcvd) */
 	uint32 rx_mpdu;        /* number of received data pkts */
 	uint32 mpdu_lost;      /* number of data packet losses (no ACK) */
 	uint32 retries;        /* total number of data pkt retries */
 	uint32 retries_short;  /* number of short data pkt retries */
 	uint32 retries_long;   /* number of long data pkt retries */
-	wifi_rate rate;     /* rate information */
+} wifi_rate_stat_v1;
+
+typedef struct {
+	uint16 version;
+	uint16 length;
+	uint32 tx_mpdu;        /* number of successfully transmitted data pkts (ACK rcvd) */
+	uint32 rx_mpdu;        /* number of received data pkts */
+	uint32 mpdu_lost;      /* number of data packet losses (no ACK) */
+	uint32 retries;        /* total number of data pkt retries */
+	uint32 retries_short;  /* number of short data pkt retries */
+	uint32 retries_long;   /* number of long data pkt retries */
+	wifi_rate rate;
 } wifi_rate_stat;
 
 /* access categories */
@@ -263,9 +300,28 @@
 	uint32 beacon_rx;                     /* access point beacon received count from
 					       * connected AP
 					       */
+	uint64 average_tsf_offset;	/* average beacon offset encountered (beacon_TSF - TBTT)
+					* The average_tsf_offset field is used so as to calculate
+					* the typical beacon contention time on the channel as well
+					* may be used to debug beacon synchronization and related
+					* power consumption issue
+					*/
+	uint32 leaky_ap_detected;	/* indicate that this AP
+					* typically leaks packets beyond
+					* the driver guard time.
+					*/
+	uint32 leaky_ap_avg_num_frames_leaked;	/* average number of frame leaked by AP after
+					* frame with PM bit set was ACK'ed by AP
+					*/
+	uint32 leaky_ap_guard_time;		/* guard time currently in force
+					* (when implementing IEEE power management
+					* based on frame control PM bit), How long
+					* driver waits before shutting down the radio and after
+					* receiving an ACK for a data frame with PM bit set)
+					*/
 	uint32 mgmt_rx;                       /* access point mgmt frames received count from
-					       * connected AP (including Beacon)
-					       */
+				       * connected AP (including Beacon)
+				       */
 	uint32 mgmt_action_rx;                /* action frames received count */
 	uint32 mgmt_action_tx;                /* action frames transmit count */
 	wifi_rssi rssi_mgmt;                  /* access Point Beacon and Management frames RSSI
@@ -281,6 +337,5 @@
 	uint32 num_peers;                        /* number of peers */
 	wifi_peer_info peer_info[1];           /* per peer statistics */
 } wifi_iface_stat;
-#endif /* LINKSTAT_SUPPORT */
 
 #endif /* _dngl_stats_h_ */

--
Gitblit v1.6.2