From a66b3b5a6119e93d36f98e9bf9beb8d3e08a4e5c Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Tue, 1 Aug 2023 12:34:18 +0200 Subject: [PATCH] Fix rtl8812au-ct --- 6.1/package/kernel/rtl8812au-ct/Makefile | 13 +- .../patches/001-use-kernel-byteorder.patch | 15 ++ .../patches/002-vendor_command_policy.patch | 156 ++++++++++++++++++ .../patches/003-wireless-5.8.patch | 30 ++++ .../patches/004-remove-extern-inline.patch | 24 +++ .../rtl8812au-ct/patches/005-kernel-6.1.patch | 14 ++ ...osdep_service-use-new-get_random_u32.patch | 25 +++ ...de-fix-always-TRUE-condition-warning.patch | 72 ++++++++ ...de-use-correct-type-for-tasklet_init.patch | 93 +++++++++++ ...09-treewide-drop-const-from-dev_addr.patch | 56 +++++++ ...linux-proc-move-to-pde_data-function.patch | 26 +++ .../rtl8812au-ct/patches/100-api_update.patch | 56 +++++++ 12 files changed, 571 insertions(+), 9 deletions(-) create mode 100644 6.1/package/kernel/rtl8812au-ct/patches/001-use-kernel-byteorder.patch create mode 100644 6.1/package/kernel/rtl8812au-ct/patches/002-vendor_command_policy.patch create mode 100644 6.1/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch create mode 100644 6.1/package/kernel/rtl8812au-ct/patches/004-remove-extern-inline.patch create mode 100644 6.1/package/kernel/rtl8812au-ct/patches/005-kernel-6.1.patch create mode 100644 6.1/package/kernel/rtl8812au-ct/patches/006-os_dep-osdep_service-use-new-get_random_u32.patch create mode 100644 6.1/package/kernel/rtl8812au-ct/patches/007-treewide-fix-always-TRUE-condition-warning.patch create mode 100644 6.1/package/kernel/rtl8812au-ct/patches/008-treewide-use-correct-type-for-tasklet_init.patch create mode 100644 6.1/package/kernel/rtl8812au-ct/patches/009-treewide-drop-const-from-dev_addr.patch create mode 100644 6.1/package/kernel/rtl8812au-ct/patches/010-os_dep-linux-proc-move-to-pde_data-function.patch create mode 100644 6.1/package/kernel/rtl8812au-ct/patches/100-api_update.patch diff --git a/6.1/package/kernel/rtl8812au-ct/Makefile b/6.1/package/kernel/rtl8812au-ct/Makefile index e0893b0c..be1acabf 100644 --- a/6.1/package/kernel/rtl8812au-ct/Makefile +++ b/6.1/package/kernel/rtl8812au-ct/Makefile @@ -6,16 +6,11 @@ PKG_RELEASE=1 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= -#PKG_SOURCE_URL:=https://github.com/greearb/rtl8812AU_8821AU_linux.git -PKG_SOURCE_URL:=https://github.com/aircrack-ng/rtl8812au.git -#PKG_MIRROR_HASH:=31e658df3e4d4c18c396259c2e0bef2bfc44a4aa870931f031a31e948be98af4 +PKG_SOURCE_URL:=https://github.com/greearb/rtl8812AU_8821AU_linux.git +PKG_MIRROR_HASH:=31e658df3e4d4c18c396259c2e0bef2bfc44a4aa870931f031a31e948be98af4 PKG_SOURCE_PROTO:=git -#PKG_SOURCE_DATE:=2021-11-07 -#PKG_SOURCE_VERSION:=39df55967b7de9f6c9600017b724303f95a8b9e2 -#PKG_SOURCE_DATE:=2022-10-26 -#PKG_SOURCE_VERSION:=9b2b203a217e1320602a0eb07c338a1bfca0f5a6 -PKG_SOURCE_DATE:=2023-04-02 -PKG_SOURCE_VERSION:=fe71d8368671cb074b8ed6278ffd57308056fa20 +PKG_SOURCE_DATE:=2021-11-07 +PKG_SOURCE_VERSION:=39df55967b7de9f6c9600017b724303f95a8b9e2 PKG_MAINTAINER:=Ben Greear PKG_BUILD_PARALLEL:=1 diff --git a/6.1/package/kernel/rtl8812au-ct/patches/001-use-kernel-byteorder.patch b/6.1/package/kernel/rtl8812au-ct/patches/001-use-kernel-byteorder.patch new file mode 100644 index 00000000..dd42b124 --- /dev/null +++ b/6.1/package/kernel/rtl8812au-ct/patches/001-use-kernel-byteorder.patch @@ -0,0 +1,15 @@ +Fix compile problem when rtw_byteorder.h and asm/byteorder.h gets +included in addition for example indirectly, do not use realtek own copy +of the byteorder headers. + +--- a/include/drv_types.h ++++ b/include/drv_types.h +@@ -30,7 +30,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include diff --git a/6.1/package/kernel/rtl8812au-ct/patches/002-vendor_command_policy.patch b/6.1/package/kernel/rtl8812au-ct/patches/002-vendor_command_policy.patch new file mode 100644 index 00000000..0b56ed6e --- /dev/null +++ b/6.1/package/kernel/rtl8812au-ct/patches/002-vendor_command_policy.patch @@ -0,0 +1,156 @@ +mac80211 from kernel 5.3 and later checks the new policy attribute. +As this driver does not define any policies and does strange things, +just tell mac80211 to ignore the policies. + +--- a/os_dep/linux/rtw_cfgvendor.c ++++ b/os_dep/linux/rtw_cfgvendor.c +@@ -1173,7 +1173,8 @@ static const struct wiphy_vendor_command + .subcmd = BRCM_VENDOR_SCMD_PRIV_STR + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_priv_string_handler ++ .doit = wl_cfgvendor_priv_string_handler, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + #if defined(GSCAN_SUPPORT) && 0 + { +@@ -1182,7 +1183,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_GET_CAPABILITIES + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_gscan_get_capabilities ++ .doit = wl_cfgvendor_gscan_get_capabilities, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1190,7 +1192,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_SET_CONFIG + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_set_scan_cfg ++ .doit = wl_cfgvendor_set_scan_cfg, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1198,7 +1201,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_SET_SCAN_CONFIG + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_set_batch_scan_cfg ++ .doit = wl_cfgvendor_set_batch_scan_cfg, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1206,7 +1210,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_ENABLE_GSCAN + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_initiate_gscan ++ .doit = wl_cfgvendor_initiate_gscan, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1214,7 +1219,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_ENABLE_FULL_SCAN_RESULTS + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_enable_full_scan_result ++ .doit = wl_cfgvendor_enable_full_scan_result, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1222,7 +1228,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_SET_HOTLIST + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_hotlist_cfg ++ .doit = wl_cfgvendor_hotlist_cfg, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1230,7 +1237,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_SET_SIGNIFICANT_CHANGE_CONFIG + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_significant_change_cfg ++ .doit = wl_cfgvendor_significant_change_cfg, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1238,7 +1246,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_GET_SCAN_RESULTS + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_gscan_get_batch_results ++ .doit = wl_cfgvendor_gscan_get_batch_results, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1246,7 +1255,8 @@ static const struct wiphy_vendor_command + .subcmd = GSCAN_SUBCMD_GET_CHANNEL_LIST + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_gscan_get_channel_list ++ .doit = wl_cfgvendor_gscan_get_channel_list, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + #endif /* GSCAN_SUPPORT */ + #if defined(RTT_SUPPORT) && 0 +@@ -1256,7 +1266,8 @@ static const struct wiphy_vendor_command + .subcmd = RTT_SUBCMD_SET_CONFIG + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_rtt_set_config ++ .doit = wl_cfgvendor_rtt_set_config, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1264,7 +1275,8 @@ static const struct wiphy_vendor_command + .subcmd = RTT_SUBCMD_CANCEL_CONFIG + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_rtt_cancel_config ++ .doit = wl_cfgvendor_rtt_cancel_config, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1272,7 +1284,8 @@ static const struct wiphy_vendor_command + .subcmd = RTT_SUBCMD_GETCAPABILITY + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = wl_cfgvendor_rtt_get_capability ++ .doit = wl_cfgvendor_rtt_get_capability, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + #endif /* RTT_SUPPORT */ + { +@@ -1281,7 +1294,8 @@ static const struct wiphy_vendor_command + .subcmd = ANDR_WIFI_SUBCMD_GET_FEATURE_SET + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = rtw_cfgvendor_get_feature_set ++ .doit = rtw_cfgvendor_get_feature_set, ++ .policy = VENDOR_CMD_RAW_DATA, + }, + { + { +@@ -1289,7 +1303,8 @@ static const struct wiphy_vendor_command + .subcmd = ANDR_WIFI_SUBCMD_GET_FEATURE_SET_MATRIX + }, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, +- .doit = rtw_cfgvendor_get_feature_set_matrix ++ .doit = rtw_cfgvendor_get_feature_set_matrix, ++ .policy = VENDOR_CMD_RAW_DATA, + } + }; + diff --git a/6.1/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch b/6.1/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch new file mode 100644 index 00000000..67ebb82b --- /dev/null +++ b/6.1/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch @@ -0,0 +1,30 @@ +--- a/os_dep/linux/ioctl_cfg80211.c ++++ b/os_dep/linux/ioctl_cfg80211.c +@@ -5177,6 +5177,15 @@ exit: + return ret; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) || defined(BUILD_OPENWRT) ++static void cfg80211_rtw_update_mgmt_frame_registrations(struct wiphy *wiphy, ++ struct wireless_dev *wdev, ++ struct mgmt_frame_regs *upd) ++{ ++ ++} ++#endif ++ + #if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) + static int cfg80211_rtw_tdls_mgmt(struct wiphy *wiphy, + struct net_device *ndev, +@@ -5990,7 +5999,10 @@ static struct cfg80211_ops rtw_cfg80211_ + .cancel_remain_on_channel = cfg80211_rtw_cancel_remain_on_channel, + #endif + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)) || defined(BUILD_OPENWRT) ++ .mgmt_tx = cfg80211_rtw_mgmt_tx, ++ .update_mgmt_frame_registrations = cfg80211_rtw_update_mgmt_frame_registrations, ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + .mgmt_tx = cfg80211_rtw_mgmt_tx, + #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,34) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,35)) + .action = cfg80211_rtw_mgmt_tx, diff --git a/6.1/package/kernel/rtl8812au-ct/patches/004-remove-extern-inline.patch b/6.1/package/kernel/rtl8812au-ct/patches/004-remove-extern-inline.patch new file mode 100644 index 00000000..871fe106 --- /dev/null +++ b/6.1/package/kernel/rtl8812au-ct/patches/004-remove-extern-inline.patch @@ -0,0 +1,24 @@ +--- a/include/ieee80211.h ++++ b/include/ieee80211.h +@@ -1313,18 +1313,18 @@ enum ieee80211_state { + (((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \ + (((Addr[5]) & 0xff) == 0xff)) + #else +-extern __inline int is_multicast_mac_addr(const u8 *addr) ++__inline static int is_multicast_mac_addr(const u8 *addr) + { + return ((addr[0] != 0xff) && (0x01 & addr[0])); + } + +-extern __inline int is_broadcast_mac_addr(const u8 *addr) ++__inline static int is_broadcast_mac_addr(const u8 *addr) + { + return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ + (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); + } + +-extern __inline int is_zero_mac_addr(const u8 *addr) ++__inline static int is_zero_mac_addr(const u8 *addr) + { + return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \ + (addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00)); diff --git a/6.1/package/kernel/rtl8812au-ct/patches/005-kernel-6.1.patch b/6.1/package/kernel/rtl8812au-ct/patches/005-kernel-6.1.patch new file mode 100644 index 00000000..98aa6784 --- /dev/null +++ b/6.1/package/kernel/rtl8812au-ct/patches/005-kernel-6.1.patch @@ -0,0 +1,14 @@ +--- a/include/osdep_service_linux.h ++++ b/include/osdep_service_linux.h +@@ -163,7 +163,11 @@ typedef void* _thread_hdl_; + typedef int thread_return; + typedef void* thread_context; + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)) ++#define thread_exit() kthread_complete_and_exit(NULL, 0) ++#else + #define thread_exit() complete_and_exit(NULL, 0) ++#endif + + typedef void timer_hdl_return; + typedef void* timer_hdl_context; diff --git a/6.1/package/kernel/rtl8812au-ct/patches/006-os_dep-osdep_service-use-new-get_random_u32.patch b/6.1/package/kernel/rtl8812au-ct/patches/006-os_dep-osdep_service-use-new-get_random_u32.patch new file mode 100644 index 00000000..16ebbb1e --- /dev/null +++ b/6.1/package/kernel/rtl8812au-ct/patches/006-os_dep-osdep_service-use-new-get_random_u32.patch @@ -0,0 +1,25 @@ +From e8f10b21abd8ae440632f561f8b65f37b4b55cc8 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 30 Jul 2023 11:16:32 +0200 +Subject: [PATCH 1/5] os_dep/osdep_service: use new get_random_u32 + +Drop prandom_u32 as got deprecated for get_random_u32. + +Signed-off-by: Christian Marangi +--- + os_dep/osdep_service.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/os_dep/osdep_service.c ++++ b/os_dep/osdep_service.c +@@ -2335,7 +2335,9 @@ u64 rtw_division64(u64 x, u64 y) + inline u32 rtw_random32(void) + { + #ifdef PLATFORM_LINUX +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0)) ++ return get_random_u32(); ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) + return prandom_u32(); + #elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)) + u32 random_int; diff --git a/6.1/package/kernel/rtl8812au-ct/patches/007-treewide-fix-always-TRUE-condition-warning.patch b/6.1/package/kernel/rtl8812au-ct/patches/007-treewide-fix-always-TRUE-condition-warning.patch new file mode 100644 index 00000000..be7b70ab --- /dev/null +++ b/6.1/package/kernel/rtl8812au-ct/patches/007-treewide-fix-always-TRUE-condition-warning.patch @@ -0,0 +1,72 @@ +From dc4024894c9deefc56f8dd6b2d2822b277f268a5 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 30 Jul 2023 11:18:48 +0200 +Subject: [PATCH 2/5] treewide: fix always TRUE condition warning + +Fix always TRUE condition warning an drop redundant check. + +Signed-off-by: Christian Marangi +--- + core/rtw_sta_mgt.c | 3 +-- + hal/OUTSRC/phydm_debug.c | 16 ++++++---------- + os_dep/linux/ioctl_cfg80211.c | 3 +-- + 3 files changed, 8 insertions(+), 14 deletions(-) + +--- a/core/rtw_sta_mgt.c ++++ b/core/rtw_sta_mgt.c +@@ -207,8 +207,7 @@ void rtw_mfree_stainfo(struct sta_info * + { + _func_enter_; + +- if(&psta->lock != NULL) +- _rtw_spinlock_free(&psta->lock); ++ _rtw_spinlock_free(&psta->lock); + + _rtw_free_sta_xmit_priv_lock(&psta->sta_xmitpriv); + _rtw_free_sta_recv_priv_lock(&psta->sta_recvpriv); +--- a/hal/OUTSRC/phydm_debug.c ++++ b/hal/OUTSRC/phydm_debug.c +@@ -870,12 +870,10 @@ phydm_cmd_parser( + case PHYDM_RA: + + for(i=0; i<5; i++) { +- if(input[i+1]) { +- PHYDM_SSCANF(input[i+1], DCMD_DECIMAL, &var1[i]); ++ PHYDM_SSCANF(input[i+1], DCMD_DECIMAL, &var1[i]); + +- PHYDM_SNPRINTF((output+used, out_len-used, "new SET, RA_var[%d]= (( %d ))\n", i , var1[i])); +- input_idx++; +- } ++ PHYDM_SNPRINTF((output+used, out_len-used, "new SET, RA_var[%d]= (( %d ))\n", i , var1[i])); ++ input_idx++; + } + + if(input_idx>=1) { +@@ -891,12 +889,10 @@ phydm_cmd_parser( + case PHYDM_PATHDIV: + + for(i=0; i<5; i++) { +- if(input[i+1]) { +- PHYDM_SSCANF(input[i+1], DCMD_HEX, &var1[i]); ++ PHYDM_SSCANF(input[i+1], DCMD_HEX, &var1[i]); + +- PHYDM_SNPRINTF((output+used, out_len-used, "new SET, PATHDIV_var[%d]= (( %d ))\n", i , var1[i])); +- input_idx++; +- } ++ PHYDM_SNPRINTF((output+used, out_len-used, "new SET, PATHDIV_var[%d]= (( %d ))\n", i , var1[i])); ++ input_idx++; + } + + if(input_idx>=1) { +--- a/os_dep/linux/ioctl_cfg80211.c ++++ b/os_dep/linux/ioctl_cfg80211.c +@@ -2170,8 +2170,7 @@ static int cfg80211_rtw_scan(struct wiph + + #ifdef CONFIG_P2P + if( pwdinfo->driver_interface == DRIVER_CFG80211 ) { +- if(ssids->ssid != NULL +- && _rtw_memcmp(ssids->ssid, "DIRECT-", 7) ++ if(_rtw_memcmp(ssids->ssid, "DIRECT-", 7) + && rtw_get_p2p_ie((u8 *)request->ie, request->ie_len, NULL, NULL) + ) { + if(rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { diff --git a/6.1/package/kernel/rtl8812au-ct/patches/008-treewide-use-correct-type-for-tasklet_init.patch b/6.1/package/kernel/rtl8812au-ct/patches/008-treewide-use-correct-type-for-tasklet_init.patch new file mode 100644 index 00000000..60674131 --- /dev/null +++ b/6.1/package/kernel/rtl8812au-ct/patches/008-treewide-use-correct-type-for-tasklet_init.patch @@ -0,0 +1,93 @@ +From 5f3bb5602615894cda88ca1b44fdfafdfb01c8c8 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 30 Jul 2023 11:20:39 +0200 +Subject: [PATCH 3/5] treewide: use correct type for tasklet_init + +Update and use correct type for tasklet_init to fix compilation error +for not valid cast. + +Signed-off-by: Christian Marangi +--- + hal/hal_hci/hal_usb.c | 2 +- + hal/rtl8812a/usb/rtl8812au_xmit.c | 2 +- + hal/rtl8812a/usb/usb_ops_linux.c | 2 +- + include/rtl8812a_xmit.h | 2 +- + include/usb_ops_linux.h | 2 +- + os_dep/linux/usb_ops_linux.c | 4 ++-- + 6 files changed, 7 insertions(+), 7 deletions(-) + +--- a/hal/hal_hci/hal_usb.c ++++ b/hal/hal_hci/hal_usb.c +@@ -35,7 +35,7 @@ int usb_init_recv_priv(_adapter *padapte + + #ifdef PLATFORM_LINUX + tasklet_init(&precvpriv->recv_tasklet, +- (void(*)(unsigned long))usb_recv_tasklet, ++ usb_recv_tasklet, + (unsigned long)padapter); + #endif /* PLATFORM_LINUX */ + +--- a/hal/rtl8812a/usb/rtl8812au_xmit.c ++++ b/hal/rtl8812a/usb/rtl8812au_xmit.c +@@ -30,7 +30,7 @@ s32 rtl8812au_init_xmit_priv(_adapter *p + + #ifdef PLATFORM_LINUX + tasklet_init(&pxmitpriv->xmit_tasklet, +- (void(*)(unsigned long))rtl8812au_xmit_tasklet, ++ rtl8812au_xmit_tasklet, + (unsigned long)padapter); + #endif + #ifdef CONFIG_TX_EARLY_MODE +--- a/hal/rtl8812a/usb/usb_ops_linux.c ++++ b/hal/rtl8812a/usb/usb_ops_linux.c +@@ -475,7 +475,7 @@ _exit_recvbuf2recvframe: + } + + +-void rtl8812au_xmit_tasklet(void *priv) ++void rtl8812au_xmit_tasklet(unsigned long priv) + { + int ret = _FALSE; + _adapter *padapter = (_adapter*)priv; +--- a/include/rtl8812a_xmit.h ++++ b/include/rtl8812a_xmit.h +@@ -331,7 +331,7 @@ s32 rtl8812au_hal_xmit(PADAPTER padapter + s32 rtl8812au_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe); + s32 rtl8812au_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe); + s32 rtl8812au_xmit_buf_handler(PADAPTER padapter); +-void rtl8812au_xmit_tasklet(void *priv); ++void rtl8812au_xmit_tasklet(unsigned long priv); + s32 rtl8812au_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); + #endif + +--- a/include/usb_ops_linux.h ++++ b/include/usb_ops_linux.h +@@ -78,7 +78,7 @@ int usb_write16(struct intf_hdl *pintfhd + int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val); + int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata); + u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem); +-void usb_recv_tasklet(void *priv); ++void usb_recv_tasklet(unsigned long priv); + + #endif + +--- a/os_dep/linux/usb_ops_linux.c ++++ b/os_dep/linux/usb_ops_linux.c +@@ -717,7 +717,7 @@ void usb_init_recvbuf(_adapter *padapter + int recvbuf2recvframe(PADAPTER padapter, void *ptr); + + #ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX +-void usb_recv_tasklet(void *priv) ++void usb_recv_tasklet(unsigned long priv) + { + struct recv_buf *precvbuf = NULL; + _adapter *padapter = (_adapter*)priv; +@@ -870,7 +870,7 @@ u32 usb_read_port(struct intf_hdl *pintf + } + #else // CONFIG_USE_USB_BUFFER_ALLOC_RX + +-void usb_recv_tasklet(void *priv) ++void usb_recv_tasklet(unsigned long priv) + { + _pkt *pskb; + _adapter *padapter = (_adapter*)priv; diff --git a/6.1/package/kernel/rtl8812au-ct/patches/009-treewide-drop-const-from-dev_addr.patch b/6.1/package/kernel/rtl8812au-ct/patches/009-treewide-drop-const-from-dev_addr.patch new file mode 100644 index 00000000..64ad8537 --- /dev/null +++ b/6.1/package/kernel/rtl8812au-ct/patches/009-treewide-drop-const-from-dev_addr.patch @@ -0,0 +1,56 @@ +From 51ab9d6a959de87206731f941b1df39e5c5d63ea Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 30 Jul 2023 11:21:49 +0200 +Subject: [PATCH 4/5] treewide: drop const from dev_addr + +dev_addr is not const and conflict with memcpy function. Fix compilation +warning by casting dev_addr to void*. + +This operation is safe as this is done before netdev register. + +Signed-off-by: Christian Marangi +--- + os_dep/linux/os_intfs.c | 6 +++--- + os_dep/osdep_service.c | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +--- a/os_dep/linux/os_intfs.c ++++ b/os_dep/linux/os_intfs.c +@@ -1885,7 +1885,7 @@ int _netdev_if2_open(struct net_device * + + _rtw_memcpy(padapter->eeprompriv.mac_addr, mac, ETH_ALEN); + rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr, padapter->eeprompriv.mac_addr); +- _rtw_memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); ++ _rtw_memcpy((void *)pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); + } + #endif //CONFIG_PLATFORM_INTEL_BYT + +@@ -2254,7 +2254,7 @@ static int _rtw_drv_register_netdev(_ada + /* alloc netdev name */ + rtw_init_netdev_name(pnetdev, name); + +- _rtw_memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); ++ _rtw_memcpy((void *)pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); + + /* Tell the network stack we exist */ + if (register_netdev(pnetdev) != 0) { +@@ -2334,7 +2334,7 @@ int _netdev_open(struct net_device *pnet + #ifdef CONFIG_PLATFORM_INTEL_BYT + rtw_macaddr_cfg(padapter->eeprompriv.mac_addr); + rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr, padapter->eeprompriv.mac_addr); +- _rtw_memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); ++ _rtw_memcpy((void *)pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); + #endif //CONFIG_PLATFORM_INTEL_BYT + + padapter->bDriverStopped = _FALSE; +--- a/os_dep/osdep_service.c ++++ b/os_dep/osdep_service.c +@@ -2209,7 +2209,7 @@ int rtw_change_ifname(_adapter *padapter + + rtw_init_netdev_name(pnetdev, ifname); + +- _rtw_memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); ++ _rtw_memcpy((void *)pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN); + + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)) + if(!rtnl_is_locked()) diff --git a/6.1/package/kernel/rtl8812au-ct/patches/010-os_dep-linux-proc-move-to-pde_data-function.patch b/6.1/package/kernel/rtl8812au-ct/patches/010-os_dep-linux-proc-move-to-pde_data-function.patch new file mode 100644 index 00000000..1c62e77d --- /dev/null +++ b/6.1/package/kernel/rtl8812au-ct/patches/010-os_dep-linux-proc-move-to-pde_data-function.patch @@ -0,0 +1,26 @@ +From f455198acaa71c2963746a6b17c878c7d1d0e331 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 30 Jul 2023 11:22:58 +0200 +Subject: [PATCH 5/5] os_dep/linux/proc: move to pde_data function + +PDE_DATA macro was dropped in 5.17 with the new pde_data that does the +exact thing. Fix compilation error and use new function. + +Signed-off-by: Christian Marangi +--- + os_dep/linux/rtw_proc.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/os_dep/linux/rtw_proc.c ++++ b/os_dep/linux/rtw_proc.c +@@ -37,6 +37,10 @@ inline struct proc_dir_entry *get_rtw_dr + #define file_inode(file) ((file)->f_dentry->d_inode) + #endif + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0)) ++#define PDE_DATA(inode) pde_data(inode) ++#endif ++ + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)) + #define PDE_DATA(inode) PDE((inode))->data + #define proc_get_parent_data(inode) PDE((inode))->parent->data diff --git a/6.1/package/kernel/rtl8812au-ct/patches/100-api_update.patch b/6.1/package/kernel/rtl8812au-ct/patches/100-api_update.patch new file mode 100644 index 00000000..2c081256 --- /dev/null +++ b/6.1/package/kernel/rtl8812au-ct/patches/100-api_update.patch @@ -0,0 +1,56 @@ +--- a/os_dep/linux/ioctl_cfg80211.c ++++ b/os_dep/linux/ioctl_cfg80211.c +@@ -798,8 +798,8 @@ check_bss: + + DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) +- roam_info.channel = notify_channel; +- roam_info.bssid = cur_network->network.MacAddress; ++ roam_info.links[0].channel = notify_channel; ++ roam_info.links[0].bssid = cur_network->network.MacAddress; + roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2; + roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2; + roam_info.resp_ie = pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6; +@@ -1389,6 +1389,7 @@ exit: + + static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++ int link_id, + u8 key_index, bool pairwise, const u8 *mac_addr, + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr, +@@ -1529,6 +1530,7 @@ addkey_end: + + static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++ int link_id, + u8 key_index, bool pairwise, const u8 *mac_addr, + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr, +@@ -1562,6 +1564,7 @@ static int cfg80211_rtw_get_key(struct w + + static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++ int link_id, + u8 key_index, bool pairwise, const u8 *mac_addr) + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr) +@@ -1581,7 +1584,7 @@ static int cfg80211_rtw_del_key(struct w + } + + static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, +- struct net_device *ndev, u8 key_index ++ struct net_device *ndev, int link_id, u8 key_index + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + , bool unicast, bool multicast + #endif +@@ -4019,7 +4022,8 @@ static int cfg80211_rtw_change_beacon(st + return ret; + } + +-static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev) ++static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, ++ unsigned int link_id) + { + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + return 0;