From 75d28379ec00c6328e9cb73336f118d4549616dd Mon Sep 17 00:00:00 2001 From: Butterfly Date: Mon, 8 Nov 2021 17:37:10 +0300 Subject: [PATCH 1/7] Added 20F4:808A and 13B1:0045 support Added TRENDnet TEW-808UBM and Linksys WUSB3600 v2 support for v5.8.7.1 --- os_dep/linux/usb_intf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c index 4d8c215..5e1d889 100644 --- a/os_dep/linux/usb_intf.c +++ b/os_dep/linux/usb_intf.c @@ -249,6 +249,8 @@ static struct usb_device_id rtw_usb_id_tbl[] = { {USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0138, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* TP-Link Archer T3U Plus V1 */ {USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xB822, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Edimax EW-7822ULC */ {USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xC822, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Edimax EW-7822UTC */ + {USB_DEVICE_AND_INTERFACE_INFO(0x20F4, 0x808A, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* TRENDnet TEW-808UBM */ + {USB_DEVICE_AND_INTERFACE_INFO(0x13b1, 0x0045, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Linksys WUSB3600 v2 */ #endif /* CONFIG_RTL8822B */ #ifdef CONFIG_RTL8723D From abf86be86eb3c31b56b055a7432a7627dfde345c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20G=C3=B6rner?= <5477952+MaxG87@users.noreply.github.com> Date: Wed, 10 Aug 2022 11:12:25 +0200 Subject: [PATCH 2/7] Fix one occassion of Werror=address With GCC 12 gcc started to detect if comparisons to addresses are always true. This could indicate a bug, as seen in the Linux kernel. For instance, a simple overlooked ampersand could turn a useful comparison to a tautological default, e.g. in `&my_struct->my_value`. In this particular case it seems as if the comparison was superfluous. --- core/rtw_mlme_ext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 7334dc5..6fc7bee 100755 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -8995,7 +8995,7 @@ static u32 rtw_append_assoc_req_owe_ie(_adapter *adapter, u8 *pbuf) if (sec == NULL) goto exit; - if (sec->owe_ie && sec->owe_ie_len > 0) { + if (sec->owe_ie_len > 0) { len = sec->owe_ie_len; _rtw_memcpy(pbuf, sec->owe_ie, len); } @@ -16655,4 +16655,3 @@ int rtw_sae_preprocess(_adapter *adapter, const u8 *buf, u32 len, u8 tx) return _SUCCESS; #endif /* CONFIG_IOCTL_CFG80211 */ } - From 2f224a9a8926e589e8e85fad0ec325f39a72f80a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20G=C3=B6rner?= <5477952+MaxG87@users.noreply.github.com> Date: Wed, 10 Aug 2022 11:12:25 +0200 Subject: [PATCH 3/7] Fix one occassion of Werror=address With GCC 12 gcc started to detect if comparisons to addresses are always true. This could indicate a bug, as seen in the Linux kernel. For instance, a simple overlooked ampersand could turn a useful comparison to a tautological default, e.g. in `&my_struct->my_value`. In this particular case the function guarded by the condition is empty for Linux. It has implementations only for FreeBSD and Windows. This, the entire block is removed. --- core/rtw_sta_mgt.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index e6d2fb1..8530a99 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -380,13 +380,8 @@ static void _rtw_free_sta_recv_priv_lock(struct sta_recv_priv *psta_recvpriv) void rtw_mfree_stainfo(struct sta_info *psta); void rtw_mfree_stainfo(struct sta_info *psta) { - - if (&psta->lock != NULL) - _rtw_spinlock_free(&psta->lock); - _rtw_free_sta_xmit_priv_lock(&psta->sta_xmitpriv); _rtw_free_sta_recv_priv_lock(&psta->sta_recvpriv); - } From 95c81e43faafdcb578b70bde22e9a41bf958e7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20G=C3=B6rner?= <5477952+MaxG87@users.noreply.github.com> Date: Wed, 10 Aug 2022 11:12:25 +0200 Subject: [PATCH 4/7] Fix one occassion of Werror=address With GCC 12 gcc started to detect if comparisons to addresses are always true. This could indicate a bug, as seen in the Linux kernel. For instance, a simple overlooked ampersand could turn a useful comparison to a tautological default, e.g. in `&my_struct->my_value`. In this particular case it seemed as if it was forgotten to make use of the array index. It is very unclear whether this exposes more bugs, because without the patch both affected loops were effectively disabled. Now they are enabled again and it is unclear whether this correct. --- core/rtw_ap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/rtw_ap.c b/core/rtw_ap.c index 15910d0..2ec750a 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -4400,7 +4400,7 @@ static u8 rtw_ap_update_chbw_by_ifbmp(struct dvobj_priv *dvobj, u8 ifbmp int i; for (i = 0; i < dvobj->iface_nums; i++) { - if (!(ifbmp & BIT(i)) || !dvobj->padapters) + if (!(ifbmp & BIT(i)) || !dvobj->padapters[i]) continue; iface = dvobj->padapters[i]; @@ -4420,7 +4420,7 @@ static u8 rtw_ap_update_chbw_by_ifbmp(struct dvobj_priv *dvobj, u8 ifbmp } for (i = 0; i < dvobj->iface_nums; i++) { - if (!(ifbmp & BIT(i)) || !dvobj->padapters) + if (!(ifbmp & BIT(i)) || !dvobj->padapters[i]) continue; iface = dvobj->padapters[i]; @@ -4591,7 +4591,7 @@ u8 rtw_ap_chbw_decision(_adapter *adapter, u8 ifbmp, u8 excl_ifbmp #ifdef CONFIG_RTW_MESH for (i = 0; i < dvobj->iface_nums; i++) - if ((ifbmp & BIT(i)) && dvobj->padapters) + if ((ifbmp & BIT(i)) && dvobj->padapters[i]) if (!MLME_IS_MESH(dvobj->padapters[i])) break; ifbmp_all_mesh = i >= dvobj->iface_nums ? 1 : 0; From fb0b1fd2c6c8f671366a2fd458076cc422b4db84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20G=C3=B6rner?= <5477952+MaxG87@users.noreply.github.com> Date: Thu, 25 Aug 2022 21:31:55 +0200 Subject: [PATCH 5/7] Replace to noop calls with comment Two calls in a function that had to be touched anyways were effectively no-op on Linux. Thus, they are removed now. A comment explains why this function with empty body exists. Thanks at @CGarces for pointing this out. --- Makefile | 1 - core/rtw_sta_mgt.c | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 03025e4..db890fa 100755 --- a/Makefile +++ b/Makefile @@ -2457,4 +2457,3 @@ clean: rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~ rm -fr .tmp_versions *.ur-safe endif - diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index 8530a99..70a84f0 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -380,8 +380,13 @@ static void _rtw_free_sta_recv_priv_lock(struct sta_recv_priv *psta_recvpriv) void rtw_mfree_stainfo(struct sta_info *psta); void rtw_mfree_stainfo(struct sta_info *psta) { - _rtw_free_sta_xmit_priv_lock(&psta->sta_xmitpriv); - _rtw_free_sta_recv_priv_lock(&psta->sta_recvpriv); + // Here used to be some calls to helper functions that would call + // _rtw_spinlock_free several times. However, _rtw_spinlock_free does not + // do anything on Linux. Since this project is concerned only with Linux, + // it is safe to remove the calls entirely. + // This function is kept. Removing it would force us to remove it in the + // callers, which has the danger of becoming incompatible with possible + // future patches. } @@ -1337,4 +1342,3 @@ void dump_pre_link_sta_ctl(void *sel, struct sta_priv *stapriv) } } #endif /* CONFIG_RTW_PRE_LINK_STA */ - From e61bba54d9631bffeacaa60bea954f3d1a03fac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20G=C3=B6rner?= <5477952+MaxG87@users.noreply.github.com> Date: Thu, 25 Aug 2022 21:35:36 +0200 Subject: [PATCH 6/7] Disable -Werror=address While some occasions were found by it and hopefully fixed, the issues in the debug file are too numerous to fix by hand. Thus, this error is silenced. --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index db890fa..b06bbbe 100755 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ EXTRA_CFLAGS += -Wno-unused-function EXTRA_CFLAGS += -Wno-unused-parameter EXTRA_CFLAGS += -Wno-unused-variable EXTRA_CFLAGS += -Wno-array-bounds +EXTRA_CFLAGS += -Wno-address GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) ifeq ($(GCC_VER_49),1) From 5d33030c3d05981b880ecfb76e0d133fda7928e4 Mon Sep 17 00:00:00 2001 From: Deokgyu Yang Date: Sun, 10 Jul 2022 06:18:36 +0000 Subject: [PATCH 7/7] Use nproc to build driver using multithreads Signed-off-by: Deokgyu Yang --- dkms.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dkms.conf b/dkms.conf index 710be5c..a0e5440 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,6 +1,7 @@ PACKAGE_NAME="rtl88x2bu" PACKAGE_VERSION="5.8.7.1" -MAKE[0]="'make' KVER=$kernelver src=$source_tree/rtl88x2bu-$PACKAGE_VERSION" +PROCS_NUM="$(nproc)" +MAKE[0]="'make' -j $PROCS_NUM KVER=$kernelver src=$source_tree/rtl88x2bu-$PACKAGE_VERSION" CLEAN="make clean" BUILT_MODULE_NAME[0]="88x2bu" DEST_MODULE_LOCATION[0]="/kernel/drivers/net"