How to include the RTL8821 driver in the firmware

To get my RTL8821 built-in wifi to work (From F28 to F32 - current at this time), I compile the C driver for the wifi adapter. Everytime Fedora does a kernel update, I have to recompile the driver to have Linux pick-it up. When I tried to log it as a bug or request the KDE Linux developers got nasty about where to log stuff and also got no results from the fedora core devs (the bugs just get closed when rolled unto a newer flavour). So I am hoping to ask here to receive a friendly response on what can be done to request the RTL8821ce drivers be included in the Linux firmware. There seems to be enough people using the chipset to simply built it in for Linux to pick-up automatically on many other machines.

How can one insert this driver into the firmware, or request it be done without backlash?

2 Likes

So, KDE is the desktop environment. They don’t deal with the Linux kernel or drivers. They shouldn’t be nasty about it, but sure, they’re not the right people to speak about it.

Is this firmware, or is this a kernel module? Could you provide a link to the source please?

Kernel modules cannot be packaged separately for inclusion in Fedora:
https://docs.fedoraproject.org/en-US/packaging-guidelines/what-can-be-packaged/#_no_external_kernel_modules

The idea is that the modules should be sent upstream to the Linux kernel for inclusion.

1 Like

I’m not an expert, but in order to avoid to recompile the module by hand at each kernel update, you could look if there is a way to use Dynamic Kernel Module Support (source Wikipedia: an essential feature of DKMS is that it automatically recompiles all DKMS modules if a new kernel version is installed).

Please perform also a search here on Ask Fedora, there are various topics related to RTL8821CE.

1 Like

Yes, I did eventually logged it further upstream, but never heard anything again.

1 Like

I initially did try the DKMS methods, but could not get it to work, compiling the drivers was the eventual solution. i will perhaps try DKMS again.

1 Like

Someone needs to work on driving the effort to include these in the Linux kernel. It’s generally the vendor that does this. Submitting an issue does not mean that there’s free man-power to work on it :slightly_frowning_face:

Maybe the akmods/kmods at RPMFusion are worth looking into? That’s how the nvidia drivers are provided.

https://rpmfusion.org/Packaging/KernelModules/Akmods
https://rpmfusion.org/Packaging/KernelModules/Kmods2

I found it at:

But there seems to be an issue with 5.6 kernel:

Ubuntu have a package:
https://packages.ubuntu.com/focal/rtl8821ce-dkms
and their source is:
Vcs-Git: https://git.launchpad.net/~canonical-hwe-team/+git/rtl8821ce

Hi guys,

I’m just recently switched from Windows 10 to Fedora 32. First time I’m using Fedora and instantly fell in :blue_heart: with it!

My hardware is a HP Laptop 14-dk0355ng with a RTL8821CH WiFi chipset. I, too, had to implement Tomas Pinho’s DKMS module to make it work which initially took me some time to understand and implement, but at the end was pretty straightforward and simple. Huge thanks to him! :clap:t2:

Nevertheless my Laptop sometimes loses the WiFi connection after hibernating even though it still shows a (good) WiFi signal. Stopping and restarting the WiFi connection sometimes help, but otherwise I have to restart the system. Another issue is that the WiFi connection sometimes miraculously gets extremely slow, fix is the same as above.

In general and most of the time the WiFi connection works just fine though (5 GHz with a strong signal).
My system is running on Kernel 5.6.11-300.fc32.x86_64.

Problem report tells me regularly about the following Kernel issue even though when this pop ups up the WiFi connection still works just fine aside from the issues mentioned above:

Zusammenfassung
WARNING: CPU: 3 PID: 1288 at /var/lib/dkms/rtl8821ce/v5.5.2_34066.20200325/build/hal/hal_com.c:11447 rtw_lps_state_chk+0x34/0x3a [8821ce]
Modules linked in: uinput rfcomm xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_nat_tftp nf_conntrack_tftp tun nft_objref nf_conntrack_netbios_ns nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nf_tables_set nft_chain_nat ip6table_nat ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c iptable_mangle iptable_raw iptable_security ip_set nf_tables nfnetlink ip6table_filter ip6_tables iptable_filter uhid cmac bnep sunrpc vfat fat edac_mce_amd kvm_amd kvm irqbypass crct10dif_pclmul crc32_pclmul btusb btrtl btbcm btintel ghash_clmulni_intel uvcvideo bluetooth videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev ecdh_generic joydev mc ecc 8821ce(OE) hp_wmi sparse_keymap snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_codec_hdmi wmi_bmof snd_hda_intel pcspkr snd_intel_dspcfg snd_hda_codec
 snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm cfg80211 snd_timer snd_pci_acp3x snd ccp soundcore k10temp sp5100_tco i2c_piix4 rfkill hp_wireless acpi_cpufreq ip_tables amdgpu hid_multitouch amd_iommu_v2 gpu_sched i2c_algo_bit ttm drm_kms_helper drm crc32c_intel serio_raw wmi r8169 video pinctrl_amd i2c_hid br_netfilter bridge stp llc fuse
CPU: 3 PID: 1288 Comm: wpa_supplicant Tainted: G           OE     5.6.11-300.fc32.x86_64 #1
Hardware name: HP HP Laptop 14-dk0xxx/85E0, BIOS F.53 12/27/2019
RIP: 0010:rtw_lps_state_chk+0x34/0x3a [8821ce]
Code: 55 53 48 89 fd bb 0b 00 00 00 be 04 06 00 00 48 89 ef e8 7a c2 f9 ff 84 c0 79 11 bf 01 00 00 00 e8 0d 9f fd ff 80 eb 01 75 e0 <0f> 0b 5b 5d c3 c3 0f 1f 44 00 00 55 53 48 83 ec 08 48 89 d5 48 8b
RSP: 0018:ffffb852018375e0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff9a4858ade4c0 RSI: 00000000ea830c00 RDI: ffffb85201837550
RBP: ffffb852004d5000 R08: ffff9a4858aeb8d0 R09: ffff9a4858aeb8d0
R10: 000000000000039e R11: 0000000000000003 R12: ffffb85201837694
R13: ffffb85200c6d000 R14: ffffb85200c6d000 R15: 0000000000000083
FS:  00007fd2ea830c00(0000) GS:ffff9a4858ac0000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f34f0000000 CR3: 000000016f864000 CR4: 00000000003406e0

sudo modprobe 8821ce
… returns nothing which is fine (=positive indicator) as far as I understand the basics of a UNIX/Linux shell :question:

So my question, too is when and if this driver gets officially supported by the Kernel or Fedora?
Where can I back or report such a request whether it be to the Kernel-, Fedora- or Realtek-Team?

Can you guys recommend me some small if not to say tiny WiFi USB dongles which support at least n (better ac) and 5 GHz which are working just fine out-of-the-box with the Kernel 5.6.11-300.fc32.x86_64? So no huge WiFi dongles or even worse those with external antennas :scream: This would at least be a feasible workaround.

Thanks in advance!

https://github.com/tomaspinho/rtl8821ce/issues/26 is very enlightening.

In summary:

  • The author of the mentioned driver, have no more access to the hardware, and is hoping that his code could be closed, once rtw88 will support the 8821ce
  • rtw88, now in the kernel, is the expected driver to be used in the future
  • alas, rtw88, is said to only support: 10ec:b822 or 10ec:c822 (you can check your version with lspci -nnv)

Also there is the bug report:
https://bugzilla.kernel.org/show_bug.cgi?id=201875 it mentions this out of tree driver https://github.com/RangeeGmbH/rtl8821ce And: https://github.com/endlessm/linux/tree/master/drivers/net/wireless/rtl8821ce

But reading: https://github.com/torvalds/linux/blob/master/drivers/net/wireless/realtek/rtw88/Kconfig
I tend to conclude rtw88 only supports 8822be and 8822ce.

2 Likes

This looks like power management in the driver is to blame for your problems, maybe it can’t return to normal from a low power state or something - that’s my guess from rtw_lps_state_chk.

If the module is called 8821ce, you can use modinfo 8821ce to see all possible configuration options (“parm” section). Supposing the power management option is called something like power_mngmt and 0 means disabled, you can try this:

First unload the module:
modprobe -r 8821ce

Load it again, this time with power management disabled:
modprobe 8821ce power_mngmt=0

If it works (or at least if it works better) like that, you can have it load automatically at boot with the same option, by creating a file in /etc/modprobe.d/, e.g. 8821ce_disable_pm.conf with the following syntax:
options 8821ce power_mngmt=0

You’ll need to figure out the exact names of the parameters and values, but I think you get the idea.

3 Likes

First of all thanks @pauld and @alexpl for all your insightful information!

@pauld
So does that basically mean support for 8821ce won’t be happening anytime soon if at all?
What about the gits you mentioned? Rangee and endlessm?
Rangee seems outdated, but endlessm has been updated recently. Also what about the DKMS module/driver which can be installed in Ubuntu via it’s GUI. It seemed to work pretty well with my HP Laptop. Does one of these drivers work also with Fedora and if so how can this be achieved?

@alexpl
modinfo 8821ce | grep power returned this:

Zusammenfassung
parm:           rtw_power_mgnt:int
parm:           rtw_low_power:int
parm:           rtw_powertracking_type:default init value:64 (uint)
parm:           rtw_target_tx_pwr_2g_a:2.4G target tx power (unit:dBm) of RF path A for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm:           rtw_target_tx_pwr_2g_b:2.4G target tx power (unit:dBm) of RF path B for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm:           rtw_target_tx_pwr_2g_c:2.4G target tx power (unit:dBm) of RF path C for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm:           rtw_target_tx_pwr_2g_d:2.4G target tx power (unit:dBm) of RF path D for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm:           rtw_target_tx_pwr_5g_a:5G target tx power (unit:dBm) of RF path A for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm:           rtw_target_tx_pwr_5g_b:5G target tx power (unit:dBm) of RF path B for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm:           rtw_target_tx_pwr_5g_c:5G target tx power (unit:dBm) of RF path C for each rate section, should match the real calibrate power, -1: undefined (array of int)
parm:           rtw_target_tx_pwr_5g_d:5G target tx power (unit:dBm) of RF path D for each rate section, should match the real calibrate power, -1: undefined (array of int)

So what does rtw_power_mgnt:int mean?

@pauld @alexpl
If I can’t expect a mainline driver for 8821ce my wifi possibly will break anytime soon with an upcoming kernel update, right? So am I forced to get a new laptop if I want just use integrated wifi? Can you recommend some Laptops preferably with an AMD APU and a Wifi module which is supported by the Kernel or for which ones do I have to look? What about a USB Wifi dongle? I’ve read that the one from Panda are working in Linux out of the box?

Once again many thanks in advance!

It means that the accepted values for the parameter are integers. While documentation-wise this driver is not very helpful, I would go with rtw_power_mgnt=0 in the commands to disable it. I have no idea what the possible values of rtw_low_power might mean, but perhaps this is also worth looking into, if you can’t get anywhere with rtw_power_mgnt.

Off the top of my head I’d say that anything with an Intel wireless card should be a sure thing and most Atheros chipsets I’ve encountered work more or less out of the box.

2 Likes

As a note, I had to download another set of drivers called rtl8821ce-master as the ones from tomaspinho stopped compilling. attempts to update the C code headers was too time-consuming. Downloading new drivers was a good idea and compiled again. so be sure to use the rtl8821ce-master compilation code-set.

1 Like