Bug 217205 - rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
Summary: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
Status: REOPENED
Alias: None
Product: Drivers
Classification: Unclassified
Component: network-wireless (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_network-wireless@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-15 16:26 UTC by Michael
Modified: 2024-01-30 20:03 UTC (History)
1 user (show)

See Also:
Kernel Version: 6.8-rc2
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
quick and dirty code to reset a "dead" USB interface (797 bytes, text/plain)
2023-04-09 18:08 UTC, Michael
Details
entire results of the for next loop (18.84 KB, text/plain)
2023-04-10 08:40 UTC, Michael
Details
RTL8188EU firmware v28 (14.90 KB, application/octet-stream)
2023-04-18 20:16 UTC, rtl8821cerfe2
Details

Description Michael 2023-03-15 16:26:58 UTC
After USB WLAN interface is connected for the first time, interface doesn't respond:
rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!


[ 5085.096197] usbcore: registered new interface driver rtl8xxxu
[ 5104.105708] usb 1-2: new high-speed USB device number 3 using xhci_hcd
[ 5104.357890] usb 1-2: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[ 5104.357901] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5104.357905] usb 1-2: Product: 802.11n NIC
[ 5104.357908] usb 1-2: Manufacturer: Realtek
[ 5107.412769] usb 1-2: Vendor: Realtek
[ 5107.412777] usb 1-2: Product: \x03802.11n NI
[ 5107.412781] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[ 5107.412785] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[ 5107.412793] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
[ 5107.412797] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[ 5107.421690] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[ 5111.638510] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!


After reconnecting the interface , everything is fine:
[ 5162.855223] usb 1-2: new high-speed USB device number 4 using xhci_hcd
[ 5163.106485] usb 1-2: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[ 5163.106496] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5163.106500] usb 1-2: Product: 802.11n NIC
[ 5163.106503] usb 1-2: Manufacturer: Realtek
[ 5166.161384] usb 1-2: Vendor: Realtek
[ 5166.161399] usb 1-2: Product: \x03802.11n NI
[ 5166.161402] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[ 5166.161404] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[ 5166.161410] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
[ 5166.161414] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[ 5166.164736] usb 1-2: Firmware revision 11.1 (signature 0x88e1)


I've read the wireless mailing list and noticed the patches, e.g.:
https://lore.kernel.org/lkml/a0c14bfd-a502-6b19-de75-491ea9af3816@gmail.com/T/

Now I would like to inform you that rtl8xxxu_8188e.c is also affected.
Comment 1 rtl8821cerfe2 2023-04-08 14:51:36 UTC
Thanks for the report.

When you get the message „Path A RX IQK failed!” can you still use the device? Does it scan? Does it connect?

IQ calibration is attempted twice, so if you only saw one of these messages it means the second attempt was successful and the device should be working.
Comment 2 Michael 2023-04-08 15:48:30 UTC
The device doesn't respond. After reconnecting it or after an USB reset everything is fine.
Comment 3 rtl8821cerfe2 2023-04-09 14:23:47 UTC
Unfortunately my TP-Link TL-WN725N doesn't have that problem.

What are you trying to do with the device when it doesn't respond?
Comment 4 Michael 2023-04-09 16:16:34 UTC
Reset the device:
static void resetusbif(char *sysfsusbdevpath)
{
static int fd_usb;

if((fd_usb = open(sysfsusbdevpath, O_WRONLY)) < 0)
	{
	fprintf(stderr, "ERROR openening USB device\n");
	return;
	}
if(ioctl(fd_usb, USBDEVFS_RESET, 0) < 0) fprintf(stderr, "ioctl failed\n");
else fprintf(stdout, "reset successful\n");
close(fd_usb);
return;
}

This always work.


BTW:
That happens on this driver, too:
https://github.com/kimocoder/realtek_rtwifi/issues/34#issue-1524625740
and let me assume, it is related to the driver.
Confirmed by another user of that driver (not the stock kernel driver)
https://github.com/kimocoder/realtek_rtwifi/issues/35#issuecomment-1444676522
Comment 5 Michael 2023-04-09 16:34:10 UTC
This will not happen if I connect e.g. a rtl8192 device:
ID 0bda:8178 Realtek Semiconductor Corp. RTL8192CU 802.11n WLAN Adapter

[36029.791983] usb 1-2: new high-speed USB device number 11 using xhci_hcd
[36029.935014] usb 1-2: New USB device found, idVendor=0bda, idProduct=8178, bcdDevice= 2.00
[36029.935025] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[36029.935030] usb 1-2: Product: USB WLAN
[36029.935033] usb 1-2: Manufacturer: 802.11n
[36029.935036] usb 1-2: SerialNumber: 00e04c000001
[36030.397257] usb 1-2: Vendor: 802.11n
[36030.397267] usb 1-2: Product: USB WLAN
[36030.397270] usb 1-2: RTL8192CU rev A (TSMC) romver 0, 2T2R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[36030.397277] usb 1-2: RTL8192CU MAC: f8:1a:67:0d:c5:27
[36030.397282] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
[36030.401276] usb 1-2: Firmware revision 88.2 (signature 0x88c1)
[36031.451440] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
Comment 6 Michael 2023-04-09 16:43:36 UTC
compared to a rtl8188 device. This time a Logilink 0150  & efuse information:
sudo insmod rtl8xxxu.ko debug=0x2000

[36544.627558] usbcore: registered new interface driver rtl8xxxu
[36549.949836] usb 1-2: new high-speed USB device number 13 using xhci_hcd
[36550.091883] usb 1-2: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[36550.091895] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[36550.091900] usb 1-2: Product: 802.11n NIC
[36550.091903] usb 1-2: Manufacturer: Realtek
[36550.091906] usb 1-2: SerialNumber: 70F11C27AEEC
[36550.481162] usb 1-2: Vendor: Realtek
[36550.481173] usb 1-2: Product: \x03802.11n NI
[36550.481176] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[36550.481179] usb 1-2: Dumping efuse for RTL8188EU (0x200 bytes):
[36550.481184] 00000000: 29 81 00 6c 0b 00 00 00 00 0c 00 00 00 00 00 00  )..l............
[36550.481188] 00000010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 02 ff ff ff ff  ***********.....
[36550.481191] 00000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481193] 00000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481195] 00000040: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481198] 00000050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481200] 00000060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481202] 00000070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481204] 00000080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481206] 00000090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481209] 000000a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481211] 000000b0: ff ff ff ff ff ff ff ff 20 27 1a 00 00 00 00 00  ........ '......
[36550.481213] 000000c0: 00 00 00 10 00 00 00 00 00 01 ff ff ff ff ff ff  ................
[36550.481215] 000000d0: da 0b 79 81 42 66 00 70 f1 1c 27 ae ec 0a 03 52  ..y.Bf.p..'....R
[36550.481218] 000000e0: 65 61 6c 74 65 6b 0d 0d 03 38 30 32 2e 31 31 6e  ealtek...802.11n
[36550.481220] 000000f0: 20 4e 49 43 ff ff ff ff ff ff ff ff ff ff ff ff   NIC............
[36550.481222] 00000100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481224] 00000110: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481226] 00000120: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481228] 00000130: 81 ae 96 2d 03 93 96 11 fc 8c 00 11 9b ff ff ff  ...-............
[36550.481231] 00000140: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481233] 00000150: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481235] 00000160: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481237] 00000170: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481239] 00000180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481241] 00000190: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481243] 000001a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481246] 000001b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481248] 000001c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481250] 000001d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481252] 000001e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481254] 000001f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[36550.481257] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[36550.481264] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[36550.481268] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[36550.484894] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[36
Comment 7 Michael 2023-04-09 16:47:26 UTC
Please notice:
On first connect:
[ 5111.638510] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!

This message does not appear any longer after an USB reset or dis/reconnecting the device.

At them moment, I have no idea why this happens.
Comment 8 rtl8821cerfe2 2023-04-09 17:31:21 UTC
Can you try firmware v28? https://github.com/lwfinger/rtl8188eu/blob/1201a7a51fcef5228cc5aa6df749e6c94c91c70b/hal8188e_t_fw.c#L1957

What are you trying to do with the device when it doesn't respond? In other words, what command are you running when you notice it doesn't respond?
Comment 9 Michael 2023-04-09 18:08:48 UTC
Created attachment 304103 [details]
quick and dirty code to reset a "dead" USB interface

gcc resetif.c -o resetif
Comment 10 Michael 2023-04-09 18:09:33 UTC
I'm not sure if my commands to reset an USB device will helpful.
But here they are:

get USB ID:
$ lsusb
Bus 001 Device 015: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter

reset interface:
$ sudo resetif /dev/bus/usb/001/015
reset successful

resetif is a quick and dirty code to reset an USB device if it crashed ag.g during hcxdumptool tests.

The entire code is attached above.
Comment 11 Michael 2023-04-09 18:36:48 UTC
resetif is exactly doing what I expect it to do:

Interface connected for the first time:
[43110.568424] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[43110.568428] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[43110.572456] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[43111.400716] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[43111.435086] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[43111.498085] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[43111.607823] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!

...
sudo ./resetif /dev/bus/usb/001/016
...

43344.960509] usb 1-2: disconnecting
[43344.960529] usb 1-2: Device still attached, trying to reset
[43345.081609] usb 1-2: reset high-speed USB device number 16 using xhci_hcd
[43345.609136] usb 1-2: Vendor: Realtek
[43345.609155] usb 1-2: Product: \x03802.11n NI
[43345.609158] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[43345.609162] usb 1-2: Dumping efuse for RTL8188EU (0x200 bytes):
[43345.609168] 00000000: 29 81 00 6c 0b 00 00 00 00 0c 00 00 00 00 00 00  )..l............
[43345.609173] 00000010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 02 ff ff ff ff  ***********.....
[43345.609176] 00000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609178] 00000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609181] 00000040: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609183] 00000050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609185] 00000060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609188] 00000070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609190] 00000080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609192] 00000090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609194] 000000a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609196] 000000b0: ff ff ff ff ff ff ff ff 20 27 1a 00 00 00 00 00  ........ '......
[43345.609199] 000000c0: 00 00 00 10 00 00 00 00 00 01 ff ff ff ff ff ff  ................
[43345.609201] 000000d0: da 0b 79 81 42 66 00 70 f1 1c 27 ae ec 0a 03 52  ..y.Bf.p..'....R
[43345.609203] 000000e0: 65 61 6c 74 65 6b 0d 0d 03 38 30 32 2e 31 31 6e  ealtek...802.11n
[43345.609206] 000000f0: 20 4e 49 43 ff ff ff ff ff ff ff ff ff ff ff ff   NIC............
[43345.609208] 00000100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609210] 00000110: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609212] 00000120: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609215] 00000130: 81 ae 96 2d 03 93 96 11 fc 8c 00 11 9b ff ff ff  ...-............
[43345.609217] 00000140: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609220] 00000150: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609222] 00000160: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609225] 00000170: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609227] 00000180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609229] 00000190: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609231] 000001a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609233] 000001b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609236] 000001c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609238] 000001d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609240] 000001e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609243] 000001f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[43345.609245] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[43345.609252] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[43345.609257] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[43345.614682] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[43346.553557] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0

and everything is fine.
Comment 12 Michael 2023-04-09 18:43:19 UTC
At a first step, we should make sure that the firmware is evaluated correctly.
That is not the case, right now:
Product: \x03802.11n NI
Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
Comment 13 Michael 2023-04-09 18:46:22 UTC
Edit: comment 12: I meant interface information - firmware is loaded correctly
At a first step, we should make sure that the interface information is evaluated correctly.
That is not the case, right now:
Product: \x03802.11n NI
Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
Comment 14 rtl8821cerfe2 2023-04-09 18:52:54 UTC
The problem with the product and serial is completely harmless and not related to the IQ calibration failures.
Comment 15 Michael 2023-04-09 19:17:18 UTC
I fully agree - however, fixing that, will keep dmesg log clean.

At the moment a take a look at the calibration function:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c?h=v6.3-rc6#n664
Comment 16 Michael 2023-04-09 19:22:57 UTC
Changed mdelay from 10 to 20
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c?h=v6.3-rc6#n703

[46234.153161] usb 1-2: new high-speed USB device number 19 using xhci_hcd
[46234.295693] usb 1-2: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[46234.295706] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[46234.295710] usb 1-2: Product: 802.11n NIC
[46234.295713] usb 1-2: Manufacturer: Realtek
[46234.295716] usb 1-2: SerialNumber: 70F11C27AEEC
[46234.684314] usb 1-2: Vendor: Realtek
[46234.684323] usb 1-2: Product: \x03802.11n NI
[46234.684327] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[46234.684330] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[46234.684337] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[46234.684341] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[46234.688100] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[46235.659570] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
Comment 17 Michael 2023-04-09 19:28:47 UTC
$ sudo rmmod rtl8xxxu
$ sudo insmod rtl8xxxu.ko

device number 19
no warning

device number 20
no warning

device number 21
[46446.874622] usb 1-2: new high-speed USB device number 21 using xhci_hcd
[46447.017115] usb 1-2: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[46447.017127] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[46447.017132] usb 1-2: Product: 802.11n NIC
[46447.017135] usb 1-2: Manufacturer: Realtek
[46447.017138] usb 1-2: SerialNumber: 70F11C27AEEC
[46447.406615] usb 1-2: Vendor: Realtek
[46447.406624] usb 1-2: Product: \x03802.11n NI
[46447.406629] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[46447.406632] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[46447.406639] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[46447.406643] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[46447.410510] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[46448.380953] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0

dmesg doesn't show a warning any longer.
Comment 18 Michael 2023-04-09 19:31:00 UTC
rejoiced too soon

try 22:
[46663.828964] usb 1-2: new high-speed USB device number 22 using xhci_hcd
[46663.971043] usb 1-2: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[46663.971055] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[46663.971059] usb 1-2: Product: 802.11n NIC
[46663.971063] usb 1-2: Manufacturer: Realtek
[46663.971066] usb 1-2: SerialNumber: 70F11C27AEEC
[46664.359041] usb 1-2: Vendor: Realtek
[46664.359051] usb 1-2: Product: \x03802.11n NI
[46664.359055] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[46664.359058] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[46664.359066] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[46664.359071] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[46664.363132] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[46665.377920] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[46665.412318] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[46665.457378] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
Comment 19 Michael 2023-04-09 20:20:51 UTC
Regardless if we give the interface some more time do to the calibration, the error appears randomly

Now changed the interface from a cheap Logilink 0150 to an ALFA AWUS0136NHV

https://www.alfa.com.tw/products/awus036nhv

Bus 001 Device 023: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter

[49276.814153] usb 1-2: new high-speed USB device number 23 using xhci_hcd
[49276.958540] usb 1-2: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[49276.958552] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[49276.958557] usb 1-2: Product: 802.11n NIC
[49276.958560] usb 1-2: Manufacturer: Realtek
[49277.340800] usb 1-2: Vendor: Realtek
[49277.340810] usb 1-2: Product: \x03802.11n NI
[49277.340814] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[49277.340816] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[49277.340824] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
[49277.340828] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[49277.345761] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[49278.189693] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[49278.302947] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[49278.390829] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0

$ sudo ./resetif /dev/bus/usb/001/023
reset successful

[49714.455396] usb 1-2: Device still attached, trying to reset
[49714.576361] usb 1-2: reset high-speed USB device number 23 using xhci_hcd
[49715.098521] usb 1-2: Vendor: Realtek
[49715.098530] usb 1-2: Product: \x03802.11n NI
[49715.098534] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[49715.098536] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[49715.098543] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
[49715.098547] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[49715.103048] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[49716.067057] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
Comment 20 rtl8821cerfe2 2023-04-09 22:23:11 UTC
Can you try this patch and tell me what it prints, please? I'm not sure it will work, it's inspired by the RTL8192FU driver.

diff --git a/rtl8xxxu_8188e.c b/rtl8xxxu_8188e.c
index af84360..c27c97b 100644
--- a/rtl8xxxu_8188e.c
+++ b/rtl8xxxu_8188e.c
@@ -665,6 +665,7 @@ static int rtl8188eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 {
 	u32 reg_ea4, reg_eac, reg_e94, reg_e9c, val32;
 	int result = 0;
+	int ktime;
 
 	/* Leave IQK mode */
 	val32 = rtl8xxxu_read32(priv, REG_FPGA0_IQK);
@@ -752,6 +753,13 @@ static int rtl8188eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 
 	mdelay(10);
 
+	ktime = 0;
+	while (rtl8xxxu_read32(priv, 0xea8) == 0 && ktime < 101) {
+		mdelay(5);
+		ktime += 5;
+	}
+	pr_warn("%s: waited an extra %d ms.\n", __func__, ktime);
+
 	reg_eac = rtl8xxxu_read32(priv, REG_RX_POWER_AFTER_IQK_A_2);
 	reg_ea4 = rtl8xxxu_read32(priv, REG_RX_POWER_BEFORE_IQK_A_2);
Comment 21 Michael 2023-04-10 07:05:15 UTC
Thanks. Applied to kernel 6.3-rc6

Pretty good idea to make mdelay dynamic:

[87092.697524] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[87093.533462] rtl8188eu_rx_iqk_path_a: waited an extra 0 ms.
[87093.597921] rtl8188eu_rx_iqk_path_a: waited an extra 0 ms.
[87093.645301] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0

Interesting
Did another test. This time I removed mdelay(10) from the applied patch and we enter the while loop directly:
	rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf9000000);
	rtl8xxxu_write32(priv, REG_IQK_AGC_PTS, 0xf8000000);

	ktime = 0;
	while (rtl8xxxu_read32(priv, 0xea8) == 0 && ktime < 101) {
		mdelay(5);
		ktime += 5;
	}
	pr_warn("%s: waited an extra %d ms.\n", __func__, ktime);


[87993.201415] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[87994.056759] rtl8188eu_rx_iqk_path_a: waited an extra 0 ms.
[87994.057512] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[87994.110260] rtl8188eu_rx_iqk_path_a: waited an extra 0 ms.
[87994.177262] rtl8188eu_rx_iqk_path_a: waited an extra 0 ms.
[87994.229111] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0

expected ktime at least 10
measured ktime = 0

Shouldn't the ktime increase in that case?
Comment 22 Michael 2023-04-10 08:39:47 UTC
For me it looks that mdelay(10) is completely useless.
Modified the patch to:
	pr_warn("val32: %s %04x\n", __func__, rtl8xxxu_read32(priv, 0xea8));
	for(int x = 0; x < 100; x++)
		{
		pr_warn("val32: %s %04x\n", __func__, rtl8xxxu_read32(priv, 0xea8));
		mdelay(5);
		}

[ 5085.740565] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[ 5086.563554] val32: rtl8188eu_rx_iqk_path_a 3a7ea4e8
[ 5086.563929] val32: rtl8188eu_rx_iqk_path_a 3a7ea4e8
...
[ 5088.529686] val32: rtl8188eu_rx_iqk_path_a 16ea090
[ 5088.534939] val32: rtl8188eu_rx_iqk_path_a 16ea090
[ 5088.540202] val32: rtl8188eu_rx_iqk_path_a 16ea090
Comment 23 Michael 2023-04-10 08:40:32 UTC
Created attachment 304106 [details]
entire results of the for next loop

entire results of the for next loop
Comment 24 rtl8821cerfe2 2023-04-10 12:13:07 UTC
Okay. If even 500 ms is not enough then adjusting the delay is not the way to go.

Let's see what is happening:

diff --git a/rtl8xxxu_8188e.c b/rtl8xxxu_8188e.c
index af84360..417c85e 100644
--- a/rtl8xxxu_8188e.c
+++ b/rtl8xxxu_8188e.c
@@ -757,9 +757,10 @@ static int rtl8188eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 
 	if (!(reg_eac & BIT(27)) &&
 	    ((reg_ea4 & 0x03ff0000) != 0x01320000) &&
-	    ((reg_eac & 0x03ff0000) != 0x00360000))
+	    ((reg_eac & 0x03ff0000) != 0x00360000)) {
 		result |= 0x02;
-	else
+		pr_warn("%s: Path A RX IQK success!\n", __func__);
+	} else
 		dev_warn(&priv->udev->dev, "%s: Path A RX IQK failed!\n",
 			 __func__);
 
@@ -985,8 +986,8 @@ static void rtl8188eu_phy_iq_calibrate(struct rtl8xxxu_priv *priv)
 		priv->regebc = reg_ebc;
 		reg_ec4 = result[candidate][6];
 		reg_ecc = result[candidate][7];
-		dev_dbg(dev, "%s: candidate is %x\n", __func__, candidate);
-		dev_dbg(dev,
+		dev_warn(dev, "%s: candidate is %x\n", __func__, candidate);
+		dev_warn(dev,
 			"%s: e94=%x e9c=%x ea4=%x eac=%x eb4=%x ebc=%x ec4=%x ecc=%x\n",
 			__func__, reg_e94, reg_e9c, reg_ea4, reg_eac,
 			reg_eb4, reg_ebc, reg_ec4, reg_ecc);
Comment 25 Michael 2023-04-10 13:00:26 UTC
ALFA:
[19636.536498] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[19637.370919] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[19637.434871] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[19637.448624] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[19637.448634] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fc e9c=2 ea4=fb eac=3fb eb4=0 ebc=0 ec4=0 ecc=0
[19637.478068] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0


after USB reset:
[19796.781609] usb 1-2: Device still attached, trying to reset
[19796.902489] usb 1-2: reset high-speed USB device number 12 using xhci_hcd
[19797.423876] usb 1-2: Vendor: Realtek
[19797.423884] usb 1-2: Product: \x03802.11n NI
[19797.423887] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[19797.423889] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[19797.423895] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
[19797.423898] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[19797.428054] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[19798.256273] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[19798.320140] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[19798.333640] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[19798.333644] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=df e9c=7 ea4=fd eac=3fd eb4=0 ebc=0 ec4=0 ecc=0
[19798.355158] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0


after re-connect:
[19827.045898] usb 1-2: new high-speed USB device number 13 using xhci_hcd
[19827.189861] usb 1-2: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[19827.189872] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[19827.189876] usb 1-2: Product: 802.11n NIC
[19827.189880] usb 1-2: Manufacturer: Realtek
[19827.572610] usb 1-2: Vendor: Realtek
[19827.572619] usb 1-2: Product: \x03802.11n NI
[19827.572623] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[19827.572626] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[19827.572633] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
[19827.572638] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[19827.576491] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[19828.407015] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[19828.471488] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[19828.484988] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[19828.484997] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fc e9c=2 ea4=fd eac=3fd eb4=0 ebc=0 ec4=0 ecc=0
[19828.517877] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0


looking pretty good so far. Interface respond and it as able to receive and transmit packets


$ hcxdumptool -I wlp5s0f3u2

Requesting interface capabilities. This may take some time.
Please be patient...


interface information:

phy idx hw-mac       virtual-mac  m ifname           driver (protocol)
---------------------------------------------------------------------------------------------
 10  13 00c0cab067e9 52dedbee35fc + wlp5s0f3u2       rtl8xxxu (NETLINK & WIRELESS EXTENSIONS)


available frequencies: frequency [channel] tx-power

  2412 [  1] 20.0 dBm	  2417 [  2] 20.0 dBm	  2422 [  3] 20.0 dBm	  2427 [  4] 20.0 dBm
  2432 [  5] 20.0 dBm	  2437 [  6] 20.0 dBm	  2442 [  7] 20.0 dBm	  2447 [  8] 20.0 dBm
  2452 [  9] 20.0 dBm	  2457 [ 10] 20.0 dBm	  2462 [ 11] 20.0 dBm	  2467 [ 12] 20.0 dBm
  2472 [ 13] 20.0 dBm	  2484 [ 14] disabled

bye-bye


[19828.407015] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[19828.471488] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[19828.484988] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[19828.484997] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fc e9c=2 ea4=fd eac=3fd eb4=0 ebc=0 ec4=0 ecc=0
[19828.517877] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
[19963.358671] device wlp5s0f3u2 entered promiscuous mode
[19999.414727] device wlp5s0f3u2 left promiscuous mode


Logilink:
[20133.526541] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[20134.358414] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[20134.422657] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[20134.436629] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[20134.436639] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fc e9c=5 ea4=fd eac=3fd eb4=0 ebc=0 ec4=0 ecc=0
[20134.470647] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0


after USB-reset:
[20197.755799] usb 1-2: Device still attached, trying to reset
[20197.877209] usb 1-2: reset high-speed USB device number 14 using xhci_hcd
[20198.406289] usb 1-2: Vendor: Realtek
[20198.406299] usb 1-2: Product: \x03802.11n NI
[20198.406302] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[20198.406305] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[20198.406312] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[20198.406316] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[20198.410362] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[20199.245487] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[20199.327323] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[20199.403356] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[20199.416846] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 1
[20199.416851] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fe e9c=5 ea4=fd eac=3fd eb4=0 ebc=0 ec4=0 ecc=0
[20199.438913] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0


after re-connect:
[20234.653431] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[20235.487872] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[20235.551613] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[20235.565467] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[20235.565477] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fe e9c=5 ea4=fd eac=3fd eb4=0 ebc=0 ec4=0 ecc=0
[20235.599000] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0


looking pretty good so far. Interface respond and it as able to receive and transmit packets.


$ hcxdumptool -I wlp5s0f3u2
$ sudo hcxdumptool -I wlp5s0f3u2

Requesting interface capabilities. This may take some time.
Please be patient...


interface information:

phy idx hw-mac       virtual-mac  m ifname           driver (protocol)
---------------------------------------------------------------------------------------------
 13  16 70f11c27aeec b025aac41fd3 + wlp5s0f3u2       rtl8xxxu (NETLINK & WIRELESS EXTENSIONS)


available frequencies: frequency [channel] tx-power

  2412 [  1] 20.0 dBm	  2417 [  2] 20.0 dBm	  2422 [  3] 20.0 dBm	  2427 [  4] 20.0 dBm
  2432 [  5] 20.0 dBm	  2437 [  6] 20.0 dBm	  2442 [  7] 20.0 dBm	  2447 [  8] 20.0 dBm
  2452 [  9] 20.0 dBm	  2457 [ 10] 20.0 dBm	  2462 [ 11] 20.0 dBm	  2467 [ 12] 20.0 dBm
  2472 [ 13] 20.0 dBm	  2484 [ 14] disabled

bye-bye


Good job. Thanks.

I think we can mark it as fixed.
Comment 26 rtl8821cerfe2 2023-04-10 13:54:29 UTC
I don't get it. That last patch only prints some more messages. It shouldn't fix anything.
Comment 27 Michael 2023-04-10 13:59:42 UTC
You're right. Epical fail of me. I applied your patch to mine.
Now I clean up the source.
Comment 28 Michael 2023-04-10 14:32:31 UTC
Looks like my entire USB subsystem crashed due to the last test series:
[26418.746420] INFO: task rmmod:35303 blocked for more than 614 seconds.
[26418.746430]       Tainted: P           OE      6.2.8-arch1-1 #1
[26418.746434] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[26418.746436] task:rmmod           state:D stack:0     pid:35303 ppid:35302  flags:0x00000006
[26418.746445] Call Trace:
[26418.746448]  <TASK>
[26418.746455]  __schedule+0x3c8/0x12e0
[26418.746467]  ? __slab_free+0xe0/0x310
[26418.746474]  ? prb_read_valid+0x11/0x30
[26418.746484]  schedule+0x5e/0xd0
[26418.746489]  klist_remove+0xcc/0x110
[26418.746499]  bus_remove_driver+0x4f/0xe0
[26418.746508]  usb_deregister+0x7d/0xf0
[26418.746516]  __do_sys_delete_module+0x1d5/0x320
[26418.746527]  do_syscall_64+0x5f/0x90
[26418.746535]  ? ksys_read+0x6f/0xf0
[26418.746540]  ? syscall_exit_to_user_mode+0x1b/0x40
[26418.746547]  ? do_syscall_64+0x6b/0x90
[26418.746552]  ? ksys_read+0x6f/0xf0
[26418.746557]  ? syscall_exit_to_user_mode+0x1b/0x40
[26418.746563]  ? do_syscall_64+0x6b/0x90
[26418.746569]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
[26418.746578] RIP: 0033:0x7f1cba921d6b
[26418.746604] RSP: 002b:00007ffd6febecd8 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
[26418.746610] RAX: ffffffffffffffda RBX: 00005557376aa6f0 RCX: 00007f1cba921d6b
[26418.746613] RDX: 0000000000000000 RSI: 0000000000000800 RDI: 00005557376aa758
[26418.746616] RBP: 0000000000000000 R08: 1999999999999999 R09: 0000000000000000
[26418.746619] R10: 00007f1cba996ac0 R11: 0000000000000206 R12: 0000000000000000
[26418.746622] R13: 00007ffd6febef40 R14: 00007ffd6febfdf8 R15: 00005557376aa2a0
[26418.746628]  </TASK>

Ok, I'll go back to the roots and start again at ground lever.
Comment 29 Michael 2023-04-10 15:11:59 UTC
This is the reason why I closed the report:

I replaced  mdelay(10) by
if(rtl8xxxu_read32(priv, 0xea8) == 0) mdelay(25);

that worked:

[   50.428908] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[   50.428915] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[   50.428919] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[   50.436225] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[   51.265642] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[   51.319891] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[   51.333520] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[   51.333529] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fe e9c=5 ea4=fd eac=3fd eb4=0 ebc=0 ec4=0 ecc=0
[   51.365568] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0

Than i tried to make it dynamic:
rtl8xxxu_read32(priv, 0xea8) as long as it doesn't change.
That doesn't work and caused the USB subsystem to crash and I had to reboot.

Now testing "if(rtl8xxxu_read32(priv, 0xea8) == 0) mdelay(25);" again.
This time I do an USB reset every 10 seconds to see if the warning will appear.

I dmesg it looks like this:
[  774.538763] usb 1-2: disconnecting
[  778.066423] usb 1-2: new high-speed USB device number 6 using xhci_hcd
[  778.209043] usb 1-2: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[  778.209055] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  778.209059] usb 1-2: Product: 802.11n NIC
[  778.209063] usb 1-2: Manufacturer: Realtek
[  778.209065] usb 1-2: SerialNumber: 70F11C27AEEC
[  778.599164] usb 1-2: Vendor: Realtek
[  778.599173] usb 1-2: Product: \x03802.11n NI
[  778.599176] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[  778.599179] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[  778.599185] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[  778.599189] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[  778.603208] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[  779.428162] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[  779.482788] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[  779.496331] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[  779.496338] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fd e9c=4 ea4=fd eac=3fd eb4=0 ebc=0 ec4=0 ecc=0
[  779.526613] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
...
[  821.478449] usb 1-2: disconnecting
[  821.478461] usb 1-2: Device still attached, trying to reset
[  821.599603] usb 1-2: reset high-speed USB device number 6 using xhci_hcd
[  822.130450] usb 1-2: Vendor: Realtek
[  822.130460] usb 1-2: Product: \x03802.11n NI
[  822.130463] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[  822.130466] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[  822.130472] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[  822.130476] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[  822.134128] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[  822.971867] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[  823.044074] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[  823.058111] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[  823.058121] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fe e9c=6 ea4=fd eac=3fd eb4=0 ebc=0 ec4=0 ecc=0

every 5 second I set interface to monitor mode to receive and to transmit some packets.

[  823.080235] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
[  875.652907] device wlp5s0f3u2 entered promiscuous mode
[  884.265597] device wlp5s0f3u2 left promiscuous mode

That is still working, too.

[  986.024814] usb 1-2: disconnecting
[  986.024824] usb 1-2: Device still attached, trying to reset
[  986.148513] usb 1-2: reset high-speed USB device number 6 using xhci_hcd
[  986.681818] usb 1-2: Vendor: Realtek
[  986.681827] usb 1-2: Product: \x03802.11n NI
[  986.681831] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[  986.681833] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[  986.681840] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[  986.681844] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[  986.685439] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[  987.510064] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[  987.578312] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[  987.645313] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[  987.659074] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 3
[  987.659085] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=100 e9c=0 ea4=100 eac=0 eb4=100 ebc=0 ec4=100 ecc=0
[  987.681555] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
Comment 30 rtl8821cerfe2 2023-04-10 16:23:06 UTC
I see. I was hoping you would apply my last patch without any other changes.
Comment 31 Michael 2023-04-10 16:50:33 UTC
I feel sorry about that, but I'm a bit scattered at the moment, beacause I'm working on hcxdumptool in parallel
https://github.com/ZerBea/hcxdumptool/commits/master
that include to hunt for some problems on mt76 driver.

Unfortunately everything is linked: drivers, USB system, NETLINK, RTNETLINK, hcxdumptool
whereas one cannot work without the other.
Comment 32 Michael 2023-04-10 17:04:27 UTC
Register values without my patch:
[ 7622.337212] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
[ 7622.337217] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[ 7622.341419] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[ 7623.161187] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[ 7623.215061] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[ 7623.298312] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[ 7623.311807] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 1
[ 7623.311811] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fc e9c=2 ea4=fb eac=3fc eb4=0 ebc=0 ec4=0 ecc=0
[ 7623.340445] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
Comment 33 Michael 2023-04-10 17:16:24 UTC
BTW:
Do you see a chance to add active monitor mode to this driver.

Feature is part of the MAC80211 stack. I guess it is possible to add this to all stock drivers (like mt76).
Comment 34 rtl8821cerfe2 2023-04-10 18:08:58 UTC
On 10/04/2023 20:04, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=217205
> 
> --- Comment #32 from Michael (ZeroBeat@gmx.de) ---
> Register values without my patch:
> [ 7622.337212] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
> [ 7622.337217] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
> [ 7622.341419] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
> [ 7623.161187] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
> [ 7623.215061] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
> [ 7623.298312] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
> [ 7623.311807] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 1
> [ 7623.311811] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fc e9c=2 ea4=fb
> eac=3fc
> eb4=0 ebc=0 ec4=0 ecc=0
> [ 7623.340445] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
> 

What about when it fails?
Comment 35 Michael 2023-04-10 18:16:13 UTC
You make a good point. Here we go:

[11874.160379] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
[11874.160384] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[11874.165137] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[11874.984977] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[11875.038854] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[11875.063350] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[11875.129227] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[11875.142724] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[11875.142727] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fc e9c=2 ea4=fc eac=3fd eb4=0 ebc=0 ec4=0 ecc=0

$ sudo ./resetif /dev/bus/usb/001/013

12049.631253] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
[12049.631258] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[12049.635082] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[12050.453602] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[12050.507478] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
[12050.520975] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[12050.520979] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fc e9c=2 ea4=fc eac=3fc eb4=0 ebc=0 ec4=0 ecc=0
[12050.545294] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
Comment 36 rtl8821cerfe2 2023-04-10 18:31:11 UTC
On 10/04/2023 20:16, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=217205
> 
> --- Comment #33 from Michael (ZeroBeat@gmx.de) ---
> BTW:
> Do you see a chance to add active monitor mode to this driver.
> 
> Feature is part of the MAC80211 stack. I guess it is possible to add this to
> all stock drivers (like mt76).
> 

Probably yes. You should open another bug about that so we can discuss
it there.
Comment 37 Michael 2023-04-10 18:33:30 UTC
Thanks for the answer. I'll open a bug report/feature request.
Comment 38 rtl8821cerfe2 2023-04-10 18:59:20 UTC
On 10/04/2023 21:16, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=217205
> 
> --- Comment #35 from Michael (ZeroBeat@gmx.de) ---
> You make a good point. Here we go:
> 
> [11874.160379] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
> [11874.160384] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
> [11874.165137] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
> [11874.984977] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!>
> [11875.038854] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
> [11875.063350] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
> [11875.129227] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
> [11875.142724] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
> [11875.142727] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fc e9c=2 ea4=fc
> eac=3fd
> eb4=0 ebc=0 ec4=0 ecc=0

So at this point the message "renamed from wlan0" doesn't appear? I assume
"iw dev" doesn't show it?

The IQ calibration looks fine. One stage of it fails once, it's tried again
and it succeeds.

> 
> $ sudo ./resetif /dev/bus/usb/001/013
> 
> 12049.631253] usb 1-2: RTL8188EU MAC: 00:c0:ca:b0:67:e9
> [12049.631258] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
> [12049.635082] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
> [12050.453602] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
> [12050.507478] rtl8188eu_rx_iqk_path_a: Path A RX IQK success!
> [12050.520975] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
> [12050.520979] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fc e9c=2 ea4=fc
> eac=3fc
> eb4=0 ebc=0 ec4=0 ecc=0
> [12050.545294] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
>
Comment 39 Michael 2023-04-10 19:11:26 UTC
That was a copy and paste error:
[11875.169574] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0

As I mentioned above. The device sometimes need a "second chance".

But if this message appeared twice:
[11875.038854] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
device will neither receive notr transmit:
iw show it
hcxdumptool show it
but it does not receive packets
and it does not transmit packets

[15164.437895] usb 1-2: new high-speed USB device number 20 using xhci_hcd
[15164.580591] usb 1-2: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[15164.580600] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[15164.580604] usb 1-2: Product: 802.11n NIC
[15164.580607] usb 1-2: Manufacturer: Realtek
[15164.580609] usb 1-2: SerialNumber: 70F11C27AEEC
[15164.967957] usb 1-2: Vendor: Realtek
[15164.967964] usb 1-2: Product: \x03802.11n NI
[15164.967968] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[15164.967970] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[15164.967977] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
[15164.967981] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[15164.971864] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
[15165.809079] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[15165.862204] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[15165.892329] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
[15165.892334] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fe e9c=5 ea4=0 eac=0 eb4=0 ebc=0 ec4=0 ecc=0
[15165.923215] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0

It is really hard to reproduce because happen by accident.
It is not a problem on a notebook or a desktop. But it is a big problem on a Raspberry Pi that is running headless.
Comment 40 rtl8821cerfe2 2023-04-10 19:39:54 UTC
On 10/04/2023 22:11, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=217205
> 
> --- Comment #39 from Michael (ZeroBeat@gmx.de) ---
> That was a copy and paste error:
> [11875.169574] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
> 
> As I mentioned above. The device sometimes need a "second chance".
> 
> But if this message appeared twice:
> [11875.038854] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
> device will neither receive notr transmit:
> iw show it
> hcxdumptool show it
> but it does not receive packets
> and it does not transmit packets

I see. Are you testing that in station mode or monitor mode?

> 
> [15164.437895] usb 1-2: new high-speed USB device number 20 using xhci_hcd
> [15164.580591] usb 1-2: New USB device found, idVendor=0bda, idProduct=8179,
> bcdDevice= 0.00
> [15164.580600] usb 1-2: New USB device strings: Mfr=1, Product=2,
> SerialNumber=3
> [15164.580604] usb 1-2: Product: 802.11n NIC
> [15164.580607] usb 1-2: Manufacturer: Realtek
> [15164.580609] usb 1-2: SerialNumber: 70F11C27AEEC
> [15164.967957] usb 1-2: Vendor: Realtek
> [15164.967964] usb 1-2: Product: \x03802.11n NI
> [15164.967968] usb 1-2: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
> [15164.967970] usb 1-2: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2,
> WiFi=1, BT=0, GPS=0, HI PA=0
> [15164.967977] usb 1-2: RTL8188EU MAC: 70:f1:1c:27:ae:ec
> [15164.967981] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
> [15164.971864] usb 1-2: Firmware revision 11.1 (signature 0x88e1)
> [15165.809079] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
> [15165.862204] usb 1-2: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!

I don't understand how this part here is possible. There should be more
messages, either with "failed" or "success".

> [15165.892329] usb 1-2: rtl8188eu_phy_iq_calibrate: candidate is 0
> [15165.892334] usb 1-2: rtl8188eu_phy_iq_calibrate: e94=fe e9c=5 ea4=0 eac=0
> eb4=0 ebc=0 ec4=0 ecc=0
> [15165.923215] rtl8xxxu 1-2:1.0 wlp5s0f3u2: renamed from wlan0
> 
> It is really hard to reproduce because happen by accident.
> It is not a problem on a notebook or a desktop. But it is a big problem on a
> Raspberry Pi that is running headless.
>
Comment 41 rtl8821cerfe2 2023-04-10 19:44:19 UTC
Nevermind, I see how that can happen.
Comment 42 Michael 2023-04-10 20:00:15 UTC
"I don't understand how this part here is possible. There should be more
messages, either with "failed" or "success"."
Me too, so you are in good company.

The tests (connect device, re-connect, USB reset) are done in managed mode, only.
"rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!" is show before I set monitor mode.
The tests if the device transmit/receive are done in monitor mode, only.
I monitor the traffic directly via hcxdumptool and in parallel with Wireshark on the same interface an on a second reference interface.

I coded hcxdumptool that it use RTNETLINK to set interface up and down and
NL80211 to set monitor mode, to set bandwidth, bit rate and frequency.

I set bandwidth, bit rate and frequency via a single NL80211 message:
https://github.com/ZerBea/hcxdumptool/blob/master/hcxdumptool.c#L3047

I do not use libnl or libnl-tiny to create and send NETLINK messages, due to performance reasons.

Realtek and iwlwifi drivers "do not like" WIRELESS EXTENSIONS so I had to refactor hcxdumptool. Now WIRELESS EXTENSIONS are retired in favor of NL80211.
This is still in progress. Next release will be v 6.3.0 on 1th of May.

My reference interface/driver is a mt76 interface/driver. Other drivers (Realtek, Atheros, iwlwifi) are compared to this reference.
Comment 44 rtl8821cerfe2 2023-04-18 20:11:27 UTC
I think it would be best if we discuss only the problems you have with the code obtained from official sources, like your distro's kernel package, or:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/

or:

https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git/

kimocoder's repository has a lot of confusing commits. I don't know what's going on there.

You're having this intermittent problem with the monitor mode and IQ calibration even with the driver from kernel 6.3, right? I think you said so. If that's the case, then the problem should still be there.
Comment 45 rtl8821cerfe2 2023-04-18 20:16:53 UTC
Created attachment 304160 [details]
RTL8188EU firmware v28
Comment 46 Michael 2023-04-18 20:17:56 UTC
I fully agree. The problems still exist on 6.3-rc7.

But the driver mentioned above may help me to figure out what's wrong.

On the bright side, while diving into kimocoder's driver code, I guess that cause it is not located here:
https://bugzilla.kernel.org/show_bug.cgi?id=217205#c20
Comment 47 Michael 2023-04-18 20:18:58 UTC
Do you think it is related to the firmware?
Comment 49 rtl8821cerfe2 2023-04-18 21:36:33 UTC
I think it's worth trying the newer firmware.
Comment 50 Michael 2023-04-19 05:21:56 UTC
Do you plan to commit v28 to linux-firmware.git?
Comment 51 rtl8821cerfe2 2023-04-19 09:51:26 UTC
Only if it fixes a bug.
Comment 52 Michael 2023-04-19 10:13:42 UTC
I think v28 fixed a bug on
ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter


[ 8426.899088] usb 5-1.1.3: new high-speed USB device number 12 using xhci_hcd
[ 8427.090428] usb 5-1.1.3: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[ 8427.090437] usb 5-1.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 8427.090441] usb 5-1.1.3: Product: 802.11n NIC
[ 8427.090443] usb 5-1.1.3: Manufacturer: Realtek
[ 8427.162049] usb 5-1.1.3: Vendor: Realtek
[ 8427.162054] usb 5-1.1.3: Product: \x03802.11n NI
[ 8427.162057] usb 5-1.1.3: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff
[ 8427.162059] usb 5-1.1.3: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[ 8427.162065] usb 5-1.1.3: RTL8188EU MAC: 00:c0:ca:b0:67:e9
[ 8427.162068] usb 5-1.1.3: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[ 8427.162124] usb 5-1.1.3: Firmware revision 28.0 (signature 0x88e1)
[ 8427.674562] rtl8xxxu 5-1.1.3:1.0 wlp39s0f3u1u1u3: renamed from wlan0
[ 8463.714876] usb 5-1.1.1: USB disconnect, device number 9
[ 8471.791443] device wlp39s0f3u1u1u3 entered promiscuous mode
[ 8491.684973] device wlp39s0f3u1u1u3 left promiscuous mode




[ 8471.791443] device wlp39s0f3u1u1u3 entered promiscuous mode
$ hcxdumptool -I wlp39s0f3u1u1u3

Requesting interface capabilities. This may take some time.
Please be patient...


interface information:

phy idx hw-mac       virtual-mac  m ifname           driver (protocol)
---------------------------------------------------------------------------------------------
  4   5 00c0cab063a9 c8aacc5f63a9 + wlp39s0f3u1u1u3  rtl8xxxu (NETLINK & WIRELESS EXTENSIONS)


available frequencies: frequency [channel] tx-power of Regulatory Domain: DE

  2412 [  1] 20.0 dBm	  2417 [  2] 20.0 dBm	  2422 [  3] 20.0 dBm	  2427 [  4] 20.0 dBm
  2432 [  5] 20.0 dBm	  2437 [  6] 20.0 dBm	  2442 [  7] 20.0 dBm	  2447 [  8] 20.0 dBm
  2452 [  9] 20.0 dBm	  2457 [ 10] 20.0 dBm	  2462 [ 11] 20.0 dBm	  2467 [ 12] 20.0 dBm
  2472 [ 13] 20.0 dBm	  2484 [ 14] disabled

bye-bye
[ 8491.684973] device wlp39s0f3u1u1u3 left promiscuous mode

Thanks for sharing the new firmware.
Comment 53 Michael 2023-04-19 10:23:16 UTC
rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!

is gone on this driver:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/wireless/realtek/rtl8xxxu?h=v6.3-rc7
Comment 54 Michael 2023-04-19 10:34:12 UTC
Do you know what changed from:
Firmware revision 11.1 (signature 0x88e1)
to
Firmware revision 28.0 (signature 0x88e1)
Comment 55 rtl8821cerfe2 2023-04-19 14:06:40 UTC
No, I don't know. The manufacturer doesn't say much about the changes in the firmware.
Comment 56 Michael 2023-04-19 14:45:12 UTC
Ok, thanks.
Tested this three adapters:
Bus 005 Device 030: ID 2357:010c TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS]
Bus 005 Device 031: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter
Bus 005 Device 029: ID 7392:b811 Edimax Technology Co., Ltd Edimax N150 Adapter

And they are working as expected running v28.

The problem, reading device informatin is related to the driver and still exists:
[24872.589992] usb 5-1.1.3: Product: \x03802.11n NI
[24872.589995] usb 5-1.1.3: Serial: \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff

I think we can close this report.
Comment 57 rtl8821cerfe2 2023-04-19 16:46:54 UTC
I sent a patch to „fix” the other thing: https://lore.kernel.org/linux-wireless/a2a7d9df-0529-7890-3522-48dce613753f@gmail.com/
Comment 58 Michael 2023-04-19 19:46:23 UTC
Great. Thanks for your effort.
Comment 59 Michael 2023-04-19 19:47:15 UTC
Fixed by fw v28.
Comment 60 rtl8821cerfe2 2023-05-10 09:18:09 UTC
Still fixed? Just making sure.
Comment 61 Michael 2023-05-10 09:41:42 UTC
Yes, working as expected. I'm still running fw v28.

Arch Linux is on kernel:
$ uname -r
6.3.1-arch1-1

And I was really surprised by this dmesg warning:
[ 2770.939021] warning: hcxdumptool uses wireless extensions which will stop working for Wi-Fi 7 hardware; use nl80211

Took me a couple of hours to remove entire WEXT stuff and to replace it by NL80211.

In hindsight, I am grateful for the warning. RTNETLINK and NL80211 are working smooth (I don't use libnl). Additional NETLINK offer some nice new (driver) features.
Comment 62 rtl8821cerfe2 2023-05-10 12:04:17 UTC
On 10/05/2023 12:41, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=217205
> 
> --- Comment #61 from Michael (ZeroBeat@gmx.de) ---
> Yes, working as expected. I'm still running fw v28.
> 

That's good. I'll send the v28 firmware upstream soon-ish.

> Arch Linux is on kernel:
> $ uname -r
> 6.3.1-arch1-1
> 
> And I was really surprised by this dmesg warning:
> [ 2770.939021] warning: hcxdumptool uses wireless extensions which will stop
> working for Wi-Fi 7 hardware; use nl80211
> 
> Took me a couple of hours to remove entire WEXT stuff and to replace it by
> NL80211.
> 
> In hindsight, I am grateful for the warning. RTNETLINK and NL80211 are
> working
> smooth (I don't use libnl). Additional NETLINK offer some nice new (driver)
> features.
> 

Yes, Wifi 7 introduces some things which are incompatible with the Wireless
Extensions:
https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git/commit/?id=4ca69027691a
Comment 63 Michael 2023-05-10 12:13:36 UTC
There is a major advantage of the new firmware:

I noticed some calibration problems on USB cables > 1m in combination with a high TX power device. This is gone with fw 28, too.
Comment 64 Michael 2023-11-15 08:39:44 UTC
Looks like this problem is back on kernel 6.6.1

Once a new kernel has been released, I do some driver tests regarding monitor mode an packet injection:
https://github.com/ZerBea/hcxdumptool/discussions/361


This test failed:
https://github.com/ZerBea/hcxdumptool/discussions/361#discussioncomment-7550830

ALFA AWUS036NHV
ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter

driver: rtl8xxxu (Linux stock kernel driver)

213 packet(s) captured
1 SHB written to pcapng dumpfile
1 IDB written to pcapng dumpfile
1 ECB written to pcapng dumpfile
17 EPB written to pcapng dumpfile

exit on EAPOL M1M2
bye-bye

real	0m6,546s
user	0m0,000s
sys	0m0,009s

Important notice:
The first attack was successful but the driver died after the first test and device has to be reconnect to the USB port!
Neither tshark nor Wireshark nor hcxdumptool received packers any longer.

run hcxdumptool twice:

Warning: no packets received (frame injection may not work as expected)
Possible reasons:
 no AP in range
 frames are filtered out by BPF
 driver is broken
 driver does not support frame injection

1 SHB written to pcapng dumpfile
1 IDB written to pcapng dumpfile
1 ECB written to pcapng dumpfile

exit on sigterm
bye-bye

confirm that device is in monitor mode:

$ iw dev
phy#6
	Interface wlp22s0f0u9u4
		ifindex 9
		wdev 0x600000001
		addr 00:c0:ca:b0:67:e9
		type monitor
		channel 10 (2457 MHz), width: 20 MHz (no HT), center1: 2457 MHz
		txpower 20.00 dBm
		multicast TXQ:
			qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcol	tx-bytes	tx-packets
			0	0	0	0	0	0	0	0		0

run tshark to capture packets:

$ tshark -i wlp22s0f0u9u3
Capturing on 'wlp22s0f0u9u3'
 ** (tshark:5627) 08:24:47.585105 [Main MESSAGE] -- Capture started.
 ** (tshark:5627) 08:24:47.585157 [Main MESSAGE] -- File: "/tmp/wireshark_wlp22s0f0u9u3ZKCRE2.pcapng"
^Ctshark: 
0 packets captured

sometimes dmesg print a warning:

$ dmesg
[ 1697.283905] usb 1-9.3: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[ 1697.418898] usb 1-9.3: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!
[ 1697.712900] usb 1-9.3: rtl8188eu_rx_iqk_path_a: Path A RX IQK failed!

but mostly not:

$ dmesg
[ 1748.913402] usb 1-9.3: New USB device found, idVendor=0bda, idProduct=8179, bcdDevice= 0.00
[ 1748.913407] usb 1-9.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1748.913410] usb 1-9.3: Product: 802.11n NIC
[ 1748.913411] usb 1-9.3: Manufacturer: Realtek
[ 1751.979371] usb 1-9.3: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[ 1751.979377] usb 1-9.3: RTL8188EU MAC: 00:c0:ca:b0:67:e9
[ 1751.979380] usb 1-9.3: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[ 1751.979560] usb 1-9.3: Firmware revision 28.0 (signature 0x88e1)
[ 1756.744526] rtl8xxxu 1-9.3:1.0 wlp22s0f0u9u3: renamed from wlan0
[ 1758.045644] rtl8xxxu 1-9.3:1.0 wlp22s0f0u9u3: entered promiscuous mode


The problem is not related to the device itself.
All tested RTL8188EUS devices running this driver show the same behavior
https://github.com/ZerBea/hcxdumptool/discussions/361#discussioncomment-7551692
https://github.com/ZerBea/hcxdumptool/discussions/361#discussioncomment-7554097
https://github.com/ZerBea/hcxdumptool/discussions/361#discussioncomment-7554193

while RTL8192CU devices are not affected:
https://github.com/ZerBea/hcxdumptool/discussions/361#discussioncomment-7554247
Comment 65 Michael 2023-11-15 08:42:04 UTC
Maybe a regression (selected check box regression), but I'm not sure.
Comment 66 Michael 2023-11-15 09:35:37 UTC
Same behavior on kernel 6.5.0.
Comment 67 rtl8821cerfe2 2023-11-15 12:44:13 UTC
What is the exact hcxdumptool command I should run to reproduce this?
Comment 68 Michael 2023-11-15 13:16:14 UTC
That should do it:
$ hcxdumptool -i INTERFACENAME --rds=1

Please make sure that all services that take access to the device are stopped before you run hcxdumptool.
It is not mandatory to set monitor mode by iw before, because hcxdumptool will do this, as well as set the device up.

After a while stop hcxdumptool than restart it.
Packets are no longer received.

You can confirm this running:
$ tshark -i SAME_INTERFACE


BTW:
rtl8xxxu (RTL8192CU) is not affected
https://github.com/ZerBea/hcxdumptool/discussions/361#discussioncomment-7554247

I'll say that we can rule out an error in the test environment.
Comment 69 Michael 2023-11-15 13:20:44 UTC
I'm not sure if this test can be done with e.g. aireplay-ng too because hcxdumptool produce a much higher work load.
Comment 70 Michael 2023-11-15 13:24:45 UTC
Also we can rule out distribution dependent issues.
I compiled kernels on Debian and kernels on Arch.
Same behavior on both.
Comment 71 Michael 2023-11-15 13:28:01 UTC
Also we can rule out hardware dependent issues.
Tests are done on a RYZEN machine and on an Intel machine.
Comment 72 rtl8821cerfe2 2023-11-15 13:34:22 UTC
I can reproduce it with my TP-Link TL-WN725N. I'll have to see what is going on in the driver.
Comment 73 Michael 2023-11-15 13:41:09 UTC
Thanks.
I'm glad to hear that you can reproduce it.

BTW:
You can monitor the entire traffic between hcxdumptool and the kernel:
Create a NETLINK monitor interface (nlmon) and run Wireshark on nlmon.
Than start hcxdumptool in parallel.
Comment 74 Michael 2023-11-15 13:51:54 UTC
The interface is completely controlled using RTNETLINK and NETLINK (NL80211).
802.11 frames will be read via a raw packet socket and they will be sent via raw packet socket.


I don't think that the problem is related to the NETLINK control interface.
Comment 75 Michael 2023-11-15 14:13:36 UTC
Please take care when running hcxdumptool, because it is an extreme aggressive penetration testing tool.
Comment 76 Michael 2023-11-15 14:42:17 UTC
(In reply to rtl8821cerfe2 from comment #72)
> I can reproduce it with my TP-Link TL-WN725N. I'll have to see what is going
> on in the driver.

This device is on my test list, too:
https://github.com/ZerBea/hcxdumptool/discussions/361#discussioncomment-7554097
Comment 77 rtl8821cerfe2 2023-11-15 19:11:18 UTC
Does this fix it?

diff --git a/rtl8xxxu_8188e.c b/rtl8xxxu_8188e.c
index 6d0f975..07ddbc6 100644
--- a/rtl8xxxu_8188e.c
+++ b/rtl8xxxu_8188e.c
@@ -1298,7 +1298,7 @@ static void rtl8188e_disable_rf(struct rtl8xxxu_priv *priv)
 	rtl8xxxu_write32(priv, REG_OFDM0_TRX_PATH_ENABLE, val32);
 
 	/* Power down RF module */
-	rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0);
+	// rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0);
 
 	rtl8188eu_active_to_emu(priv);
 }
Comment 78 Michael 2023-11-15 20:10:03 UTC
Looking good:

TP-Link TL-WN722N v2 is working (receive and send packets) as expected:
ID 2357:010c TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS]

tried that for several times and everything is fine, dmesg does not show a warning any longer:
[46850.077821] rtl8xxxu 5-2.4:1.0 wlp48s0f4u2u4: renamed from wlan0
[46874.418349] rtl8xxxu 5-2.4:1.0 wlp48s0f4u2u4: entered promiscuous mode
[46882.492930] rtl8xxxu 5-2.4:1.0 wlp48s0f4u2u4: left promiscuous mode
[46885.975786] rtl8xxxu 5-2.4:1.0 wlp48s0f4u2u4: entered promiscuous mode
[46893.746354] rtl8xxxu 5-2.4:1.0 wlp48s0f4u2u4: left promiscuous mode
[46895.860573] rtl8xxxu 5-2.4:1.0 wlp48s0f4u2u4: entered promiscuous mode
[46902.563128] rtl8xxxu 5-2.4:1.0 wlp48s0f4u2u4: left promiscuous mode

Also tested TP-Link TL-WN725N and everything is fine, too:
ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter


Great job, thanks.


BTW:
I think we can remove this information "This Realtek USB WiFi dongle (0x2357:0x010c) is untested!", too:

TP-Link TL-WN722N v2:
ID 2357:010c TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS]


[46848.552865] usb 5-2.4: new high-speed USB device number 24 using xhci_hcd
[46848.647172] usb 5-2.4: New USB device found, idVendor=2357, idProduct=010c, bcdDevice= 0.00
[46848.647183] usb 5-2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[46848.647186] usb 5-2.4: Product: 802.11n NIC
[46848.647188] usb 5-2.4: Manufacturer: Realtek
[46848.647190] usb 5-2.4: SerialNumber: 00E04C0001
[46848.647954] usb 5-2.4: This Realtek USB WiFi dongle (0x2357:0x010c) is untested!
[46848.647957] usb 5-2.4: Please report results to Jes.Sorensen@gmail.com
[46849.137278] usb 5-2.4: Dumping efuse for RTL8188EU (0x200 bytes):
[46849.137282] 00000000: 29 81 00 6c 0b 00 00 00 00 0c 00 00 00 00 00 00  )..l............
[46849.137285] 00000010: 2b 2b 2b 2b 2b 2b 2f 2f 2f 2e 2e f1 ff ff ff ff  ++++++///.......
[46849.137286] 00000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137288] 00000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137289] 00000040: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137290] 00000050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137291] 00000060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137293] 00000070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137294] 00000080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137295] 00000090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137297] 000000a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137298] 000000b0: ff ff ff ff ff ff ff ff a1 2f 17 00 00 00 00 00  ........./......
[46849.137299] 000000c0: 00 01 00 10 00 00 00 00 00 03 ff ff ff ff ff ff  ................
[46849.137301] 000000d0: 57 23 0c 01 43 66 00 9c a2 f4 09 3a f0 09 03 52  W#..Cf.....:...R
[46849.137302] 000000e0: 65 61 6c 74 65 6b 0d 03 38 30 32 2e 31 31 6e 20  ealtek..802.11n 
[46849.137303] 000000f0: 4e 49 43 0c 03 30 30 45 30 34 43 30 30 30 31 00  NIC..00E04C0001.
[46849.137304] 00000100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137306] 00000110: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137307] 00000120: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137308] 00000130: 81 ae 96 2d 03 93 96 11 fc 8c 00 11 9b ff ff ff  ...-............
[46849.137310] 00000140: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137311] 00000150: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137312] 00000160: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137314] 00000170: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137315] 00000180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137316] 00000190: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137317] 000001a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137319] 000001b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137320] 000001c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137321] 000001d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137323] 000001e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137324] 000001f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
[46849.137325] usb 5-2.4: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[46849.137329] usb 5-2.4: RTL8188EU MAC: 9c:a2:f4:09:3a:f0
[46849.137331] usb 5-2.4: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[46849.137515] usb 5-2.4: Firmware revision 28.0 (signature 0x88e1)
Comment 79 Michael 2023-11-15 20:16:12 UTC
How have you discovered this so fast?
Comment 80 rtl8821cerfe2 2023-11-15 22:38:20 UTC
Experience, I guess. :)
Comment 81 Michael 2023-11-20 06:22:31 UTC
Good to hear that. 
I'm going to close this report, because the patch is working like a charm.

Also I'll remove the driver from "hcxdumptool's not suitable driver list".

Thanks again.
Cheers
Mike
Comment 82 Michael 2024-01-29 14:02:43 UTC
Reopened this bug report, because the patch mentioned here:
https://bugzilla.kernel.org/show_bug.cgi?id=217205#c77
has not been applied to latest kernel 6.8 rc2
Comment 83 rtl8821cerfe2 2024-01-30 19:37:20 UTC
On 29/01/2024 16:02, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=217205
> 
> Michael (ZeroBeat@gmx.de) changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|RESOLVED                    |REOPENED
>          Resolution|PATCH_ALREADY_AVAILABLE     |---
> 
> --- Comment #82 from Michael (ZeroBeat@gmx.de) ---
> Reopened this bug report, because the patch mentioned here:
> https://bugzilla.kernel.org/show_bug.cgi?id=217205#c77
> has not been applied to latest kernel 6.8 rc2
> 

I didn't do anything with the patch because it's not a good fix.
It revealed where the problem is (probably), but not what it is.

I need to do more digging.
Comment 84 Michael 2024-01-30 20:03:29 UTC
I fully agree, because the driver needs a lot more attention.
While I tried to add a new device ID:
TP-Link TL-WN8200ND v3
ID 2357:0126 TP-Link 802.11n NIC
I noticed that the patch has not been applied and I thought it might be a good idea to reopen the report until we have a final solution.

Note You need to log in before you can comment on or make changes to this bug.