Message ID | 20230427020512.1221062-1-luyun_611@163.com |
---|---|
State | Superseded |
Headers | show |
Series | wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value | expand |
On 27/04/2023 05:05, Yun Lu wrote: > From: Yun Lu <luyun@kylinos.cn> > > When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a > probability of failure, which shows "authentication with ... timed out". > Through debugging, it was found that the RCR register has been inexplicably > modified to an incorrect value, resulting in the nic not being able to > receive authenticated frames. > > To fix this problem, add regrcr in rtl8xxxu_priv struct, and store > the RCR value every time the register is writen, and use it the next > time the register need to be modified. > Can this bug be reproduced easily? Is it always the same bits which are mysteriously cleared from REG_RCR?
On 4/26/23 21:05, Yun Lu wrote: > From: Yun Lu <luyun@kylinos.cn> > > When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a > probability of failure, which shows "authentication with ... timed out". > Through debugging, it was found that the RCR register has been inexplicably > modified to an incorrect value, resulting in the nic not being able to > receive authenticated frames. > > To fix this problem, add regrcr in rtl8xxxu_priv struct, and store > the RCR value every time the register is writen, and use it the next > time the register need to be modified. > > Signed-off-by: Yun Lu <luyun@kylinos.cn> > --- > drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + > drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 +++- > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h > index c8cee4a24755..4088aaa1c618 100644 > --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h > +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h > @@ -1518,6 +1518,7 @@ struct rtl8xxxu_priv { > u32 rege9c; > u32 regeb4; > u32 regebc; > + u32 regrcr; > int next_mbox; > int nr_out_eps; > > diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > index 620a5cc2bfdd..2fe71933ba08 100644 > --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c > @@ -4053,6 +4053,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw) > RCR_ACCEPT_MGMT_FRAME | RCR_HTC_LOC_CTRL | > RCR_APPEND_PHYSTAT | RCR_APPEND_ICV | RCR_APPEND_MIC; > rtl8xxxu_write32(priv, REG_RCR, val32); > + priv->regrcr = val32; > > if (priv->rtl_chip == RTL8188F) { > /* Accept all data frames */ > @@ -6273,7 +6274,7 @@ static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw, > unsigned int *total_flags, u64 multicast) > { > struct rtl8xxxu_priv *priv = hw->priv; > - u32 rcr = rtl8xxxu_read32(priv, REG_RCR); > + u32 rcr = priv->regrcr; > > dev_dbg(&priv->udev->dev, "%s: changed_flags %08x, total_flags %08x\n", > __func__, changed_flags, *total_flags); > @@ -6319,6 +6320,7 @@ static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw, > */ > > rtl8xxxu_write32(priv, REG_RCR, rcr); > + priv->regrcr = rcr; > > *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_BCN_PRBRESP_PROMISC | > FIF_CONTROL | FIF_OTHER_BSS | FIF_PSPOLL | Wouldn't it be better to find the location that is writing the incorrect value to RCR and fix that? It seems to me that you are applying a band-aid rather than fixing the problem. Larry
On 4/26/23 21:05, Yun Lu wrote: > From: Yun Lu <luyun@kylinos.cn> > > When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a > probability of failure, which shows "authentication with ... timed out". > Through debugging, it was found that the RCR register has been inexplicably > modified to an incorrect value, resulting in the nic not being able to > receive authenticated frames. > > To fix this problem, add regrcr in rtl8xxxu_priv struct, and store > the RCR value every time the register is writen, and use it the next > time the register need to be modified. I added the attached patch to see what was different between the two values in REG_RCR. To my surprise, nothing was logged. Please add this one on top of you proposed patch, and send me the output from the log. Thanks, Larry
At 2023-04-28 10:00:28, "Larry Finger" <Larry.Finger@lwfinger.net> wrote: >On 4/26/23 21:05, Yun Lu wrote: >> From: Yun Lu <luyun@kylinos.cn> >> >> When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a >> probability of failure, which shows "authentication with ... timed out". >> Through debugging, it was found that the RCR register has been inexplicably >> modified to an incorrect value, resulting in the nic not being able to >> receive authenticated frames. >> >> To fix this problem, add regrcr in rtl8xxxu_priv struct, and store >> the RCR value every time the register is writen, and use it the next >> time the register need to be modified. > >I added the attached patch to see what was different between the two values in >REG_RCR. To my surprise, nothing was logged. > >Please add this one on top of you proposed patch, and send me the output from >the log. > >Thanks, > >Larry > Larry: Thanks for providing the debugging patch. The REG_RCR can only be writen in function rtl8xxxu_init_device or rtl8xxxu_configure_filter, the init value is 0x7000600e, and may be modified to 0x700060ce or 0x7000604e when configure_filter. But on this device(EDIMAX EW-7822UAn) we used, the REG_RCR has indeed been modified for unknown reason. After applying your debugging patch, the log shows: [ 70.426757] [pid:217,cpu6,kworker/u16:3,3]AFTER: REG_RCR differs from regrcr: 0x7000600e insted of 0x7000600e [ 70.465881] [pid:1994,cpu6,wpa_supplicant,5]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 71.803222] [pid:217,cpu7,kworker/u16:3,0]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 71.805358] [pid:217,cpu7,kworker/u16:3,1]BEFORE: REG_RCR differs from regrcr: 0x70006009 insted of 0x700060ce [ 71.806854] [pid:217,cpu6,kworker/u16:3,2]AFTER: REG_RCR differs from regrcr: 0x390272a insted of 0x700060ce [ 98.894104] [pid:1994,cpu6,wpa_supplicant,9]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 100.151824] [pid:1949,cpu7,NetworkManager,1]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 100.830505] [pid:1994,cpu6,wpa_supplicant,5]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 102.101806] [pid:7,cpu7,kworker/u16:0,9]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 107.545440] [pid:1994,cpu7,wpa_supplicant,4]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 108.878204] [pid:216,cpu1,kworker/u16:2,7]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 126.028961] [pid:1994,cpu7,wpa_supplicant,5]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 127.389801] [2023:04:28 11:11:45][pid:237,cpu7,kworker/u16:5,6]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 137.119384] [pid:1994,cpu6,wpa_supplicant,3]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 138.393005] [pid:237,cpu7,kworker/u16:5,5]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 138.395996] [pid:1994,cpu7,wpa_supplicant,6]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 138.436889] [pid:1994,cpu6,wpa_supplicant,9]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 148.251800] [pid:1994,cpu6,wpa_supplicant,5]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 149.538909] [2023:04:28 11:12:08][pid:216,cpu6,kworker/u16:2,6]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 149.542419] [pid:1994,cpu6,wpa_supplicant,7]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 149.595642] [pid:7,cpu6,kworker/u16:0,0]BEFORE: REG_RCR differs from regrcr: 0x1830613 insted of 0x7000604e [ 149.597778] [pid:1994,cpu6,wpa_supplicant,1]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 159.384613] [pid:1994,cpu7,wpa_supplicant,7]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 160.673583] [pid:237,cpu4,kworker/u16:5,1]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 160.676422] [pid:237,cpu6,kworker/u16:5,3]BEFORE: REG_RCR differs from regrcr: 0x70006009 insted of 0x700060ce [ 170.521148] [pid:1994,cpu7,wpa_supplicant,8]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 171.845764] [pid:237,cpu6,kworker/u16:5,0]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 171.850830] [pid:1994,cpu6,wpa_supplicant,1]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 171.897125] [pid:1994,cpu7,wpa_supplicant,4]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 173.092742] [2023:04:28 11:12:31][pid:1994,cpu6,wpa_supplicant,0]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 174.369445] [pid:237,cpu6,kworker/u16:5,2]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 176.070007] [2023:04:28 11:12:34][pid:1994,cpu7,wpa_supplicant,8]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 177.354827] [2023:04:28 11:12:35][pid:216,cpu6,kworker/u16:2,9]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 181.610473] [pid:1994,cpu7,wpa_supplicant,4]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 182.904541] [pid:7,cpu7,kworker/u16:0,6]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 188.618011] [2023:04:28 11:12:47][pid:1994,cpu7,wpa_supplicant,3]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 189.923339] [2023:04:28 11:12:48][pid:7,cpu7,kworker/u16:0,4]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 192.706268] [pid:1994,cpu6,wpa_supplicant,8]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 194.026855] [pid:7,cpu6,kworker/u16:0,1]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 196.727020] [pid:1994,cpu6,wpa_supplicant,8]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 196.753326] [pid:216,cpu7,kworker/u16:2,9]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 203.798675] [pid:1994,cpu7,wpa_supplicant,4]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 205.088653] [2023:04:28 11:13:03][pid:216,cpu6,kworker/u16:2,5]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 214.879211] [pid:1994,cpu7,wpa_supplicant,7]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 216.193817] [2023:04:28 11:13:14][pid:216,cpu7,kworker/u16:2,8]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 221.726043] [pid:1994,cpu6,wpa_supplicant,2]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 223.019012] [pid:95,cpu6,kworker/u16:1,4]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 225.984741] [pid:1994,cpu7,wpa_supplicant,2]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 227.272735] [pid:95,cpu6,kworker/u16:1,4]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 233.242523] [2023:04:28 11:13:31][pid:1994,cpu7,wpa_supplicant,6]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 234.541503] [pid:237,cpu7,kworker/u16:5,9]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 237.070556] [pid:1994,cpu6,wpa_supplicant,7]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 238.388366] [2023:04:28 11:13:36][pid:237,cpu4,kworker/u16:5,8]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 246.725952] [pid:1994,cpu7,wpa_supplicant,3]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 247.046478] [pid:216,cpu6,kworker/u16:2,4]BEFORE: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 247.079742] [pid:76395,cpu6,ifconfig,5]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 248.217987] [pid:1994,cpu6,wpa_supplicant,9]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 249.530578] [2023:04:28 11:13:48][pid:237,cpu6,kworker/u16:5,1]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 249.533721] [pid:1994,cpu7,wpa_supplicant,2]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 249.579711] [pid:237,cpu6,kworker/u16:5,5]BEFORE: REG_RCR differs from regrcr: 0x1832e13 insted of 0x7000604e [ 249.582946] [pid:1994,cpu7,wpa_supplicant,6]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 259.287170] [pid:1994,cpu7,wpa_supplicant,7]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 260.566009] [pid:237,cpu6,kworker/u16:5,9]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 270.383453] [pid:1994,cpu6,wpa_supplicant,0]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 271.678924] [2023:04:28 11:14:10][pid:7,cpu6,kworker/u16:0,1]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 281.472015] [pid:1994,cpu6,wpa_supplicant,3]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 282.743103] [pid:237,cpu7,kworker/u16:5,5]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 283.654632] [2023:04:28 11:14:22][pid:1994,cpu7,wpa_supplicant,6]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 284.942474] [pid:217,cpu6,kworker/u16:3,8]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 292.564056] [pid:1994,cpu6,wpa_supplicant,8]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 293.845397] [2023:04:28 11:14:32][pid:217,cpu7,kworker/u16:3,9]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 299.727813] [pid:1994,cpu6,wpa_supplicant,3]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 301.002807] [pid:217,cpu7,kworker/u16:3,6]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 303.659973] [pid:1994,cpu6,wpa_supplicant,3]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 304.962829] [2023:04:28 11:14:43][pid:237,cpu7,kworker/u16:5,5]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 305.818237] [pid:1994,cpu7,wpa_supplicant,6]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 307.107818] [pid:216,cpu7,kworker/u16:2,8]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 314.760284] [pid:1994,cpu6,wpa_supplicant,8]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 316.032379] [2023:04:28 11:14:54][pid:95,cpu7,kworker/u16:1,9]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 324.724700] [pid:1994,cpu6,wpa_supplicant,4]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 324.757446] [pid:77352,cpu7,ifconfig,5]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 325.891845] [pid:1994,cpu7,wpa_supplicant,0]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 327.196166] [2023:04:28 11:15:05][pid:7,cpu7,kworker/u16:0,1]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e [ 327.199157] [pid:1994,cpu7,wpa_supplicant,2]AFTER: REG_RCR differs from regrcr: 0x700060ce insted of 0x700060ce [ 327.234588] [pid:7,cpu7,kworker/u16:0,5]BEFORE: REG_RCR differs from regrcr: 0x1830d33 insted of 0x7000604e [ 327.236968] [pid:1994,cpu7,wpa_supplicant,6]AFTER: REG_RCR differs from regrcr: 0x7000604e insted of 0x7000604e The REG_RCR has been inexplicably modified to an different value, it is very strange on driver's perspective. In fact, there is another driver rtl8192cu.ko (drivers/net/wireless/realtek/rtlwifi/), that can also match this device. This driver also uses the saved value instead of reading from REG_RCR, when need to modify the REG_RCR. And there will be no issue with authentication timeout, if using this rtl8192cu driver. Thanks. Yun Lu
At 2023-04-28 01:01:06, "Bitterblue Smith" <rtl8821cerfe2@gmail.com> wrote: >On 27/04/2023 05:05, Yun Lu wrote: >> From: Yun Lu <luyun@kylinos.cn> >> >> When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a >> probability of failure, which shows "authentication with ... timed out". >> Through debugging, it was found that the RCR register has been inexplicably >> modified to an incorrect value, resulting in the nic not being able to >> receive authenticated frames. >> >> To fix this problem, add regrcr in rtl8xxxu_priv struct, and store >> the RCR value every time the register is writen, and use it the next >> time the register need to be modified. >> > >Can this bug be reproduced easily? Is it always the same bits which >are mysteriously cleared from REG_RCR? On the device(EDIMAX EW-7822UAn) we used, it can be reproduced easily. And the changed bits is not always the same, as the log shows in my reply to Larry. It seems that the nic will modify the value of this register itself? I guess it. Thanks.
wo <luyun_611@163.com> writes: > In fact, there is another driver rtl8192cu.ko > (drivers/net/wireless/realtek/rtlwifi/), that can also match this > device. It's not good if there are two drivers supporting same hardware. Should the support be removed from rtlwifi?
On 4/27/23 23:11, wo wrote: > [ 149.595642] [pid:7,cpu6,kworker/u16:0,0]BEFORE: REG_RCR differs from regrcr: > 0x1830613 insted of 0x7000604e > [ 160.676422] [pid:237,cpu6,kworker/u16:5,3]BEFORE: REG_RCR differs from > regrcr: 0x70006009 insted of 0x700060ce > [ 327.234588] [pid:7,cpu7,kworker/u16:0,5]BEFORE: REG_RCR differs from regrcr: 0x1830d33 insted of 0x7000604e My patch was messed up, but it got the information that I wanted, which is shown in the quoted lines above. One of these differs only in the low-order byte, while the other 2 are completely different. Strange! It is possible that there is a firmware error. My system, which does not show the problem, reports the following: [54130.741148] usb 3-6: RTL8192CU rev A (TSMC) romver 0, 2T2R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0 [54130.741153] usb 3-6: RTL8192CU MAC: xx:xx:xx:xx:xx:xx [54130.741155] usb 3-6: rtl8xxxu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin [54130.742301] usb 3-6: Firmware revision 88.2 (signature 0x88c1) Which firmware does your unit use? Attached is a new test patch. When it logs a CORRUPTED value, I would like to know what task is attached to the pid listed in the message. Note that the two instances where the entire word was wrong came from pid:7. Could improper locking could produce these results? Larry
On 4/28/23 03:25, Kalle Valo wrote: > wo <luyun_611@163.com> writes: > >> In fact, there is another driver rtl8192cu.ko >> (drivers/net/wireless/realtek/rtlwifi/), that can also match this >> device. > > It's not good if there are two drivers supporting same hardware. Should > the support be removed from rtlwifi? Kalle, I have just sent a patch removing rtl8192cu. Larry
At 2023-04-29 01:06:03, "Larry Finger" <Larry.Finger@lwfinger.net> wrote: >On 4/27/23 23:11, wo wrote: >> [ 149.595642] [pid:7,cpu6,kworker/u16:0,0]BEFORE: REG_RCR differs from regrcr: >> 0x1830613 insted of 0x7000604e >> [ 160.676422] [pid:237,cpu6,kworker/u16:5,3]BEFORE: REG_RCR differs from >> regrcr: 0x70006009 insted of 0x700060ce > > [ 327.234588] [pid:7,cpu7,kworker/u16:0,5]BEFORE: REG_RCR differs from >regrcr: 0x1830d33 insted of 0x7000604e > > >My patch was messed up, but it got the information that I wanted, which is shown >in the quoted lines above. One of these differs only in the low-order byte, >while the other 2 are completely different. Strange! > >It is possible that there is a firmware error. My system, which does not show >the problem, reports the following: > >[54130.741148] usb 3-6: RTL8192CU rev A (TSMC) romver 0, 2T2R, TX queues 2, >WiFi=1, BT=0, GPS=0, HI PA=0 >[54130.741153] usb 3-6: RTL8192CU MAC: xx:xx:xx:xx:xx:xx >[54130.741155] usb 3-6: rtl8xxxu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin >[54130.742301] usb 3-6: Firmware revision 88.2 (signature 0x88c1) > >Which firmware does your unit use? The firmware verion we used is 80.0 (signature 0x88c1) [ 903.873107] [pid:14,cpu0,kworker/0:1,2]usb 1-1.2: RTL8192CU rev A (TSMC) 2T2R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0 [ 903.873138] [pid:14,cpu0,kworker/0:1,3]usb 1-1.2: RTL8192CU MAC: 08:be:xx:xx:xx:xx [ 903.873138] [pid:14,cpu0,kworker/0:1,4]usb 1-1.2: rtl8xxxu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin [ 903.873474] [pid:14,cpu0,kworker/0:1,5]usb 1-1.2: Firmware revision 80.0 (signature 0x88c1) > >Attached is a new test patch. When it logs a CORRUPTED value, I would like to >know what task is attached to the pid listed in the message. Note that the two >instances where the entire word was wrong came from pid:7. > >Could improper locking could produce these results? > >Larry Apply your new patch, then turn on/off the wireless network switch on the network control panel serverl loops. The log shows: [ 85.384429] [pid:221,cpu6,kworker/u16:6,5]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce [ 121.681976] [pid:216,cpu6,kworker/u16:3,0]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce [ 144.416992] [pid:217,cpu6,kworker/u16:4,1]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce And if we up/down the interface serverl loops as follows: ifconfig wlx08bexxxxxx down sleep 1 ifconfig wlx08bexxxxxx up sleep 10 The log shows: [ 282.112335] [2023:04:29 10:30:34][pid:95,cpu6,kworker/u16:1,3]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1832e13 insted of 0x7000604e [ 293.311462] [2023:04:29 10:30:45][pid:217,cpu7,kworker/u16:4,9]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1830e72 insted of 0x7000604e [ 304.435089] [2023:04:29 10:30:56][pid:217,cpu6,kworker/u16:4,9]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1830ed3 insted of 0x7000604e [ 315.532257] [2023:04:29 10:31:07][pid:95,cpu7,kworker/u16:1,8]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x7000604e insted of 0x7000604e [ 324.114379] [2023:04:29 10:31:16][pid:221,cpu6,kworker/u16:6,7]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1832e14 insted of 0x7000604e We also update the firmware verion to 88.2, and the test results are the same as above. Thank you for helping debug this issue, which seems to be related to specific devices. Yun Lu
Larry Finger <Larry.Finger@lwfinger.net> writes: > On 4/28/23 03:25, Kalle Valo wrote: >> wo <luyun_611@163.com> writes: >> >>> In fact, there is another driver rtl8192cu.ko >>> (drivers/net/wireless/realtek/rtlwifi/), that can also match this >>> device. >> >> It's not good if there are two drivers supporting same hardware. Should >> the support be removed from rtlwifi? > > Kalle, > > I have just sent a patch removing rtl8192cu. Awesome, thanks Larry.
On 29/04/2023 06:35, Yun Lu wrote: > At 2023-04-29 01:06:03, "Larry Finger" <Larry.Finger@lwfinger.net> wrote: >> On 4/27/23 23:11, wo wrote: >>> [ 149.595642] [pid:7,cpu6,kworker/u16:0,0]BEFORE: REG_RCR differs from regrcr: >>> 0x1830613 insted of 0x7000604e >>> [ 160.676422] [pid:237,cpu6,kworker/u16:5,3]BEFORE: REG_RCR differs from >>> regrcr: 0x70006009 insted of 0x700060ce >>> [ 327.234588] [pid:7,cpu7,kworker/u16:0,5]BEFORE: REG_RCR differs from >> regrcr: 0x1830d33 insted of 0x7000604e >> >> >> My patch was messed up, but it got the information that I wanted, which is shown >> in the quoted lines above. One of these differs only in the low-order byte, >> while the other 2 are completely different. Strange! >> >> It is possible that there is a firmware error. My system, which does not show >> the problem, reports the following: >> >> [54130.741148] usb 3-6: RTL8192CU rev A (TSMC) romver 0, 2T2R, TX queues 2, >> WiFi=1, BT=0, GPS=0, HI PA=0 >> [54130.741153] usb 3-6: RTL8192CU MAC: xx:xx:xx:xx:xx:xx >> [54130.741155] usb 3-6: rtl8xxxu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin >> [54130.742301] usb 3-6: Firmware revision 88.2 (signature 0x88c1) >> >> Which firmware does your unit use? > > The firmware verion we used is 80.0 (signature 0x88c1) > [ 903.873107] [pid:14,cpu0,kworker/0:1,2]usb 1-1.2: RTL8192CU rev A (TSMC) 2T2R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0 > [ 903.873138] [pid:14,cpu0,kworker/0:1,3]usb 1-1.2: RTL8192CU MAC: 08:be:xx:xx:xx:xx > [ 903.873138] [pid:14,cpu0,kworker/0:1,4]usb 1-1.2: rtl8xxxu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin > [ 903.873474] [pid:14,cpu0,kworker/0:1,5]usb 1-1.2: Firmware revision 80.0 (signature 0x88c1) > >> >> Attached is a new test patch. When it logs a CORRUPTED value, I would like to >> know what task is attached to the pid listed in the message. Note that the two >> instances where the entire word was wrong came from pid:7. >> >> Could improper locking could produce these results? >> >> Larry > > Apply your new patch, then turn on/off the wireless network switch on the network control panel serverl loops. > The log shows: > [ 85.384429] [pid:221,cpu6,kworker/u16:6,5]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce > [ 121.681976] [pid:216,cpu6,kworker/u16:3,0]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce > [ 144.416992] [pid:217,cpu6,kworker/u16:4,1]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce > > And if we up/down the interface serverl loops as follows: > ifconfig wlx08bexxxxxx down > sleep 1 > ifconfig wlx08bexxxxxx up > sleep 10 > The log shows: > [ 282.112335] [2023:04:29 10:30:34][pid:95,cpu6,kworker/u16:1,3]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1832e13 insted of 0x7000604e > [ 293.311462] [2023:04:29 10:30:45][pid:217,cpu7,kworker/u16:4,9]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1830e72 insted of 0x7000604e > [ 304.435089] [2023:04:29 10:30:56][pid:217,cpu6,kworker/u16:4,9]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1830ed3 insted of 0x7000604e > [ 315.532257] [2023:04:29 10:31:07][pid:95,cpu7,kworker/u16:1,8]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x7000604e insted of 0x7000604e > [ 324.114379] [2023:04:29 10:31:16][pid:221,cpu6,kworker/u16:6,7]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1832e14 insted of 0x7000604e > > We also update the firmware verion to 88.2, and the test results are the same as above. > > Thank you for helping debug this issue, which seems to be related to specific devices. > > Yun Lu > > > > There was this bug report about phantom MAC addresses with the RTL8188CUS: https://lore.kernel.org/linux-wireless/a31d9500-73a3-f890-bebd-d0a4014f87da@reto-schneider.ch/ See the pcap file. I wonder if it's related?
Larry and Bitterblue: Thank you for your reply, are there any further questions or suggestions on this issue? Could this patch be merged? There seems to be no other side effects. 在 2023-05-04 15:39:57,"Yun Lu" <luyun_611@163.com> 写道: > >在 2023-04-30 18:36:50,"Bitterblue Smith" <rtl8821cerfe2@gmail.com> 写道: >>On 29/04/2023 06:35, Yun Lu wrote: >>> At 2023-04-29 01:06:03, "Larry Finger" <Larry.Finger@lwfinger.net> wrote: >>>> On 4/27/23 23:11, wo wrote: >>>>> [ 149.595642] [pid:7,cpu6,kworker/u16:0,0]BEFORE: REG_RCR differs from regrcr: >>>>> 0x1830613 insted of 0x7000604e >>>>> [ 160.676422] [pid:237,cpu6,kworker/u16:5,3]BEFORE: REG_RCR differs from >>>>> regrcr: 0x70006009 insted of 0x700060ce >>>>> [ 327.234588] [pid:7,cpu7,kworker/u16:0,5]BEFORE: REG_RCR differs from >>>> regrcr: 0x1830d33 insted of 0x7000604e >>>> >>>> >>>> My patch was messed up, but it got the information that I wanted, which is shown >>>> in the quoted lines above. One of these differs only in the low-order byte, >>>> while the other 2 are completely different. Strange! >>>> >>>> It is possible that there is a firmware error. My system, which does not show >>>> the problem, reports the following: >>>> >>>> [54130.741148] usb 3-6: RTL8192CU rev A (TSMC) romver 0, 2T2R, TX queues 2, >>>> WiFi=1, BT=0, GPS=0, HI PA=0 >>>> [54130.741153] usb 3-6: RTL8192CU MAC: xx:xx:xx:xx:xx:xx >>>> [54130.741155] usb 3-6: rtl8xxxu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin >>>> [54130.742301] usb 3-6: Firmware revision 88.2 (signature 0x88c1) >>>> >>>> Which firmware does your unit use? >>> >>> The firmware verion we used is 80.0 (signature 0x88c1) >>> [ 903.873107] [pid:14,cpu0,kworker/0:1,2]usb 1-1.2: RTL8192CU rev A (TSMC) 2T2R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0 >>> [ 903.873138] [pid:14,cpu0,kworker/0:1,3]usb 1-1.2: RTL8192CU MAC: 08:be:xx:xx:xx:xx >>> [ 903.873138] [pid:14,cpu0,kworker/0:1,4]usb 1-1.2: rtl8xxxu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin >>> [ 903.873474] [pid:14,cpu0,kworker/0:1,5]usb 1-1.2: Firmware revision 80.0 (signature 0x88c1) >>> >>>> >>>> Attached is a new test patch. When it logs a CORRUPTED value, I would like to >>>> know what task is attached to the pid listed in the message. Note that the two >>>> instances where the entire word was wrong came from pid:7. >>>> >>>> Could improper locking could produce these results? >>>> >>>> Larry >>> >>> Apply your new patch, then turn on/off the wireless network switch on the network control panel serverl loops. >>> The log shows: >>> [ 85.384429] [pid:221,cpu6,kworker/u16:6,5]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce >>> [ 121.681976] [pid:216,cpu6,kworker/u16:3,0]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce >>> [ 144.416992] [pid:217,cpu6,kworker/u16:4,1]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce >>> >>> And if we up/down the interface serverl loops as follows: >>> ifconfig wlx08bexxxxxx down >>> sleep 1 >>> ifconfig wlx08bexxxxxx up >>> sleep 10 >>> The log shows: >>> [ 282.112335] [2023:04:29 10:30:34][pid:95,cpu6,kworker/u16:1,3]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1832e13 insted of 0x7000604e >>> [ 293.311462] [2023:04:29 10:30:45][pid:217,cpu7,kworker/u16:4,9]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1830e72 insted of 0x7000604e >>> [ 304.435089] [2023:04:29 10:30:56][pid:217,cpu6,kworker/u16:4,9]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1830ed3 insted of 0x7000604e >>> [ 315.532257] [2023:04:29 10:31:07][pid:95,cpu7,kworker/u16:1,8]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x7000604e insted of 0x7000604e >>> [ 324.114379] [2023:04:29 10:31:16][pid:221,cpu6,kworker/u16:6,7]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1832e14 insted of 0x7000604e >>> >>> We also update the firmware verion to 88.2, and the test results are the same as above. >>> >>> Thank you for helping debug this issue, which seems to be related to specific devices. >>> >>> Yun Lu >>> >>> >>> >>> >>There was this bug report about phantom MAC addresses with >>the RTL8188CUS: >>https://lore.kernel.org/linux-wireless/a31d9500-73a3-f890-bebd-d0a4014f87da@reto-schneider.ch/ >> >>See the pcap file. I wonder if it's related? > >The bug in the link is a high retransmission rate during message transmission, but the problem we encountered is that >the nic cannot receive authentication frames, resulting in authentication timeout and inability to connect to WiFi. It seems >that these two issues are not related. > >We also enabled monitor mode and found that the AP has replied to the authentication message, but the nic cannot receive >this reply message due to the incorrect RCR register value. Once the RCR register is modified to the correct value, >the authentication message can be received normally and the connection to WIFI can be normal. > >Thanks. > > >
On 5/10/23 21:29, Yun Lu wrote: > Larry and Bitterblue: > > Thank you for your reply, are there any further questions or suggestions on this issue? > Could this patch be merged? There seems to be no other side effects. > > > > 在 2023-05-04 15:39:57,"Yun Lu" <luyun_611@163.com> 写道: >> >> 在 2023-04-30 18:36:50,"Bitterblue Smith" <rtl8821cerfe2@gmail.com> 写道: >>> On 29/04/2023 06:35, Yun Lu wrote: >>>> At 2023-04-29 01:06:03, "Larry Finger" <Larry.Finger@lwfinger.net> wrote: >>>>> On 4/27/23 23:11, wo wrote: >>>>>> [ 149.595642] [pid:7,cpu6,kworker/u16:0,0]BEFORE: REG_RCR differs from regrcr: >>>>>> 0x1830613 insted of 0x7000604e >>>>>> [ 160.676422] [pid:237,cpu6,kworker/u16:5,3]BEFORE: REG_RCR differs from >>>>>> regrcr: 0x70006009 insted of 0x700060ce >>>>>> [ 327.234588] [pid:7,cpu7,kworker/u16:0,5]BEFORE: REG_RCR differs from >>>>> regrcr: 0x1830d33 insted of 0x7000604e >>>>> >>>>> >>>>> My patch was messed up, but it got the information that I wanted, which is shown >>>>> in the quoted lines above. One of these differs only in the low-order byte, >>>>> while the other 2 are completely different. Strange! >>>>> >>>>> It is possible that there is a firmware error. My system, which does not show >>>>> the problem, reports the following: >>>>> >>>>> [54130.741148] usb 3-6: RTL8192CU rev A (TSMC) romver 0, 2T2R, TX queues 2, >>>>> WiFi=1, BT=0, GPS=0, HI PA=0 >>>>> [54130.741153] usb 3-6: RTL8192CU MAC: xx:xx:xx:xx:xx:xx >>>>> [54130.741155] usb 3-6: rtl8xxxu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin >>>>> [54130.742301] usb 3-6: Firmware revision 88.2 (signature 0x88c1) >>>>> >>>>> Which firmware does your unit use? >>>> >>>> The firmware verion we used is 80.0 (signature 0x88c1) >>>> [ 903.873107] [pid:14,cpu0,kworker/0:1,2]usb 1-1.2: RTL8192CU rev A (TSMC) 2T2R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0 >>>> [ 903.873138] [pid:14,cpu0,kworker/0:1,3]usb 1-1.2: RTL8192CU MAC: 08:be:xx:xx:xx:xx >>>> [ 903.873138] [pid:14,cpu0,kworker/0:1,4]usb 1-1.2: rtl8xxxu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin >>>> [ 903.873474] [pid:14,cpu0,kworker/0:1,5]usb 1-1.2: Firmware revision 80.0 (signature 0x88c1) >>>> >>>>> >>>>> Attached is a new test patch. When it logs a CORRUPTED value, I would like to >>>>> know what task is attached to the pid listed in the message. Note that the two >>>>> instances where the entire word was wrong came from pid:7. >>>>> >>>>> Could improper locking could produce these results? >>>>> >>>>> Larry >>>> >>>> Apply your new patch, then turn on/off the wireless network switch on the network control panel serverl loops. >>>> The log shows: >>>> [ 85.384429] [pid:221,cpu6,kworker/u16:6,5]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce >>>> [ 121.681976] [pid:216,cpu6,kworker/u16:3,0]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce >>>> [ 144.416992] [pid:217,cpu6,kworker/u16:4,1]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x70006009 insted of 0x700060ce >>>> >>>> And if we up/down the interface serverl loops as follows: >>>> ifconfig wlx08bexxxxxx down >>>> sleep 1 >>>> ifconfig wlx08bexxxxxx up >>>> sleep 10 >>>> The log shows: >>>> [ 282.112335] [2023:04:29 10:30:34][pid:95,cpu6,kworker/u16:1,3]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1832e13 insted of 0x7000604e >>>> [ 293.311462] [2023:04:29 10:30:45][pid:217,cpu7,kworker/u16:4,9]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1830e72 insted of 0x7000604e >>>> [ 304.435089] [2023:04:29 10:30:56][pid:217,cpu6,kworker/u16:4,9]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1830ed3 insted of 0x7000604e >>>> [ 315.532257] [2023:04:29 10:31:07][pid:95,cpu7,kworker/u16:1,8]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x7000604e insted of 0x7000604e >>>> [ 324.114379] [2023:04:29 10:31:16][pid:221,cpu6,kworker/u16:6,7]REG_RCR corrupted in rtl8xxxu_configure_filter: 0x1832e14 insted of 0x7000604e >>>> >>>> We also update the firmware verion to 88.2, and the test results are the same as above. >>>> >>>> Thank you for helping debug this issue, which seems to be related to specific devices. >>>> >>>> Yun Lu >>>> >>>> >>>> >>>> >>> There was this bug report about phantom MAC addresses with >>> the RTL8188CUS: >>> https://lore.kernel.org/linux-wireless/a31d9500-73a3-f890-bebd-d0a4014f87da@reto-schneider.ch/ >>> >>> See the pcap file. I wonder if it's related? >> >> The bug in the link is a high retransmission rate during message transmission, but the problem we encountered is that >> the nic cannot receive authentication frames, resulting in authentication timeout and inability to connect to WiFi. It seems >> that these two issues are not related. >> >> We also enabled monitor mode and found that the AP has replied to the authentication message, but the nic cannot receive >> this reply message due to the incorrect RCR register value. Once the RCR register is modified to the correct value, >> the authentication message can be received normally and the connection to WIFI can be normal. Yun Lu, I have no objection to adding this patch. Although it looked a little ad-hoc at first, it seems to fix a hardware or firmware error for your device. It certainly does no harm other than taking up a bit of memory in the loaded driver. Resubmit the patch with a new version number, and I will Ack it. Larry Larry
On 11/05/2023 05:29, Yun Lu wrote: > Larry and Bitterblue: > > Thank you for your reply, are there any further questions or suggestions on this issue? > Could this patch be merged? There seems to be no other side effects. > Your patch looks okay to me. I couldn't reproduce the bug and I don't have any brilliant ideas, so that's it.
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h index c8cee4a24755..4088aaa1c618 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h @@ -1518,6 +1518,7 @@ struct rtl8xxxu_priv { u32 rege9c; u32 regeb4; u32 regebc; + u32 regrcr; int next_mbox; int nr_out_eps; diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 620a5cc2bfdd..2fe71933ba08 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4053,6 +4053,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw) RCR_ACCEPT_MGMT_FRAME | RCR_HTC_LOC_CTRL | RCR_APPEND_PHYSTAT | RCR_APPEND_ICV | RCR_APPEND_MIC; rtl8xxxu_write32(priv, REG_RCR, val32); + priv->regrcr = val32; if (priv->rtl_chip == RTL8188F) { /* Accept all data frames */ @@ -6273,7 +6274,7 @@ static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw, unsigned int *total_flags, u64 multicast) { struct rtl8xxxu_priv *priv = hw->priv; - u32 rcr = rtl8xxxu_read32(priv, REG_RCR); + u32 rcr = priv->regrcr; dev_dbg(&priv->udev->dev, "%s: changed_flags %08x, total_flags %08x\n", __func__, changed_flags, *total_flags); @@ -6319,6 +6320,7 @@ static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw, */ rtl8xxxu_write32(priv, REG_RCR, rcr); + priv->regrcr = rcr; *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL | FIF_OTHER_BSS | FIF_PSPOLL |