From patchwork Thu Jul 5 07:36:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ping-Ke Shih X-Patchwork-Id: 10508297 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 16B9E60325 for ; Thu, 5 Jul 2018 07:37:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66C5128879 for ; Thu, 5 Jul 2018 07:37:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A26928978; Thu, 5 Jul 2018 07:37:09 +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.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,URIBL_BLACK autolearn=unavailable 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 C1D0528879 for ; Thu, 5 Jul 2018 07:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753198AbeGEHg4 (ORCPT ); Thu, 5 Jul 2018 03:36:56 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:37165 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753151AbeGEHgy (ORCPT ); Thu, 5 Jul 2018 03:36:54 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID w657a3Pp003642, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcas11.realtek.com.tw[172.21.6.12]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id w657a3Pp003642 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 5 Jul 2018 15:36:03 +0800 Received: from RTITMBSV07.realtek.com.tw ([fe80::8d2f:f777:70b1:3332]) by RTITCAS11.realtek.com.tw ([fe80::7c6d:ced5:c4ff:8297%15]) with mapi id 14.03.0399.000; Thu, 5 Jul 2018 15:36:02 +0800 From: Pkshih To: "Larry.Finger@lwfinger.net" , "drake@endlessm.com" CC: Shaofu , "linux-kernel@vger.kernel.org" , "dan.carpenter@oracle.com" , "colin.king@canonical.com" , "devel@driverdev.osuosl.org" , Birming Chiu , "kvalo@codeaurora.org" , "frank@generalsoftwareinc.com" , "gregkh@linuxfoundation.org" , "linux@endlessm.com" , Steven Ting , Tony Chuang , "arnd@arndb.de" , "sgruszka@redhat.com" , "jian-hong@endlessm.com" , "linux-wireless@vger.kernel.org" Subject: Re: [BUG] staging: r8822be: RTL8822be can't find any wireless AP Thread-Topic: [BUG] staging: r8822be: RTL8822be can't find any wireless AP Thread-Index: AQHUE22DzuvlCflYc0m+BYaX7Z1mD6R+kDsAgAAEEYCAABHSAIAABbEAgAEM1QA= Date: Thu, 5 Jul 2018 07:36:02 +0000 Message-ID: <1530776154.4156.12.camel@realtek.com> References: <20180704140933.3dk2ylbntltz6jqd@mwanda> <7e95bd6a-97bc-b030-26ce-83da66e5f279@lwfinger.net> In-Reply-To: Accept-Language: en-US, zh-TW Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.21.69.146] Content-ID: MIME-Version: 1.0 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 Wed, 2018-07-04 at 10:33 -0500, Daniel Drake wrote: > On Wed, Jul 4, 2018 at 10:13 AM, Larry Finger wrote: > > We will have to agree to disagree. > > > > I have no idea what the vendors are doing that cause some motherboards to > > need a different aspm value. What I do know is that we have had to live with > > the idiocy of some vendors saving a few pennies by only including a single > > antenna, rather than two, and then making a problem by miscoding the EFUSE > > bit that indicates which connector is actually in use. As we have no means > > that I know about to detect which boxes have the problem, a module parameter > > was created, just as in this case. > > > > I agree that drivers should work "out of the box", but finite resources and > > lack of vendor cooperation make this a goal that may not be attainable. > > As you touched on, the ideal situation is that Realtek solve the > issue. Ping-Ke Shih is on CC and I am adding a few more contacts from > the commit log. The context is that the r8822 driver fails on several > platforms unless setting aspm=0 (the default is 1). It's hard to have all laptop or motherboards and all rtl8822be modules in my side, so what I can do is to analyze the issue when user encountered. > > https://gist.github.com/dsd/20c05f0c6d66ee2ef9bfbb17f93f18ba > https://bugzilla.kernel.org/show_bug.cgi?id=199651 > > > If we don't get a timely fix from Realtek though, I think there is a > key difference between the antenna selection headache and this one. In > the antenna case, there isn't a good value that you can set that will > work on all systems. If you change the default behaviour you will > solve the issue for some users while simultanously introducing the > problem on other systems that were previously fine. > > However in this case, it's highly likely that setting aspm=0 (off) by > default would work for everyone. It has the disadvantage of using a > bit more power, but especially with the indications that this issue > affects a significant number of systems, I think that having the > driver working out of the box everywhere is more important. The module > parameter can be left in place so that unaffected users that want to > save power can set aspm=1. > I think this issue may be due to L1 latency, so below patch would be helpful but not sure because I don't have the same laptop. Is there anyone can help to test? --- PK diff --git a/drivers/staging/rtlwifi/rtl8822be/hw.c b/drivers/staging/rtlwifi/rtl8822be/hw.c index 7947edb239a1..88ba5b2fea6a 100644 --- a/drivers/staging/rtlwifi/rtl8822be/hw.c +++ b/drivers/staging/rtlwifi/rtl8822be/hw.c @@ -803,7 +803,7 @@ static void _rtl8822be_enable_aspm_back_door(struct ieee80211_hw *hw)   return;     pci_read_config_byte(rtlpci->pdev, 0x70f, &tmp); - pci_write_config_byte(rtlpci->pdev, 0x70f, tmp | BIT(7)); + pci_write_config_byte(rtlpci->pdev, 0x70f, tmp | ASPM_L1_LATENCY << 3);     pci_read_config_byte(rtlpci->pdev, 0x719, &tmp);   pci_write_config_byte(rtlpci->pdev, 0x719, tmp | BIT(3) | BIT(4)); diff --git a/drivers/staging/rtlwifi/wifi.h b/drivers/staging/rtlwifi/wifi.h index 012fb618840b..a45f0eb69d3f 100644 --- a/drivers/staging/rtlwifi/wifi.h +++ b/drivers/staging/rtlwifi/wifi.h @@ -88,6 +88,7 @@  #define RTL_USB_MAX_RX_COUNT 100  #define QBSS_LOAD_SIZE 5  #define MAX_WMMELE_LENGTH 64 +#define ASPM_L1_LATENCY 7    #define TOTAL_CAM_ENTRY 32