rtlwifi-linux / rtlwifi-next

GNU General Public License v2.0
70 stars 39 forks source link

Update flags after recent kernel clean up #7

Closed mcraveiro closed 6 years ago

mcraveiro commented 7 years ago

I've open this PR as a request for comments more than anything else. I have managed to get the code to compile with kernel 4.13 after updating various flags (RX, bandwidth, etc) best I could given the commits I saw in mainline [0], [1]. The code now compiles and the module installs cleanly on my laptop. However, take this with a grain of salt, given that:

Its likely that this is not the best approach and even if it is, it may contain mistakes. In addition, I assume that, by applying this patch, the driver will no longer compile against kernels pre-clean-up. Presumably some kind of macros are required in order to support both pre and post-clean-up kernels.

With all of that said let, do me know if you have any comments on the patch. I personally am just trying to get wireless working on my laptop :-) In terms of the behaviour of the patch on my laptop:

[    2.817692] rtlwifi: loading out-of-tree module taints kernel.
[    2.884073] Bluetooth: hci0: rtl: examining hci_ver=07 hci_rev=000b lmp_ver=07 lmp_subver=8822
[    2.884076] Bluetooth: hci0: rtl: loading rtl_bt/rtl8822b_config.bin
[    2.885593] bluetooth hci0: firmware: direct-loading firmware rtl_bt/rtl8822b_config.bin
[    2.885603] Bluetooth: hci0: rtl: loading rtl_bt/rtl8822b_fw.bin
[    2.886897] bluetooth hci0: firmware: direct-loading firmware rtl_bt/rtl8822b_fw.bin
[    4.885108] rtl8822be: Using firmware rtlwifi/rtl8822befw.bin
[    4.887265] rtl8822be 0000:02:00.0: firmware: direct-loading firmware rtlwifi/rtl8822befw.bin
[    4.892998] ieee80211 phy0: Selected rate control algorithm 'rtl_rc'
[    4.893358] rtlwifi: rtlwifi: wireless switch is on
[    6.219067] rtl8822be 0000:02:00.0 wlo1: renamed from wlan0
[   10.320292] rtl8822be 0000:02:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0001 address=0x00000000fef36c40 flags=0x0000]
[  135.007928] rtl8822be 0000:02:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0001 address=0x00000000fef36c40 flags=0x0000]
# dmesg | grep halmac
[    2.872361] halmac: HALMAC_MAJOR_VER_88XX = 1
[    2.872363] halmac: HALMAC_PROTOTYPE_88XX = 3
[    2.872363] halmac: HALMAC_MINOR_VER_88XX = 5
[    2.872364] halmac: HALMAC_PATCH_VER_88XX = 0
[    9.942081] halmac: halmac_check_fw_chksum_88xx error!!
[    9.943044] halmac: halmac_check_fw_chksum_88xx fail!!
[    9.943052] rtl8822be: halmac_init_hal failed
[    9.989879] rtl8822be: halmac_init_hal failed
[    9.990260] rtl8822be: halmac_init_hal failed
...

I am not sure if these issues are related to my changes; it seems similar issues have been reported elsewhere [2].

Cheers

Marco

[0] https://github.com/torvalds/linux/commit/7fdd69c5af2160236e97668bc1fb7d70855c66ae#diff-1075d6e37d6e772865460fdf6d143dd7 [1] https://github.com/torvalds/linux/commit/8613c94815fcdd358638a22fed50c3f172042aa2#diff-1075d6e37d6e772865460fdf6d143dd7 [2] https://ubuntuforums.org/showthread.php?t=2364383&page=2

mcraveiro commented 7 years ago

I have solved my problems with the error above, i.e.:

[   10.320292] rtl8822be 0000:02:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0001 address=0x00000000fef36c40 flags=0x0000]
[  135.007928] rtl8822be 0000:02:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0001 address=0x00000000fef36c40 flags=0x0000]

This was fixed by supplying iommu=soft as a kernel parameter (see [0]). However, I now have a more serious problem: some very sinister errors are coming up in dmesg. I definitely think there is something wrong with my patch but not quite sure what.

dmesg:

[   15.041481] wlo1: authenticate with MAC_ADDRESS
[   15.076870] wlo1: send auth to MAC_ADDRESS (try 1/3)
[   15.132306] wlo1: authenticated
[   15.136183] wlo1: associate with MAC_ADDRESS (try 1/3)
[   15.141307] wlo1: RX AssocResp from MAC_ADDRESS (capab=0x411 status=0 aid=3)
[   15.141488] wlo1: associated
[   15.141623] IPv6: ADDRCONF(NETDEV_CHANGE): wlo1: link becomes ready
[   18.447230] ------------[ cut here ]------------
[   18.447280] WARNING: CPU: 3 PID: 0 at /build/linux-5utP9D/linux-4.13.4/net/mac80211/rx.c:4321 ieee80211_rx_napi+0x8b3/0x9a0 [mac80211]
[   18.447282] Modules linked in: ctr ccm fuse cmac bnep binfmt_misc nls_ascii nls_cp437 vfat fat hp_wmi arc4 wmi_bmof sparse_keymap rtl8822be(O) edac_mce_amd kvm_amd halmac(O) kvm phydm_mod(O) irqbypass crct10dif_pclmul btusb crc32_pclmul btrtl btbcm btintel bluetooth btcoexist(O) efi_pstore ghash_clmulni_intel rtl_pci(O) joydev evdev rtlwifi(O) amdkfd pcspkr hid_sensor_accel_3d serio_raw hid_sensor_rotation hid_sensor_magn_3d hid_sensor_gyro_3d hid_sensor_incl_3d drbg hid_sensor_trigger efivars hid_sensor_iio_common ansi_cprng uvcvideo mac80211 videobuf2_vmalloc snd_hda_codec_realtek industrialio_triggered_buffer videobuf2_memops kfifo_buf snd_hda_codec_generic industrialio videobuf2_v4l2 videobuf2_core snd_hda_codec_hdmi amdgpu videodev media snd_hda_intel ecdh_generic ttm rtsx_pci_ms drm_kms_helper
[   18.447335]  k10temp fam15h_power memstick cfg80211 rfkill snd_hda_codec sp5100_tco drm i2c_algo_bit snd_hda_core shpchp snd_hwdep snd_pcm sg wmi snd_timer ac snd battery hp_accel lis3lv02d soundcore video tpm_crb input_polldev hp_wireless button acpi_cpufreq parport_pc ppdev lp parport efivarfs ip_tables x_tables autofs4 ext4 crc16 mbcache jbd2 crc32c_generic fscrypto ecb hid_sensor_custom hid_sensor_hub usbhid sd_mod crc32c_intel rtsx_pci_sdmmc mmc_core aesni_intel aes_x86_64 crypto_simd cryptd glue_helper psmouse xhci_pci xhci_hcd ahci ehci_pci libahci ehci_hcd libata i2c_piix4 usbcore scsi_mod usb_common rtsx_pci mfd_core thermal i2c_scmi i2c_hid hid i2c_designware_platform i2c_designware_core
[   18.447400] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G           O    4.13.0-1-amd64 #1 Debian 4.13.4-2
[   18.447402] Hardware name: HP HP ENVY x360 Convertible 15-bq0xx/8311, BIOS F.02 05/04/2017
[   18.447404] task: ffff9a53f5a77080 task.stack: ffffbbee40ce8000
[   18.447434] RIP: 0010:ieee80211_rx_napi+0x8b3/0x9a0 [mac80211]
[   18.447435] RSP: 0018:ffff9a53fed83e30 EFLAGS: 00010206
[   18.447438] RAX: 0000000000000082 RBX: ffff9a53f069ea00 RCX: ffff9a53f40619d8
[   18.447439] RDX: 0000000000000000 RSI: 000000000000000f RDI: ffff9a53f4060780
[   18.447441] RBP: ffff9a53f4060c68 R08: 0000000000000013 R09: 0000000000000100
[   18.447442] R10: 0000000000000000 R11: ffff9a53fec9a900 R12: ffff9a53f4060780
[   18.447444] R13: ffffffffc0c13ae0 R14: ffff9a53f4060c80 R15: ffff9a53f4060780
[   18.447447] FS:  0000000000000000(0000) GS:ffff9a53fed80000(0000) knlGS:0000000000000000
[   18.447449] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   18.447450] CR2: 00007fd7ac00d520 CR3: 00000001e9f82000 CR4: 00000000001406e0
[   18.447452] Call Trace:
[   18.447457]  <IRQ>
[   18.447483]  ? ieee80211_tasklet_handler+0xba/0xc0 [mac80211]
[   18.447489]  ? tasklet_action+0x59/0x100
[   18.447492]  ? __do_softirq+0x105/0x293
[   18.447496]  ? irq_exit+0xae/0xb0
[   18.447498]  ? do_IRQ+0x4a/0xc0
[   18.447501]  ? common_interrupt+0x82/0x82
[   18.447502]  </IRQ>
[   18.447507]  ? cpuidle_enter_state+0x11f/0x2b0
[   18.447510]  ? do_idle+0x188/0x1f0
[   18.447513]  ? cpu_startup_entry+0x6f/0x80
[   18.447517]  ? start_secondary+0x14f/0x190
[   18.447520]  ? secondary_startup_64+0x9f/0x9f
[   18.447521] Code: 4c 8b aa d8 00 00 00 e9 c5 f9 ff ff 48 89 de 4c 89 ff e8 51 36 fe ff e9 0a fa ff ff 0f ff 48 89 df e8 32 26 d6 cc e9 30 f8 ff ff <0f> ff e9 21 f8 ff ff 39 f0 0f 87 a0 fa ff ff 29 d0 48 89 df 89 
[   18.447564] ---[ end trace 237a407f8910bc17 ]---
[   19.382504] ------------[ cut here ]------------
[   19.382637] WARNING: CPU: 3 PID: 0 at /build/linux-5utP9D/linux-4.13.4/net/mac80211/rx.c:4321 ieee80211_rx_napi+0x8b3/0x9a0 [mac80211]
[   19.382650] Modules linked in: ctr ccm fuse cmac bnep binfmt_misc nls_ascii nls_cp437 vfat fat hp_wmi arc4 wmi_bmof sparse_keymap rtl8822be(O) edac_mce_amd kvm_amd halmac(O) kvm phydm_mod(O) irqbypass crct10dif_pclmul btusb crc32_pclmul btrtl btbcm btintel bluetooth btcoexist(O) efi_pstore ghash_clmulni_intel rtl_pci(O) joydev evdev rtlwifi(O) amdkfd pcspkr hid_sensor_accel_3d serio_raw hid_sensor_rotation hid_sensor_magn_3d hid_sensor_gyro_3d hid_sensor_incl_3d drbg hid_sensor_trigger efivars hid_sensor_iio_common ansi_cprng uvcvideo mac80211 videobuf2_vmalloc snd_hda_codec_realtek industrialio_triggered_buffer videobuf2_memops kfifo_buf snd_hda_codec_generic industrialio videobuf2_v4l2 videobuf2_core snd_hda_codec_hdmi amdgpu videodev media snd_hda_intel ecdh_generic ttm rtsx_pci_ms drm_kms_helper
[   19.382731]  k10temp fam15h_power memstick cfg80211 rfkill snd_hda_codec sp5100_tco drm i2c_algo_bit snd_hda_core shpchp snd_hwdep snd_pcm sg wmi snd_timer ac snd battery hp_accel lis3lv02d soundcore video tpm_crb input_polldev hp_wireless button acpi_cpufreq parport_pc ppdev lp parport efivarfs ip_tables x_tables autofs4 ext4 crc16 mbcache jbd2 crc32c_generic fscrypto ecb hid_sensor_custom hid_sensor_hub usbhid sd_mod crc32c_intel rtsx_pci_sdmmc mmc_core aesni_intel aes_x86_64 crypto_simd cryptd glue_helper psmouse xhci_pci xhci_hcd ahci ehci_pci libahci ehci_hcd libata i2c_piix4 usbcore scsi_mod usb_common rtsx_pci mfd_core thermal i2c_scmi i2c_hid hid i2c_designware_platform i2c_designware_core
[   19.382815] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G        W  O    4.13.0-1-amd64 #1 Debian 4.13.4-2
[   19.382823] Hardware name: HP HP ENVY x360 Convertible 15-bq0xx/8311, BIOS F.02 05/04/2017
[   19.382827] task: ffff9a53f5a77080 task.stack: ffffbbee40ce8000
[   19.382862] RIP: 0010:ieee80211_rx_napi+0x8b3/0x9a0 [mac80211]
[   19.382870] RSP: 0018:ffff9a53fed83e30 EFLAGS: 00010206
[   19.382874] RAX: 0000000000000082 RBX: ffff9a53f12c9600 RCX: ffff9a53f40619d8
[   19.382878] RDX: 0000000000000000 RSI: 000000000000000f RDI: ffff9a53f4060780
[   19.382882] RBP: ffff9a53f4060c68 R08: 0000000000000013 R09: 0000000000000100
[   19.382885] R10: 000000000000006f R11: 00000000cccccccd R12: ffff9a53f4060780
[   19.382888] R13: ffffffffc0c13ae0 R14: ffff9a53f4060c80 R15: ffff9a53f4060780
[   19.382893] FS:  0000000000000000(0000) GS:ffff9a53fed80000(0000) knlGS:0000000000000000
[   19.382898] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   19.382906] CR2: 00007f64901dfd98 CR3: 00000001dd02b000 CR4: 00000000001406e0
[   19.382912] Call Trace:
[   19.382920]  <IRQ>
[   19.382950]  ? ieee80211_tasklet_handler+0xba/0xc0 [mac80211]
[   19.382965]  ? tasklet_action+0x59/0x100
[   19.382971]  ? __do_softirq+0x105/0x293
[   19.382979]  ? irq_exit+0xae/0xb0
[   19.382985]  ? do_IRQ+0x4a/0xc0
[   19.382997]  ? common_interrupt+0x82/0x82
[   19.383003]  </IRQ>
[   19.383011]  ? cpuidle_enter_state+0x11f/0x2b0
[   19.383017]  ? do_idle+0x188/0x1f0
[   19.383022]  ? cpu_startup_entry+0x6f/0x80
[   19.383028]  ? start_secondary+0x14f/0x190
[   19.383035]  ? secondary_startup_64+0x9f/0x9f
[   19.383048] Code: 4c 8b aa d8 00 00 00 e9 c5 f9 ff ff 48 89 de 4c 89 ff e8 51 36 fe ff e9 0a fa ff ff 0f ff 48 89 df e8 32 26 d6 cc e9 30 f8 ff ff <0f> ff e9 21 f8 ff ff 39 f0 0f 87 a0 fa ff ff 29 d0 48 89 df 89 
[   19.383098] ---[ end trace 237a407f8910bc18 ]---
[   21.286275] ------------[ cut here ]------------
[   21.286348] WARNING: CPU: 3 PID: 0 at /build/linux-5utP9D/linux-4.13.4/net/mac80211/rx.c:4321 ieee80211_rx_napi+0x8b3/0x9a0 [mac80211]
[   21.286350] Modules linked in: ctr ccm fuse cmac bnep binfmt_misc nls_ascii nls_cp437 vfat fat hp_wmi arc4 wmi_bmof sparse_keymap rtl8822be(O) edac_mce_amd kvm_amd halmac(O) kvm phydm_mod(O) irqbypass crct10dif_pclmul btusb crc32_pclmul btrtl btbcm btintel bluetooth btcoexist(O) efi_pstore ghash_clmulni_intel rtl_pci(O) joydev evdev rtlwifi(O) amdkfd pcspkr hid_sensor_accel_3d serio_raw hid_sensor_rotation hid_sensor_magn_3d hid_sensor_gyro_3d hid_sensor_incl_3d drbg hid_sensor_trigger efivars hid_sensor_iio_common ansi_cprng uvcvideo mac80211 videobuf2_vmalloc snd_hda_codec_realtek industrialio_triggered_buffer videobuf2_memops kfifo_buf snd_hda_codec_generic industrialio videobuf2_v4l2 videobuf2_core snd_hda_codec_hdmi amdgpu videodev media snd_hda_intel ecdh_generic ttm rtsx_pci_ms drm_kms_helper
[   21.286412]  k10temp fam15h_power memstick cfg80211 rfkill snd_hda_codec sp5100_tco drm i2c_algo_bit snd_hda_core shpchp snd_hwdep snd_pcm sg wmi snd_timer ac snd battery hp_accel lis3lv02d soundcore video tpm_crb input_polldev hp_wireless button acpi_cpufreq parport_pc ppdev lp parport efivarfs ip_tables x_tables autofs4 ext4 crc16 mbcache jbd2 crc32c_generic fscrypto ecb hid_sensor_custom hid_sensor_hub usbhid sd_mod crc32c_intel rtsx_pci_sdmmc mmc_core aesni_intel aes_x86_64 crypto_simd cryptd glue_helper psmouse xhci_pci xhci_hcd ahci ehci_pci libahci ehci_hcd libata i2c_piix4 usbcore scsi_mod usb_common rtsx_pci mfd_core thermal i2c_scmi i2c_hid hid i2c_designware_platform i2c_designware_core
[   21.286495] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G        W  O    4.13.0-1-amd64 #1 Debian 4.13.4-2
[   21.286496] Hardware name: HP HP ENVY x360 Convertible 15-bq0xx/8311, BIOS F.02 05/04/2017
[   21.286499] task: ffff9a53f5a77080 task.stack: ffffbbee40ce8000
[   21.286529] RIP: 0010:ieee80211_rx_napi+0x8b3/0x9a0 [mac80211]
[   21.286531] RSP: 0018:ffff9a53fed83e30 EFLAGS: 00010246
[   21.286533] RAX: 0000000000000082 RBX: ffff9a53f4f65000 RCX: ffff9a53f40619d8
[   21.286535] RDX: 0000000000000000 RSI: 000000000000000c RDI: ffff9a53f4060780
[   21.286536] RBP: ffff9a53f4060c68 R08: 0000000000000014 R09: 0000000000000100
[   21.286538] R10: 0000000000000067 R11: 00000000cccccccd R12: ffff9a53f4060780
[   21.286539] R13: ffffffffc0c13ae0 R14: ffff9a53f4060c80 R15: ffff9a53f4060780
[   21.286542] FS:  0000000000000000(0000) GS:ffff9a53fed80000(0000) knlGS:0000000000000000
[   21.286544] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   21.286546] CR2: 00007fdb32364090 CR3: 00000001de820000 CR4: 00000000001406e0
[   21.286548] Call Trace:
[   21.286555]  <IRQ>
[   21.286581]  ? ieee80211_tasklet_handler+0xba/0xc0 [mac80211]
[   21.286589]  ? tasklet_action+0x59/0x100
[   21.286594]  ? __do_softirq+0x105/0x293
[   21.286597]  ? irq_exit+0xae/0xb0
[   21.286600]  ? do_IRQ+0x4a/0xc0
[   21.286604]  ? common_interrupt+0x82/0x82
[   21.286605]  </IRQ>
[   21.286608]  ? native_safe_halt+0x2/0x10
[   21.286611]  ? acpi_safe_halt.part.5+0xa/0x20
[   21.286615]  ? acpi_idle_enter+0x106/0x2b0
[   21.286619]  ? sched_clock_cpu+0xc/0xb0
[   21.286624]  ? cpuidle_enter_state+0xe9/0x2b0
[   21.286628]  ? do_idle+0x188/0x1f0
[   21.286631]  ? cpu_startup_entry+0x6f/0x80
[   21.286635]  ? start_secondary+0x14f/0x190
[   21.286639]  ? secondary_startup_64+0x9f/0x9f
[   21.286640] Code: 4c 8b aa d8 00 00 00 e9 c5 f9 ff ff 48 89 de 4c 89 ff e8 51 36 fe ff e9 0a fa ff ff 0f ff 48 89 df e8 32 26 d6 cc e9 30 f8 ff ff <0f> ff e9 21 f8 ff ff 39 f0 0f 87 a0 fa ff ff 29 d0 48 89 df 89 
[   21.286683] ---[ end trace 237a407f8910bc19 ]---

There are many more such errors, all appearing to point to ieee80211_tasklet_handler.

[0] https://askubuntu.com/questions/805008/errors-showing-while-booting-16-04-amd-vi-event-logged-io-page-fault

mcraveiro commented 7 years ago

It seems Chris Fitzpatrick has also created a patch for this [0], [1]. I will diff his patch against mine to see if I can spot any mistakes I may have made.

[0] https://github.com/synthtc/rtlwifi-next/commit/7ecca9543e1e6a02a0a7b5261a3a71808f0543fd [1] https://github.com/lwfinger/rtlwifi_new/issues/247

mcraveiro commented 6 years ago

Actually I ended up just building and installing Chris' [1] drivers and it works perfectly, so I'm abandoning this effort.

[1] https://github.com/synthtc/rtlwifi-next

mcraveiro commented 6 years ago

Actually I am now using [0], branch origin/extended.

[0] https://github.com/lwfinger/rtlwifi_new