From patchwork Thu Apr 27 02:05:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yun Lu X-Patchwork-Id: 677708 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6582C77B7C for ; Thu, 27 Apr 2023 02:06:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242740AbjD0CGR (ORCPT ); Wed, 26 Apr 2023 22:06:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbjD0CGQ (ORCPT ); Wed, 26 Apr 2023 22:06:16 -0400 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 06534359E; Wed, 26 Apr 2023 19:06:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=8anvP xD8XmwYs/lU3l44S7Jx4BpVN/L/yRKmtDO3HDQ=; b=XTNVCwqs6XL5Lj84+31bC DVrzCAkDGi6I+n6azGA1E/HpVPBjZF+vIcDe9igzKF1XCa7/dCDvBCWgR7UtCIW9 hLwZCA+yqyJSCisxCVyDx04bs7mpFrGzrI0wiu47PRCla+rOFoqBXhuG4dArmNRF b9abalyEVCXiP8MOO4+fwk= Received: from localhost.localdomain (unknown [116.128.244.169]) by zwqz-smtp-mta-g1-1 (Coremail) with SMTP id _____wBnOwFi2ElkFJLoAA--.8925S2; Thu, 27 Apr 2023 10:05:23 +0800 (CST) From: Yun Lu To: Jes.Sorensen@gmail.com Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH] wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value Date: Thu, 27 Apr 2023 10:05:12 +0800 Message-Id: <20230427020512.1221062-1-luyun_611@163.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CM-TRANSID: _____wBnOwFi2ElkFJLoAA--.8925S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxAryDAw4UAFW5ZF43urykZrb_yoW5Gryxpr WDCa4FyF1UJw1kW3y8Xa17CF1rX3WSqrs3uFyfJ34Svrs5X34S9F1F9F98AF4kurWkJFWa qrWFyrsrGrn8W37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jjQ6LUUUUU= X-Originating-IP: [116.128.244.169] X-CM-SenderInfo: pox130jbwriqqrwthudrp/1tbi6wRezlXl4lutdgAAst Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yun Lu 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 --- 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 |