From: John Thomson Date: Tue, 15 Aug 2023 22:11:45 +0000 (+1000) Subject: rtl8812au-ct: bump to fix kernel 6.1 compile X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c123e4f0533ea0f0a01d0c81eb00b22da5ea9004;p=openwrt%2Fstaging%2Fthess.git rtl8812au-ct: bump to fix kernel 6.1 compile 9b2b203 fix usb_recv_tasklet -Wcast-function-type a027da5 fix kernel 6.1 80211 link_id 7a9c802 fix build for kernel 6.1 prandom 3a3eb24 fix build for kernel 5.17 PDE_DATA fe2afbd fix build for kernel 5.17 const netdev->dev_addr 7275bae fix build for 5.17 kernel complete_and_exit c9c2aa7 Update usb_intf.c revert the upstream 6.1 link_id (depend on kernel version) changes and force 6.1 link_id The downstream patch casting const off the direct dev_addr writes triggers the runtime check from Linux d07b26f5bbea ("dev_addr: add a modification check") Fixes: #13261 Fixes: a07566ead82a ("rtl8812au-ct: fix even more compilation error with kernel 6.1") Signed-off-by: John Thomson --- diff --git a/package/kernel/rtl8812au-ct/Makefile b/package/kernel/rtl8812au-ct/Makefile index be1acabf28..e3b71f75aa 100644 --- a/package/kernel/rtl8812au-ct/Makefile +++ b/package/kernel/rtl8812au-ct/Makefile @@ -7,10 +7,10 @@ PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/greearb/rtl8812AU_8821AU_linux.git -PKG_MIRROR_HASH:=31e658df3e4d4c18c396259c2e0bef2bfc44a4aa870931f031a31e948be98af4 +PKG_MIRROR_HASH:=7ae5ebcba382de97942b13f8edbcb2ebff1a93eb25ae1d3de98317386fafb830 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_MAINTAINER:=Ben Greear PKG_BUILD_PARALLEL:=1 diff --git a/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch b/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch index 67ebb82b38..f84adebe0a 100644 --- a/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch +++ b/package/kernel/rtl8812au-ct/patches/003-wireless-5.8.patch @@ -1,6 +1,6 @@ --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c -@@ -5177,6 +5177,15 @@ exit: +@@ -5196,6 +5196,15 @@ exit: return ret; } @@ -16,7 +16,7 @@ #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_ +@@ -6009,7 +6018,10 @@ static struct cfg80211_ops rtw_cfg80211_ .cancel_remain_on_channel = cfg80211_rtw_cancel_remain_on_channel, #endif diff --git a/package/kernel/rtl8812au-ct/patches/005-kernel-6.1.patch b/package/kernel/rtl8812au-ct/patches/005-kernel-6.1.patch deleted file mode 100644 index 98aa678491..0000000000 --- a/package/kernel/rtl8812au-ct/patches/005-kernel-6.1.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- 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/package/kernel/rtl8812au-ct/patches/006-os_dep-osdep_service-use-new-get_random_u32.patch b/package/kernel/rtl8812au-ct/patches/006-os_dep-osdep_service-use-new-get_random_u32.patch deleted file mode 100644 index 16ebbb1eaa..0000000000 --- a/package/kernel/rtl8812au-ct/patches/006-os_dep-osdep_service-use-new-get_random_u32.patch +++ /dev/null @@ -1,25 +0,0 @@ -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/package/kernel/rtl8812au-ct/patches/007-treewide-fix-always-TRUE-condition-warning.patch b/package/kernel/rtl8812au-ct/patches/007-treewide-fix-always-TRUE-condition-warning.patch index be7b70ab5f..c645c1e8e3 100644 --- a/package/kernel/rtl8812au-ct/patches/007-treewide-fix-always-TRUE-condition-warning.patch +++ b/package/kernel/rtl8812au-ct/patches/007-treewide-fix-always-TRUE-condition-warning.patch @@ -60,7 +60,7 @@ Signed-off-by: Christian Marangi 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 +@@ -2185,8 +2185,7 @@ static int cfg80211_rtw_scan(struct wiph #ifdef CONFIG_P2P if( pwdinfo->driver_interface == DRIVER_CFG80211 ) { diff --git a/package/kernel/rtl8812au-ct/patches/008-treewide-use-correct-type-for-tasklet_init.patch b/package/kernel/rtl8812au-ct/patches/008-treewide-use-correct-type-for-tasklet_init.patch deleted file mode 100644 index 6067413166..0000000000 --- a/package/kernel/rtl8812au-ct/patches/008-treewide-use-correct-type-for-tasklet_init.patch +++ /dev/null @@ -1,93 +0,0 @@ -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/package/kernel/rtl8812au-ct/patches/009-treewide-drop-const-from-dev_addr.patch b/package/kernel/rtl8812au-ct/patches/009-treewide-drop-const-from-dev_addr.patch deleted file mode 100644 index 64ad85372b..0000000000 --- a/package/kernel/rtl8812au-ct/patches/009-treewide-drop-const-from-dev_addr.patch +++ /dev/null @@ -1,56 +0,0 @@ -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/package/kernel/rtl8812au-ct/patches/010-os_dep-linux-proc-move-to-pde_data-function.patch b/package/kernel/rtl8812au-ct/patches/010-os_dep-linux-proc-move-to-pde_data-function.patch deleted file mode 100644 index 1c62e77d1b..0000000000 --- a/package/kernel/rtl8812au-ct/patches/010-os_dep-linux-proc-move-to-pde_data-function.patch +++ /dev/null @@ -1,26 +0,0 @@ -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/package/kernel/rtl8812au-ct/patches/099-cut-linkid-linux-version-code-conditionals.patch b/package/kernel/rtl8812au-ct/patches/099-cut-linkid-linux-version-code-conditionals.patch new file mode 100644 index 0000000000..bb644a9ace --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/099-cut-linkid-linux-version-code-conditionals.patch @@ -0,0 +1,86 @@ +From 30fc9d96fa2ce16209306237e677d3d3cbb12685 Mon Sep 17 00:00:00 2001 +From: John Thomson +Date: Sun, 28 May 2023 13:26:46 +1000 +Subject: [PATCH] Revert "fix kernel 6.1 80211 link_id" + +This reverts commit a027da58e8d8e95827f97222ca321cd0b2d377dd. +--- + os_dep/linux/ioctl_cfg80211.c | 29 +++++------------------------ + 1 file changed, 5 insertions(+), 24 deletions(-) + +--- a/os_dep/linux/ioctl_cfg80211.c ++++ b/os_dep/linux/ioctl_cfg80211.c +@@ -797,14 +797,9 @@ check_bss: + #endif + + DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +- roam_info.links[0].channel = notify_channel; +- roam_info.links[0].bssid = cur_network->network.MacAddress; +-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + roam_info.channel = notify_channel; + roam_info.bssid = cur_network->network.MacAddress; +-#endif +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + 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; +@@ -1393,9 +1388,7 @@ exit: + } + + static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +- int link_id, u8 key_index, bool pairwise, const u8 *mac_addr, +-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + 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, +@@ -1535,9 +1528,7 @@ addkey_end: + } + + static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev, +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +- int link_id, u8 key_index, bool pairwise, const u8 *mac_addr, +-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + 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, +@@ -1570,9 +1561,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(6, 1, 0)) +- int link_id, u8 key_index, bool pairwise, const u8 *mac_addr) +-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) + 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) +@@ -1592,11 +1581,7 @@ static int cfg80211_rtw_del_key(struct w + } + + static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, +- struct net_device *ndev, +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +- int link_id, +-#endif +- u8 key_index ++ struct net_device *ndev, u8 key_index + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + , bool unicast, bool multicast + #endif +@@ -4033,11 +4018,7 @@ static int cfg80211_rtw_change_beacon(st + return ret; + } + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0)) +-static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id) +-#else + static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev) +-#endif + { + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + return 0; diff --git a/package/kernel/rtl8812au-ct/patches/100-api_update.patch b/package/kernel/rtl8812au-ct/patches/100-api_update.patch index 2c081256ed..e7ca4b05f3 100644 --- a/package/kernel/rtl8812au-ct/patches/100-api_update.patch +++ b/package/kernel/rtl8812au-ct/patches/100-api_update.patch @@ -44,7 +44,7 @@ #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 +@@ -4018,7 +4021,8 @@ static int cfg80211_rtw_change_beacon(st return ret; }