lwfinger / rtl8723du

89 stars 43 forks source link

kernel panic on PowerPC linux 5.15 #24

Closed gtisan closed 2 years ago

gtisan commented 2 years ago

I use an Edimax stick EW-7611ULB V2 on a Freescale PowerPC P1010 device with Linux kernel 5.15.25 The Wifi seems to work(plug-in/-out works without problems), but I get a kernel panic at configuration/connection(OnAssocReq).

Do you have any clue what I could try ?

BUG: Unable to handle kernel data access on read at 0xb0000010 Faulting instruction address: 0xb1b6b210 Oops: Kernel access of bad area, sig: 11 [#1] BE PAGE_SIZE=4K PREEMPT_RT MIC-400 Modules linked in: 8723du(O) 8723bu(O) brcmfmac brcmutil rt2800usb rt2x00usb rt2800lib crc_ccitt rt2x00lib xhci_pci xhci_hcd pps_irq(O) spider2(O) CPU: 0 PID: 2173 Comm: irq/44-xhci_hcd Tainted: G O 5.15.25-rt32-00074-g2425a6ad7cf9-dirty #9 NIP: b1b6b210 LR: b1b6b15c CTR: b1b6b4e4 REGS: 852b79e0 TRAP: 0300 Tainted: G O (5.15.25-rt32-00074-g2425a6ad7cf9-dirty) MSR: 00029000 <CE,EE,ME> CR: 22000224 XER: 20000000 DEAR: b0000010 ESR: 00000000 GPR00: 00000008 852b7ac0 852b8cc0 852b7b24 00000070 00000056 0000003f 00000004 GPR08: 0000904c 00000000 b1b6b4e4 00000004 7001652c 00000000 7005347c 00000018 GPR16: 00000000 70b4f408 b1cb0000 b1c7ae80 b1c7ad4c b1c7ad14 b1c7ad90 b1c7ae20 GPR24: b1c7add8 00000001 002ea6c1 852b7b24 b0000010 afffffba 00000056 d7e15818 NIP [b1b6b210] rtw_ieee802_11_parse_elems+0x118/0x478 [8723du] LR [b1b6b15c] rtw_ieee802_11_parse_elems+0x64/0x478 [8723du] Call Trace: [852b7ac0] [b13aa4d0] 0xb13aa4d0 (unreliable) [852b7b10] [b1b86e00] OnAssocReq+0x194/0x6d8 [8723du] [852b7c30] [b1b76298] on_action_spct+0x1c4/0x3f4 [8723du] [852b7c60] [b1b791c0] mgt_dispatcher+0x1ac/0x24c [8723du] [852b7ca0] [b1b9a074] validate_recv_frame+0x48c/0x17b8 [8723du] [852b7cf0] [b1b9b4cc] rtw_recv_entry+0x44/0x290 [8723du] [852b7d10] [b1b9bd4c] pre_recv_entry+0x58/0x98 [8723du] [852b7d30] [b1c1180c] recvbuf2recvframe+0x2d4/0x300 [8723du] [852b7d80] [b1bc14a4] usb_recv_tasklet+0x7c/0x16c [8723du] [852b7db0] [70036120] tasklet_action_common.isra.18+0x108/0x164 [852b7de0] [7082bcb4] __do_softirq+0x10c/0x214 [852b7e40] [700364d0] __local_bh_enable_ip+0x12c/0x130 [852b7e70] [7006deb4] irq_forced_thread_fn+0xa0/0xc0 [852b7e90] [7006e1d8] irq_thread+0x148/0x274 [852b7ed0] [700535e4] kthread+0x168/0x198 [852b7f10] [7000f14c] ret_from_kernel_thread+0x14/0x1c Instruction dump: 3c60b1c8 3863ac90 4cc63182 480f8e3d 3860ffff 48000334 93bb0000 98bb0004 7ffef850 7f9df214 2b9f0001 409d0304 <7d3df0ae> 3bbc0002 88bc0001 3bfffffe ---[ end trace 0000000000000002 ]--- printk: enabled sync mode

Kernel panic - not syncing: Aiee, killing interrupt handler! Rebooting in 10 seconds..

lwfinger commented 2 years ago

Is this device big-endian? If so, there are a lot of places where the code will fail.

I have a PowerBook with a ppc32 cpu, but no 8723du device, thus I will not be able to test.. I am currently busy with another project, but please do a 'git pull' followed by 'make'. Then install gdb if it is not already on your system, and run 'gdb 8723du.ko'. At the prompt, enter "l *OnAssocReq+0x194" and post the resulting output. That will show me where the error is happening. The offending address (0xb0000010) certainly looks like an endian mistake.

gtisan commented 2 years ago

Yes, it is a big endian.

Type "apropos word" to search for commands related to "word"... Reading symbols from spider2/build/rtl8723du/8723du.ko... (gdb) l OnAssocReq+0x194 0x35e00 is in OnAssocReq (/home/gabtis00/work/rtl8723du/core/rtw_mlme_ext.c:2074). 2069 } 2070
2071 /
now parse all ieee802_11 ie to point to elems */ 2072 left = pkt_len - (IEEE80211_3ADDR_LEN + ie_offset); 2073 pos = pframe + (IEEE80211_3ADDR_LEN + ie_offset); 2074 if (rtw_ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed) { 2075 RTW_INFO("STA " MAC_FMT " sent invalid association request\n", 2076 MAC_ARG(pstat->cmn.mac_addr)); 2077 status = _STATSFAILURE; 2078 goto OnAssocReqFail;

I had to add -g flag in Makefile to have debug informations: -EXTRA_CFLAGS += -I$(src)/include +EXTRA_CFLAGS += -g -I$(src)/include

Maybe you can tell me what are your thoughts and I will try to do that. Thanks !

lwfinger commented 2 years ago

My first task will be to look at the headers to identify the structs that define the on-air packets. In those structs, most multi-byte data words must be little endian; however, a few have to be big endian. Those should already be treated more-or-less correctly for the driver to work on LE machines. Once those headers are correct, the final step will be to use Sparse with make C=1 to find the places where endian quantities are not handled correctly. It is not rocket science, but it is tedious.

If you want to help, you should compare the headers in include/ieee80211.h with those in include/linux/ieee80211.h from the kernel source.

I have a task that will likely take 4 hours, or so. Once that is done, I plan to work on this issue.

Your traceback

lwfinger commented 2 years ago

I made a number of endian changes. The Sparse output shows only two places that show endian errors. One of these could not have worked on a little-endian CPU, thus I am not very worried about it. I do not think the other warning will affect you.

Let me know.

gtisan commented 2 years ago

Thanks, I had other problems and no time for this.

I tested master branch with your last changes and now the wifi does not initialize at all. I changed the log level of driver to INFO and I show you the log when I insert the wifi stick:

tail -f /var/log/syslog

1656397224.830414 INFO 0 0 [kernel]: cfg80211: failed to load regulatory.db 1656397271.175281 INFO 0 0 []: starting pid 2683, tty '/dev/ttyS0': '/bin/ash --login' 1656397331.705424 INFO 0 0 [kernel]: usb 1-1: new high-speed USB device number 2 using xhci_hcd 1656397331.835366 INFO 0 0 [kernel]: usb 1-1: New USB device found, idVendor=7392, idProduct=d611, bcdDevice= 2.00 1656397331.835386 INFO 0 0 [kernel]: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 1656397331.835393 INFO 0 0 [kernel]: usb 1-1: Product: 802.11n WLAN Adapter 1656397331.835399 INFO 0 0 [kernel]: usb 1-1: Manufacturer: Realtek 1656397331.835405 INFO 0 0 [kernel]: usb 1-1: SerialNumber: 00e04c000001 1656397331.894294 INFO 0 0 [usb_bt_mdev.3568]: MDEV:hci0 ACTION:add SEQNUM:925 1656398318.988406 WARN 0 0 [kernel]: rtw_drv_log_level:4

1656398344.412385 INFO 0 0 [kernel]: usb 1-1: USB disconnect, device number 2

RTW: usb_endpoint_descriptor(0): RTW: bLength=7 RTW: bDescriptorType=5 RTW: bEndpointAddress=84 RTW: wMaxPacketSize=512 RTW: bInterval=0 RTW: RT_usb_endpoint_is_bulk_in = 4 RTW: usb_endpoint_descriptor(1): RTW: bLength=7 RTW: bDescriptorType=5 RTW: bEndpointAddress=5 RTW: wMaxPacketSize=512 RTW: bInterval=0 RTW: RT_usb_endpoint_is_bulk_out = 5 RTW: usb_endpoint_descriptor(2): RTW: bLength=7 RTW: bDescriptorType=5 RTW: bEndpointAddress=6 RTW: wMaxPacketSize=512 RTW: bInterval=0 RTW: RT_usb_endpoint_is_bulk_out = 6 RTW: usb_endpoint_descriptor(3): RTW: bLength=7 RTW: bDescriptorType=5 RTW: bEndpointAddress=87 RTW: wMaxPacketSize=64 RTW: bInterval=3 RTW: RT_usb_endpoint_is_int_in = 7, Interval = 3 RTW: usb_endpoint_descriptor(4): RTW: bLength=7 RTW: bDescriptorType=5 RTW: bEndpointAddress=8 RTW: wMaxPacketSize=512 RTW: bInterval=0 RTW: RT_usb_endpoint_is_bulk_out = 8 RTW: usb_endpoint_descriptor(5): RTW: bLength=7 RTW: bDescriptorType=5 RTW: bEndpointAddress=9 RTW: wMaxPacketSize=512 RTW: bInterval=0 RTW: RT_usb_endpoint_is_bulk_out = 9 RTW: nr_endpoint=6, in_num=2, out_num=4 RTW: USB_SPEED_HIGH RTW: CHIP TYPE: RTL8723DU RTW: rtw_hal_config_rftype RF_Type is 0 TotalTxPath is 1 RTW: Chip Version Info: CHIP_8723D_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0) RTW: USB NumInPipe(2), NumOutPipe(4/4) RTW: EEPROM type is E-FUSE RTW: Boot from EFUSE, Autoload OK ! RTW: hal_EfuseSwitchToBank: Efuse switch bank to 0 1656398352.068375 INFO 0 0 [kernel]: usb 1-1: new high-speed USB device number 3 using xhci_hcd 1656398352.197360 INFO 0 0 [kernel]: usb 1-1: New USB device found, idVendor=7392, idProduct=d611, bcdDevice= 2.00 1656398352.197381 INFO 0 0 [kernel]: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 1656398352.197388 INFO 0 0 [kernel]: usb 1-1: Product: 802.11n WLAN Adapter 1656398352.197394 INFO 0 0 [kernel]: usb 1-1: Manufacturer: Realtek 1656398352.197400 INFO 0 0 [kernel]: usb 1-1: SerialNumber: 00e04c000001 1656398352.222357 WARN 0 0 [kernel]: RTW: 1656398352.222382 WARN 0 0 [kernel]: usb_endpoint_descriptor(0): 1656398352.222389 WARN 0 0 [kernel]: RTW: bLength=7 1656398352.222395 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656398352.222401 WARN 0 0 [kernel]: RTW: bEndpointAddress=84 1656398352.222407 WARN 0 0 [kernel]: RTW: wMaxPacketSize=512 1656398352.222413 WARN 0 0 [kernel]: RTW: bInterval=0 1656398352.222419 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_bulk_in = 4 1656398352.222425 WARN 0 0 [kernel]: RTW: 1656398352.222431 WARN 0 0 [kernel]: usb_endpoint_descriptor(1): 1656398352.222437 WARN 0 0 [kernel]: RTW: bLength=7 1656398352.222443 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656398352.222449 WARN 0 0 [kernel]: RTW: bEndpointAddress=5 1656398352.222455 WARN 0 0 [kernel]: RTW: wMaxPacketSize=512 1656398352.222461 WARN 0 0 [kernel]: RTW: bInterval=0 1656398352.222466 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_bulk_out = 5 1656398352.222472 WARN 0 0 [kernel]: RTW: 1656398352.222478 WARN 0 0 [kernel]: usb_endpoint_descriptor(2): 1656398352.222484 WARN 0 0 [kernel]: RTW: bLength=7 1656398352.222503 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656398352.222509 WARN 0 0 [kernel]: RTW: bEndpointAddress=6 1656398352.222515 WARN 0 0 [kernel]: RTW: wMaxPacketSize=512 1656398352.222521 WARN 0 0 [kernel]: RTW: bInterval=0 1656398352.222527 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_bulk_out = 6 1656398352.222533 WARN 0 0 [kernel]: RTW: 1656398352.222538 WARN 0 0 [kernel]: usb_endpoint_descriptor(3): 1656398352.222544 WARN 0 0 [kernel]: RTW: bLength=7 1656398352.222550 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656398352.222556 WARN 0 0 [kernel]: RTW: bEndpointAddress=87 1656398352.222562 WARN 0 0 [kernel]: RTW: wMaxPacketSize=64 1656398352.222568 WARN 0 0 [kernel]: RTW: bInterval=3 1656398352.222574 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_int_in = 7, Interval = 3 1656398352.222580 WARN 0 0 [kernel]: RTW: 1656398352.222586 WARN 0 0 [kernel]: usb_endpoint_descriptor(4): 1656398352.222592 WARN 0 0 [kernel]: RTW: bLength=7 1656398352.222598 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656398352.222604 WARN 0 0 [kernel]: RTW: bEndpointAddress=8 1656398352.222610 WARN 0 0 [kernel]: RTW: wMaxPacketSize=512 1656398352.222616 WARN 0 0 [kernel]: RTW: bInterval=0 1656398352.222622 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_bulk_out = 8 1656398352.222820 WARN 0 0 [kernel]: RTW: 1656398352.222831 WARN 0 0 [kernel]: usb_endpoint_descriptor(5): 1656398352.222837 WARN 0 0 [kernel]: RTW: bLength=7 1656398352.222843 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656398352.222849 WARN 0 0 [kernel]: RTW: bEndpointAddress=9 1656398352.222855 WARN 0 0 [kernel]: RTW: wMaxPacketSize=512 1656398352.222861 WARN 0 0 [kernel]: RTW: bInterval=0 1656398352.222866 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_bulk_out = 9 1656398352.222873 WARN 0 0 [kernel]: RTW: nr_endpoint=6, in_num=2, out_num=4 1656398352.222880 WARN 0 0 [kernel]: 1656398352.222886 WARN 0 0 [kernel]: RTW: USB_SPEED_HIGH 1656398352.222892 WARN 0 0 [kernel]: RTW: CHIP TYPE: RTL8723DU 1656398352.226425 WARN 0 0 [kernel]: RTW: rtw_hal_config_rftype RF_Type is 0 TotalTxPath is 1 1656398352.226447 WARN 0 0 [kernel]: RTW: Chip Version Info: CHIP_8723D_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0) 1656398352.226453 WARN 0 0 [kernel]: RTW: USB NumInPipe(2), NumOutPipe(4/4) 1656398352.227403 WARN 0 0 [kernel]: RTW: EEPROM type is E-FUSE 1656398352.228453 WARN 0 0 [kernel]: RTW: Boot from EFUSE, Autoload OK ! 1656398352.230484 WARN 0 0 [kernel]: RTW: hal_EfuseSwitchToBank: Efuse switch bank to 0 1656398352.264298 INFO 0 0 [usb_bt_mdev.8368]: MDEV:hci0 ACTION:add SEQNUM:941 RTW: efuse_OneByteRead: [ERROR] addr=0x0 bResult=0 time out 1s !!! RTW: efuse_OneByteRead: [ERROR] EFUSE_CTRL =0x50600000 !!! RTW: hal_ReadEFuse_WiFi: data end at address=0x0 RTW: ERROR wrong map size 33554432 RTW: ERROR eFuse length error :33554432 RTW: ERROR invalid phy efuse and read from file fail, will use driver default!! RTW: EEPROM ID(0xffff) is invalid!! RTW: VID = 0x5678, PID = 0x1234 RTW: Customer ID: 0xAB, SubCustomer ID: 0xCD RTW: rtw_read_macaddr_from_file /data/wifimac.txt is not readable RTW: [A] 2G G00 CCK-1T base:45 from IC_DEF RTW: [A] 2G G01 CCK-1T base:45 from IC_DEF RTW: [A] 2G G02 CCK-1T base:45 from IC_DEF RTW: [A] 2G G03 CCK-1T base:45 from IC_DEF RTW: [A] 2G G04 CCK-1T base:45 from IC_DEF RTW: [A] 2G G05 CCK-1T base:45 from IC_DEF RTW: [A] 2G G00 BW40-1S base:45 from IC_DEF RTW: [A] 2G G01 BW40-1S base:45 from IC_DEF RTW: [A] 2G G02 BW40-1S base:45 from IC_DEF RTW: [A] 2G G03 BW40-1S base:45 from IC_DEF RTW: [A] 2G G04 BW40-1S base:45 from IC_DEF RTW: [B] 2G G00 CCK-1T base:34 from IC_DEF RTW: [B] 2G G01 CCK-1T base:34 from IC_DEF RTW: [B] 2G G02 CCK-1T base:34 from IC_DEF RTW: [B] 2G G03 CCK-1T base:34 from IC_DEF RTW: [B] 2G G04 CCK-1T base:34 from IC_DEF RTW: [B] 2G G05 CCK-1T base:34 from IC_DEF RTW: [B] 2G G00 BW40-1S base:33 from IC_DEF RTW: [B] 2G G01 BW40-1S base:33 from IC_DEF RTW: [B] 2G G02 BW40-1S base:33 from IC_DEF RTW: [B] 2G G03 BW40-1S base:33 from IC_DEF RTW: [B] 2G G04 BW40-1S base:33 from IC_DEF RTW: Hal_EfuseParseBTCoexistInfo_8723D: Disable BT-coex, ant_num=1 RTW: hal_com_config_channel_plan use def_chplan:0x20 RTW: SetHwReg: bMacPwrCtrlOn=1 RTW: rtl8723d_FirmwareDownload((null)) tmp_ps=0 RTW: rtl8723d_FirmwareDownload fw: FW_NIC, size: 27828 RTW: rtl8723d_FirmwareDownload: fw_ver=29 fw_subver=0000 sig=0x23d1, Month=01, Date=04, Hour=08, Minute=57 RTW: rtl8723d_FirmwareDownload(): Shift for fw header! RTW: rtl8723d_FirmwareDownload by IO write! RTW: polling_fwdl_chksum: Checksum report OK! (1, 0ms), REG_MCUFWDL:0x00060305 RTW: rtl8723d_FirmwareDownload: download FW count:1 RTW: _8051Reset8723: Finish RTW: _FWFreeToGo: Polling FW ready Fail! (519, 200ms), REG_MCUFWDL:0x00030604 RTW: rtl8723d_FirmwareDownload fail. write_fw:1, 309ms RTW: <=== rtl8723d_FirmwareDownload() RTW: c2h_mac_hidden_rpt_bt_info_hdl bt_ft_ver: 1 RTW: CardDisableRTL8723du((null)): bMacPwrCtrlOn=1 RTW: SetHwReg: bMacPwrCtrlOn=0 RTW: hal_read_mac_hidden_rpt Fail! (0, 356ms), fwdl:0, id:0xfd RTW: rtw_hal_read_chip_info in 1846 ms RTW: rtw_usb_primary_adapter_init Failed! 1656398353.709483 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] addr=0x0 bResult=0 time out 1s !!! 1656398353.716358 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] EFUSE_CTRL =0x50600000 !!! 1656398353.716373 WARN 0 0 [kernel]: RTW: hal_ReadEFuse_WiFi: data end at address=0x0 1656398353.716379 WARN 0 0 [kernel]: RTW: ERROR wrong map size 33554432 1656398353.716385 WARN 0 0 [kernel]: RTW: ERROR eFuse length error :33554432 1656398353.716392 WARN 0 0 [kernel]: RTW: ERROR invalid phy efuse and read from file fail, will use driver default!! 1656398353.716412 WARN 0 0 [kernel]: RTW: EEPROM ID(0xffff) is invalid!! 1656398353.716418 WARN 0 0 [kernel]: RTW: VID = 0x5678, PID = 0x1234 1656398353.716424 WARN 0 0 [kernel]: RTW: Customer ID: 0xAB, SubCustomer ID: 0xCD 1656398353.716430 WARN 0 0 [kernel]: RTW: rtw_read_macaddr_from_file /data/wifimac.txt is not readable 1656398353.716437 WARN 0 0 [kernel]: RTW: [A] 2G G00 CCK-1T base:45 from IC_DEF 1656398353.716443 WARN 0 0 [kernel]: RTW: [A] 2G G01 CCK-1T base:45 from IC_DEF 1656398353.716449 WARN 0 0 [kernel]: RTW: [A] 2G G02 CCK-1T base:45 from IC_DEF 1656398353.716455 WARN 0 0 [kernel]: RTW: [A] 2G G03 CCK-1T base:45 from IC_DEF 1656398353.716461 WARN 0 0 [kernel]: RTW: [A] 2G G04 CCK-1T base:45 from IC_DEF 1656398353.716467 WARN 0 0 [kernel]: RTW: [A] 2G G05 CCK-1T base:45 from IC_DEF 1656398353.716473 WARN 0 0 [kernel]: RTW: [A] 2G G00 BW40-1S base:45 from IC_DEF 1656398353.716479 WARN 0 0 [kernel]: RTW: [A] 2G G01 BW40-1S base:45 from IC_DEF 1656398353.716486 WARN 0 0 [kernel]: RTW: [A] 2G G02 BW40-1S base:45 from IC_DEF 1656398353.716492 WARN 0 0 [kernel]: RTW: [A] 2G G03 BW40-1S base:45 from IC_DEF 1656398353.716498 WARN 0 0 [kernel]: RTW: [A] 2G G04 BW40-1S base:45 from IC_DEF 1656398353.716689 WARN 0 0 [kernel]: RTW: [B] 2G G00 CCK-1T base:34 from IC_DEF 1656398353.716699 WARN 0 0 [kernel]: RTW: [B] 2G G01 CCK-1T base:34 from IC_DEF 1656398353.716705 WARN 0 0 [kernel]: RTW: [B] 2G G02 CCK-1T base:34 from IC_DEF 1656398353.716712 WARN 0 0 [kernel]: RTW: [B] 2G G03 CCK-1T base:34 from IC_DEF 1656398353.716718 WARN 0 0 [kernel]: RTW: [B] 2G G04 CCK-1T base:34 from IC_DEF 1656398353.716724 WARN 0 0 [kernel]: RTW: [B] 2G G05 CCK-1T base:34 from IC_DEF 1656398353.716730 WARN 0 0 [kernel]: RTW: [B] 2G G00 BW40-1S base:33 from IC_DEF 1656398353.716736 WARN 0 0 [kernel]: RTW: [B] 2G G01 BW40-1S base:33 from IC_DEF 1656398353.716742 WARN 0 0 [kernel]: RTW: [B] 2G G02 BW40-1S base:33 from IC_DEF 1656398353.716748 WARN 0 0 [kernel]: RTW: [B] 2G G03 BW40-1S base:33 from IC_DEF 1656398353.716754 WARN 0 0 [kernel]: RTW: [B] 2G G04 BW40-1S base:33 from IC_DEF 1656398353.716761 WARN 0 0 [kernel]: RTW: Hal_EfuseParseBTCoexistInfo_8723D: Disable BT-coex, ant_num=1 1656398353.716767 WARN 0 0 [kernel]: RTW: hal_com_config_channel_plan use def_chplan:0x20 1656398353.737355 WARN 0 0 [kernel]: RTW: SetHwReg: bMacPwrCtrlOn=1 1656398353.739358 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload((null)) tmp_ps=0 1656398353.739372 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload fw: FW_NIC, size: 27828 1656398353.739378 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload: fw_ver=29 fw_subver=0000 sig=0x23d1, Month=01, Date=04, Hour=08, Minute=57 1656398353.739385 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload(): Shift for fw header! 1656398353.739391 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload by IO write! 1656398353.848377 WARN 0 0 [kernel]: RTW: polling_fwdl_chksum: Checksum report OK! (1, 0ms), REG_MCUFWDL:0x00060305 1656398353.848393 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload: download FW count:1 1656398353.852313 WARN 0 0 [kernel]: RTW: _8051Reset8723: Finish 1656398354.048407 WARN 0 0 [kernel]: RTW: _FWFreeToGo: Polling FW ready Fail! (519, 200ms), REG_MCUFWDL:0x00030604 1656398354.048442 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload fail. write_fw:1, 309ms 1656398354.056361 WARN 0 0 [kernel]: RTW: <=== rtl8723d_FirmwareDownload() 1656398354.056376 WARN 0 0 [kernel]: RTW: c2h_mac_hidden_rpt_bt_info_hdl bt_ft_ver: 1 1656398354.056383 WARN 0 0 [kernel]: RTW: CardDisableRTL8723du((null)): bMacPwrCtrlOn=1 1656398354.056389 WARN 0 0 [kernel]: RTW: SetHwReg: bMacPwrCtrlOn=0 1656398354.072346 WARN 0 0 [kernel]: RTW: hal_read_mac_hidden_rpt Fail! (0, 356ms), fwdl:0, id:0xfd 1656398354.072362 WARN 0 0 [kernel]: RTW: rtw_hal_read_chip_info in 1846 ms 1656398354.072368 WARN 0 0 [kernel]: RTW: rtw_usb_primary_adapter_init Failed!
gtisan commented 2 years ago

I think, you made a type mistake with lu16 instead of le16 in include/ieee80211_ext.h

gtisan commented 2 years ago

Fixed Sparse warning rtl8723du/hal/phydm/phydm_phystatus.c:1088:95: warning: shift too big (63) for type int rtl8723du/hal/phydm/phydm_phystatus.c:1046:104: warning: shift too big (63) for type int

but I am not sure if I need __le64 or not ??

diff --git a/include/rtw_sta_info.h b/include/rtw_sta_info.h
index 8448ae8..a771928 100644
--- a/include/rtw_sta_info.h
+++ b/include/rtw_sta_info.h
@@ -125,7 +125,7 @@ struct rssi_info {
        s8              rssi;
        s8              rssi_cck;
        s8              rssi_ofdm;
-       u8              packet_map;
+       u64             packet_map;
        u8              ofdm_pkt_cnt;
        u8              cck_pkt_cnt;
        u16             cck_sum_power;
gtisan commented 2 years ago

Fixed Sparse warning : mixing declarations and code

diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c
index b7d5fec..7b72b25 100644
--- a/core/rtw_mlme_ext.c
+++ b/core/rtw_mlme_ext.c
@@ -1235,7 +1235,7 @@ void mgt_dispatcher(struct adapter *adapt, union recv_frame *precv_frame)
                        ptable->func = &OnAuth;
                else
                        ptable->func = &OnAuthClient;
-               __attribute__((__fallthrough__));
+               fallthrough;
        case WIFI_ASSOCREQ:
        case WIFI_REASSOCREQ:
                _mgt_dispatcher(adapt, ptable, precv_frame);
diff --git a/hal/hal_intf.c b/hal/hal_intf.c
index ed1e31a..d8e53b0 100644
--- a/hal/hal_intf.c
+++ b/hal/hal_intf.c
@@ -599,7 +599,7 @@ int c2h_handler(struct adapter *adapter, u8 id, u8 seq, u8 plen, u8 *payload)
                break;
        case C2H_EXTEND:
                sub_id = payload[0];
-               __attribute__((__fallthrough__));
+               fallthrough;
        default:
                if (!phydm_c2H_content_parsing(adapter_to_phydm(adapter), id, plen, payload))
                        ret = _FAIL;
diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c
index ffd0954..2d0787a 100644
--- a/os_dep/ioctl_cfg80211.c
+++ b/os_dep/ioctl_cfg80211.c
@@ -1745,7 +1745,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
        #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE))
        case NL80211_IFTYPE_P2P_CLIENT:
                is_p2p = true;
-               __attribute__((__fallthrough__));
+               fallthrough;
        #endif
        case NL80211_IFTYPE_STATION:
                networkType = Ndis802_11Infrastructure;
@@ -1764,7 +1764,7 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
        #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE))
        case NL80211_IFTYPE_P2P_GO:
                is_p2p = true;
-               __attribute__((__fallthrough__));
+               fallthrough;
        #endif
        case NL80211_IFTYPE_AP:
                networkType = Ndis802_11APMode;
gtisan commented 2 years ago

I think that the initializing problem is fixed with the following commit :

diff --git a/hal/hal_usb.c b/hal/hal_usb.c
index d186b98..4c98a98 100644
--- a/hal/hal_usb.c
+++ b/hal/hal_usb.c
@@ -240,14 +240,14 @@ int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
        return ret;
 }

-int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
+int usb_write16(struct intf_hdl *pintfhdl, u32 addr, __le16 val)
 {
        u8 request;
        u8 requesttype;
        u16 wvalue;
        u16 index;
        u16 len;
-       __le32 data;
+       __le16 data;
        int ret;

@@ -258,7 +258,7 @@ int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
        wvalue = (u16)(addr & 0x0000ffff);
        len = 2;

-       data = cpu_to_le32(val & 0x0000ffff);
+       data = val;
        ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index,
                                &data, len, requesttype);

@@ -267,7 +267,7 @@ int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)

 }

-int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
+int usb_write32(struct intf_hdl *pintfhdl, u32 addr, __le32 val)
 {
        u8 request;
        u8 requesttype;
@@ -284,7 +284,7 @@ int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)

        wvalue = (u16)(addr & 0x0000ffff);
        len = 4;
-       data = cpu_to_le32(val);
+       data = val;
        ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index,
                                &data, len, requesttype);

diff --git a/include/usb_ops_linux.h b/include/usb_ops_linux.h
index 83bec3d..42cab2a 100644
--- a/include/usb_ops_linux.h
+++ b/include/usb_ops_linux.h
@@ -57,8 +57,8 @@ u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr);
 u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr);
 u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr);
 int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val);
-int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val);
-int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val);
+int usb_write16(struct intf_hdl *pintfhdl, u32 addr, __le16 val);
+int usb_write32(struct intf_hdl *pintfhdl, u32 addr, __le32 val);
 int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata);
 u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem);
 void usb_recv_tasklet(void *priv);

Also the problem in OnAssocReq seems to shift a little bit forward: 1656588776.349495 WARN 0 0 [kernel]: RTW: update_sta_infoapmode 1656588776.349558 WARN 0 0 [kernel]: RTW: ### Set STA(0) info ### 1656588776.349568 WARN 0 0 [kernel]: RTW: issue_asocrsp 1656588776.349574 WARN 0 0 [kernel]: RTW: report_add_sta_event: add STA 1656588777.579962 CRIT 0 0 [kernel]: kernel tried to execute user page (0) - exploit attempt? (uid: 0) 165RTW: rtw_mlcst2unicst()-341: rtw_xmit() return error! res=-1 6588777.579986 RTW: rtw_mlcst2unicst()-341: rtw_xmit() return error! res=-1 CRIT 0 0 [kernel]: BUG: Unable to handle kernel instruction fetch (NULL pointer?) 1656588777.579993 CRIT 0 0 [kernel]: Faulting instruction address: 0x00000000 1656588777.579999 WARN 0 0 [kernel]: Oops: Kernel access of bad area, sig: 11 [#1] 1656588777.580005 WARN 0 0 [kernel]: BE PAGE_SIZE=4K PREEMPT_RT MIC-400 1656588777.580012 WARN 0 0 [kernel]: Modules linked in: 8723du(O) 8723bu(O) brcmfmac brcmutil rt2800usb rt2x00usb rt2800lib crc_ccitt rt2x00lib xhci_pci xhci_hcd pps_irq(O) spider2(O) 1656588777.580019 WARN 0 0 [kernel]: CPU: 0 PID: 3659 Comm: RTW_CMD_THREAD Tainted: G O 5.15.25-rt33 #1 1656588777.580025 WARN 0 0 [kernel]: NIP: 00000000 LR: b1b7bf2c CTR: 00000000 1656588777.580031 WARN 0 0 [kernel]: REGS: 87aebd70 TRAP: 0400 Tainted: G O (5.15.25-rt33) 1656588777.580038 WARN 0 0 [kernel]: MSR: 00029000 <CE,EE,ME> CR: 88000222 XER: 00000000 1656588777.580045 WARN 0 0 [kernel]: 1656588777.580051 WARN 0 0 [kernel]: GPR00: b1b44a18 87aebe50 800edfe0 b1521000 85342a08 0000000e 85342a0d 00060b01 1656588777.580058 WARN 0 0 [kernel]: GPR08: 00000030 00000000 00000001 00000004 700165f4 00000000 7005347c b1b7be98 1656588777.580064 WARN 0 0 [kernel]: GPR16: 00000000 ffff6754 00000003 b1ca0000 b1c66dd4 b1c5ba20 85342a00 b1521f5c 1656588777.580071 WARN 0 0 [kernel]: GPR24: b1c66e4c b1c66e20 b1c66dfc b1c5b9c0 b1521f10 b1521000 85342a00 b1c5d8a4 1656588777.580907 WARN 0 0 [kernel]: NIP [00000000] 0x0 1656588777.580925 WARN 0 0 [kernel]: LR [b1b7bf2c] mlme_evt_hdl+0x94/0xc0 [8723du] 1656588777.580945 WARN 0 0 [kernel]: Call Trace: 1656588777.580954 WARN 0 0 [kernel]: [87aebe50] [b1b434d8] _rtw_dequeue_cmd+0x5c/0x80 [8723du] (unreliable) 1656588777.580961 WARN 0 0 [kernel]: [87aebe70] [b1b44a18] rtw_cmd_thread+0x490/0x654 [8723du] 1656588777.580968 WARN 0 0 [kernel]: [87aebed0] [700535e4] kthread+0x168/0x198 1656588777.580975 WARN 0 0 [kernel]: [87aebf10] [7000f14c] ret_from_kernel_thread+0x14/0x1c 1656588777.580981 WARN 0 0 [kernel]: Instruction dump: 1656588777.580987 WARN 0 0 [kernel]: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX 1656588777.580993 WARN 0 0 [kernel]: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX 1656588777.581000 WARN 0 0 [kernel]: ---[ end trace 0000000000000002 ]--- 1656588777.581006 INFO 0 0 [kernel]: printk: enabled sync mode 1656588777.581013 WARN 0 0 [kernel]: 1656588777.588396 INFO 0 0 [kernel]: printk: console [ttyS0]: printing thread stopped 1656588777.768742 WARN 0 0 [kernel]: RTW: rtw_mlcst2unicst()-341: rtw_xmit() return error! res=-1 1656588777.768767 WARN 0 0 [kernel]: RTW: rtw_mlcst2unicst()-341: rtw_xmit() return error! res=-1

lwfinger commented 2 years ago

The fallthrough changes will work on newer kernel/gcc combinations, but fail with older systems. I prefer to ignore those Sparse warnings.

I am not sure about your fix for packet_map. The value is loaded as a u8 quantity, thus a right shift of 63 is nonsense. I think "i" should be set to 7, not 63, but that needs more thought.

Thanks for the patches to usb_write16 and usb_write32. The error was one that was masked from Sparse, but a real endian error.

What does gdb report at addresses _rtw_dequeue_cmd+0x5c and mlme_evt_hdl+0x94?

lwfinger commented 2 years ago

I looked at your patches for the usb read/write routines, but I do not agree with them. My experience is that everything should be kept in cpu order up to the point where it is written to the device. For BE systems, that means doing the conversion to LE in usb_write(16,32). Similarly, usb_read{16,32} will read in LE order, and should convert to CPU order on exit.

On one of the drivers, I had a problem with the firmware as the routine was converting the data twice, thereby sending it to the device in the wrong order. That is not a problem here as the driver sends it to the device as a string of bytes, and I think that works for both byte ordering schemes.

I pushed a small change to log that firmware was loaded correctly. Please try it.

gtisan commented 2 years ago

OK, I tried only with your new changes in master. The firmware is loaded, but the wifi does not come up : 1656661722.625554 INFO 0 0 [kernel]: usb 1-1: new high-speed USB device number 2 using xhci_hcd 1656661722.755515 INFO 0 0 [kernel]: usb 1-1: New USB device found, idVendor=7392, idProduct=d611, bcdDevice= 2.00 1656661722.755536 INFO 0 0 [kernel]: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 1656661722.755542 INFO 0 0 [kernel]: usb 1-1: Product: 802.11n WLAN Adapter 1656661722.755548 INFO 0 0 [kernel]: usb 1-1: Manufacturer: Realtek 1656661722.755554 INFO 0 0 [kernel]: usb 1-1: SerialNumber: 00e04c000001 1656661722.780678 WARN 0 0 [kernel]: RTW: 1656661722.780703 WARN 0 0 [kernel]: usb_endpoint_descriptor(0): 1656661722.780709 WARN 0 0 [kernel]: RTW: bLength=7 1656661722.780715 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656661722.780721 WARN 0 0 [kernel]: RTW: bEndpointAddress=84 1656661722.780727 WARN 0 0 [kernel]: RTW: wMaxPacketSize=512 1656661722.780733 WARN 0 0 [kernel]: RTW: bInterval=0 1656661722.780739 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_bulk_in = 4 1656661722.780745 WARN 0 0 [kernel]: RTW: 1656661722.780751 WARN 0 0 [kernel]: usb_endpoint_descriptor(1): 1656661722.780757 WARN 0 0 [kernel]: RTW: bLength=7 1656661722.780763 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656661722.780769 WARN 0 0 [kernel]: RTW: bEndpointAddress=5 1656661722.780775 WARN 0 0 [kernel]: RTW: wMaxPacketSize=512 1656661722.780781 WARN 0 0 [kernel]: RTW: bInterval=0 1656661722.780787 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_bulk_out = 5 1656661722.780792 WARN 0 0 [kernel]: RTW: 1656661722.780798 WARN 0 0 [kernel]: usb_endpoint_descriptor(2): 1656661722.780804 WARN 0 0 [kernel]: RTW: bLength=7 1656661722.780810 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656661722.780816 WARN 0 0 [kernel]: RTW: bEndpointAddress=6 1656661722.780822 WARN 0 0 [kernel]: RTW: wMaxPacketSize=512 1656661722.780828 WARN 0 0 [kernel]: RTW: bInterval=0 1656661722.780834 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_bulk_out = 6 1656661722.780840 WARN 0 0 [kernel]: RTW: 1656661722.780846 WARN 0 0 [kernel]: usb_endpoint_descriptor(3): 1656661722.780852 WARN 0 0 [kernel]: RTW: bLength=7 1656661722.780857 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656661722.780863 WARN 0 0 [kernel]: RTW: bEndpointAddress=87 1656661722.780869 WARN 0 0 [kernel]: RTW: wMaxPacketSize=64 1656661722.780875 WARN 0 0 [kernel]: RTW: bInterval=3 1656661722.780881 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_int_in = 7, Interval = 3 1656661722.780887 WARN 0 0 [kernel]: RTW: 1656661722.780893 WARN 0 0 [kernel]: usb_endpoint_descriptor(4): 1656661722.780899 WARN 0 0 [kernel]: RTW: bLength=7 1656661722.780905 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656661722.780922 WARN 0 0 [kernel]: RTW: bEndpointAddress=8 1656661722.780928 WARN 0 0 [kernel]: RTW: wMaxPacketSize=512 1656661722.780934 WARN 0 0 [kernel]: RTW: bInterval=0 1656661722.780940 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_bulk_out = 8 1656661722.781129 WARN 0 0 [kernel]: RTW: 1656661722.781139 WARN 0 0 [kernel]: usb_endpoint_descriptor(5): 1656661722.781145 WARN 0 0 [kernel]: RTW: bLength=7 1656661722.781151 WARN 0 0 [kernel]: RTW: bDescriptorType=5 1656661722.781157 WARN 0 0 [kernel]: RTW: bEndpointAddress=9 1656661722.781163 WARN 0 0 [kernel]: RTW: wMaxPacketSize=512 1656661722.781169 WARN 0 0 [kernel]: RTW: bInterval=0 1656661722.781175 WARN 0 0 [kernel]: RTW: RT_usb_endpoint_is_bulk_out = 9 1656661722.781181 WARN 0 0 [kernel]: RTW: nr_endpoint=6, in_num=2, out_num=4 1656661722.781189 WARN 0 0 [kernel]: 1656661722.781194 WARN 0 0 [kernel]: RTW: USB_SPEED_HIGH 1656661722.781200 WARN 0 0 [kernel]: RTW: CHIP TYPE: RTL8723DU 1656661722.785652 WARN 0 0 [kernel]: RTW: rtw_hal_config_rftype RF_Type is 0 TotalTxPath is 1 1656661722.785674 WARN 0 0 [kernel]: RTW: Chip Version Info: CHIP_8723D_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0) 1656661722.785680 WARN 0 0 [kernel]: RTW: USB NumInPipe(2), NumOutPipe(4/4) 1656661722.785687 WARN 0 0 [kernel]: RTW: EEPROM type is E-FUSE 1656661722.786571 WARN 0 0 [kernel]: RTW: Boot from EFUSE, Autoload OK ! 1656661722.788608 WARN 0 0 [kernel]: RTW: hal_EfuseSwitchToBank: Efuse switch bank to 0 1656661722.836547 INFO 0 0 [usb_bt_mdev.3217]: MDEV:hci0 ACTION:add SEQNUM:925 1656661724.276637 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] addr=0x0 bResult=0 time out 1s !!! 1656661724.276663 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] EFUSE_CTRL =0x50600000 !!! 1656661724.276669 WARN 0 0 [kernel]: RTW: hal_ReadEFuse_WiFi: data end at address=0x0 1656661724.283585 WARN 0 0 [kernel]: RTW: ERROR wrong map size 33554432 1656661724.283602 WARN 0 0 [kernel]: RTW: ERROR eFuse length error :33554432 1656661724.283608 WARN 0 0 [kernel]: RTW: ERROR invalid phy efuse and read from file fail, will use driver default!! 1656661724.283615 WARN 0 0 [kernel]: RTW: EEPROM ID(0xffff) is invalid!! 1656661724.283621 WARN 0 0 [kernel]: RTW: VID = 0x5678, PID = 0x1234 1656661724.283627 WARN 0 0 [kernel]: RTW: Customer ID: 0xAB, SubCustomer ID: 0xCD 1656661724.283633 WARN 0 0 [kernel]: RTW: rtw_read_macaddr_from_file /data/wifimac.txt is not readable 1656661724.283640 WARN 0 0 [kernel]: RTW: [A] 2G G00 CCK-1T base:45 from IC_DEF 1656661724.283646 WARN 0 0 [kernel]: RTW: [A] 2G G01 CCK-1T base:45 from IC_DEF 1656661724.283652 WARN 0 0 [kernel]: RTW: [A] 2G G02 CCK-1T base:45 from IC_DEF 1656661724.283658 WARN 0 0 [kernel]: RTW: [A] 2G G03 CCK-1T base:45 from IC_DEF 1656661724.283664 WARN 0 0 [kernel]: RTW: [A] 2G G04 CCK-1T base:45 from IC_DEF 1656661724.283670 WARN 0 0 [kernel]: RTW: [A] 2G G05 CCK-1T base:45 from IC_DEF 1656661724.283676 WARN 0 0 [kernel]: RTW: [A] 2G G00 BW40-1S base:45 from IC_DEF 1656661724.283682 WARN 0 0 [kernel]: RTW: [A] 2G G01 BW40-1S base:45 from IC_DEF 1656661724.283688 WARN 0 0 [kernel]: RTW: [A] 2G G02 BW40-1S base:45 from IC_DEF 1656661724.283709 WARN 0 0 [kernel]: RTW: [A] 2G G03 BW40-1S base:45 from IC_DEF 1656661724.283715 WARN 0 0 [kernel]: RTW: [A] 2G G04 BW40-1S base:45 from IC_DEF 1656661724.283721 WARN 0 0 [kernel]: RTW: [B] 2G G00 CCK-1T base:34 from IC_DEF 1656661724.283727 WARN 0 0 [kernel]: RTW: [B] 2G G01 CCK-1T base:34 from IC_DEF 1656661724.283733 WARN 0 0 [kernel]: RTW: [B] 2G G02 CCK-1T base:34 from IC_DEF 1656661724.283977 WARN 0 0 [kernel]: RTW: [B] 2G G03 CCK-1T base:34 from IC_DEF 1656661724.283990 WARN 0 0 [kernel]: RTW: [B] 2G G04 CCK-1T base:34 from IC_DEF 1656661724.283996 WARN 0 0 [kernel]: RTW: [B] 2G G05 CCK-1T base:34 from IC_DEF 1656661724.284002 WARN 0 0 [kernel]: RTW: [B] 2G G00 BW40-1S base:33 from IC_DEF 1656661724.284008 WARN 0 0 [kernel]: RTW: [B] 2G G01 BW40-1S base:33 from IC_DEF 1656661724.284014 WARN 0 0 [kernel]: RTW: [B] 2G G02 BW40-1S base:33 from IC_DEF 1656661724.284020 WARN 0 0 [kernel]: RTW: [B] 2G G03 BW40-1S base:33 from IC_DEF 1656661724.284027 WARN 0 0 [kernel]: RTW: [B] 2G G04 BW40-1S base:33 from IC_DEF 1656661724.284033 WARN 0 0 [kernel]: RTW: Hal_EfuseParseBTCoexistInfo_8723D: Disable BT-coex, ant_num=1 1656661724.284039 WARN 0 0 [kernel]: RTW: hal_com_config_channel_plan use def_chplan:0x20 1656661724.303487 WARN 0 0 [kernel]: RTW: SetHwReg: bMacPwrCtrlOn=1 1656661724.305511 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload((null)) tmp_ps=0 1656661724.305525 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload fw: FW_NIC, size: 27828 1656661724.305531 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload: fw_ver=29 fw_subver=0000 sig=0x23d1, Month=01, Date=04, Hour=08, Minute=57 1656661724.305538 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload(): Shift for fw header! 1656661724.305544 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload by IO write! 1656661724.337471 INFO 0 0 [kernel]: rtl8723du firmware loaded. 1656661724.352466 INFO 0 0 [kernel]: rtl8723du firmware loaded. 1656661724.366507 INFO 0 0 [kernel]: rtl8723du firmware loaded. 1656661724.380466 INFO 0 0 [kernel]: rtl8723du firmware loaded. 1656661724.394469 INFO 0 0 [kernel]: rtl8723du firmware loaded. 1656661724.414515 INFO 0 0 [kernel]: rtl8723du firmware loaded. 1656661724.414528 INFO 0 0 [kernel]: *** rtl8723du firmware loaded. 1656661724.414534 WARN 0 0 [kernel]: RTW: polling_fwdl_chksum: Checksum report OK! (1, 0ms), REG_MCUFWDL:0x00060305 1656661724.414541 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload: download FW count:1 1656661724.419469 WARN 0 0 [kernel]: RTW: _8051Reset8723: Finish 1656661724.615518 WARN 0 0 [kernel]: RTW: _FWFreeToGo: Polling FW ready Fail! (520, 200ms), REG_MCUFWDL:0x00030604 1656661724.622446 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload fail. write_fw:1, 310ms 1656661724.623479 WARN 0 0 [kernel]: RTW: <=== rtl8723d_FirmwareDownload() 1656661724.623492 WARN 0 0 [kernel]: RTW: c2h_mac_hidden_rpt_bt_info_hdl bt_ft_ver: 1 1656661724.623498 WARN 0 0 [kernel]: RTW: CardDisableRTL8723du((null)): bMacPwrCtrlOn=1 1656661724.623504 WARN 0 0 [kernel]: RTW: SetHwReg: bMacPwrCtrlOn=0 1656661724.639527 WARN 0 0 [kernel]: RTW: hal_read_mac_hidden_rpt Fail! (0, 356ms), fwdl:0, id:0xfd 1656661724.639558 WARN 0 0 [kernel]: RTW: rtw_hal_read_chip_info in 1854 ms 1656661724.639565 WARN 0 0 [kernel]: RTW: rtw_usb_primary_adapter_init Failed!

Do you have any suggestion ?

lwfinger commented 2 years ago

The problem starts here:

1656661724.276637 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] addr=0x0 bResult=0 time out 1s !!! 1656661724.276663 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] EFUSE_CTRL =0x50600000 !!! 1656661724.276669 WARN 0 0 [kernel]: RTW: hal_ReadEFuse_WiFi: data end at address=0x0 1656661724.283585 WARN 0 0 [kernel]: RTW: ERROR wrong map size 33554432 1656661724.283602 WARN 0 0 [kernel]: RTW: ERROR eFuse length error :33554432 1656661724.283608 WARN 0 0 [kernel]: RTW: ERROR invalid phy efuse and read from file fail, will use driver default!! 1656661724.283615 WARN 0 0 [kernel]: RTW: EEPROM ID(0xffff) is invalid!!

I have suppressed all that endpoint output, which is only needed in very special cases, and fix a minor error in the timeout routine for OneByte. I added some test prints. Try and report.

lwfinger commented 2 years ago

I got a little hurried with my previous post, and forgot to say that we have made significant progress. Now to find the remaining bits that are not properly annotated.

gtisan commented 2 years ago

Here is the log after last changes : 1656921778.505504 INFO 0 0 [kernel]: usb 1-1: new high-speed USB device number 2 using xhci_hcd 1656921778.634487 INFO 0 0 [kernel]: usb 1-1: New USB device found, idVendor=7392, idProduct=d611, bcdDevice= 2.00 1656921778.634507 INFO 0 0 [kernel]: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 1656921778.635527 INFO 0 0 [kernel]: usb 1-1: Product: 802.11n WLAN Adapter 1656921778.635548 INFO 0 0 [kernel]: usb 1-1: Manufacturer: Realtek 1656921778.635554 INFO 0 0 [kernel]: usb 1-1: SerialNumber: 00e04c000001 1656921778.660605 INFO 0 0 [kernel]: Contents of REG_SYS_CFG 0x413135 1656921778.660631 INFO 0 0 [kernel]: Contents of REG_GPIO_OUTSTS 0x40000454 1656921778.660637 INFO 0 0 [kernel]: *** Contents of REG_MULTI_FUNC_CTRL 0xb205c80c 1656921778.695465 INFO 0 0 [usb_bt_mdev.2965]: MDEV:hci0 ACTION:add SEQNUM:913

gtisan commented 2 years ago

Here is a better log with log level on INFO 1657009329.471542 INFO 0 0 [kernel]: usb 1-1: new high-speed USB device number 4 using xhci_hcd 1657009329.601505 INFO 0 0 [kernel]: usb 1-1: New USB device found, idVendor=7392, idProduct=d611, bcdDevice= 2.00 1657009329.601526 INFO 0 0 [kernel]: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 1657009329.601533 INFO 0 0 [kernel]: usb 1-1: Product: 802.11n WLAN Adapter 1657009329.601539 INFO 0 0 [kernel]: usb 1-1: Manufacturer: Realtek 1657009329.601545 INFO 0 0 [kernel]: usb 1-1: SerialNumber: 00e04c000001 1657009329.625647 WARN 0 0 [kernel]: RTW: nr_endpoint=6, in_num=2, out_num=4 1657009329.625674 WARN 0 0 [kernel]: 1657009329.625680 WARN 0 0 [kernel]: RTW: USB_SPEED_HIGH 1657009329.625687 WARN 0 0 [kernel]: RTW: CHIP TYPE: RTL8723DU 1657009329.625693 INFO 0 0 [kernel]: Contents of REG_SYS_CFG 0x413135 1657009329.626383 INFO 0 0 [kernel]: Contents of REG_GPIO_OUTSTS 0x40000454 1657009329.626563 INFO 0 0 [kernel]: *** Contents of REG_MULTI_FUNC_CTRL 0xb205c80c 1657009329.626573 WARN 0 0 [kernel]: RTW: rtw_hal_config_rftype RF_Type is 0 TotalTxPath is 1 1657009329.626579 WARN 0 0 [kernel]: RTW: Chip Version Info: CHIP_8723D_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0) 1657009329.626586 WARN 0 0 [kernel]: RTW: USB NumInPipe(2), NumOutPipe(4/4) 1657009329.627907 WARN 0 0 [kernel]: RTW: EEPROM type is E-FUSE 1657009329.627921 WARN 0 0 [kernel]: RTW: Boot from EFUSE, Autoload OK ! 1657009329.629485 WARN 0 0 [kernel]: RTW: hal_EfuseSwitchToBank: Efuse switch bank to 0 1657009329.667925 INFO 0 0 [usb_bt_mdev.25644]: MDEV:hci0 ACTION:add SEQNUM:957 1657009331.043545 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] addr=0x0 bResult=0 time out 1s !!! 1657009331.043571 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] EFUSE_CTRL =0x50600000 !!! 1657009331.043578 WARN 0 0 [kernel]: RTW: hal_ReadEFuse_WiFi: data end at address=0x0 1657009331.043584 WARN 0 0 [kernel]: RTW: ERROR wrong map size 33554432 1657009331.043591 WARN 0 0 [kernel]: RTW: ERROR eFuse length error :33554432 1657009331.043597 WARN 0 0 [kernel]: RTW: ERROR invalid phy efuse and read from file fail, will use driver default!! 1657009331.043604 WARN 0 0 [kernel]: RTW: EEPROM ID(0xffff) is invalid!! 1657009331.043610 WARN 0 0 [kernel]: RTW: VID = 0x5678, PID = 0x1234 1657009331.043616 WARN 0 0 [kernel]: RTW: Customer ID: 0xAB, SubCustomer ID: 0xCD 1657009331.043622 WARN 0 0 [kernel]: RTW: rtw_read_macaddr_from_file /data/wifimac.txt is not readable 1657009331.043629 WARN 0 0 [kernel]: RTW: [A] 2G G00 CCK-1T base:45 from IC_DEF 1657009331.043635 WARN 0 0 [kernel]: RTW: [A] 2G G01 CCK-1T base:45 from IC_DEF 1657009331.043641 WARN 0 0 [kernel]: RTW: [A] 2G G02 CCK-1T base:45 from IC_DEF 1657009331.043648 WARN 0 0 [kernel]: RTW: [A] 2G G03 CCK-1T base:45 from IC_DEF 1657009331.043654 WARN 0 0 [kernel]: RTW: [A] 2G G04 CCK-1T base:45 from IC_DEF 1657009331.043660 WARN 0 0 [kernel]: RTW: [A] 2G G05 CCK-1T base:45 from IC_DEF 1657009331.043666 WARN 0 0 [kernel]: RTW: [A] 2G G00 BW40-1S base:45 from IC_DEF 1657009331.043686 WARN 0 0 [kernel]: RTW: [A] 2G G01 BW40-1S base:45 from IC_DEF 1657009331.043692 WARN 0 0 [kernel]: RTW: [A] 2G G02 BW40-1S base:45 from IC_DEF 1657009331.043699 WARN 0 0 [kernel]: RTW: [A] 2G G03 BW40-1S base:45 from IC_DEF 1657009331.043870 WARN 0 0 [kernel]: RTW: [A] 2G G04 BW40-1S base:45 from IC_DEF 1657009331.043880 WARN 0 0 [kernel]: RTW: [B] 2G G00 CCK-1T base:34 from IC_DEF 1657009331.043886 WARN 0 0 [kernel]: RTW: [B] 2G G01 CCK-1T base:34 from IC_DEF 1657009331.043893 WARN 0 0 [kernel]: RTW: [B] 2G G02 CCK-1T base:34 from IC_DEF 1657009331.043899 WARN 0 0 [kernel]: RTW: [B] 2G G03 CCK-1T base:34 from IC_DEF 1657009331.043905 WARN 0 0 [kernel]: RTW: [B] 2G G04 CCK-1T base:34 from IC_DEF 1657009331.043911 WARN 0 0 [kernel]: RTW: [B] 2G G05 CCK-1T base:34 from IC_DEF 1657009331.043918 WARN 0 0 [kernel]: RTW: [B] 2G G00 BW40-1S base:33 from IC_DEF 1657009331.049537 WARN 0 0 [kernel]: RTW: [B] 2G G01 BW40-1S base:33 from IC_DEF 1657009331.049553 WARN 0 0 [kernel]: RTW: [B] 2G G02 BW40-1S base:33 from IC_DEF 1657009331.049560 WARN 0 0 [kernel]: RTW: [B] 2G G03 BW40-1S base:33 from IC_DEF 1657009331.049566 WARN 0 0 [kernel]: RTW: [B] 2G G04 BW40-1S base:33 from IC_DEF 1657009331.049572 WARN 0 0 [kernel]: RTW: Hal_EfuseParseBTCoexistInfo_8723D: Disable BT-coex, ant_num=1 1657009331.049579 WARN 0 0 [kernel]: RTW: hal_com_config_channel_plan use def_chplan:0x20 1657009331.069488 WARN 0 0 [kernel]: RTW: SetHwReg: bMacPwrCtrlOn=1 1657009331.071442 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload((null)) tmp_ps=0 1657009331.071455 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload fw: FW_NIC, size: 27828 1657009331.071462 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload: fw_ver=29 fw_subver=0000 sig=0x23d1, Month=01, Date=04, Hour=08, Minute=57 1657009331.071468 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload(): Shift for fw header! 1657009331.071475 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload by IO write! 1657009331.180482 WARN 0 0 [kernel]: RTW: polling_fwdl_chksum: Checksum report OK! (1, 1ms), REG_MCUFWDL:0x00060305 1657009331.180501 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload: download FW count:1 1657009331.186559 WARN 0 0 [kernel]: RTW: _8051Reset8723: Finish 1657009331.380501 WARN 0 0 [kernel]: RTW: _FWFreeToGo: Polling FW ready Fail! (514, 200ms), REG_MCUFWDL:0x00030604 1657009331.380522 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload fail. write_fw:1, 309ms 1657009331.388440 WARN 0 0 [kernel]: RTW: <=== rtl8723d_FirmwareDownload() 1657009331.388453 WARN 0 0 [kernel]: RTW: c2h_mac_hidden_rpt_bt_info_hdl bt_ft_ver: 1 1657009331.389441 WARN 0 0 [kernel]: RTW: CardDisableRTL8723du((null)): bMacPwrCtrlOn=1 1657009331.389454 WARN 0 0 [kernel]: RTW: SetHwReg: bMacPwrCtrlOn=0 1657009331.405513 WARN 0 0 [kernel]: RTW: hal_read_mac_hidden_rpt Fail! (0, 356ms), fwdl:0, id:0xfd 1657009331.405532 WARN 0 0 [kernel]: RTW: rtw_hal_read_chip_info in 1778 ms 1657009331.405539 WARN 0 0 [kernel]: RTW: rtw_usb_primary_adapter_init Failed!

It seems that efuse_OneByteRead still timeouts.

lwfinger commented 2 years ago

I have no idea why that would be endian specific. One byte reads and writes are not endian affected unless the hardware reverses the bit order as well. I see no reason that this is the case here.

I pushed a few more data logging statements in this routine. Pull and run sending me the same log info as in the previous report. Thanks.

gtisan commented 2 years ago

Hier it is the new log: 1657088376.222774 INFO 0 0 [kernel]: usb 1-1: new high-speed USB device number 2 using xhci_hcd 1657088376.351749 INFO 0 0 [kernel]: usb 1-1: New USB device found, idVendor=7392, idProduct=d611, bcdDevice= 2.00 1657088376.351768 INFO 0 0 [kernel]: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 1657088376.351775 INFO 0 0 [kernel]: usb 1-1: Product: 802.11n WLAN Adapter 1657088376.352798 INFO 0 0 [kernel]: usb 1-1: Manufacturer: Realtek 1657088376.352817 INFO 0 0 [kernel]: usb 1-1: SerialNumber: 00e04c000001 1657088376.377102 WARN 0 0 [kernel]: RTW: nr_endpoint=6, in_num=2, out_num=4 1657088376.377130 WARN 0 0 [kernel]: 1657088376.377136 WARN 0 0 [kernel]: RTW: USB_SPEED_HIGH 1657088376.377142 WARN 0 0 [kernel]: RTW: CHIP TYPE: RTL8723DU 1657088376.377148 INFO 0 0 [kernel]: Contents of REG_SYS_CFG 0x413135 1657088376.381835 INFO 0 0 [kernel]: Contents of REG_GPIO_OUTSTS 0x40000454 1657088376.381857 INFO 0 0 [kernel]: * Contents of REG_MULTI_FUNC_CTRL 0xb205c80c 1657088376.381863 WARN 0 0 [kernel]: RTW: rtw_hal_config_rftype RF_Type is 0 TotalTxPath is 1 1657088376.381869 WARN 0 0 [kernel]: RTW: Chip Version Info: CHIP_8723D_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0) 1657088376.381875 WARN 0 0 [kernel]: RTW: USB NumInPipe(2), NumOutPipe(4/4) 1657088376.381882 WARN 0 0 [kernel]: RTW: EEPROM type is E-FUSE 1657088376.383848 WARN 0 0 [kernel]: RTW: Boot from EFUSE, Autoload OK ! 1657088376.383873 WARN 0 0 [kernel]: RTW: hal_EfuseSwitchToBank: Efuse switch bank to 0 1657088376.385852 INFO 0 0 [kernel]: ***** wrote 0x0 to EFUSE_CTRL + 1 1657088376.386779 INFO 0 0 [kernel]: wrote 0x60 to EyyFUSE_CTRL + 2 1657088376.387765 INFO 0 0 [kernel]: wrote 0x50 to EFUSE_CTRL + 3, readbyte 0x50 1657088376.430128 INFO 0 0 [usb_bt_mdev.4039]: MDEV:hci0 ACTION:add SEQNUM:925 1657088377.803814 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] addr=0x0 bResult=0 time out 1s !!! 1657088377.803840 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] EFUSE_CTRL =0x50600000 !!! 1657088377.803846 WARN 0 0 [kernel]: RTW: hal_ReadEFuse_WiFi: data end at address=0x0 1657088377.803852 WARN 0 0 [kernel]: RTW: ERROR wrong map size 33554432 1657088377.803859 WARN 0 0 [kernel]: RTW: ERROR eFuse length error :33554432 1657088377.803865 WARN 0 0 [kernel]: RTW: ERROR invalid phy efuse and read from file fail, will use driver default!! 1657088377.803871 WARN 0 0 [kernel]: RTW: EEPROM ID(0xffff) is invalid!! 1657088377.803877 WARN 0 0 [kernel]: RTW: VID = 0x5678, PID = 0x1234 1657088377.803883 WARN 0 0 [kernel]: RTW: Customer ID: 0xAB, SubCustomer ID: 0xCD 1657088377.803890 WARN 0 0 [kernel]: RTW: rtw_read_macaddr_from_file /data/wifimac.txt is not readable 1657088377.808753 WARN 0 0 [kernel]: RTW: [A] 2G G00 CCK-1T base:45 from IC_DEF 1657088377.808769 WARN 0 0 [kernel]: RTW: [A] 2G G01 CCK-1T base:45 from IC_DEF 1657088377.808827 WARN 0 0 [kernel]: RTW: [A] 2G G02 CCK-1T base:45 from IC_DEF 1657088377.808834 WARN 0 0 [kernel]: RTW: [A] 2G G03 CCK-1T base:45 from IC_DEF 1657088377.808840 WARN 0 0 [kernel]: RTW: [A] 2G G04 CCK-1T base:45 from IC_DEF 1657088377.808846 WARN 0 0 [kernel]: RTW: [A] 2G G05 CCK-1T base:45 from IC_DEF 1657088377.808852 WARN 0 0 [kernel]: RTW: [A] 2G G00 BW40-1S base:45 from IC_DEF 1657088377.808859 WARN 0 0 [kernel]: RTW: [A] 2G G01 BW40-1S base:45 from IC_DEF 1657088377.808865 WARN 0 0 [kernel]: RTW: [A] 2G G02 BW40-1S base:45 from IC_DEF 1657088377.808871 WARN 0 0 [kernel]: RTW: [A] 2G G03 BW40-1S base:45 from IC_DEF 1657088377.808877 WARN 0 0 [kernel]: RTW: [A] 2G G04 BW40-1S base:45 from IC_DEF 1657088377.808883 WARN 0 0 [kernel]: RTW: [B] 2G G00 CCK-1T base:34 from IC_DEF 1657088377.808889 WARN 0 0 [kernel]: RTW: [B] 2G G01 CCK-1T base:34 from IC_DEF 1657088377.808895 WARN 0 0 [kernel]: RTW: [B] 2G G02 CCK-1T base:34 from IC_DEF 1657088377.808901 WARN 0 0 [kernel]: RTW: [B] 2G G03 CCK-1T base:34 from IC_DEF 1657088377.808908 WARN 0 0 [kernel]: RTW: [B] 2G G04 CCK-1T base:34 from IC_DEF 1657088377.808914 WARN 0 0 [kernel]: RTW: [B] 2G G05 CCK-1T base:34 from IC_DEF 1657088377.808920 WARN 0 0 [kernel]: RTW: [B] 2G G00 BW40-1S base:33 from IC_DEF 1657088377.808926 WARN 0 0 [kernel]: RTW: [B] 2G G01 BW40-1S base:33 from IC_DEF 1657088377.808932 WARN 0 0 [kernel]: RTW: [B] 2G G02 BW40-1S base:33 from IC_DEF 1657088377.808938 WARN 0 0 [kernel]: RTW: [B] 2G G03 BW40-1S base:33 from IC_DEF 1657088377.808944 WARN 0 0 [kernel]: RTW: [B] 2G G04 BW40-1S base:33 from IC_DEF 1657088377.809104 WARN 0 0 [kernel]: RTW: Hal_EfuseParseBTCoexistInfo_8723D: Disable BT-coex, ant_num=1 1657088377.809114 WARN 0 0 [kernel]: RTW: hal_com_config_channel_plan use def_chplan:0x20 1657088377.828755 WARN 0 0 [kernel]: RTW: SetHwReg: bMacPwrCtrlOn=1 1657088377.830728 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload((null)) tmp_ps=0 1657088377.830742 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload fw: FW_NIC, size: 27828 1657088377.830748 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload: fw_ver=29 fw_subver=0000 sig=0x23d1, Month=01, Date=04, Hour=08, Minute=57 1657088377.830755 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload(): Shift for fw header! 1657088377.830761 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload by IO write! 1657088377.939774 WARN 0 0 [kernel]: RTW: polling_fwdl_chksum: Checksum report OK! (1, 1ms), REG_MCUFWDL:0x00060305 1657088377.939794 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload: download FW count:1 1657088377.943736 WARN 0 0 [kernel]: RTW: _8051Reset8723: Finish 1657088378.140774 WARN 0 0 [kernel]: RTW: _FWFreeToGo: Polling FW ready Fail! (521, 200ms), REG_MCUFWDL:0x00030604 1657088378.148707 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload fail. write_fw:1, 318ms 1657088378.148722 WARN 0 0 [kernel]: RTW: <=== rtl8723d_FirmwareDownload() 1657088378.148728 WARN 0 0 [kernel]: RTW: c2h_mac_hidden_rpt_bt_info_hdl bt_ft_ver: 1 1657088378.149733 WARN 0 0 [kernel]: RTW: CardDisableRTL8723du((null)): bMacPwrCtrlOn=1 1657088378.149746 WARN 0 0 [kernel]: RTW: SetHwReg: bMacPwrCtrlOn=0 1657088378.165785 WARN 0 0 [kernel]: RTW: hal_read_mac_hidden_rpt Fail! (0, 357ms), fwdl:0, id:0xfd 1657088378.165803 WARN 0 0 [kernel]: RTW: rtw_hal_read_chip_info in 1784 ms 1657088378.165810 WARN 0 0 [kernel]: RTW: rtw_usb_primary_adapter_init Failed!

lwfinger commented 2 years ago

Although I do not have an rtl8723du card, I do have an rtl8812au device, which has a similar driver. It works on the ppc32, big-endian machine. When I looked at the differences, I found a potential error in usb_read16(). Pull and try this change.

gtisan commented 2 years ago

It is really strange, nothing change better. Maybe I can really try to send you the wifi stick.

RTW: nr_endpoint=6, in_num=2, out_num=4

RTW: USB_SPEED_HIGH RTW: CHIP TYPE: RTL8723DU RTW: rtw_hal_config_rftype RF_Type is 0 TotalTxPath is 1 RTW: Chip Version Info: CHIP_8723D_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0) RTW: USB NumInPipe(2), NumOutPipe(4/4) RTW: EEPROM type is E-FUSE RTW: Boot from EFUSE, Autoload OK ! RTW: hal_EfuseSwitchToBank: Efuse switch bank to 0 1657122026.890643 INFO 0 0 [kernel]: usb 1-1: new high-speed USB device number 2 using xhci_hcd 1657122027.021709 INFO 0 0 [kernel]: usb 1-1: New USB device found, idVendor=7392, idProduct=d611, bcdDevice= 2.00 1657122027.021732 INFO 0 0 [kernel]: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 1657122027.021739 INFO 0 0 [kernel]: usb 1-1: Product: 802.11n WLAN Adapter 1657122027.021745 INFO 0 0 [kernel]: usb 1-1: Manufacturer: Realtek 1657122027.021752 INFO 0 0 [kernel]: usb 1-1: SerialNumber: 00e04c000001 1657122027.045084 WARN 0 0 [kernel]: RTW: nr_endpoint=6, in_num=2, out_num=4 1657122027.045112 WARN 0 0 [kernel]: 1657122027.045118 WARN 0 0 [kernel]: RTW: USB_SPEED_HIGH 1657122027.045124 WARN 0 0 [kernel]: RTW: CHIP TYPE: RTL8723DU 1657122027.049704 INFO 0 0 [kernel]: Contents of REG_SYS_CFG 0x413135 1657122027.049727 INFO 0 0 [kernel]: Contents of REG_GPIO_OUTSTS 0x40000454 1657122027.049734 INFO 0 0 [kernel]: * Contents of REG_MULTI_FUNC_CTRL 0xb205c80c 1657122027.049740 WARN 0 0 [kernel]: RTW: rtw_hal_config_rftype RF_Type is 0 TotalTxPath is 1 1657122027.049747 WARN 0 0 [kernel]: RTW: Chip Version Info: CHIP_8723D_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0) 1657122027.049753 WARN 0 0 [kernel]: RTW: USB NumInPipe(2), NumOutPipe(4/4) 1657122027.050677 WARN 0 0 [kernel]: RTW: EEPROM type is E-FUSE 1657122027.051620 WARN 0 0 [kernel]: RTW: Boot from EFUSE, Autoload OK ! 1657122027.053751 WARN 0 0 [kernel]: RTW: hal_EfuseSwitchToBank: Efuse switch bank to 0 1657122027.053838 INFO 0 0 [kernel]: ***** wrote 0x0 to EFUSE_CTRL + 1 1657122027.054682 INFO 0 0 [kernel]: wrote 0x60 to EyyFUSE_CTRL + 2 1657122027.056605 INFO 0 0 [kernel]: wrote 0x50 to EFUSE_CTRL + 3, readbyte 0x50 1657122027.101267 INFO 0 0 [usb_bt_mdev.3392]: MDEV:hci0 ACTION:add SEQNUM:925 RTW: efuse_OneByteRead: [ERROR] addr=0x0 bResult=0 time out 1s !!! RTW: efuse_OneByteRead: [ERROR] EFUSE_CTRL =0x50600000 !!! RTW: hal_ReadEFuse_WiFi: data end at address=0x0 RTW: ERROR wrong map size 33554432 RTW: ERROR eFuse length error :33554432 RTW: ERROR invalid phy efuse and read from file fail, will use driver default!! RTW: EEPROM ID(0xffff) is invalid!! RTW: VID = 0x5678, PID = 0x1234 RTW: Customer ID: 0xAB, SubCustomer ID: 0xCD RTW: rtw_read_macaddr_from_file /data/wifimac.txt is not readable RTW: [A] 2G G00 CCK-1T base:45 from IC_DEF RTW: [A] 2G G01 CCK-1T base:45 from IC_DEF RTW: [A] 2G G02 CCK-1T base:45 from IC_DEF RTW: [A] 2G G03 CCK-1T base:45 from IC_DEF RTW: [A] 2G G04 CCK-1T base:45 from IC_DEF RTW: [A] 2G G05 CCK-1T base:45 from IC_DEF RTW: [A] 2G G00 BW40-1S base:45 from IC_DEF RTW: [A] 2G G01 BW40-1S base:45 from IC_DEF RTW: [A] 2G G02 BW40-1S base:45 from IC_DEF RTW: [A] 2G G03 BW40-1S base:45 from IC_DEF RTW: [A] 2G G04 BW40-1S base:45 from IC_DEF RTW: [B] 2G G00 CCK-1T base:34 from IC_DEF RTW: [B] 2G G01 CCK-1T base:34 from IC_DEF RTW: [B] 2G G02 CCK-1T base:34 from IC_DEF RTW: [B] 2G G03 CCK-1T base:34 from IC_DEF RTW: [B] 2G G04 CCK-1T base:34 from IC_DEF RTW: [B] 2G G05 CCK-1T base:34 from IC_DEF RTW: [B] 2G G00 BW40-1S base:33 from IC_DEF RTW: [B] 2G G01 BW40-1S base:33 from IC_DEF RTW: [B] 2G G02 BW40-1S base:33 from IC_DEF RTW: [B] 2G G03 BW40-1S base:33 from IC_DEF RTW: [B] 2G G04 BW40-1S base:33 from IC_DEF RTW: Hal_EfuseParseBTCoexistInfo_8723D: Disable BT-coex, ant_num=1 RTW: hal_com_config_channel_plan use def_chplan:0x20 RTW: SetHwReg: bMacPwrCtrlOn=1 RTW: rtl8723d_FirmwareDownload((null)) tmp_ps=0 RTW: rtl8723d_FirmwareDownload fw: FW_NIC, size: 27828 RTW: rtl8723d_FirmwareDownload: fw_ver=29 fw_subver=0000 sig=0x23d1, Month=01, Date=04, Hour=08, Minute=57 RTW: rtl8723d_FirmwareDownload(): Shift for fw header! RTW: rtl8723d_FirmwareDownload by IO write! RTW: polling_fwdl_chksum: Checksum report OK! (1, 0ms), REG_MCUFWDL:0x00060305 RTW: rtl8723d_FirmwareDownload: download FW count:1 RTW: _8051Reset8723: Finish 1657122028.470680 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] addr=0x0 bResult=0 time out 1s !!! 1657122028.470705 WARN 0 0 [kernel]: RTW: efuse_OneByteRead: [ERROR] EFUSE_CTRL =0x50600000 !!! 1657122028.470712 WARN 0 0 [kernel]: RTW: hal_ReadEFuse_WiFi: data end at address=0x0 1657122028.470718 WARN 0 0 [kernel]: RTW: ERROR wrong map size 33554432 1657122028.470724 WARN 0 0 [kernel]: RTW: ERROR eFuse length error :33554432 1657122028.470730 WARN 0 0 [kernel]: RTW: ERROR invalid phy efuse and read from file fail, will use driver default!! 1657122028.470737 WARN 0 0 [kernel]: RTW: EEPROM ID(0xffff) is invalid!! 1657122028.470743 WARN 0 0 [kernel]: RTW: VID = 0x5678, PID = 0x1234 1657122028.470749 WARN 0 0 [kernel]: RTW: Customer ID: 0xAB, SubCustomer ID: 0xCD 1657122028.470755 WARN 0 0 [kernel]: RTW: rtw_read_macaddr_from_file /data/wifimac.txt is not readable 165712202RTW: _FWFreeToGo: Polling FW ready Fail! (519, 200ms), REG_MCUFWDL:0x00030604 8.470761 WARN RTW: rtl8723d_FirmwareDownload fail. write_fw:1, 310ms 0 0 [kernel]: RRTW: <=== rtl8723d_FirmwareDownload() TW: [A] 2G G00 CRTW: c2h_mac_hidden_rpt_bt_info_hdl bt_ft_ver: 1 CK-1T base:45 frRTW: CardDisableRTL8723du((null)): bMacPwrCtrlOn=1 om IC_DEF 16571RTW: SetHwReg: bMacPwrCtrlOn=0 22028.470781 WARTW: hal_read_mac_hidden_rpt Fail! (0, 356ms), fwdl:0, id:0xfd RN 0 0 [kernelRTW: rtw_hal_read_chip_info in 1781 ms ]: RTW: [A] 2G GRTW: rtw_usb_primary_adapter_init Failed! 01 CCK-1T base:45 from IC_DEF 1657122028.470787 WARN 0 0 [kernel]: RTW: [A] 2G G02 CCK-1T base:45 from IC_DEF 1657122028.470793 WARN 0 0 [kernel]: RTW: [A] 2G G03 CCK-1T base:45 from IC_DEF 1657122028.470799 WARN 0 0 [kernel]: RTW: [A] 2G G04 CCK-1T base:45 from IC_DEF 1657122028.470806 WARN 0 0 [kernel]: RTW: [A] 2G G05 CCK-1T base:45 from IC_DEF 1657122028.470812 WARN 0 0 [kernel]: RTW: [A] 2G G00 BW40-1S base:45 from IC_DEF 1657122028.470818 WARN 0 0 [kernel]: RTW: [A] 2G G01 BW40-1S base:45 from IC_DEF 1657122028.470824 WARN 0 0 [kernel]: RTW: [A] 2G G02 BW40-1S base:45 from IC_DEF 1657122028.470830 WARN 0 0 [kernel]: RTW: [A] 2G G03 BW40-1S base:45 from IC_DEF 1657122028.471018 WARN 0 0 [kernel]: RTW: [A] 2G G04 BW40-1S base:45 from IC_DEF 1657122028.471029 WARN 0 0 [kernel]: RTW: [B] 2G G00 CCK-1T base:34 from IC_DEF 1657122028.471035 WARN 0 0 [kernel]: RTW: [B] 2G G01 CCK-1T base:34 from IC_DEF 1657122028.471041 WARN 0 0 [kernel]: RTW: [B] 2G G02 CCK-1T base:34 from IC_DEF 1657122028.471047 WARN 0 0 [kernel]: RTW: [B] 2G G03 CCK-1T base:34 from IC_DEF 1657122028.471054 WARN 0 0 [kernel]: RTW: [B] 2G G04 CCK-1T base:34 from IC_DEF 1657122028.471060 WARN 0 0 [kernel]: RTW: [B] 2G G05 CCK-1T base:34 from IC_DEF 1657122028.471066 WARN 0 0 [kernel]: RTW: [B] 2G G00 BW40-1S base:33 from IC_DEF 1657122028.471072 WARN 0 0 [kernel]: RTW: [B] 2G G01 BW40-1S base:33 from IC_DEF 1657122028.471078 WARN 0 0 [kernel]: RTW: [B] 2G G02 BW40-1S base:33 from IC_DEF 1657122028.471084 WARN 0 0 [kernel]: RTW: [B] 2G G03 BW40-1S base:33 from IC_DEF 1657122028.471090 WARN 0 0 [kernel]: RTW: [B] 2G G04 BW40-1S base:33 from IC_DEF 1657122028.474608 WARN 0 0 [kernel]: RTW: Hal_EfuseParseBTCoexistInfo_8723D: Disable BT-coex, ant_num=1 1657122028.474624 WARN 0 0 [kernel]: RTW: hal_com_config_channel_plan use def_chplan:0x20 1657122028.494636 WARN 0 0 [kernel]: RTW: SetHwReg: bMacPwrCtrlOn=1 1657122028.495634 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload((null)) tmp_ps=0 1657122028.495647 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload fw: FW_NIC, size: 27828 1657122028.495653 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload: fw_ver=29 fw_subver=0000 sig=0x23d1, Month=01, Date=04, Hour=08, Minute=57 1657122028.495660 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload(): Shift for fw header! 1657122028.495666 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload by IO write! 1657122028.604633 WARN 0 0 [kernel]: RTW: polling_fwdl_chksum: Checksum report OK! (1, 0ms), REG_MCUFWDL:0x00060305 1657122028.604649 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload: download FW count:1 1657122028.609595 WARN 0 0 [kernel]: RTW: _8051Reset8723: Finish 1657122028.805619 WARN 0 0 [kernel]: RTW: _FWFreeToGo: Polling FW ready Fail! (519, 200ms), REG_MCUFWDL:0x00030604 1657122028.805638 WARN 0 0 [kernel]: RTW: rtl8723d_FirmwareDownload fail. write_fw:1, 310ms 1657122028.813631 WARN 0 0 [kernel]: RTW: <=== rtl8723d_FirmwareDownload() 1657122028.813793 WARN 0 0 [kernel]: RTW: c2h_mac_hidden_rpt_bt_info_hdl bt_ft_ver: 1 1657122028.814572 WARN 0 0 [kernel]: RTW: CardDisableRTL8723du((null)): bMacPwrCtrlOn=1 1657122028.814600 WARN 0 0 [kernel]: RTW: SetHwReg: bMacPwrCtrlOn=0 1657122028.830653 WARN 0 0 [kernel]: RTW: hal_read_mac_hidden_rpt Fail! (0, 356ms), fwdl:0, id:0xfd 1657122028.830672 WARN 0 0 [kernel]: RTW: rtw_hal_read_chip_info in 1781 ms 1657122028.830678 WARN 0 0 [kernel]: RTW: rtw_usb_primary_adapter_init Failed!

lwfinger commented 2 years ago

I think we have reached the point where being able to access both LE and BE platforms would be very desirable.

I just ordered an EW-7611ULB from E-bay. It should arrive by July 13. In the meantime, I will look at the code to see if I can find problems.

gtisan commented 2 years ago

I hope that you ordered V2 of EW-7611ULB. First version has RTL8723BU chipset.

lwfinger commented 2 years ago

Just in case the first one was a V1, I just ordered a V2 as well. It will also arrive by July 13. Thanks for the warning.

lwfinger commented 2 years ago

I am having trouble getting a v2. If you are still willing, perhaps you should send me yours.

Send E-mail to larry.finger@lwfinger.net and I will send you my address.

lwfinger commented 2 years ago

Good news. I found that 2- and 4-bit writes were undergoing the byte swapping twice, once in _rtw_write{16,32}() and once more in usb_write{16,32}(). Keeping the transform as close as possible to the device, I removed the transform in _rtw_writexx().

The device is now running on my PowerBook with a ppc32 big-endian cpu.

Performance is pretty good. Connected to my wifi5 Linksys EA6900 AP, I am getting download speeds of 40-45 Mbps, and upload speeds of 32-37 Mbps. The connection is stable without any drops. I will continue testing overnight and send it back tomorrow.

gtisan commented 2 years ago

I test it also and it works very well, thanks.