Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8202824rwr; Wed, 10 May 2023 20:20:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Ct30tvkdtZDcFcT5mkNdjvvOT0w8bfBOmA4hG17gRnCYwVoMZQz4bVH2r1kAdN8fBzMpL X-Received: by 2002:a05:6a20:158a:b0:103:7b36:f21 with SMTP id h10-20020a056a20158a00b001037b360f21mr3907677pzj.21.1683775232726; Wed, 10 May 2023 20:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683775232; cv=none; d=google.com; s=arc-20160816; b=aa2rfkwx4KFaM2B0uQyImvrNzc3B9hgquIknUHowhxslbyafd7KbjK2vLr6w/wrvzf c3QikWYIJJDeUHcLn1KOtBEnKghW8JTjpwV5B16WGPnd73O36sCR8UA6K1Ar/exWvoUQ KE9uK+Pah0ITAp4ASQaiiHsrBUrAQ69+/aRPUwNMDwyGCreiFSbMID/fv5naIwLi4qWW JE4qwPvAsTkdHMQxxDLc3IUhD7ImFN/78dHzFsosllGReUIGMZ01SavSdvD4/+Fzpr1n Buu32COkFGSf+jtkaGUKAvcw2ZfBQdfn8yMUnCp0jzUXEZrTwklXF+iJfVI94BE36xvK EEBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=fqTZeyYMGiYuy99yTw2mCq9WCFqKj4kqAdwg8UFHt8I=; b=fiGpwpL0rmZe6I7FuHfwoIxmOsQ7c0RiDJNmkef3LnaFUy4ZU6t0VHRyUHepDDKI6P v71Pc0nZ8vXw4nXp9qkvjtOuOVQRwG2Z6mPWAtdMQ7ud1aVn/h+GNQT0IgHub+6ZPGYR mKEWqu+c4kVt2v7sQC5ZVjumY53Q/3BYm4kbj5L0G7ELkhwOybjfrB07O61xKVzgXv5x 5S2K6fiDqD5UQ71hTUuf8fkY3ahFwtR0aVlEUI2ya4O9qFnPMqpYne3cPW0TiowY1Ynl BNyuUpOlVgHALmX9kMGIZDZJenFkzwqD4sZ6KcDlLBPOBTxkZfzGIrUn62nji6OIdiVF SZPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=Noh2+cJ8; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t64-20020a638143000000b0052c96dcaa82si5621046pgd.98.2023.05.10.20.20.23; Wed, 10 May 2023 20:20:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=Noh2+cJ8; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230004AbjEKDT3 (ORCPT + 62 others); Wed, 10 May 2023 23:19:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229799AbjEKDT1 (ORCPT ); Wed, 10 May 2023 23:19:27 -0400 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 503BAE63; Wed, 10 May 2023 20:19:24 -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=fqTZe yYMGiYuy99yTw2mCq9WCFqKj4kqAdwg8UFHt8I=; b=Noh2+cJ8cwYOLyIEmBYU9 gdnHcKuLA69Ptt1PGNH+/iHZwRJDd2iGWglLOvs3ssW+UyY2XKxl4XctSNLN94d1 dq0M/4BuSsZD64Lg70pjYNmQqLc/DRHbyI57fap7yotVJSHt97/s7nwCLGzUbIRV bisNf6LPZ7Dc8Pnch6J52I= Received: from localhost.localdomain (unknown [116.128.244.169]) by zwqz-smtp-mta-g1-4 (Coremail) with SMTP id _____wD3_0eCXlxkoDwhBA--.34445S2; Thu, 11 May 2023 11:18:26 +0800 (CST) From: Yun Lu To: Jes.Sorensen@gmail.com, Larry.Finger@lwfinger.net 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 v2] wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value Date: Thu, 11 May 2023 11:18:25 +0800 Message-Id: <20230511031825.2125279-1-luyun_611@163.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wD3_0eCXlxkoDwhBA--.34445S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxAryDKw4kJF4UAw4fGw1UGFg_yoW5Xr1Upr WDCa4FyF1UJr1kWw48Xa17CF1rX3WSqrs3uFyfJ34Svrs5Z34S9F1F9F90yF4kurWkJFWa qrZYyrsrG3Z8W37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jjPfQUUUUU= X-Originating-IP: [116.128.244.169] X-CM-SenderInfo: pox130jbwriqqrwthudrp/1tbiWwdszmI0Z+svngAAsV X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 Link: https://lore.kernel.org/all/20230427020512.1221062-1-luyun_611@163.com --- 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 | -- 2.25.1 No virus found Checked by Hillstone Network AntiVirus