Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build on Linux 6.10 Kernel #356

Open
LFRon opened this issue Aug 5, 2024 · 12 comments
Open

Cannot build on Linux 6.10 Kernel #356

LFRon opened this issue Aug 5, 2024 · 12 comments

Comments

@LFRon
Copy link

LFRon commented Aug 5, 2024

I use Linux 6.10 Kernel and use make command,it reports:
/home/mozixun/Cache/rtw89/phy.c: In function ‘rtw89_phy_ra_sta_update’:
/home/mozixun/Cache/rtw89/phy.c:397:21: warning: unused variable ‘mcs_map’ [-Wunused-variable]
397 | u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
| ^~~~~~~
/home/mozixun/Cache/rtw89/phy.c:399:23: error: ‘struct ieee80211_sta’ has no member named ‘vht_cap’
399 | } else if (sta->vht_cap.vht_supported) {
| ^~
In file included from ./include/linux/byteorder/little_endian.h:5,
from ./arch/x86/include/uapi/asm/byteorder.h:5,
from ./include/asm-generic/qrwlock_types.h:6,
from ./arch/x86/include/asm/spinlock_types.h:7,
from ./include/linux/spinlock_types_raw.h:7,
from ./include/linux/ratelimit_types.h:7,
from ./include/linux/printk.h:9,
from ./include/asm-generic/bug.h:22,
from ./arch/x86/include/asm/bug.h:87,
from ./include/linux/bug.h:5,
from ./include/linux/average.h:5,
from /home/mozixun/Cache/rtw89/core.h:8,
from /home/mozixun/Cache/rtw89/coex.h:8,
from /home/mozixun/Cache/rtw89/phy.c:5:
/home/mozixun/Cache/rtw89/phy.c:400:46: error: ‘struct ieee80211_sta’ has no member named ‘vht_cap’
400 | u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
| ^~
./include/uapi/linux/byteorder/little_endian.h:37:51: note: in definition of macro ‘__le16_to_cpu’
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
/home/mozixun/Cache/rtw89/phy.c:400:31: note: in expansion of macro ‘le16_to_cpu’
400 | u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
| ^~~~~~~~~~~
make[3]: *** [scripts/Makefile.build:244: /home/mozixun/Cache/rtw89/phy.o] Error 1
make[2]: *** [/usr/src/linux-headers-6.10.0-dppve/Makefile:1934: /home/mozixun/Cache/rtw89] Error 2
make[1]: *** [Makefile:240: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.10.0-dppve'
make: *** [Makefile:104: all] Error 2

Could developer improve the support of Linux higher kernel version?Thanks!

@gustavoflw
Copy link

I managed to get my WiFi working again in Arch Linux by uninstalling this driver and unblacklisting the kernel modules in /etc/modprobe.d/.

@LFRon
Copy link
Author

LFRon commented Aug 6, 2024

I managed to get my WiFi working again in Arch Linux by uninstalling this driver and unblacklisting the kernel modules in /etc/modprobe.d/.

Sounds good!How to do it?

@gustavoflw
Copy link

gustavoflw commented Aug 6, 2024

I managed to get my WiFi working again in Arch Linux by uninstalling this driver and unblacklisting the kernel modules in /etc/modprobe.d/.

Sounds good!How to do it?

# Uninstall the driver. In my case, it had been installed with yay
yay -R rtw89-dkms-git

# Unblacklist the kernel modules. In my case there was a file that I had placed for blacklisting kernel modules. Find the file in:
ls /etc/modprobe.d/

# Rebuild initramfs
sudo mkinitcpio -P

# Mine was fine after rebooting
reboot

@charlesluo2014
Copy link

same in ubuntu24.04,kernel version 6.10.4

@CharSnipeur
Copy link

my modifs to compil under 6.10.4 :

diff --git a/pci.c b/pci.c
index 7b00476..3817ae6 100644
--- a/pci.c
+++ b/pci.c
@@ -3637,7 +3637,7 @@ static int rtw89_pci_request_irq(struct rtw89_dev *rtwdev,
        unsigned long flags = 0;
        int ret;
 
-       flags |= PCI_IRQ_LEGACY | PCI_IRQ_MSI;
+       flags |=  PCI_IRQ_MSI;
        ret = pci_alloc_irq_vectors(pdev, 1, 1, flags);
        if (ret < 0) {
                rtw89_err(rtwdev, "failed to alloc irq vectors, ret %d\n", ret);
diff --git a/phy.c b/phy.c
index 8427b32..789d91a 100644
--- a/phy.c
+++ b/phy.c
@@ -395,7 +395,7 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev,
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) || (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)))
        } else if (sta->deflink.vht_cap.vht_supported) {
                u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
        } else if (sta->vht_cap.vht_supported) {
                u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
 #endif

But modules don't insert good => Invalid Aggument... :-(

@CharSnipeur
Copy link

According to https://lore.kernel.org/linux-rdma/[email protected]/t/ I replace PCI_IRQ_LEGACY by PCI_IRQ_INTX
I think is better.
I have the "warning" Skipping BTF generation [my module name] due to unavailabilty of vmlinux And use https://askubuntu.com/questions/1348250/skipping-btf-generation-xxx-due-to-unavailability-of-vmlinux-on-ubuntu-21-04 to correct this.
But Always : # modprobe -v rtw_8851b insmod /lib/modules/6.10.4-custom/kernel/drivers/net/wireless/realtek/rtw89/rtw89core.ko.xz modprobe: ERROR: could not insert 'rtw_8851b': Invalid argument

@pkshih
Copy link

pkshih commented Aug 19, 2024

My changes for kernel 6.10.2.
I think it can be also compatible to older kernels.

@brianwitte
Could you merge this change below?

diff --git a/pci.c b/pci.c
index 7b00476a5dee..e7ee2729179f 100644
--- a/pci.c
+++ b/pci.c
@@ -3637,7 +3637,11 @@ static int rtw89_pci_request_irq(struct rtw89_dev *rtwdev,
        unsigned long flags = 0;
        int ret;

-       flags |= PCI_IRQ_LEGACY | PCI_IRQ_MSI;
+#ifndef PCI_IRQ_INTX
+#define PCI_IRQ_INTX PCI_IRQ_LEGACY
+#endif
+
+       flags |= PCI_IRQ_INTX | PCI_IRQ_MSI;
        ret = pci_alloc_irq_vectors(pdev, 1, 1, flags);
        if (ret < 0) {
                rtw89_err(rtwdev, "failed to alloc irq vectors, ret %d\n", ret);
diff --git a/phy.c b/phy.c
index 8427b3231560..bb00905287bc 100644
--- a/phy.c
+++ b/phy.c
@@ -395,10 +395,9 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev,
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) || (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)))
        } else if (sta->deflink.vht_cap.vht_supported) {
                u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
        } else if (sta->vht_cap.vht_supported) {
                u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
-#endif
 #else
                u16 mcs_map = 0;
 #endif

@CharSnipeur
Copy link

Hum...

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) || (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)))
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
#endif

Maybe I'm wrong, but you never fall in "LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)", because LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0) implie LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0).
No ?

@pkshih
Copy link

pkshih commented Aug 20, 2024

You are correct.

The commit 6cc0f85 messed up the code that we should revert:

@@ -401,12 +393,15 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev,
                rtw89_phy_ra_gi_ltf(rtwdev, rtwsta, chan, &fix_giltf_en, &fix_giltf);
 #endif
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) || (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)))
-        } else if (sta->deflink.vht_cap.vht_supported) {
-                u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
-#else
+       } else if (sta->deflink.vht_cap.vht_supported) {
+               u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
        } else if (sta->vht_cap.vht_supported) {
                u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
 #endif
+#else
+               u16 mcs_map = 0;
+#endif

                mode |= RTW89_RA_MODE_VHT;
                csi_mode = RTW89_RA_RPT_MODE_VHT;

In fact, there is no change after kernel 6.10, so we need below change to correct it.
Tested on kernel 6.10.2.
(@brianwitte Please help to apply below change. Sorry for the mistakes in #356 (comment))

diff --git a/phy.c b/phy.c
index bb00905287bc..8583af51991c 100644
--- a/phy.c
+++ b/phy.c
@@ -395,11 +395,9 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev,
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) || (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)))
        } else if (sta->deflink.vht_cap.vht_supported) {
                u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
+#else
        } else if (sta->vht_cap.vht_supported) {
                u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
-#else
-               u16 mcs_map = 0;
 #endif

                mode |= RTW89_RA_MODE_VHT;

@brianwitte
Copy link
Collaborator

hey, @pkshih. reverting tonight, sorry I somehow missed these notifications.

thank you, @CharSnipeur 👍

@brianwitte
Copy link
Collaborator

@pkshih -- applied here -> d1fced1

@XYZliang
Copy link

I also encountered the problem of Invalid argument:

shuzhilian@ARC3060:/etc/modprobe.d$ sudo modprobe -v rtw_8852ce
insmod /lib/modules/6.5.0-45-generic/kernel/drivers/net/wireless/realtek/rtw89/rtw89core.ko 
modprobe: ERROR: could not insert 'rtw_8852ce': Invalid argument

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants