From patchwork Wed Sep 13 15:01:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9951511 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 188E06038F for ; Wed, 13 Sep 2017 15:01:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 096D91FFAD for ; Wed, 13 Sep 2017 15:01:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0F8E200DF; Wed, 13 Sep 2017 15:01:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B0961FFAD for ; Wed, 13 Sep 2017 15:01:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751894AbdIMPBk (ORCPT ); Wed, 13 Sep 2017 11:01:40 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:34739 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750993AbdIMPBj (ORCPT ); Wed, 13 Sep 2017 11:01:39 -0400 Received: by mail-oi0-f66.google.com with SMTP id v66so363111oig.1 for ; Wed, 13 Sep 2017 08:01:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=JZpy4vs2x1nmTkXwl7USyEdZRgmiH4lcmka7DqonReI=; b=WOSkL6nF1XBW01dAcC9w3K0qiVYYHnVx2vFaL6IGTb/L+d36pVh9nI/QqhUWv6XGYL fI4cDfd9orUNmGaaCLvtqdORpkUJw2WEgiTCo4fokq15eeMT4eb3mK6mzOxp/hg9pqO8 UmUoyAsO+FMKgWUzxi8uWZuhEdaQ3pBawgc0kns9fIDQdi8nnXEmunRCHL8iEf8xSs61 LREX83SqFxPwOxfoarH1x1zp+1YF+AO89fONkanA3BzSavzJIfNk+ao1UVX2yF9uBlSZ d/zTLSZILi02oMa2aDid5CobnnZ0vwmb6zMQLisEBRrTH4BRQL26YrvZAduRsHl1XDq+ wckA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JZpy4vs2x1nmTkXwl7USyEdZRgmiH4lcmka7DqonReI=; b=JjBuVsZUbrErzDSgtutPNPzp69N3KUqiwc/TIqQVupr81nxfsKZqihiQP06AFxwSKe b+C3IMom6/T72mO0d5z89WS6LVFev45ENdlNnas572gMl2vsuZ8FpgWgR1E7ioxZpc+z 9kKmNiXKIfQYKlqwPwbwrrdErdxKfPIdKje2NNMCL6nbGMcefjIqt7nzSnWMwoR9yn7W SmjFv2T4dljWagqnOh3oQXQX/K++uqNhp3LXRgcig/A6gGsbrDthXmQVy0VP4pTuTo5o FprImcY2TqWycYxwCucOwdF4N5U9PitFlWAjNFkah5aHjvfg5fpmvv+kZ7RY7KekLys/ DfXA== X-Gm-Message-State: AHPjjUjhQX2OIDsuUv6DWOCsAyJWiGNS5PgEJ2M2AqeV7EnfIqapMnlF EUDKZQGEuF/UbiOv X-Google-Smtp-Source: AOwi7QDgRL71s7yzdzsoiFo8vPj/t3S8lEkcTpz04DYGJ3ypdxu92a+S7JpF8rIb9wmCtHMQob+evw== X-Received: by 10.202.80.78 with SMTP id e75mr15376593oib.1.1505314898903; Wed, 13 Sep 2017 08:01:38 -0700 (PDT) Received: from linux-4v1g.suse (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id u144sm16059233oie.11.2017.09.13.08.01.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Sep 2017 08:01:38 -0700 (PDT) Subject: Re: rtl8821ae keep alive not set, connection lost To: James Cameron , linux-wireless@vger.kernel.org Cc: Ping-Ke Shih , Kalle Valo References: <20170912220916.GB32211@us.netrek.org> From: Larry Finger Message-ID: <59e28611-9840-8873-2f15-1263e4e93d1c@lwfinger.net> Date: Wed, 13 Sep 2017 10:01:37 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170912220916.GB32211@us.netrek.org> Content-Language: en-US Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 09/12/2017 05:09 PM, James Cameron wrote: > Summary: 40b368af4b75 ("rtlwifi: Fix alignment issues") breaks > rtl8821ae keep alive, causing "Connection to AP lost" and deauth, but > why? > > Wireless connection is lost after a few seconds or minutes, on every > OLPC NL3 laptop with rtl8821ae, with any stable kernel after 4.10.1, > and any kernel with 40b368af4b75. > > dmesg contains > > wlp2s0: Connection to AP 2c:b0:5d:a6:86:eb lost > > iw event shows > > wlp2s0: del station 2c:b0:5d:a6:86:eb > wlp2s0 (phy #0): deauth 74:c6:3b:09:b5:0d -> 2c:b0:5d:a6:86:eb reason 4: Disassociated due to inactivity > wlp2s0 (phy #0): disconnected (local request) > > Workaround is to bounce the link, then reconnect; > > ip link set wlp2s0 down > ip link set wlp2s0 up > iw dev wlp2s0 connect qz > > A nearby monitor host captures a deauthentication packet sent by the > device. > > Bisection showed cause is 40b368af4b75 ("rtlwifi: Fix alignment > issues") which changes the width of DBI register read. > > On the face of it, 40b368af4b75 looks correct, especially compared > against same function in rtl8723be. > > I've no idea why reverting fixes the problem. I'm hoping someone here > might speculate and suggest ways to test. > > As keep alive is set through this path, my guess is that keep alive is > not being set in the device. Or perhaps reading 16-bits perturbs > another register. Is there a way to test? > > http://dev.laptop.org/~quozl/z/1drtGD.txt dmesg of 4.13 > > http://dev.laptop.org/~quozl/z/1drt7c.txt dmesg with 4.13 and revert > of 40b368af4b75 James, Thank you very much for making the effort to bisect this problem. I know that several people have reported the problem, which we cannot duplicate; however, most of them just say it drops the connection and do nothing more. In fact, we are lucky to have them even report which kernel version they are running! As we do not see the problem, we will be relying on you to help diagnose the issue. Merely changing the read from 8 to 16 bits should not cause any change. As _rtl8821ae_dbi_read() is only called from _rtl8821ae_enable_aspm_back_door(), we want to test turning off ASPM. The following patch will accomplish this. Unfortunately, the patch is white-space damaged, thus you will need to apply it manually. Please try it to see if it helps your connection loss. Note that ASPM settings are preserved through a module unload/reload sequence. Thus you will need to reboot after rebuilding the driver. Thanks, Larry diff --git a/rtl8821ae/hw.c b/rtl8821ae/hw.c index 305b3abbf..755d3704b 100644 --- a/rtl8821ae/hw.c +++ b/rtl8821ae/hw.c @@ -1982,8 +1982,8 @@ int rtl8821ae_hw_init(struct ieee80211_hw *hw) ppsc->rfpwr_state = ERFON; rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr); - _rtl8821ae_enable_aspm_back_door(hw); - rtlpriv->intf_ops->enable_aspm(hw); + //_rtl8821ae_enable_aspm_back_door(hw); + //rtlpriv->intf_ops->enable_aspm(hw); if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE && (rtlhal->rfe_type == 1 || rtlhal->rfe_type == 5))