tomaspinho / rtl8821ce

Other
1.6k stars 409 forks source link

New versions of this chipset #298

Open SirLouen opened 2 years ago

SirLouen commented 2 years ago

This project seems to be a little bit abandoned, but I feel it is more practical than the core rtw88 driver (because it's embedded on the latest kernel changes which makes it a hassle to keep it up in more stable Linux distros)

I wondered if you could be planning to support newer versions of this chipset like 8821CE RFE 6 devices (some SoCs with latest fw version launched late 2021)

This is the changes that Ping-Ke Shih from Realtek committed into the RTW88 driver to make this functional: https://github.com/torvalds/linux/commit/e109e3617e5d563b431a52e6e2f07f0fc65a93ae

dubhater commented 2 years ago

Did you check if it already works? According to that commit, RFE 6 is handled the same way as RFE 0, which I'm pretty sure already works.

SirLouen commented 2 years ago

Did you check if it already works? According to that commit, RFE 6 is handled the same way as RFE 0, which I'm pretty sure already works.

Yes, I already checked this and the driver is never claimed by the chipset.

This is the output of dmesg with this driver:

rtl8821ce: loading out-of-tree module taints kernel.
rtl8821ce: module verification failed: signature and/or required key missing - tainting kernel

No errors, but it doesn't work either :(

dubhater commented 2 years ago

What does lspci -nn say? Maybe the PCI ID is not known to the driver.

SirLouen commented 2 years ago

What does lspci -nn say? Maybe the PCI ID is not known to the driver.

01:00.0 Network controller [0280]: Realtek Semiconductors ... Network Adapter [10ec:c821]

dubhater commented 2 years ago

Okay, that's not the problem. That ID has been known to the driver for years.

Is that all you see in dmesg? If you were using grep, try without it.

dubhater commented 2 years ago

But probably there is nothing useful. Try changing CONFIG_RTW_LOG_LEVEL back to 4 in the Makefile and recompile. That should make the driver a lot more chatty.

SirLouen commented 2 years ago

Is that all you see in dmesg? If you were using grep, try without it.

Yes, this is the output

[    6.234957] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    6.235322] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    6.318444] 8821ce: loading out-of-tree module taints kernel.
[    6.321738] 8821ce: module verification failed: signature and/or required key missing - tainting kernel
[    6.374826] rtl8821ce 0000:01:00.0: enabling device (0000 -> 0003)
SirLouen commented 2 years ago

But probably there is nothing useful. Try changing CONFIG_RTW_LOG_LEVEL back to 4 in the Makefile and recompile. That should make the driver a lot more chatty.

By default, I see that CONFIG_RTW_LOG_LEVEL is at 4

dubhater commented 2 years ago

Oh, okay. I was looking at this old commit: https://github.com/tomaspinho/rtl8821ce/commit/47cbf27635ed428d3b1cb6974ffb9f35ca7924dd

Perhaps what you need is CONFIG_RTW_DEBUG=y.

SirLouen commented 2 years ago

Oh, okay. I was looking at this old commit: 47cbf27

Perhaps what you need is CONFIG_RTW_DEBUG=y.

Here we go

[    5.875835] 8821ce: loading out-of-tree module taints kernel.
[    5.877867] 8821ce: module verification failed: signature and/or required key missing - tainting kernel
[    5.914630] RTW: rtl8821ce v5.5.2_34066.20200325_COEX20180712-3232
[    5.914634] RTW: rtl8821ce BT-Coex version = COEX20180712-3232
[    5.914726] rtl8821ce 0000:01:00.0: enabling device (0000 -> 0003)
[    5.917719] RTW: CHIP TYPE: RTL8821CE
[    5.917784] RTW: rtl8821ce_set_hal_ops: [ERROR]HALMAC initialize FAIL!

HALMAC initialize FAIL

Seems to be the exact same error I found with the rtw88_8821 kernel driver. A mac issue.

More info: https://bugzilla.kernel.org/show_bug.cgi?id=210779 https://bugzilla.kernel.org/show_bug.cgi?id=215496 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/net/wireless/realtek/rtw88/pci.c?h=v5.8.3&id=b8e8613492b4b3489dc382a4d1d848af7b2d6a5f

This issue had to do with the ASPM platform (Active State Power Management)

I think that incidentally, @tomaspinho thought that pci=noaer had somehow an incidence with this, but AER (Advanced Error Reporting) is completely unrelated (I was stuck yesterday with this thing to finally find out I was wasting my time on this matter)

SirLouen commented 2 years ago

Here is the whole LOG by the way

[    5.768888] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    5.769256] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    5.875835] 8821ce: loading out-of-tree module taints kernel.
[    5.877867] 8821ce: module verification failed: signature and/or required key missing - tainting kernel
[    5.886110] dw-apb-uart.8: ttyS4 at MMIO 0xfee28000 (irq = 4, base_baud = 115200) is a 16550A
[    5.914622] RTW: module init start
[    5.914630] RTW: rtl8821ce v5.5.2_34066.20200325_COEX20180712-3232
[    5.914633] RTW: build time: Sep 24 2022 16:38:35
[    5.914634] RTW: rtl8821ce BT-Coex version = COEX20180712-3232
[    5.914653] RTW: rtw_inetaddr_notifier_register
[    5.914726] rtl8821ce 0000:01:00.0: enabling device (0000 -> 0003)
[    5.917711] RTW: Memory mapped space start: 0x80200000 len:00010000 flags:00140204, after map:0xffffb533407d0000
[    5.917719] RTW: CHIP TYPE: RTL8821CE
[    5.917723] RTW: Bus master is not enabled by BIOS! usPciCommand=0
[    5.917727] RTW: Failed to enable bus master! usPciCommand=0
[    5.917728] RTW: Pci Bridge Vendor is found: VID=0x8086, VendorIdx=0
[    5.917773] RTW: [HALMAC]11692M
               HALMAC_MAJOR_VER = 1
               HALMAC_PROTOTYPE_VER = 5
               HALMAC_MINOR_VER = 0
               HALMAC_PATCH_VER = 2
[    5.917780] RTW: ERROR [HALMAC][ERR]Chip id is undefined
[    5.917782] RTW: ERROR rtw_halmac_init_adapter: halmac_init_adapter fail!(status=54)
[    5.917784] RTW: rtl8821ce_set_hal_ops: [ERROR]HALMAC initialize FAIL!
[    5.917786] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.read_chip_version ###
[    5.917788] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.init_default_value ###
[    5.917789] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.intf_chip_configure ###
[    5.917791] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.read_adapter_info ###
[    5.917792] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_power_on ###
[    5.917793] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_power_off ###
[    5.917794] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_init ###
[    5.917795] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_deinit ###
[    5.917797] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.init_xmit_priv ###
[    5.917798] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.free_xmit_priv ###
[    5.917799] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_xmit ###
[    5.917800] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.mgnt_xmit ###
[    5.917801] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_xmitframe_enqueue ###
[    5.917803] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.init_recv_priv ###
[    5.917804] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.free_recv_priv ###
[    5.917805] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.inirp_init ###
[    5.917806] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.inirp_deinit ###
[    5.917807] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.irp_reset ###
[    5.917809] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.interrupt_handler ###
[    5.917810] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.enable_interrupt ###
[    5.917811] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.disable_interrupt ###
[    5.917812] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.dm_init ###
[    5.917814] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.dm_deinit ###
[    5.917815] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_dm_watchdog ###
[    5.917816] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.set_chnl_bw_handler ###
[    5.917818] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.set_hw_reg_handler ###
[    5.917819] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.GetHwRegHandler ###
[    5.917820] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.get_hal_def_var_handler ###
[    5.917821] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.SetHalDefVarHandler ###
[    5.917823] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.GetHalODMVarHandler ###
[    5.917824] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.SetHalODMVarHandler ###
[    5.917825] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.SetBeaconRelatedRegistersHandler ###
[    5.917826] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.fill_h2c_cmd ###
[    5.917828] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_mac_c2h_handler ###
[    5.917829] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.fill_fake_txdesc ###
[    5.917830] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.fw_dl ###
[    5.917831] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.set_tx_power_index_handler ###
[    5.917833] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.get_tx_power_index_handler ###
[    5.917834] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_init_value ###
[    5.917835] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_reset_value ###
[    5.917837] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.silentreset ###
[    5.917838] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_xmit_status_check ###
[    5.917839] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_linked_status_check ###
[    5.917840] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_get_wifi_status ###
[    5.917842] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_inprogress ###
[    5.917843] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.init_mac_register ###
[    5.917844] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.init_phy ###
[    5.917851] RTW: rtw_pci_primary_adapter_init Failed!
[    5.918465] RTW: module init ret=0
dubhater commented 2 years ago

Full logs are good.

Let's see what the chip_id actually is:

diff --git a/hal/halmac/halmac_api.c b/hal/halmac/halmac_api.c
index d9e3645..645cac6 100644
--- a/hal/halmac/halmac_api.c
+++ b/hal/halmac/halmac_api.c
@@ -518,7 +518,7 @@ get_chip_info(void *drv_adapter, struct halmac_platform_api *pltfm_api,
        adapter->chip_id = HALMAC_CHIP_ID_8812F;
    } else {
        adapter->chip_id = HALMAC_CHIP_ID_UNDEFINE;
-       PLTFM_MSG_ERR("[ERR]Chip id is undefined\n");
+       PLTFM_MSG_ERR("[ERR]Chip id is undefined: 0x%x\n", chip_id);
        return HALMAC_RET_CHIP_NOT_SUPPORT;
    }
SirLouen commented 2 years ago

Let's see what the chip_id actually is:

There you go

[    6.391901] RTW: ERROR [HALMAC][ERR]Chip id is undefined: 0xff
dubhater commented 2 years ago

Weird.

Does this work?

diff --git a/hal/halmac/halmac_api.c b/hal/halmac/halmac_api.c
index d9e3645..6f966cc 100644
--- a/hal/halmac/halmac_api.c
+++ b/hal/halmac/halmac_api.c
@@ -504,6 +504,12 @@ get_chip_info(void *drv_adapter, struct halmac_platform_api *pltfm_api,

    adapter->chip_ver = (enum halmac_chip_ver)chip_ver;

+   // Hack for a specific device which is known to be 8821ce,
+   // but the chip_id is 0xff. Technically this driver will only
+   // try to handle 8821ce devices anyway, so it's fine.
+   adapter->chip_id = HALMAC_CHIP_ID_8821C;
+
+   /*
    if (chip_id == CHIP_ID_HW_DEF_8822B) {
        adapter->chip_id = HALMAC_CHIP_ID_8822B;
    } else if (chip_id == CHIP_ID_HW_DEF_8821C) {
@@ -521,6 +527,7 @@ get_chip_info(void *drv_adapter, struct halmac_platform_api *pltfm_api,
        PLTFM_MSG_ERR("[ERR]Chip id is undefined\n");
        return HALMAC_RET_CHIP_NOT_SUPPORT;
    }
+   */

    return HALMAC_RET_SUCCESS;
 }
SirLouen commented 2 years ago

Same dog but new collar :) Just removed that unidentified error, but the rest is identical.

[    6.357771] RTW: module init start
[    6.357776] RTW: rtl8821ce v5.5.2_34066.20200325_COEX20180712-3232
[    6.357778] RTW: build time: Sep 24 2022 17:54:48
[    6.357779] RTW: rtl8821ce BT-Coex version = COEX20180712-3232
[    6.357801] RTW: rtw_inetaddr_notifier_register
[    6.357877] rtl8821ce 0000:01:00.0: enabling device (0000 -> 0003)
[    6.358105] RTW: Memory mapped space start: 0x80200000 len:00010000 flags:00140204, after map:0xffff993ac0a40000
[    6.358109] RTW: CHIP TYPE: RTL8821CE
[    6.358112] RTW: Bus master is not enabled by BIOS! usPciCommand=0
[    6.358117] RTW: Failed to enable bus master! usPciCommand=0
[    6.358118] RTW: Pci Bridge Vendor is found: VID=0x8086, VendorIdx=0
[    6.358166] RTW: [HALMAC]11692M
               HALMAC_MAJOR_VER = 1
               HALMAC_PROTOTYPE_VER = 5
               HALMAC_MINOR_VER = 0
               HALMAC_PATCH_VER = 2
[    6.358178] RTW: ERROR rtw_halmac_init_adapter: halmac_phy_cfg fail!(status=23)
[    6.358181] RTW: rtl8821ce_set_hal_ops: [ERROR]HALMAC initialize FAIL!
[    6.358183] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.read_chip_version ###
[    6.358185] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.init_default_value ###
[    6.358186] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.intf_chip_configure ###
[    6.358187] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.read_adapter_info ###
[    6.358189] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_power_on ###
[    6.358190] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_power_off ###
[    6.358191] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_init ###
[    6.358193] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_deinit ###
[    6.358194] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.init_xmit_priv ###
[    6.358195] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.free_xmit_priv ###
[    6.358196] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_xmit ###
[    6.358198] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.mgnt_xmit ###
[    6.358199] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_xmitframe_enqueue ###
[    6.358200] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.init_recv_priv ###
[    6.358202] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.free_recv_priv ###
[    6.358203] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.inirp_init ###
[    6.358204] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.inirp_deinit ###
[    6.358205] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.irp_reset ###
[    6.358206] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.interrupt_handler ###
[    6.358208] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.enable_interrupt ###
[    6.358209] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.disable_interrupt ###
[    6.358210] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.dm_init ###
[    6.358212] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.dm_deinit ###
[    6.358213] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_dm_watchdog ###
[    6.358214] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.set_chnl_bw_handler ###
[    6.358215] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.set_hw_reg_handler ###
[    6.358217] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.GetHwRegHandler ###
[    6.358218] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.get_hal_def_var_handler ###
[    6.358219] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.SetHalDefVarHandler ###
[    6.358221] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.GetHalODMVarHandler ###
[    6.358222] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.SetHalODMVarHandler ###
[    6.358223] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.SetBeaconRelatedRegistersHandler ###
[    6.358224] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.fill_h2c_cmd ###
[    6.358226] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.hal_mac_c2h_handler ###
[    6.358227] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.fill_fake_txdesc ###
[    6.358228] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.fw_dl ###
[    6.358229] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.set_tx_power_index_handler ###
[    6.358231] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.get_tx_power_index_handler ###
[    6.358232] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_init_value ###
[    6.358233] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_reset_value ###
[    6.358234] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.silentreset ###
[    6.358236] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_xmit_status_check ###
[    6.358237] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_linked_status_check ###
[    6.358238] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_get_wifi_status ###
[    6.358239] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.sreset_inprogress ###
[    6.358241] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.init_mac_register ###
[    6.358242] RTW: ### rtw_hal_ops_check - Error : Please hook hal_func.init_phy ###
[    6.358247] RTW: rtw_pci_primary_adapter_init Failed!
[    6.358328] RTW: module init ret=0
dubhater commented 2 years ago

Try this, together with the other patch:

diff --git a/hal/halmac/halmac_88xx/halmac_func_88xx.c b/hal/halmac/halmac_88xx/halmac_func_88xx.c
index 22a90d6..c835e81 100644
--- a/hal/halmac/halmac_88xx/halmac_func_88xx.c
+++ b/hal/halmac/halmac_88xx/halmac_func_88xx.c
@@ -3864,7 +3864,10 @@ halmac_parse_intf_phy_88xx(
        curr_cut = (u16)HALMAC_INTF_PHY_CUT_TESTCHIP;
        break;
    default:
-       return HALMAC_RET_FAIL;
+//         return HALMAC_RET_FAIL;
+       curr_cut = (u16)HALMAC_INTF_PHY_CUT_A;
+       PLTFM_MSG_ERR("[ERR]Unknown chip version %d. Pretending it's version 0 (cut A).\n", pHalmac_adapter->chip_version);
+       break;
    }

    pCurr_phy_para = pIntf_phy_para;
dubhater commented 2 years ago

https://github.com/lwfinger/rtw88/issues/98 - Aha. I was going to ask if this device works with rtw88.

dubhater commented 2 years ago

Did you ever boot Windows on this system? Fast Startup is known to cause problems with the wifi in Linux.

SirLouen commented 2 years ago

lwfinger/rtw88#98 - Aha. I was going to ask if this device works with rtw88.

In fact, I have installed the latest kernel I've found just to see if this works out of the box, and it doesn't.

Did you ever boot Windows on this system? Fast Startup is known to cause problems with the wifi in Linux.

Yep, it booted firstly in W10 fine, and then I tried W11 for testing and worked flawlessly out of the box. But I have completely wiped both Windows.

I'm going to test now your halmac patch to see how it performs.

dubhater commented 2 years ago

It's not going to perform at all if the chip can't be turned on. You need to get a Windows 10/11 back, disable Fast Startup, and reboot it once or twice.

SirLouen commented 2 years ago

It's not going to perform at all if the chip can't be turned on. You need to get a Windows 10/11 back, disable Fast Startup, and reboot it once or twice.

Do you think that the chipset is off?

SirLouen commented 2 years ago

Try this, together with the other patch:

[   14.577416] RTW: ERROR rtw_halmac_init_adapter: halmac_phy_cfg fail!(status=23)
[   14.577425] RTW: rtl8821ce_set_hal_ops: [ERROR]HALMAC initialize FAIL!

Same error with this patch...

dubhater commented 2 years ago

rtw88 fails at the step where it's supposed to turn on a part of the device.

It's pointless to modify this driver further if the Windows Fast Startup messed with the device. The solution is to disable Fast Startup and shut down Windows.

Or if you can completely cut the power to this computer, maybe that will also work. Unplug it from mains, remove the battery. I don't know if anyone tried that. Maybe it's easier to reinstall Windows.

SirLouen commented 2 years ago

Or if you can completely cut the power to this computer, maybe that will also work. Unplug it from mains, remove the battery. I don't know if anyone tried

What do you mean with Windows Fast Startup? I don't remember activating such option in my last installation of W11 (just to try that the chipset actually worked)

Is a feature of Wlan devices in Windows? Or a general feature of Windows? I can't understand how this may interfere, if I have completely wiped Windows from the system.

dubhater commented 2 years ago

It's a feature of Windows, not specifically related to wifi but apparently it does things to the wifi cards. It's on by default, you don't have to turn it on yourself.

https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi#about_dual-boot_with_windows_and_fast-boot_enabled

Based on that description, it should only have an effect the first time you boot Linux after "shutting down" Windows. I don't know. Maybe that's not the problem. Maybe there is something else wrong.

If you can't find a solution, send an email to linux-wireless [at] vger.kernel.org and CC pkshih [at] realtek.com. Include as much detail as possible.

SirLouen commented 2 years ago

It explicitly says: "dual boot". I'm not dual booting. Finally I've managed to make this wifi chipset working with the rtw_8821 (it was conflicting with the other one from the kernel)

So that chipset power off theory is not valid (unless, maybe there is a dual boot as mentioned!).

Anyway I have decided to format and check this topic, because I'm worried that there might be some pesky thing in all this plot. I need to have things in sorts before moving on.

SirLouen commented 2 years ago

After reinstalling Windows, and removing the Fast boot thing, I'm back to Linux and I still see that pesky mac power on failed for the default kernel rtw88 driver.

I have not tried this yet, but something suggests to me that the Fastboot was completely placebo.

AT least I can tick this out of my checklist

SirLouen commented 2 years ago

My last findings show that for some reason the chipset is dropping constantly. With the lwfinger's rtw88 driver, I seem to spot the wireless networks but it drops almost immediately, Definitely a little step forward but not enough to consider this stable by any means.

Only when I have the laptop connected to the power cable, it works stable. But with this rtl8821ce driver, it doesn't even work when connected to power cable. So probably this is what solves the question of the rtw88 drops (not the Fastboot theory)

SirLouen commented 2 years ago

@dubhater accidentally I have discovered "the wlan power-on protocol"

[  126.643847] rtl8821ce 0000:01:00.0: enabling device (0000 -> 0003)
[  126.693453] rtl8821ce 0000:01:00.0 wlan0: Current addr:  e0 51 d8 3a df 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[  126.693464] rtl8821ce 0000:01:00.0 wlan0: Expected addr: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[  126.693497] Modules linked in: 8821ce(OE) cfg80211(E) rfcomm(E) cmac(E) algif_hash(E) algif_skcipher(E) af_alg(E) bnep(E) cpufreq_powersave(E) cpufreq_ondemand(E) cpufreq_userspace(E) cpufreq_conservative(E) uinput(E) nfsd(E) auth_rpcgss(E) nfs_acl(E) nfs(E) lockd(E) grace(E) fscache(E) netfs(E) sunrpc(E) nls_ascii(E) nls_cp437(E) vfat(E) fat(E) loop(E) parport_pc(E) ppdev(E) lp(E) parport(E) btusb(E) btrtl(E) btbcm(E) btintel(E) bluetooth(E) jitterentropy_rng(E) sha512_ssse3(E) sha512_generic(E) uvcvideo(E) videobuf2_vmalloc(E) videobuf2_memops(E) videobuf2_v4l2(E) videobuf2_common(E) drbg(E) videodev(E) ansi_cprng(E) mc(E) ecdh_generic(E) ecc(E) snd_sof_probes(E) snd_hda_codec_hdmi(E) snd_soc_dmic(E) snd_sof_pci_intel_apl(E) snd_sof_intel_hda_common(E) soundwire_intel(E) soundwire_generic_allocation(E) soundwire_cadence(E) snd_sof_intel_hda(E) snd_sof_pci(E) snd_sof_xtensa_dsp(E) snd_sof(E) snd_sof_utils(E) soundwire_bus(E) snd_soc_skl(E) snd_soc_hdac_hda(E) snd_hda_ext_core(E)
[  127.210403] rtl8821ce 0000:01:00.0 wlan0: Current addr:  02 83 0f 20 a0 27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[  127.210414] rtl8821ce 0000:01:00.0 wlan0: Expected addr: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[  127.210449] Modules linked in: 8821ce(OE) cfg80211(E) rfcomm(E) cmac(E) algif_hash(E) algif_skcipher(E) af_alg(E) bnep(E) cpufreq_powersave(E) cpufreq_ondemand(E) cpufreq_userspace(E) cpufreq_conservative(E) uinput(E) nfsd(E) auth_rpcgss(E) nfs_acl(E) nfs(E) lockd(E) grace(E) fscache(E) netfs(E) sunrpc(E) nls_ascii(E) nls_cp437(E) vfat(E) fat(E) loop(E) parport_pc(E) ppdev(E) lp(E) parport(E) btusb(E) btrtl(E) btbcm(E) btintel(E) bluetooth(E) jitterentropy_rng(E) sha512_ssse3(E) sha512_generic(E) uvcvideo(E) videobuf2_vmalloc(E) videobuf2_memops(E) videobuf2_v4l2(E) videobuf2_common(E) drbg(E) videodev(E) ansi_cprng(E) mc(E) ecdh_generic(E) ecc(E) snd_sof_probes(E) snd_hda_codec_hdmi(E) snd_soc_dmic(E) snd_sof_pci_intel_apl(E) snd_sof_intel_hda_common(E) soundwire_intel(E) soundwire_generic_allocation(E) soundwire_cadence(E) snd_sof_intel_hda(E) snd_sof_pci(E) snd_sof_xtensa_dsp(E) snd_sof(E) snd_sof_utils(E) soundwire_bus(E) snd_soc_skl(E) snd_soc_hdac_hda(E) snd_hda_ext_core(E)
[  131.178109] rtl8821ce 0000:01:00.0 wlan0: Current addr:  e0 51 d8 3a df 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[  131.178121] rtl8821ce 0000:01:00.0 wlan0: Expected addr: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[  131.178157] Modules linked in: 8821ce(OE) cfg80211(E) rfcomm(E) cmac(E) algif_hash(E) algif_skcipher(E) af_alg(E) bnep(E) cpufreq_powersave(E) cpufreq_ondemand(E) cpufreq_userspace(E) cpufreq_conservative(E) uinput(E) nfsd(E) auth_rpcgss(E) nfs_acl(E) nfs(E) lockd(E) grace(E) fscache(E) netfs(E) sunrpc(E) nls_ascii(E) nls_cp437(E) vfat(E) fat(E) loop(E) parport_pc(E) ppdev(E) lp(E) parport(E) btusb(E) btrtl(E) btbcm(E) btintel(E) bluetooth(E) jitterentropy_rng(E) sha512_ssse3(E) sha512_generic(E) uvcvideo(E) videobuf2_vmalloc(E) videobuf2_memops(E) videobuf2_v4l2(E) videobuf2_common(E) drbg(E) videodev(E) ansi_cprng(E) mc(E) ecdh_generic(E) ecc(E) snd_sof_probes(E) snd_hda_codec_hdmi(E) snd_soc_dmic(E) snd_sof_pci_intel_apl(E) snd_sof_intel_hda_common(E) soundwire_intel(E) soundwire_generic_allocation(E) soundwire_cadence(E) snd_sof_intel_hda(E) snd_sof_pci(E) snd_sof_xtensa_dsp(E) snd_sof(E) snd_sof_utils(E) soundwire_bus(E) snd_soc_skl(E) snd_soc_hdac_hda(E) snd_hda_ext_core(E)

Now I can make this card work with any driver, rtw88 from lwfinger, even the kernel driver and this one

I posted here https://github.com/lwfinger/rtw88/issues/98#issuecomment-1258456820 And here https://bugzilla.kernel.org/show_bug.cgi?id=216530

I've found the (weird) method to make this work always (but with a ton of flaws)

  1. First I have to turn down the computer without the power cord
  2. Then I have to plug the power cord and reload the module (modprobe -r rtw_8821ce && modprobe rtw_8221ce)

As soon as I unplug the power cord, the connection drops

[  498.777399] ------------[ cut here ]------------
[  498.777401] netdevice: wlan0 (unregistered): Incorrect netdev->dev_addr
[  498.777429] WARNING: CPU: 0 PID: 4267 at net/core/dev_addr_lists.c:519 dev_addr_check.cold+0x43/0x7a
[  498.777439] Modules linked in: 8821ce(OE-) cfg80211(E) rfcomm(E) cmac(E) algif_hash(E) algif_skcipher(E) af_alg(E) bnep(E) cpufreq_powersave(E) cpufreq_ondemand(E) cpufreq_userspace(E) cpufreq_conservative(E) uinput(E) nfsd(E) auth_rpcgss(E) nfs_acl(E) nfs(E) lockd(E) grace(E) fscache(E) netfs(E) sunrpc(E) nls_ascii(E) nls_cp437(E) vfat(E) fat(E) loop(E) parport_pc(E) ppdev(E) lp(E) parport(E) btusb(E) btrtl(E) btbcm(E) btintel(E) bluetooth(E) jitterentropy_rng(E) sha512_ssse3(E) sha512_generic(E) uvcvideo(E) videobuf2_vmalloc(E) videobuf2_memops(E) videobuf2_v4l2(E) videobuf2_common(E) drbg(E) videodev(E) ansi_cprng(E) mc(E) ecdh_generic(E) ecc(E) snd_sof_probes(E) snd_hda_codec_hdmi(E) snd_soc_dmic(E) snd_sof_pci_intel_apl(E) snd_sof_intel_hda_common(E) soundwire_intel(E) soundwire_generic_allocation(E) soundwire_cadence(E) snd_sof_intel_hda(E) snd_sof_pci(E) snd_sof_xtensa_dsp(E) snd_sof(E) snd_sof_utils(E) soundwire_bus(E) snd_soc_skl(E) snd_soc_hdac_hda(E) snd_hda_ext_core(E)
[  498.777571]  snd_soc_sst_ipc(E) snd_soc_sst_dsp(E) snd_soc_acpi_intel_match(E) snd_soc_acpi(E) x86_pkg_temp_thermal(E) snd_hda_intel(E) joydev(E) intel_powerclamp(E) snd_intel_dspcfg(E) coretemp(E) snd_intel_sdw_acpi(E) snd_hda_codec(E) snd_soc_es8316(E) kvm_intel(E) mei_hdcp(E) intel_rapl_msr(E) snd_hda_core(E) processor_thermal_device_pci_legacy(E) snd_soc_core(E) snd_hwdep(E) processor_thermal_device(E) kvm(E) snd_compress(E) irqbypass(E) processor_thermal_rfim(E) snd_pcm(E) processor_thermal_mbox(E) rapl(E) processor_thermal_rapl(E) wdat_wdt(E) snd_timer(E) mei_me(E) watchdog(E) efi_pstore(E) hid_multitouch(E) intel_cstate(E) sg(E) rfkill(E) serio_raw(E) snd(E) intel_rapl_common(E) int340x_thermal_zone(E) mei(E) intel_soc_dts_iosf(E) soundcore(E) ac(E) evdev(E) soc_button_array(E) int3400_thermal(E) intel_hid(E) intel_pmc_core(E) acpi_thermal_rel(E) sparse_keymap(E) efivarfs(E) ext4(E) crc16(E) mbcache(E) jbd2(E) btrfs(E) blake2b_generic(E) zstd_compress(E) raid10(E) raid456(E)
[  498.777691]  async_raid6_recov(E) async_memcpy(E) async_pq(E) async_xor(E) async_tx(E) xor(E) raid6_pq(E) libcrc32c(E) crc32c_generic(E) raid1(E) raid0(E) multipath(E) linear(E) md_mod(E) vmd(E) sd_mod(E) t10_pi(E) crc32_pclmul(E) crc32c_intel(E) crc64_rocksoft_generic(E) crc64_rocksoft(E) crc_t10dif(E) crct10dif_generic(E) crct10dif_pclmul(E) crc64(E) crct10dif_common(E) hid_generic(E) spi_pxa2xx_platform(E) dw_dmac(E) dw_dmac_core(E) ghash_clmulni_intel(E) aesni_intel(E) libaes(E) crypto_simd(E) cryptd(E) ahci(E) libahci(E) i915(E) libata(E) drm_buddy(E) xhci_pci(E) i2c_algo_bit(E) drm_display_helper(E) xhci_hcd(E) cec(E) i2c_i801(E) i2c_smbus(E) ttm(E) sdhci_pci(E) scsi_mod(E) cqhci(E) usbcore(E) drm_kms_helper(E) sdhci(E) intel_lpss_pci(E) mmc_core(E) intel_lpss(E) idma64(E) usb_common(E) scsi_common(E) drm(E) fan(E) button(E) battery(E) video(E) [last unloaded: cfg80211(E)]
[  498.777820] CPU: 0 PID: 4267 Comm: modprobe Tainted: G        W  OE      6.0.0-rc7 #2
[  498.777826] Hardware name: Default string Default string/Default string, BIOS X13GTE.E.L4XB376.6S.S3E3P2W7.SDZ.AOC.L003 07/21/2022
[  498.777830] RIP: 0010:dev_addr_check.cold+0x43/0x7a
[  498.777837] Code: 01 e8 72 40 fc ff 0f 0b 49 c7 c4 93 2d 37 84 80 3b 00 75 30 48 c7 c6 9e 2d 37 84 4c 89 e2 48 c7 c7 a8 67 3c 84 e8 4e 40 fc ff <0f> 0b e9 e0 a5 df ff 49 c7 c4 93 2d 37 84 eb d5 4c 8b 24 d5 60 6a
[  498.777843] RSP: 0018:ffffb2258350fd88 EFLAGS: 00010282
[  498.777848] RAX: 0000000000000000 RBX: ffff8b77d2257000 RCX: 0000000000000000
[  498.777852] RDX: 0000000000000001 RSI: ffffffff8435a5e2 RDI: 00000000ffffffff
[  498.777856] RBP: 0000000000000300 R08: 0000000000000000 R09: 00000000ffffefff
[  498.777860] R10: ffffb2258350fc28 R11: ffffffff846cbaa8 R12: ffffffff84372e84
[  498.777863] R13: ffff8b77c12cf150 R14: ffff8b77c105d150 R15: ffffffffc1fbca48
[  498.777867] FS:  00007f36f7595540(0000) GS:ffff8b78ba000000(0000) knlGS:0000000000000000
[  498.777872] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  498.777876] CR2: 00007fdd29ac5e30 CR3: 0000000100efe000 CR4: 0000000000350ef0
[  498.777881] Call Trace:
[  498.777885]  <TASK>
[  498.777889]  dev_addr_flush+0xe/0x30
[  498.777899]  free_netdev+0x82/0x1b0
[  498.777909]  rtw_free_netdev+0x19/0x1e [8821ce]
[  498.778115]  rtw_os_ndev_free+0x3b/0x4c [8821ce]
[  498.778311]  rtw_pci_primary_adapter_deinit+0x40/0x6d [8821ce]
[  498.778501]  rtw_dev_remove+0x66/0x99 [8821ce]
[  498.778685]  pci_device_remove+0x33/0xa0
[  498.778692]  device_release_driver_internal+0x1aa/0x230
[  498.778702]  driver_detach+0x44/0x90
[  498.778709]  bus_remove_driver+0x55/0xe0
[  498.778718]  pci_unregister_driver+0x2a/0xb0
[  498.778728]  rtw_drv_halt+0x16/0xe4 [8821ce]
[  498.778891]  __do_sys_delete_module+0x195/0x300
[  498.778899]  ? fpregs_assert_state_consistent+0x22/0x50
[  498.778906]  ? exit_to_user_mode_prepare+0x3a/0x150
[  498.778914]  do_syscall_64+0x38/0x90
[  498.778922]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
[  498.778929] RIP: 0033:0x7f36f71284d7
[  498.778934] Code: 73 01 c3 48 8b 0d b9 19 0d 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 89 19 0d 00 f7 d8 64 89 01 48
[  498.778939] RSP: 002b:00007ffd94955258 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
[  498.778946] RAX: ffffffffffffffda RBX: 000055fe4c8e5b10 RCX: 00007f36f71284d7
[  498.778950] RDX: 0000000000000000 RSI: 0000000000000800 RDI: 000055fe4c8e5b78
[  498.778953] RBP: 000055fe4c8e5b10 R08: 0000000000000000 R09: 0000000000000000
[  498.778957] R10: 00007f36f71a8ac0 R11: 0000000000000206 R12: 000055fe4c8e5b78
[  498.778961] R13: 0000000000000000 R14: 0000000000000000 R15: 000055fe4c8e5520
[  498.778969]  </TASK>
[  498.778971] ---[ end trace 0000000000000000 ]---

Feels the oddest thing ever.