From patchwork Sun Jan 6 00:02:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 1021025 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hotmail.de Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43XJcQ2LjJz9sCh for ; Sun, 6 Jan 2019 11:02:30 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726421AbfAFACW (ORCPT ); Sat, 5 Jan 2019 19:02:22 -0500 Received: from mail-oln040092065018.outbound.protection.outlook.com ([40.92.65.18]:6316 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726363AbfAFACV (ORCPT ); Sat, 5 Jan 2019 19:02:21 -0500 Received: from HE1EUR01FT038.eop-EUR01.prod.protection.outlook.com (10.152.0.53) by HE1EUR01HT086.eop-EUR01.prod.protection.outlook.com (10.152.1.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1471.13; Sun, 6 Jan 2019 00:02:18 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com (10.152.0.58) by HE1EUR01FT038.mail.protection.outlook.com (10.152.1.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1471.13 via Frontend Transport; Sun, 6 Jan 2019 00:02:18 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com ([fe80::e1f9:8635:f629:eb8e]) by DB7PR07MB5353.eurprd07.prod.outlook.com ([fe80::e1f9:8635:f629:eb8e%4]) with mapi id 15.20.1516.010; Sun, 6 Jan 2019 00:02:18 +0000 From: Bernd Edlinger To: Ping-Ke Shih , Larry Finger , Kalle Valo , "linux-wireless@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Andrew Lunn Subject: [PATCH v3 1/4] rtl8723ae: Take the FW LPS mode handling out Thread-Topic: [PATCH v3 1/4] rtl8723ae: Take the FW LPS mode handling out Thread-Index: AQHUpVMW1dQwmrtP7EOElJ7UgzyQKg== Date: Sun, 6 Jan 2019 00:02:18 +0000 Message-ID: Accept-Language: en-US, en-GB, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6PR06CA0023.eurprd06.prod.outlook.com (2603:10a6:20b:14::36) To DB7PR07MB5353.eurprd07.prod.outlook.com (2603:10a6:10:6e::26) x-incomingtopheadermarker: OriginalChecksum:7434CD7A7CBDF37EA75775B21C64AF86C4E0027572DABBD425845E654302B87B; UpperCasedChecksum:E11E6CAA021AADF9EAE791181A4E67B86955EA041951C5B437D2941725462D94; SizeAsReceived:8745; Count:62 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [Jpt4U8OvZLIkbVR/1i9d496jGx1/qWYN] x-microsoft-original-message-id: x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1EUR01HT086; 6:fgy8urWg2oRDZfDbOKKTAZX91U0O351eY7iT1bZd7k4/Ki7L1cH4Yc7PB9ATVPx+CA66ZaBM5wa04mETF/cMvtrMeuKejEp+a0Fphnl0/ovZNKzsD3SHPOA1qAgTgp+AT+GzzlyfV6g7fG8mIDvh/+b0XztJL0S6oycu83eoJqUvounFwJS+LHwOFnoTfj8zN0KPk0QMeqQc4kLDXC7VZO8ul9gCY36X2JSIoncHdNIuI4vanHdQZWdohj5ZOBVXZZpAtxAeWwY+V/t6zLqEn6qHW6snbDczyQm6Ta+EqYMEjy5WMOuR0iXxY3GgyrGqW5JZuNXI9NM9W9wuP0B2yoptcyBMk4RGq3zW1i8VyDjjW7So+5FIP+kdYIvR/K9jGbKZ8/FbcXPCxxRVEQCH5H0/cwZvebukD5b7cp9Z/XsOrl7N1XVFrNXZ2jt9/zci9i57Ya7E86T+L1xTvX/SNA==; 5:2vf/qXrW8VT8GKKAsFQcjYQP3c/Wg+SqQZTCJVxTpwch6733qdENDs/l1xM1G5gkfhNx3Bf7azBPtBfSNu1IdIKlP5PEMepsFANY5PGU1pBkAZEU/xH8fj4LVJSSR2JEzWbvcp8OR7u9qSxheM+QZ8MR36l6JLbIFeEX08D8Nx4=; 7:KuJyP+OWmZUNehoSxBKOOOOKvTf+qpj4ipFSrP0aMDDBVCYvlMuPaSBAD+h/xoKFVWYnwCDBY0mC9GO2UrdGBlSB7mxzQUzcU0j0xy07fPNodHY4Ixln+jaR+LO9fxy+trhDAiqKCcrci1w2BMSUFg== x-incomingheadercount: 62 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045); SRVR:HE1EUR01HT086; x-ms-traffictypediagnostic: HE1EUR01HT086: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(4566010)(82015058); SRVR:HE1EUR01HT086; BCL:0; PCL:0; RULEID:; SRVR:HE1EUR01HT086; x-microsoft-antispam-message-info: Zw6Flr9qXOa4V4bNDmNKavRpMS4+zcrVadlLyZTQ1GaY+QTXierz6/U3p6VZ4oAP Content-ID: <4DA994C4C2184140A706F188E9BA2980@eurprd07.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-Network-Message-Id: 8b478c00-df2e-490f-d7c1-08d6736a38e8 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2019 00:02:17.4108 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR01HT086 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This appears to trigger a firmware bug and causes severe problems with rtl8723ae PCI devices. When the power save mode is activated for longer periods of time the firmware stops to receive any packets. This problem was exposed by commit 873ffe154ae0 ("rtlwifi: Fix logic error in enter/exit power-save mode"). Previously the power save mode was only active rarely and only for a short time so that the problem was not noticeable. Signed-off-by: Bernd Edlinger --- v2: Adjust the defaults of swlps and fwlps module parameters to match the firmware capabilities instead of removing the whole code, so it can be easily re-activated once a firmware update is available. v3: Make the title fit in one line. --- drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c index 07b82700d1..3103151 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c @@ -266,8 +266,8 @@ static bool is_fw_header(struct rtlwifi_firmware_header *hdr) static struct rtl_mod_params rtl8723e_mod_params = { .sw_crypto = false, .inactiveps = true, - .swctrl_lps = false, - .fwctrl_lps = true, + .swctrl_lps = true, + .fwctrl_lps = false, .aspm_support = 1, .debug_level = 0, .debug_mask = 0, @@ -395,8 +395,8 @@ static bool is_fw_header(struct rtlwifi_firmware_header *hdr) bool, 0444); MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); -MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); -MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); +MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 1)\n"); +MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 0)\n"); MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 0)\n"); MODULE_PARM_DESC(aspm, "Set to 1 to enable ASPM (default 1)\n"); MODULE_PARM_DESC(debug_level, "Set debug level (0-5) (default 0)"); From patchwork Sun Jan 6 00:02:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 1021026 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hotmail.de Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43XJcZ4Vfrz9sCr for ; Sun, 6 Jan 2019 11:02:38 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726448AbfAFACc (ORCPT ); Sat, 5 Jan 2019 19:02:32 -0500 Received: from mail-oln040092064070.outbound.protection.outlook.com ([40.92.64.70]:51264 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726363AbfAFACc (ORCPT ); Sat, 5 Jan 2019 19:02:32 -0500 Received: from HE1EUR01FT038.eop-EUR01.prod.protection.outlook.com (10.152.0.55) by HE1EUR01HT069.eop-EUR01.prod.protection.outlook.com (10.152.1.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1471.13; Sun, 6 Jan 2019 00:02:28 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com (10.152.0.58) by HE1EUR01FT038.mail.protection.outlook.com (10.152.1.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1471.13 via Frontend Transport; Sun, 6 Jan 2019 00:02:28 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com ([fe80::e1f9:8635:f629:eb8e]) by DB7PR07MB5353.eurprd07.prod.outlook.com ([fe80::e1f9:8635:f629:eb8e%4]) with mapi id 15.20.1516.010; Sun, 6 Jan 2019 00:02:28 +0000 From: Bernd Edlinger To: Ping-Ke Shih , Larry Finger , Kalle Valo , "David S. Miller" , "linux-wireless@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Andrew Lunn Subject: [PATCH v3 2/4] rtl8723ae: Dont use old data for input gain control Thread-Topic: [PATCH v3 2/4] rtl8723ae: Dont use old data for input gain control Thread-Index: AQHUpVMclX/eeo4ws0GaQg3rMsPG2Q== Date: Sun, 6 Jan 2019 00:02:28 +0000 Message-ID: Accept-Language: en-US, en-GB, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6PR06CA0010.eurprd06.prod.outlook.com (2603:10a6:20b:14::23) To DB7PR07MB5353.eurprd07.prod.outlook.com (2603:10a6:10:6e::26) x-incomingtopheadermarker: OriginalChecksum:CDBF9722D95F050B2011D2967DF567538F39DEFFFBFAC8EA57C8213EF08C0CF6; UpperCasedChecksum:B9B519704729FC20E1866FF6FB9CC148C3957D79B1CE353D905C698774844B40; SizeAsReceived:8783; Count:62 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [PWlwFVUiSpt8yOB4yHpdJuWceFOPGbXL] x-microsoft-original-message-id: <37150adc-d0d4-d543-b949-07c9d42448d0@hotmail.de> x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1EUR01HT069; 6:sEQR97FnzIIia+5mMH5pzrecS4QjLhtClsumgmqO6K7WEBcvELZNfb4uY71GCj8km014MHiEGSd3P6gMgHwcOnK5IAQNew2K5oE0ImSpcSIbHeO0BgYNdbfP0QdOxsbgQ9M5zaxskf1IXyjmnwuM2Br/8YWJDh+HTQuNlGgoFRfrtrWqpatARC8NH+1W+bGud9OFu8DDHz0fsv72fQ3tYrhoKKYvuVDNVxxzQJaIdRexy7gl/BEE8kJfp0B5kyMcI0MpQ4RCBodhrtNTnCCJ4KYxD5aUW3AThL0xXuULKKWsG5raUzgTPXDUL2oMF0om8oW7Jjtn0YnFobYiLdVQ+/4oQ5g6DdJNywyqM8eFgByWdg/LA/iIm3MjSS/DrEn5eaCq0Z16eCfsu25qXpmWnX7P2URchU5X3GFygia+iwBWCi9FDCSLAKD8k6IMFIDb69cBBClh1EbY7EcnNq2Q1Q==; 5:h5OOEV4BXKy2zPGFh7/KzpGyma+YtfPROSqJkKrCUNQtLnWUoMwdajl7aqyOQo8mG/FjGpfSDcMB+ulqfbEUHJpB0tsbNikNotijssfH15a2DI+sbKFfpkCWckyd1lLZKDAWuoqqBoRfKdpW/BuUOzpswO2MKlY786cFo0rUSkw=; 7:DBa/6Pw3YUI6stvP0sbJx7ns7C0pKkuG1PZ7HJEFjBuXI3HzSjRIh2deB4LQLvPR9mBiKCYpcr/dJd9ZFoAJ4moa4TDbKWljcpBqCA+c9SYWv7F3jZ9FRgPC5S6SGbBEYRCGV9zlrZ+Tuq4McYOFWw== x-incomingheadercount: 62 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(20181119063)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045); SRVR:HE1EUR01HT069; x-ms-traffictypediagnostic: HE1EUR01HT069: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(4566010)(82015058); SRVR:HE1EUR01HT069; BCL:0; PCL:0; RULEID:; SRVR:HE1EUR01HT069; x-microsoft-antispam-message-info: wvbHOGd/WCAUYDK9kxg+oh61DP6v7J/KTNiGtFCmJIcWBSzMBdV1iDU0B3Sjb9/J Content-ID: MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-Network-Message-Id: 8bbd1aae-4ca3-43d4-32eb-08d6736a3f32 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2019 00:02:27.8485 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR01HT069 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When no beacon was received, the value in dm.undec_sm_pwdb is most likely out of date and should not be used to adjust the input path. Assume instead that the signal level is low. Fix the state machine in rtl8723e_dm_cck_packet_detection_thresh which did not clear pre_cck_fa_state when changing cur_cck_pd_state from CCK_PD_STAGE_LOWRSSI/CCK_FA_STAGE_LOW to CCK_PD_STAGE_HIGHRSSI and back again to CCK_PD_STAGE_LOWRSSI/CCK_FA_STAGE_LOW, the register RCCK0_CCA not written to 0x83 on the second change. Explicitly initialize pre_cck_fa_state/cur_cck_fa_state in rtl_dm_diginit. Signed-off-by: Bernd Edlinger --- v2: Improved patch description. v3: Make the title fit in one line. --- drivers/net/wireless/realtek/rtlwifi/core.c | 2 ++ drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c index 4bf7967..ce23339 100644 --- a/drivers/net/wireless/realtek/rtlwifi/core.c +++ b/drivers/net/wireless/realtek/rtlwifi/core.c @@ -1957,5 +1957,7 @@ void rtl_dm_diginit(struct ieee80211_hw *hw, u32 cur_igvalue) dm_digtable->bt30_cur_igi = 0x32; dm_digtable->pre_cck_pd_state = CCK_PD_STAGE_MAX; dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_LOWRSSI; + dm_digtable->pre_cck_fa_state = 0; + dm_digtable->cur_cck_fa_state = 0; } EXPORT_SYMBOL(rtl_dm_diginit); diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c index 42a6fba..902b944 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c @@ -151,8 +151,14 @@ static u8 rtl8723e_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) { struct rtl_priv *rtlpriv = rtl_priv(hw); struct dig_t *dm_digtable = &rtlpriv->dm_digtable; + struct rtl_mac *mac = rtl_mac(rtlpriv); long rssi_val_min = 0; + if (mac->link_state == MAC80211_LINKED && + mac->opmode == NL80211_IFTYPE_STATION && + rtlpriv->link_info.bcn_rx_inperiod == 0) + return 0; + if ((dm_digtable->curmultista_cstate == DIG_MULTISTA_CONNECT) && (dm_digtable->cursta_cstate == DIG_STA_CONNECT)) { if (rtlpriv->dm.entry_min_undec_sm_pwdb != 0) @@ -417,6 +423,8 @@ static void rtl8723e_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) } else { rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, 0xcd); rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x47); + dm_digtable->pre_cck_fa_state = 0; + dm_digtable->cur_cck_fa_state = 0; } dm_digtable->pre_cck_pd_state = dm_digtable->cur_cck_pd_state; From patchwork Sun Jan 6 00:02:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 1021027 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hotmail.de Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43XJcr52x3z9sCr for ; Sun, 6 Jan 2019 11:02:52 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726472AbfAFACr (ORCPT ); Sat, 5 Jan 2019 19:02:47 -0500 Received: from mail-oln040092066048.outbound.protection.outlook.com ([40.92.66.48]:6156 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726363AbfAFACr (ORCPT ); Sat, 5 Jan 2019 19:02:47 -0500 Received: from HE1EUR01FT038.eop-EUR01.prod.protection.outlook.com (10.152.0.60) by HE1EUR01HT108.eop-EUR01.prod.protection.outlook.com (10.152.1.2) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1471.13; Sun, 6 Jan 2019 00:02:41 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com (10.152.0.58) by HE1EUR01FT038.mail.protection.outlook.com (10.152.1.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1471.13 via Frontend Transport; Sun, 6 Jan 2019 00:02:41 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com ([fe80::e1f9:8635:f629:eb8e]) by DB7PR07MB5353.eurprd07.prod.outlook.com ([fe80::e1f9:8635:f629:eb8e%4]) with mapi id 15.20.1516.010; Sun, 6 Jan 2019 00:02:41 +0000 From: Bernd Edlinger To: Ping-Ke Shih , Larry Finger , Kalle Valo , "David S. Miller" , "linux-wireless@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Andrew Lunn Subject: [PATCH v3 3/4] rtl8723ae: Re-introduce the adaptive rate control Thread-Topic: [PATCH v3 3/4] rtl8723ae: Re-introduce the adaptive rate control Thread-Index: AQHUpVMkOop4N053Y0KcM2mzARMi+A== Date: Sun, 6 Jan 2019 00:02:41 +0000 Message-ID: Accept-Language: en-US, en-GB, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6PR06CA0035.eurprd06.prod.outlook.com (2603:10a6:20b:14::48) To DB7PR07MB5353.eurprd07.prod.outlook.com (2603:10a6:10:6e::26) x-incomingtopheadermarker: OriginalChecksum:8CF05EDDBD0C1EE442063221200C1639BD44ED8E995C1341267E962F1CD49C6B; UpperCasedChecksum:F68790972D8B6C8194D61C012225502E6AA665F2EAE43F54D55E4FDD20CE10B8; SizeAsReceived:8776; Count:62 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [545jQbgqfr4MuyXXKI/0T6BGc6IqLYsc] x-microsoft-original-message-id: <8071fa15-af2d-d470-894e-3fc99aa7a7d5@hotmail.de> x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1EUR01HT108; 6:xavsR/dMHuz7KdgXXiLb0OT03WeS9+SmbZelEFGzX/EH4f7giiuBdSt92cPU7RmXBlqg0wRkva14y60oCXah8hzOFxRFppYIl17C35Zz83E6oGNfRtDYyc9vy/3jq/ccPjyfZ1MuqscKIpMymXxc1Wqnq7vAwwV8IPS8qcGcTi0PqH68ItWy4HDPJUcN696yWy17+tIUdnzLDgLgWvZPupZXOKe1jUbJ3RafxjId7UjblVlktVWiSjvnBFXjQjmi4V2ojEqjDrxI6PHediKKFE0GVAPPkIISSZTkjeynRA1NAZr2CYwUhhAr4obmhY8Tprntj1cmToOXqPkt2HOsIIre5wIoUB4Wd/x4N/MpGxB4qeOrbSVUzFMDFq0KiX7kqVw7bH8ZQW+IfNDdke54pygHsUGsQFbsn5dCVYuecuBOD7JE5D9En2aKhGrtJBCaRVg2PqeECrAD/SQ6mPZcPA==; 5:cv4KzH6zWIyiRk4+PeHkp/PABlfeWtf00wMXL0bdhljIj9tHGruDAme74MghLgAZBcxQnXRB1NBmk53vzRobhZJeBUQdXmakreSscl4x+2aFoB5HVx93KDRboNBPmEQEcttQVGE6pp/pmAmQrAPbJqMAf3d5GmNnmt+8sab789k=; 7:URMymyyRzrApnOCdTKsfR/8CMqPt2BM3nnBlopTrMlem4XagSDc7lb4c5R/fewwwkxqQBUCsRhDNa5gQWzC0sVBfjUcouSkeKfYo5Mui524Ia+ZbxT0q5GZnGv0DLiu/+OauDZ4JplpqCd9QYNmZCg== x-incomingheadercount: 62 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045); SRVR:HE1EUR01HT108; x-ms-traffictypediagnostic: HE1EUR01HT108: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(4566010)(82015058); SRVR:HE1EUR01HT108; BCL:0; PCL:0; RULEID:; SRVR:HE1EUR01HT108; x-microsoft-antispam-message-info: o+d307yWn1CPVS+qZ3tdWLpgftdMRY6ogtBZtmPE25/xN+9tp5/VCZnaWTU0bqKS Content-ID: MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-Network-Message-Id: 8c0226b5-2a34-46ab-f803-08d6736a46a7 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2019 00:02:40.3488 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR01HT108 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This re-introduces the function rtl8723e_dm_refresh_rate_adaptive_mask. This function was present in a previous version of the code base, it works just fine for me -- as long as it is not using stale data. Unlike the original version of this function it avoids using dm.undec_sm_pwdb when no beacon was received. Fixed a style nit in rtl8723e_dm_init_rate_adaptive_mask. Signed-off-by: Bernd Edlinger --- v2: Improve patch description. v3: Improve patch description, mention that dm.undec_sm_pwdb is not used when no beacon received. Make the title fit in one line. --- .../net/wireless/realtek/rtlwifi/rtl8723ae/dm.c | 87 +++++++++++++++++++++- 1 file changed, 85 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c index 902b944..acfd54c 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c @@ -673,7 +673,7 @@ void rtl8723e_dm_check_txpower_tracking(struct ieee80211_hw *hw) void rtl8723e_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw) { struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rate_adaptive *p_ra = &(rtlpriv->ra); + struct rate_adaptive *p_ra = &rtlpriv->ra; p_ra->ratr_state = DM_RATR_STA_INIT; p_ra->pre_ratr_state = DM_RATR_STA_INIT; @@ -685,6 +685,89 @@ void rtl8723e_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw) } +void rtl8723e_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw) +{ + struct rtl_priv *rtlpriv = rtl_priv(hw); + struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); + struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); + struct rate_adaptive *p_ra = &rtlpriv->ra; + u32 low_rssithresh_for_ra, high_rssithresh_for_ra; + struct ieee80211_sta *sta = NULL; + + if (is_hal_stop(rtlhal)) { + RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, + " driver is going to unload\n"); + return; + } + + if (!rtlpriv->dm.useramask) { + RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, + " driver does not control rate adaptive mask\n"); + return; + } + + if (mac->link_state == MAC80211_LINKED && + mac->opmode == NL80211_IFTYPE_STATION) { + switch (p_ra->pre_ratr_state) { + case DM_RATR_STA_HIGH: + high_rssithresh_for_ra = 50; + low_rssithresh_for_ra = 20; + break; + case DM_RATR_STA_MIDDLE: + high_rssithresh_for_ra = 55; + low_rssithresh_for_ra = 20; + break; + case DM_RATR_STA_LOW: + high_rssithresh_for_ra = 60; + low_rssithresh_for_ra = 25; + break; + default: + high_rssithresh_for_ra = 50; + low_rssithresh_for_ra = 20; + break; + } + + if (rtlpriv->link_info.bcn_rx_inperiod == 0) + switch (p_ra->pre_ratr_state) { + case DM_RATR_STA_HIGH: + default: + p_ra->ratr_state = DM_RATR_STA_MIDDLE; + break; + case DM_RATR_STA_MIDDLE: + case DM_RATR_STA_LOW: + p_ra->ratr_state = DM_RATR_STA_LOW; + break; + } + else if (rtlpriv->dm.undec_sm_pwdb > high_rssithresh_for_ra) + p_ra->ratr_state = DM_RATR_STA_HIGH; + else if (rtlpriv->dm.undec_sm_pwdb > low_rssithresh_for_ra) + p_ra->ratr_state = DM_RATR_STA_MIDDLE; + else + p_ra->ratr_state = DM_RATR_STA_LOW; + + if (p_ra->pre_ratr_state != p_ra->ratr_state) { + RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, + "RSSI = %ld\n", + rtlpriv->dm.undec_sm_pwdb); + RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, + "RSSI_LEVEL = %d\n", p_ra->ratr_state); + RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, + "PreState = %d, CurState = %d\n", + p_ra->pre_ratr_state, p_ra->ratr_state); + + rcu_read_lock(); + sta = rtl_find_sta(hw, mac->bssid); + if (sta) + rtlpriv->cfg->ops->update_rate_tbl(hw, sta, + p_ra->ratr_state, + true); + rcu_read_unlock(); + + p_ra->pre_ratr_state = p_ra->ratr_state; + } + } +} + void rtl8723e_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) { struct rtl_priv *rtlpriv = rtl_priv(hw); @@ -834,7 +917,7 @@ void rtl8723e_dm_watchdog(struct ieee80211_hw *hw) rtl8723e_dm_dynamic_bb_powersaving(hw); rtl8723e_dm_dynamic_txpower(hw); rtl8723e_dm_check_txpower_tracking(hw); - /* rtl92c_dm_refresh_rate_adaptive_mask(hw); */ + rtl8723e_dm_refresh_rate_adaptive_mask(hw); rtl8723e_dm_bt_coexist(hw); rtl8723e_dm_check_edca_turbo(hw); } From patchwork Sun Jan 6 00:02:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 1021028 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hotmail.de Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43XJd15KM9z9sCr for ; Sun, 6 Jan 2019 11:03:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbfAFACz (ORCPT ); Sat, 5 Jan 2019 19:02:55 -0500 Received: from mail-oln040092066070.outbound.protection.outlook.com ([40.92.66.70]:28958 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726363AbfAFACz (ORCPT ); Sat, 5 Jan 2019 19:02:55 -0500 Received: from HE1EUR01FT038.eop-EUR01.prod.protection.outlook.com (10.152.0.55) by HE1EUR01HT209.eop-EUR01.prod.protection.outlook.com (10.152.1.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1471.13; Sun, 6 Jan 2019 00:02:51 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com (10.152.0.58) by HE1EUR01FT038.mail.protection.outlook.com (10.152.1.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1471.13 via Frontend Transport; Sun, 6 Jan 2019 00:02:51 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com ([fe80::e1f9:8635:f629:eb8e]) by DB7PR07MB5353.eurprd07.prod.outlook.com ([fe80::e1f9:8635:f629:eb8e%4]) with mapi id 15.20.1516.010; Sun, 6 Jan 2019 00:02:51 +0000 From: Bernd Edlinger To: Ping-Ke Shih , Larry Finger , Kalle Valo , "David S. Miller" , "linux-wireless@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Andrew Lunn Subject: [PATCH v3 4/4] rtlwifi: Don't clear num_rx_inperiod too early Thread-Topic: [PATCH v3 4/4] rtlwifi: Don't clear num_rx_inperiod too early Thread-Index: AQHUpVMqbKQKwAnOjEmtsNGk5fiqeA== Date: Sun, 6 Jan 2019 00:02:51 +0000 Message-ID: Accept-Language: en-US, en-GB, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6PR06CA0035.eurprd06.prod.outlook.com (2603:10a6:20b:14::48) To DB7PR07MB5353.eurprd07.prod.outlook.com (2603:10a6:10:6e::26) x-incomingtopheadermarker: OriginalChecksum:2378198F28BAB2A65EE50B50B44EC937AAD9A7F521B3F422C140E596023CDE17; UpperCasedChecksum:ABDB5120F5B50E2EA2483BFFBC0F3E29C95CAD2FE9FA7446C43744BA12E85C9C; SizeAsReceived:8771; Count:62 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [+MX+zvCYfG3n1VEtwC1upCCI+G0CSXF3] x-microsoft-original-message-id: <4565959f-d15e-500c-6f36-109b2aa29309@hotmail.de> x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1EUR01HT209; 6:TTgMRVDapWAFqfaNlyqY+4wpnwRl39rdfdYVqmEhnZsrX/kcLcBxef1tOxD0iKqfNPrR3Y3VPmFkvGgRzxD7cnCh/Bx4EhtUOMaDf9atdXF6FKn2AjUgZn8cAcF7ReAfvCZTOSmB5OTolQMUKR60sPObk3db78BaYSA+WqS2JK2qeYSypSRqafcwaWUv9wZygmlUUq9zyY6sqWnGDpczmsefWL6NZt/fwnrFV4wKAex8n7q2IYj0m1Hgduh67NqUJcjCLvRrfI207Xq/Z6wHfqyg+LxYkuxVxlHce2El7NOBDp5feV8SqxhTcuWZiYzgTL6Ucva1VS34tvgwwkXItjE1jGEk+v3ZdcKySwosawTi4WakoxzaBSJK2jPgSo8yu/bxs+Ps246YbFBzjP0S+DTpKh0CphA6dM08IT8CehD0qHdajipZzFaBr/ZCe3MF3Pf9dovfRZLaTuMrztgy4A==; 5:8qRzTjs+i/Nu1qf4x29655rDIQy8/hhzMEMv9g6AljC0XygGl9YNNsP8RgbgVe/hZd7ZAYpC2u/R1q+/q5G2+4cAYB9mzSa7Flugg6Y4q5X8/279TckiYgbDPS/0VqX75q8czGuKFda9R5sAzBoFhuAsK8OwrnTgehmkgcJVbb8=; 7:MaAl4mdu18MXJcfbhsL9TZtTRJ7aIEf3xGceR76xD4UgbYFU3n9SQLxSvoUKdGVcKRtz2DxKNLPsGIY7mpavMTSMuLxQi1Ey9BCJ5DLG1oWNZWjUt+/LhD4+RtbnI2gwtlzjxrf7MaWZVl8XKrRU8Q== x-incomingheadercount: 62 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045); SRVR:HE1EUR01HT209; x-ms-traffictypediagnostic: HE1EUR01HT209: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(4566010)(82015058); SRVR:HE1EUR01HT209; BCL:0; PCL:0; RULEID:; SRVR:HE1EUR01HT209; x-microsoft-antispam-message-info: gflcKgtxwmSv4689tBVnY6xeqHzlc81aYBEKr/8GP6A8S3amfo+m2YSa0aAi8Vev Content-ID: <49DADF5C48296D4B979FDD8951861E51@eurprd07.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-Network-Message-Id: 98b28b9f-0f6b-4489-69f7-08d6736a4ca7 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2019 00:02:50.4896 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR01HT209 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch moves the clearing of rtlpriv->link_info.num_rx_inperiod in rtl_watchdog_wq_callback a few lines down. This is necessary since it is still used in the "AP off" detection code block. Moved clearing of rtlpriv->link_info.num_rx_inperiod as well for consistency. Signed-off-by: Bernd Edlinger --- v2: Improved patch description. v3: Make the title fit in one line. --- drivers/net/wireless/realtek/rtlwifi/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c index ef9b502..7aa68fe 100644 --- a/drivers/net/wireless/realtek/rtlwifi/base.c +++ b/drivers/net/wireless/realtek/rtlwifi/base.c @@ -2172,8 +2172,6 @@ void rtl_watchdog_wq_callback(void *data) ; } - rtlpriv->link_info.num_rx_inperiod = 0; - rtlpriv->link_info.num_tx_inperiod = 0; for (tid = 0; tid <= 7; tid++) rtlpriv->link_info.tidtx_inperiod[tid] = 0; @@ -2236,6 +2234,8 @@ void rtl_watchdog_wq_callback(void *data) rtlpriv->btcoexist.btc_info.in_4way = false; } + rtlpriv->link_info.num_rx_inperiod = 0; + rtlpriv->link_info.num_tx_inperiod = 0; rtlpriv->link_info.bcn_rx_inperiod = 0; /* <6> scan list */