]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value
authorYun Lu <luyun@kylinos.cn>
Fri, 12 May 2023 01:20:55 +0000 (09:20 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 4 Sep 2023 09:10:27 +0000 (11:10 +0200)
BugLink: https://bugs.launchpad.net/bugs/2029808
[ Upstream commit 20429444e653ee8242dfbf815c0c37866beb371b ]

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 written, and use it the next
time the register need to be modified.

Signed-off-by: Yun Lu <luyun@kylinos.cn>
Link: https://lore.kernel.org/all/20230427020512.1221062-1-luyun_611@163.com
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230512012055.2990472-1-luyun_611@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c

index d26df4095da026b661aba344cd4c27e1d383a7b7..89ea6e6a8a025c98e87224531a4043ddb470c60a 100644 (file)
@@ -1409,6 +1409,7 @@ struct rtl8xxxu_priv {
        u32 rege9c;
        u32 regeb4;
        u32 regebc;
+       u32 regrcr;
        int next_mbox;
        int nr_out_eps;
 
index 846bd268ffd9416b8bd30ac024041838c416c316..5240f2d5490c054653297f4b9193025d3e9096c1 100644 (file)
@@ -3993,6 +3993,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 */
@@ -6042,7 +6043,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);
@@ -6088,6 +6089,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 |