From be8eedcf76505307f49eef1fb4d07258009c0084 Mon Sep 17 00:00:00 2001
From: Sophie Brun <sophie@offensive-security.com>
Date: Thu, 14 May 2020 11:44:14 +0200
Subject: [PATCH] New upstream version 5.3.9~git20200316

---
 BUILD_FOR_NETHUNTER.md        | 46 +++++++++++++++++
 Kconfig                       |  4 +-
 Makefile                      | 22 ++-------
 README.md                     | 37 ++++++--------
 core/rtw_debug.c              |  2 +
 core/rtw_mlme_ext.c           |  6 ++-
 core/rtw_security.c           | 18 +++----
 core/rtw_sta_mgt.c            |  2 +-
 core/rtw_wlan_util.c          |  2 +-
 dkms.conf                     |  2 +-
 hal/hal_intf.c                |  2 +-
 include/autoconf.h            |  2 +-
 include/rtl8192e_sreset.h     |  2 +-
 include/rtl8812a_sreset.h     |  2 +-
 os_dep/linux/ioctl_cfg80211.c | 10 +++-
 os_dep/linux/os_intfs.c       | 25 +++++-----
 os_dep/linux/rtw_proc.c       | 93 ++++++++++++++++++++++++++++++++++-
 os_dep/osdep_service.c        |  2 +-
 18 files changed, 204 insertions(+), 75 deletions(-)
 create mode 100644 BUILD_FOR_NETHUNTER.md

diff --git a/BUILD_FOR_NETHUNTER.md b/BUILD_FOR_NETHUNTER.md
new file mode 100644
index 0000000..2a622ff
--- /dev/null
+++ b/BUILD_FOR_NETHUNTER.md
@@ -0,0 +1,46 @@
+## Build Kernel Headers
+
+```
+cd [your kernel source directory]
+make module_prepare
+make modules_install INSTALL_MOD_PATH=../
+```
+
+## Build RTL8188EUS driver/modules
+
+```
+cd ../
+git clone https://github.com/aircrack-ng/rtl8188eus -b v5.3.9
+cd rtl8188eus
+```
+
+That command places this driver behind your kernel source directory (RECOMMENDED).
+If you put it anywhere you might need to set the Makefile in this driver, but i won't explain it.
+Now, do:
+
+```
+export ARCH=arm64
+export SUBARCH=arm64
+export CROSS_COMPILE=../toolchain/toolchain64/bin/aarch64-linux-android-
+export KBUILD_KVER=3.10.73-NetHunter-something
+```
+
+arm64 is the device architecture. 
+CROSS_COMPILE is your toolchain directory.
+KBUILD_KVER is your kernel build version, you can search for it in ../lib/modules (the place of your modules_install when you build kernel headers).
+
+Now, do:
+```
+make
+```
+
+If there is no error or success you will see a file named 8188eu.ko in this driver directory.
+
+
+## Load the driver (8188eu.ko)
+```
+su
+cd /system/lib/modules
+insmod 8188eu.ko
+```
+
diff --git a/Kconfig b/Kconfig
index d0bbdb6..013175c 100644
--- a/Kconfig
+++ b/Kconfig
@@ -1,6 +1,6 @@
-config RTL8188EUS
+config RTL8188EU
 	tristate "Realtek 8188E USB WiFi"
 	depends on USB
 	---help---
-	  Help message of RTL8188EUS
+	  Help message of RTL8188EU
 
diff --git a/Makefile b/Makefile
index 40abaa2..b24502f 100755
--- a/Makefile
+++ b/Makefile
@@ -1,30 +1,14 @@
 EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS) -fno-pie
 EXTRA_CFLAGS += -O1
 #EXTRA_CFLAGS += -O3
-#EXTRA_CFLAGS += -Wall
-#EXTRA_CFLAGS += -Wextra
-#EXTRA_CFLAGS += -Werror
-#EXTRA_CFLAGS += -pedantic
-#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-
 EXTRA_CFLAGS += -Wno-unused-variable
 EXTRA_CFLAGS += -Wno-unused-value
 EXTRA_CFLAGS += -Wno-unused-label
 EXTRA_CFLAGS += -Wno-unused-parameter
 EXTRA_CFLAGS += -Wno-unused-function
 EXTRA_CFLAGS += -Wno-unused
-#EXTRA_CFLAGS += -Wno-uninitialized
 EXTRA_CFLAGS += -Wno-vla
-#EXTRA_CFLAGS += -Wno-cast-function-type
 EXTRA_CFLAGS += -Wno-date-time
-#EXTRA_CFLAGS += -Wno-misleading-indentation
-#EXTRA_CFLAGS += -Wno-uninitialized
-# Relax some warnings from '-Wextra' so we won't get flooded with warnings
-#EXTRA_CFLAGS += -Wno-sign-compare
-#EXTRA_CFLAGS += -Wno-missing-field-initializers
-#EXTRA_CFLAGS += -Wno-type-limits
-EXTRA_CFLAGS += -Wno-implicit-fallthrough
-EXTRA_CFLAGS += -Wno-maybe-uninitialized
 
 GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
 ifeq ($(GCC_VER_49),1)
@@ -56,7 +40,7 @@ CONFIG_PCI_HCI = n
 CONFIG_SDIO_HCI = n
 CONFIG_GSPI_HCI = n
 ########################## Features ###########################
-CONFIG_NET_NS = n
+CONFIG_NET_NS = y
 CONFIG_MP_INCLUDED = y
 CONFIG_POWER_SAVING = n
 CONFIG_USB_AUTOSUSPEND = n
@@ -89,10 +73,10 @@ CONFIG_RTW_IPCAM_APPLICATION = n
 CONFIG_RTW_REPEATER_SON = n
 CONFIG_RTW_WIFI_HAL = y
 ########################## Debug ###########################
-CONFIG_RTW_DEBUG = y
+CONFIG_RTW_DEBUG = n
 # default log level is _DRV_INFO_ = 4,
 # please refer to "How_to_set_driver_debug_log_level.doc" to set the available level.
-CONFIG_RTW_LOG_LEVEL = 4
+CONFIG_RTW_LOG_LEVEL = 0
 ######################## Wake On Lan ##########################
 CONFIG_WOWLAN = n
 CONFIG_WAKEUP_TYPE = 0x7 #bit2: deauth, bit1: unicast, bit0: magic pkt.
diff --git a/README.md b/README.md
index 0df5a32..4a997e9 100644
--- a/README.md
+++ b/README.md
@@ -5,18 +5,16 @@
 [![Monitor mode](https://img.shields.io/badge/monitor%20mode-supported-brightgreen.svg)](#)
 [![Frame Injection](https://img.shields.io/badge/frame%20injection-supported-brightgreen.svg)](#)
 [![MESH Mode](https://img.shields.io/badge/mesh%20mode-supported-brightgreen.svg)](#)
-[![GitHub issues](https://img.shields.io/github/issues/kimocoder/rtl8188eus.svg)](https://github.com/kimocoder/rtl8188eus/issues)
-[![GitHub forks](https://img.shields.io/github/forks/kimocoder/rtl8188eus.svg)](https://github.com/kimocoder/rtl8188eus/network)
-[![GitHub stars](https://img.shields.io/github/stars/kimocoder/rtl8188eus.svg)](https://github.com/kimocoder/rtl8188eus/stargazers)
-[![GitHub license](https://img.shields.io/github/license/kimocoder/rtl8812au.svg)](https://github.com/kimocoder/rtl8188eus/blob/master/LICENSE)<br>
+[![GitHub issues](https://img.shields.io/github/issues/aircrack-ng/rtl8188eus.svg)](https://github.com/aircrack-ng/rtl8188eus/issues)
+[![GitHub forks](https://img.shields.io/github/forks/aircrack-ng/rtl8188eus.svg)](https://github.com/aircrack-ng/rtl8188eus/network)
+[![GitHub stars](https://img.shields.io/github/stars/aircrack-ng/rtl8188eus.svg)](https://github.com/aircrack-ng/rtl8188eus/stargazers)
+[![GitHub license](https://img.shields.io/github/license/aircrack-ng/rtl8812au.svg)](https://github.com/aircrack-ng/rtl8188eus/blob/master/LICENSE)<br>
 [![Android](https://img.shields.io/badge/android%20(8)-supported-brightgreen.svg)](#)
 [![aircrack-ng](https://img.shields.io/badge/aircrack--ng-supported-blue.svg)](#)
 
-This is a pure Realtek release, not from vendor but from all the Realtek multichip "bases"
-we've seen, this must be the newest, most stable and effective one.
-The performance and code quality has been improved.
 
 # Supports
+* Android 7
 * MESH Support
 * Monitor mode
 * Frame injection
@@ -25,21 +23,21 @@ The performance and code quality has been improved.
 
 # Howto build/install
 1. You will need to blacklist another driver in order to use this one.
-2. "echo "blacklist r8188eu.ko" > "/etc/modprobe.d/realtek.conf"
+2. "echo "blacklist r8188eu" > "/etc/modprobe.d/realtek.conf"
 3. "make && make install"<br>
 4. Reboot in order to blacklist and load the new driver/module.
 
 # MONITOR MODE howto
 Use these steps to enter monitor mode.
 ```
-airmon-ng check-kill
-ip link set <interface> down
-iw dev <interface> set type monitor
+$ sudo airmon-ng check-kill
+$ sudo ip link set <interface> down
+$ sudo iw dev <interface> set type monitor
 ```
 Frame injection test may be performed with
 (after kernel v5.2 scanning is slow, run a scan or simply an airodump-ng first!)
 ```
-aireplay -9 <interface>
+$ aireplay -9 <interface>
 ```
 
 # NetworkManager configuration
@@ -62,12 +60,9 @@ plugins=keyfile
 unmanaged-devices=mac:A7:A7:A7:A7:A7
 ```
 
-# TODO
-* Implement txpower control
-
-* Finish up the elimination of the wrapper _rtw_memset.
-  I didn't have more time after "rtw_beamforming.c"
-
-* Add more VID/PIDS for all 3 chipsets supported.
-
-
+# Credits
+Realtek       - https://www.realtek.com<br>
+Alfa Networks - https://www.alfa.com.tw<br>
+aircrack-ng.  - https://www.aircrack-ng.org<br>
+<br>
+And all those who may be using or contributing to it of anykind. Thanks!<br>
diff --git a/core/rtw_debug.c b/core/rtw_debug.c
index 40d2996..d9752bb 100644
--- a/core/rtw_debug.c
+++ b/core/rtw_debug.c
@@ -6051,6 +6051,7 @@ ssize_t proc_set_lck(struct file *file, const char __user *buffer, size_t count,
 inline void RTW_BUF_DUMP_SEL(uint _loglevel, void *sel, u8 *_titlestring,
 					bool _idx_show, const u8 *_hexdata, int _hexdatalen)
 {
+#ifdef CONFIG_RTW_DEBUG
 	int __i;
 	u8 *ptr = (u8 *)_hexdata;
 
@@ -6076,6 +6077,7 @@ inline void RTW_BUF_DUMP_SEL(uint _loglevel, void *sel, u8 *_titlestring,
 		}
 		_RTW_PRINT_SEL(sel, "\n");
 	}
+#endif
 }
 #else
 inline void _RTW_STR_DUMP_SEL(void *sel, char *str_out)
diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c
index 68dc9d2..da471c1 100644
--- a/core/rtw_mlme_ext.c
+++ b/core/rtw_mlme_ext.c
@@ -1831,7 +1831,11 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
 			ptable->func = &OnAuth;
 		else
 			ptable->func = &OnAuthClient;
-	/* pass through */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
+	__attribute__ ((fallthrough));
+#else
+			__attribute__ ((__fallthrough__));
+#endif
 	case WIFI_ASSOCREQ:
 	case WIFI_REASSOCREQ:
 		_mgt_dispatcher(padapter, ptable, precv_frame);
diff --git a/core/rtw_security.c b/core/rtw_security.c
index 52d5e3d..5807521 100644
--- a/core/rtw_security.c
+++ b/core/rtw_security.c
@@ -982,13 +982,6 @@ static void next_key(u8 *key, sint round);
 static void byte_sub(u8 *in, u8 *out);
 static void shift_row(u8 *in, u8 *out);
 static void mix_column(u8 *in, u8 *out);
-#ifndef PLATFORM_FREEBSD
-static void add_round_key(u8 *shiftrow_in,
-			  u8 *mcol_in,
-			  u8 *block_in,
-			  sint round,
-			  u8 *out);
-#endif /* PLATFORM_FREEBSD */
 static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext);
 
 
@@ -1929,7 +1922,6 @@ u32	rtw_aes_decrypt(_adapter *padapter, u8 *precvframe)
 
 
 	sint		length;
-	u32	prwskeylen;
 	u8	*pframe, *prwskey;	/* , *payload,*iv */
 	struct	sta_info		*stainfo;
 	struct	rx_pkt_attrib	*prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib;
@@ -2139,6 +2131,7 @@ BIP_exit:
 #endif /* CONFIG_IEEE80211W */
 
 #ifndef PLATFORM_FREEBSD
+#if defined(CONFIG_TDLS)
 /* compress 512-bits */
 static int sha256_compress(struct sha256_state *md, unsigned char *buf)
 {
@@ -2319,7 +2312,9 @@ static u8 os_strlen(const char *s)
 		p++;
 	return p - s;
 }
+#endif
 
+#if defined(CONFIG_TDLS) || defined(CONFIG_RTW_MESH_AEK)
 static int os_memcmp(const void *s1, const void *s2, u8 n)
 {
 	const unsigned char *p1 = s1, *p2 = s2;
@@ -2337,6 +2332,7 @@ static int os_memcmp(const void *s1, const void *s2, u8 n)
 
 	return *p1 - *p2;
 }
+#endif
 
 /**
  * hmac_sha256_vector - HMAC-SHA256 over data vector (RFC 2104)
@@ -2347,6 +2343,7 @@ static int os_memcmp(const void *s1, const void *s2, u8 n)
  * @len: Lengths of the data blocks
  * @mac: Buffer for the hash (32 bytes)
  */
+#if defined(CONFIG_TDLS)
 static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
 			       u8 *addr[], size_t *len, u8 *mac)
 {
@@ -2408,6 +2405,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
 	_len[1] = 32;
 	sha256_vector(2, _addr, _len, mac);
 }
+#endif /* CONFIG_TDLS */
 #endif /* PLATFORM_FREEBSD */
 /**
  * sha256_prf - SHA256-based Pseudo-Random Function (IEEE 802.11r, 8.5.1.5.2)
@@ -2423,6 +2421,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
  * given key.
  */
 #ifndef PLATFORM_FREEBSD /* Baron */
+#if defined(CONFIG_TDLS)
 static void sha256_prf(u8 *key, size_t key_len, char *label,
 		       u8 *data, size_t data_len, u8 *buf, size_t buf_len)
 {
@@ -2459,6 +2458,7 @@ static void sha256_prf(u8 *key, size_t key_len, char *label,
 		counter++;
 	}
 }
+#endif
 #endif /* PLATFORM_FREEBSD Baron */
 
 /* AES tables*/
@@ -3083,7 +3083,7 @@ int aes_siv_decrypt(const u8 *key, const u8 *iv_crypt, size_t iv_c_len,
 #endif /* CONFIG_RTW_MESH_AEK */
 
 #ifdef CONFIG_TDLS
-void wpa_tdls_generate_tpk(_adapter *padapter, PVOID sta)
+void wpa_tdls_generate_tpk(_adapter *padapter, void *sta)
 {
 	struct sta_info *psta = (struct sta_info *)sta;
 	struct mlme_priv	*pmlmepriv = &padapter->mlmepriv;
diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c
index 3a79e09..9b3c03f 100644
--- a/core/rtw_sta_mgt.c
+++ b/core/rtw_sta_mgt.c
@@ -41,7 +41,7 @@ inline void rtw_st_ctl_init(struct st_ctl_t *st_ctl)
 	_rtw_init_queue(&st_ctl->tracker_q);
 }
 
-inline void rtw_st_ctl_clear_tracker_q(struct st_ctl_t *st_ctl)
+static inline void rtw_st_ctl_clear_tracker_q(struct st_ctl_t *st_ctl)
 {
 	_irqL irqL;
 	_list *plist, *phead;
diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c
index b9a8944..4814717 100644
--- a/core/rtw_wlan_util.c
+++ b/core/rtw_wlan_util.c
@@ -1038,7 +1038,7 @@ exit:
 	return ret;
 }
 
-inline bool rtw_sec_camid_is_used(struct cam_ctl_t *cam_ctl, u8 id)
+static inline bool rtw_sec_camid_is_used(struct cam_ctl_t *cam_ctl, u8 id)
 {
 	_irqL irqL;
 	bool ret;
diff --git a/dkms.conf b/dkms.conf
index 8738b39..1c14127 100644
--- a/dkms.conf
+++ b/dkms.conf
@@ -1,5 +1,5 @@
 PACKAGE_NAME="realtek-rtl8188eus"
-PACKAGE_VERSION="5.3.9~20191129"
+PACKAGE_VERSION="5.3.9~20200316"
 CLEAN="'make' clean"
 BUILT_MODULE_NAME[0]=8188eu
 PROCS_NUM=`nproc`
diff --git a/hal/hal_intf.c b/hal/hal_intf.c
index d818bc8..95966c8 100644
--- a/hal/hal_intf.c
+++ b/hal/hal_intf.c
@@ -939,7 +939,7 @@ s32 c2h_handler(_adapter *adapter, u8 id, u8 seq, u8 plen, u8 *payload)
 #endif
 	case C2H_EXTEND:
 		sub_id = payload[0];
-		/* no handle, goto default */
+		__attribute__ ((__fallthrough__));
 
 	default:
 		if (phydm_c2H_content_parsing(adapter_to_phydm(adapter), id, plen, payload) != TRUE)
diff --git a/include/autoconf.h b/include/autoconf.h
index b718fe0..d5de692 100644
--- a/include/autoconf.h
+++ b/include/autoconf.h
@@ -93,7 +93,7 @@
 
 	/*#define CONFIG_ANTENNA_DIVERSITY*/
 
-	#define CONFIG_CONCURRENT_MODE
+	//#define CONFIG_CONCURRENT_MODE
 	#ifdef CONFIG_CONCURRENT_MODE
 		#define CONFIG_RUNTIME_PORT_SWITCH
                 #define CONFIG_SCAN_BACKOP
diff --git a/include/rtl8192e_sreset.h b/include/rtl8192e_sreset.h
index 78109ae..52df2ec 100644
--- a/include/rtl8192e_sreset.h
+++ b/include/rtl8192e_sreset.h
@@ -12,7 +12,7 @@
  * more details.
  *
  *****************************************************************************/
-#ifndef _RTL88812A_SRESET_H_
+#ifndef _RTL8812A_SRESET_H_
 #define _RTL8812A_SRESET_H_
 
 #include <rtw_sreset.h>
diff --git a/include/rtl8812a_sreset.h b/include/rtl8812a_sreset.h
index d4bbd58..13cbf5f 100644
--- a/include/rtl8812a_sreset.h
+++ b/include/rtl8812a_sreset.h
@@ -12,7 +12,7 @@
  * more details.
  *
  *****************************************************************************/
-#ifndef _RTL88812A_SRESET_H_
+#ifndef _RTL8812A_SRESET_H_
 #define _RTL8812A_SRESET_H_
 
 #include <rtw_sreset.h>
diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c
index c2461a3..3acf030 100644
--- a/os_dep/linux/ioctl_cfg80211.c
+++ b/os_dep/linux/ioctl_cfg80211.c
@@ -686,9 +686,13 @@ static int rtw_cfg80211_sync_iftype(_adapter *adapter)
 
 static u64 rtw_get_systime_us(void)
 {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+	struct timespec64 ts;
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
 	struct timespec ts;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+	getboottime64(&ts);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0))
 	getboottime(&ts);
 #else
 	get_monotonic_boottime(&ts);
@@ -2367,6 +2371,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
 	case NL80211_IFTYPE_P2P_CLIENT:
 		is_p2p = _TRUE;
 	#endif
+	__attribute__ ((__fallthrough__));
 	case NL80211_IFTYPE_STATION:
 		networkType = Ndis802_11Infrastructure;
 
@@ -2391,6 +2396,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
 	case NL80211_IFTYPE_P2P_GO:
 		is_p2p = _TRUE;
 	#endif
+	__attribute__ ((__fallthrough__));
 	case NL80211_IFTYPE_AP:
 		networkType = Ndis802_11APMode;
 
diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c
index 58a9e03..caf020d 100644
--- a/os_dep/linux/os_intfs.c
+++ b/os_dep/linux/os_intfs.c
@@ -817,7 +817,7 @@ void rtw_regsty_load_target_tx_power(struct registry_priv *regsty)
 #endif /* CONFIG_IEEE80211_BAND_5GHZ */
 }
 
-inline void rtw_regsty_load_excl_chs(struct registry_priv *regsty)
+static inline void rtw_regsty_load_excl_chs(struct registry_priv *regsty)
 {
 	int i;
 	int ch_num = 0;
@@ -831,7 +831,7 @@ inline void rtw_regsty_load_excl_chs(struct registry_priv *regsty)
 }
 
 #ifdef CONFIG_80211N_HT
-inline void rtw_regsty_init_rx_ampdu_sz_limit(struct registry_priv *regsty)
+static inline void rtw_regsty_init_rx_ampdu_sz_limit(struct registry_priv *regsty)
 {
 	int i, j;
 	uint *sz_limit;
@@ -1284,17 +1284,18 @@ unsigned int rtw_classify8021d(struct sk_buff *skb)
 	return dscp >> 5;
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0))
-static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
-			    struct net_device *sb_dev)
-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
-static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
-			    struct net_device *sb_dev,
-			    select_queue_fallback_t fallback)
-#else
-static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
-			    void *accel_priv, select_queue_fallback_t fallback)
+static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
+  #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)
+	  , void *accel_priv
+  #else
+    , struct net_device *sb_dev
+  #endif
+  #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0))
+	  , select_queue_fallback_t fallback
+  #endif
 #endif
+)
 {
 	_adapter	*padapter = rtw_netdev_priv(dev);
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
diff --git a/os_dep/linux/rtw_proc.c b/os_dep/linux/rtw_proc.c
index 6ed0288..8a0fd3e 100644
--- a/os_dep/linux/rtw_proc.c
+++ b/os_dep/linux/rtw_proc.c
@@ -62,7 +62,12 @@ inline struct proc_dir_entry *rtw_proc_create_dir(const char *name, struct proc_
 }
 
 inline struct proc_dir_entry *rtw_proc_create_entry(const char *name, struct proc_dir_entry *parent,
-	const struct file_operations *fops, void * data)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+const struct proc_ops *fops, void * data)
+#else
+const struct file_operations *fops, void * data)
+#endif
+
 {
 	struct proc_dir_entry *entry;
 
@@ -230,6 +235,26 @@ static ssize_t rtw_drv_proc_write(struct file *file, const char __user *buffer,
 	return -EROFS;
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+static const struct proc_ops rtw_drv_proc_seq_fops = {
+	//.proc_owner = THIS_MODULE,
+        .proc_open = rtw_drv_proc_open,
+        .proc_read = seq_read,
+        .proc_lseek = seq_lseek,
+        .proc_release = seq_release,
+	.proc_write = rtw_drv_proc_write,
+};
+
+static const struct proc_ops rtw_drv_proc_sseq_fops = {
+	//.proc_owner = THIS_MODULE,
+	.proc_open = rtw_drv_proc_open,
+	.proc_read = seq_read,
+	.proc_lseek = seq_lseek,
+	.proc_release = single_release,
+	.proc_write = rtw_drv_proc_write,
+};
+
+#else
 static const struct file_operations rtw_drv_proc_seq_fops = {
 	.owner = THIS_MODULE,
 	.open = rtw_drv_proc_open,
@@ -247,6 +272,7 @@ static const struct file_operations rtw_drv_proc_sseq_fops = {
 	.release = single_release,
 	.write = rtw_drv_proc_write,
 };
+#endif
 
 int rtw_drv_proc_init(void)
 {
@@ -3683,6 +3709,27 @@ static ssize_t rtw_adapter_proc_write(struct file *file, const char __user *buff
 	return -EROFS;
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+static const struct  proc_ops  rtw_adapter_proc_seq_fops = {
+	//.proc_owner = THIS_MODULE,
+	.proc_open = rtw_adapter_proc_open,
+	.proc_read = seq_read,
+	.proc_lseek = seq_lseek,
+	.proc_release = seq_release,
+	.proc_write = rtw_adapter_proc_write,
+};
+
+static const struct  proc_ops  rtw_adapter_proc_sseq_fops = {
+	//.proc_owner = THIS_MODULE,
+	.proc_open = rtw_adapter_proc_open,
+	.proc_read = seq_read,
+	.proc_lseek = seq_lseek,
+	.proc_release = single_release,
+	.proc_write = rtw_adapter_proc_write,
+};
+
+#else
+
 static const struct file_operations rtw_adapter_proc_seq_fops = {
 	.owner = THIS_MODULE,
 	.open = rtw_adapter_proc_open,
@@ -3700,6 +3747,7 @@ static const struct file_operations rtw_adapter_proc_sseq_fops = {
 	.release = single_release,
 	.write = rtw_adapter_proc_write,
 };
+#endif
 
 int proc_get_odm_adaptivity(struct seq_file *m, void *v)
 {
@@ -3855,6 +3903,26 @@ static ssize_t rtw_odm_proc_write(struct file *file, const char __user *buffer,
 	return -EROFS;
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+static const struct  proc_ops  rtw_odm_proc_seq_fops = {
+	//.proc_owner = THIS_MODULE,
+	.proc_open = rtw_odm_proc_open,
+	.proc_read = seq_read,
+	.proc_lseek = seq_lseek,
+	.proc_release = seq_release,
+	.proc_write = rtw_odm_proc_write,
+};
+
+static const struct  proc_ops  rtw_odm_proc_sseq_fops = {
+	//.proc_owner = THIS_MODULE,
+	.proc_open = rtw_odm_proc_open,
+	.proc_read = seq_read,
+	.proc_lseek = seq_lseek,
+	.proc_release = single_release,
+	.proc_write = rtw_odm_proc_write,
+};
+
+#else
 static const struct file_operations rtw_odm_proc_seq_fops = {
 	.owner = THIS_MODULE,
 	.open = rtw_odm_proc_open,
@@ -3873,6 +3941,8 @@ static const struct file_operations rtw_odm_proc_sseq_fops = {
 	.write = rtw_odm_proc_write,
 };
 
+#endif
+
 struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev)
 {
 	struct proc_dir_entry *dir_odm = NULL;
@@ -3996,6 +4066,26 @@ static ssize_t rtw_mcc_proc_write(struct file *file, const char __user *buffer,
 	return -EROFS;
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+static const struct  proc_ops  rtw_mcc_proc_seq_fops = {
+	.proc_owner = THIS_MODULE,
+	.proc_open = rtw_mcc_proc_open,
+	.proc_read = seq_read,
+	.proc_lseek = seq_lseek,
+	.proc_release = seq_release,
+	.proc_write = rtw_mcc_proc_write,
+};
+
+static const struct  proc_ops  rtw_mcc_proc_sseq_fops = {
+	.proc_owner = THIS_MODULE,
+	.proc_open = rtw_mcc_proc_open,
+	.proc_read = seq_read,
+	.proc_lseek = seq_lseek,
+	.proc_release = single_release,
+	.proc_write = rtw_mcc_proc_write,
+};
+
+#else
 static const struct file_operations rtw_mcc_proc_seq_fops = {
 	.owner = THIS_MODULE,
 	.open = rtw_mcc_proc_open,
@@ -4013,6 +4103,7 @@ static const struct file_operations rtw_mcc_proc_sseq_fops = {
 	.release = single_release,
 	.write = rtw_mcc_proc_write,
 };
+#endif
 
 struct proc_dir_entry *rtw_mcc_proc_init(struct net_device *dev)
 {
diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c
index e5323f1..82a37d2 100644
--- a/os_dep/osdep_service.c
+++ b/os_dep/osdep_service.c
@@ -286,7 +286,7 @@ inline struct sk_buff *_rtw_skb_clone(struct sk_buff *skb)
 	return skb_clone(skb);
 #endif /* PLATFORM_FREEBSD */
 }
-inline struct sk_buff *_rtw_pskb_copy(struct sk_buff *skb)
+static inline struct sk_buff *_rtw_pskb_copy(struct sk_buff *skb)
 {
 #ifdef PLATFORM_LINUX
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36))