From patchwork Sat Jan 5 18:38:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 10749361 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-2.web.codeaurora.org (Postfix) with ESMTP id 19CAA1399 for ; Sat, 5 Jan 2019 18:39:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08241285D4 for ; Sat, 5 Jan 2019 18:39:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFE8F28801; Sat, 5 Jan 2019 18:39:06 +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=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 8B13B285D4 for ; Sat, 5 Jan 2019 18:39:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726450AbfAESi7 (ORCPT ); Sat, 5 Jan 2019 13:38:59 -0500 Received: from mail-oln040092072022.outbound.protection.outlook.com ([40.92.72.22]:6172 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726252AbfAESi6 (ORCPT ); Sat, 5 Jan 2019 13:38:58 -0500 Received: from DB5EUR03FT031.eop-EUR03.prod.protection.outlook.com (10.152.20.55) by DB5EUR03HT167.eop-EUR03.prod.protection.outlook.com (10.152.20.253) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sat, 5 Jan 2019 18:38:55 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com (10.152.20.60) by DB5EUR03FT031.mail.protection.outlook.com (10.152.20.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18 via Frontend Transport; Sat, 5 Jan 2019 18:38:55 +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; Sat, 5 Jan 2019 18:38:55 +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" Subject: [PATCH v2 1/4] rtlwifi: rtl8723ae: Take the FW LPS mode handling out Thread-Topic: [PATCH v2 1/4] rtlwifi: rtl8723ae: Take the FW LPS mode handling out Thread-Index: AQHUpSXpgIurv04PvE2G2aRal3jeVQ== Date: Sat, 5 Jan 2019 18:38:55 +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: AM6PR03CA0009.eurprd03.prod.outlook.com (2603:10a6:20b::22) To DB7PR07MB5353.eurprd07.prod.outlook.com (2603:10a6:10:6e::26) x-incomingtopheadermarker: OriginalChecksum:27A1F20B174706964B16A057673F59FE422724317CA015346B59EE03F89D4D31;UpperCasedChecksum:373907BA3566C3D6EFC021AC012BEF0272F19E278B0D3E311A93AF05524A8519;SizeAsReceived:8741;Count:62 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [V1zTgZHRCRUga+9S0CZWcjkvSUFHwhW1] x-microsoft-original-message-id: <356f41ab-f365-d893-47dd-e7f23ab133f4@hotmail.de> x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB5EUR03HT167;6:vJVR//eBNSFXylxXJe7g4YaJMvNvx/Bi7TvKYwMbyPwwtMoVknoWmgraibEGnht30aC2xQZUVcxFu25yaMWuei90nfbXaMcEl6u2W9sgE32b40NYJPbEGGz+an5BWdDHJDiAiXn/Qf/1pb3Ms9xc1g76QTSIbxwyUnUQQ53KNTnNZPKcSPmURUMzJUwizQRN90sMDmvWZB3lQFo1p7T+dOmxTE+pkcuWeopeFoSdtm5koHP707PGMqkMxNjR+KL0eNuzO9EzuUF3F1meRH8Bmcd4MYP8nzSgfjbWHNYPo8VDUEAGn/NRLSlvdup4oKuOnHXXU/tvNw+5FB5YFH18yUgWNBN8yYRbFqLOBgb0GhvWeBm+0REhaxAkTzTlPUZngvJ5KfhsiDQ1vyBglYyGwuOVYe+MVoPqSRdzK5jYkMoOgtf91yxQbWIi3zUHnbScUnbtVdy2hLUu4I6GksI8/A==;5:Kpozm7PsHdIYY/JDPYhB+BA2llPUFUlbXOmZtlwBP86lmo5eeGap3cqpAJLxlqKJDFaN45O36b8I/i4oOrHzGGJ+eexz0whN4Ia0aHtrIMYg92iDODGc+4tIDESZ/SqUNajs4hjXMM+jVjgRxRkZkLfxyNjbT6Z7WZRD/ISRoKg=;7:C36lZH1Yyo7LZlFJRdnvX+B/kP8BsAAIgR3wy2F0VcwS7yOVzCqOm6mUWPHJFP9L9oE1jBU2l3pzcf9ox2cyzj0DnI648ua6bQF8LlMGaOww7acJsEBecHBfJw7ihulFvdY/QegP0r7eIW+Wp/GiOA== 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:DB5EUR03HT167; x-ms-traffictypediagnostic: DB5EUR03HT167: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(4566010)(82015058);SRVR:DB5EUR03HT167;BCL:0;PCL:0;RULEID:;SRVR:DB5EUR03HT167; x-microsoft-antispam-message-info: Ct5aASBJO8M1Uok1YqikS+0WKnOmfi6t04nTMHrlJ5grVRZ0WI8Tx4cwyRbNdfaU Content-ID: <04BA43E551041E45BFAF5F5579BCD83D@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: 295e6c9f-3272-400f-eb90-08d6733d0c3d X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2019 18:38:55.0712 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR03HT167 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 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 --- 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 Sat Jan 5 18:39:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 10749367 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-2.web.codeaurora.org (Postfix) with ESMTP id 370381399 for ; Sat, 5 Jan 2019 18:39:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2852228600 for ; Sat, 5 Jan 2019 18:39:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BFC32880D; Sat, 5 Jan 2019 18:39:32 +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=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 A2C8D28600 for ; Sat, 5 Jan 2019 18:39:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726524AbfAESjI (ORCPT ); Sat, 5 Jan 2019 13:39:08 -0500 Received: from mail-oln040092072053.outbound.protection.outlook.com ([40.92.72.53]:6315 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726252AbfAESjH (ORCPT ); Sat, 5 Jan 2019 13:39:07 -0500 Received: from DB5EUR03FT031.eop-EUR03.prod.protection.outlook.com (10.152.20.54) by DB5EUR03HT112.eop-EUR03.prod.protection.outlook.com (10.152.21.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sat, 5 Jan 2019 18:39:02 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com (10.152.20.60) by DB5EUR03FT031.mail.protection.outlook.com (10.152.20.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18 via Frontend Transport; Sat, 5 Jan 2019 18:39:02 +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; Sat, 5 Jan 2019 18:39:02 +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" Subject: [PATCH v2 2/4] rtlwifi: rtl8723ae: Don't use dm.undec_sm_pwdb for input Thread-Topic: [PATCH v2 2/4] rtlwifi: rtl8723ae: Don't use dm.undec_sm_pwdb for input Thread-Index: AQHUpSXugKolGutiDEibxUg5fF7dbw== Date: Sat, 5 Jan 2019 18:39:02 +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: AM6PR03CA0025.eurprd03.prod.outlook.com (2603:10a6:20b::38) To DB7PR07MB5353.eurprd07.prod.outlook.com (2603:10a6:10:6e::26) x-incomingtopheadermarker: OriginalChecksum:8DCC18BBB01028A8C8DB887D3815187C8CA74CFE7E7DB92D287B056F2382039F;UpperCasedChecksum:5655DB5B178821A1C2D5AD2527D69720EA654A048E78C7F915ECA2381F5419A5;SizeAsReceived:8750;Count:62 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [4ogDYkyruHjgs9cmE5KcQiDbBfq8YlXe] x-microsoft-original-message-id: x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB5EUR03HT112;6:/1kvWIH4zhpm2Lg3N8b7k2ZrnJpI3kjKpHloRktgKQ2IOx3zzDZnD1sdDgzuhvBcmVD0lVLZAkvgO3MAjIZxBvbv12vyS1UFryCd8MZgGwRMQfJF+LzJABQ/NT7aB4rQlyapdG0ALJigZJGbbeyNpbrPtADBfPrgs8q3DKXktRgqBU94ug5oS1u/j7km9lY/azhp3/ckzxgx2NybmvmS/iY8NMHJqUuH7gdMiflpi1637anLq1awNBcL/kw/ZKFHTc0D99AN/9OUbN+wqwJJJMk5BHLNSve1ZogEhRiZaWwf9Ip5wn8Y3OsiKvevIMkWgqBJgmBlWmHVGeiVPm3RGX5jnsyqep+9hX60YzwxXhkBLRz1iVIVCHvTSzKIImiKzQnOUtfRlUjpGWebAIXDQ5sN3JhMNySgr84C6nW67pEXc71Bm+YlWxT9CBCMuwJF9PR2T0fO/mlUqrfFy7dp1A==;5:koTx9zvscEWr5NFJ4FX2U5AV5GOfOyXCyNKUnq1CEfpKpZ45tKnN7dVME+c8MHjr6llKwVQRqsAqVV+GBfzs+HCHxQCM3U+WjFBkkIRp7/iFM8jabjiHgzeVnXEVmA4M3Uow/UkJWuXUAcGHQlNqHmww5a2j9xCv7Pei3wyKCYU=;7:Kg/n8TjgQwfselYo+nQXYORegmU96BRE1cb+2pbD0e5+F4ZvHo4yg7R4sVJXKW2GDASbAwOcWaD+S1NcfjYdhdFls3tpRN+UHepPWGJCzQ7nnwT/yBSXoapQrJ6tSXj8FNX3i7xRKSDwVGB+N+nREg== 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:DB5EUR03HT112; x-ms-traffictypediagnostic: DB5EUR03HT112: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(4566010)(82015058);SRVR:DB5EUR03HT112;BCL:0;PCL:0;RULEID:;SRVR:DB5EUR03HT112; x-microsoft-antispam-message-info: yktzmq+m/mXsGhK7iwaJIx3Lx0P5vGih5JqzKBY172Qrmfe9WA8dqpcQ98AaAl0A Content-ID: <4808AEE77A57DF41B9D9766567FE9B1D@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: cc5d2588-40ac-46c7-9305-08d6733d1073 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2019 18:39:02.0087 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR03HT112 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 gain control when no beacon was received in the connected state 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 --- 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 Sat Jan 5 18:39:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 10749365 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-2.web.codeaurora.org (Postfix) with ESMTP id DE99F1575 for ; Sat, 5 Jan 2019 18:39:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF09F28600 for ; Sat, 5 Jan 2019 18:39:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C36F72880D; Sat, 5 Jan 2019 18:39:27 +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=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 4D95128600 for ; Sat, 5 Jan 2019 18:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726562AbfAESjN (ORCPT ); Sat, 5 Jan 2019 13:39:13 -0500 Received: from mail-oln040092072058.outbound.protection.outlook.com ([40.92.72.58]:42976 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726545AbfAESjL (ORCPT ); Sat, 5 Jan 2019 13:39:11 -0500 Received: from DB5EUR03FT031.eop-EUR03.prod.protection.outlook.com (10.152.20.60) by DB5EUR03HT095.eop-EUR03.prod.protection.outlook.com (10.152.21.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sat, 5 Jan 2019 18:39:08 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com (10.152.20.60) by DB5EUR03FT031.mail.protection.outlook.com (10.152.20.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18 via Frontend Transport; Sat, 5 Jan 2019 18:39:08 +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; Sat, 5 Jan 2019 18:39:08 +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" Subject: [PATCH v2 3/4] rtlwifi: rtl8723ae: Re-introduce Thread-Topic: [PATCH v2 3/4] rtlwifi: rtl8723ae: Re-introduce Thread-Index: AQHUpSXx1u4Unkx78EyFWoocfFUG9A== Date: Sat, 5 Jan 2019 18:39:08 +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: AM6PR03CA0007.eurprd03.prod.outlook.com (2603:10a6:20b::20) To DB7PR07MB5353.eurprd07.prod.outlook.com (2603:10a6:10:6e::26) x-incomingtopheadermarker: OriginalChecksum:C2D183642B7F702CDED4AB6AEE5275700AB74163CC56E03C6618B4A7974AAB63;UpperCasedChecksum:FBA69186EE839C9AC540186E7AC42364D9FE3473ABEF95C270822CCFDB4F0F4B;SizeAsReceived:8689;Count:62 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [Z9RHEA6ZkjcYruUzczWJ84Pgv1kK6z7v] x-microsoft-original-message-id: <1d19b8cb-101d-f890-5d11-4366db570bdd@hotmail.de> x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB5EUR03HT095;6:lsKquh1MAC/UDRkp3E++Ei7/fmuNbiDMbfWMkUL3uH7fEdZ5DKtWXEGUy2ZRjsQSL2An+YEqT28w+L/50TD6QFumDZNMgdNOz2XqDdhetvI2P7MWjAMaTM3y/duEaH+ukjHzoslcHYF0SUfAUM3rHH9zF8AG8NHjI9o0ibOnkqSkzCrAfRRrQ5ZjPtH8wD3eB8s5qI/N7t1xwzcXaoVQPnsUzDEYVU61o0Cvoh7o9CSmVS8KEkMkpkV3N9uM05JOvqq4CmFS1eDzUCPpSUji8eUCEofLw3QaOlgObAc8sWyS4EUfeNj5QcoTQ38kijwiN4BtgKTmj+s3hEbyfbWVx9BdkVvvSBUWDZdeWKP5h2e3uS5EdpygwKd6zg9JYavkwGYXKzjpMG0+WI9MV4WIGJDk8aXUuNSNs/wQNP3mSZ1jY1o8foK2V+Iy397/ZaBjxrcBqBNvmvUeuOwjpRG/Cg==;5:StrJeGxXNwZeicsv1FI0XRTRNfssmG4nE0VFD2NvKf4XNKFUnS3mUR8H09DmkLidx2wgzeVRV8g6YB8AjI5sz/CK2hQsKn1n4kgC+Llm3CgjHR9u/rpm2WrSIGChdiIzImU5q40H5r+BET9jo/+L1TayQxd6ZRjvUigxKYcXCOA=;7:/hK/78UMAy33PNqxxpuh1cnqX8dnze7NVjVQSkiSsDrgg/XS3UDMSmHr4K/LTj9Ycv10S04DG4EKjX+NIgmaDnL84ogT+HYTvlEpgQe1MpkaSp9CbMSr28R6S8UOM2bZMCjkvTRmZOnTQlaVBhy1Iw== 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:DB5EUR03HT095; x-ms-traffictypediagnostic: DB5EUR03HT095: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(4566010)(82015058);SRVR:DB5EUR03HT095;BCL:0;PCL:0;RULEID:;SRVR:DB5EUR03HT095; x-microsoft-antispam-message-info: luh7Ff3gQArb0LvVmGFd4T+T2jxKMRG+0NnjxAcZ8XyUus6SBTAGLc0/gsgsRFXi Content-ID: <29264DE8DCCEBE4DB08B2C0FFB457276@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: 4bc55aa2-202e-4531-471a-08d6733d1392 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2019 18:39:07.3681 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR03HT095 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 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. Fixed a style nit in rtl8723e_dm_init_rate_adaptive_mask. Signed-off-by: Bernd Edlinger --- .../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 Sat Jan 5 18:39:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 10749363 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-2.web.codeaurora.org (Postfix) with ESMTP id 24E0C1575 for ; Sat, 5 Jan 2019 18:39:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16AD328600 for ; Sat, 5 Jan 2019 18:39:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 085482880D; Sat, 5 Jan 2019 18:39:25 +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=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 9B72628600 for ; Sat, 5 Jan 2019 18:39:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726600AbfAESjR (ORCPT ); Sat, 5 Jan 2019 13:39:17 -0500 Received: from mail-oln040092071076.outbound.protection.outlook.com ([40.92.71.76]:4272 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726545AbfAESjQ (ORCPT ); Sat, 5 Jan 2019 13:39:16 -0500 Received: from DB5EUR03FT031.eop-EUR03.prod.protection.outlook.com (10.152.20.56) by DB5EUR03HT051.eop-EUR03.prod.protection.outlook.com (10.152.21.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Sat, 5 Jan 2019 18:39:13 +0000 Received: from DB7PR07MB5353.eurprd07.prod.outlook.com (10.152.20.60) by DB5EUR03FT031.mail.protection.outlook.com (10.152.20.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18 via Frontend Transport; Sat, 5 Jan 2019 18:39:13 +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; Sat, 5 Jan 2019 18:39:13 +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" Subject: [PATCH v2 4/4] rtlwifi: Move the clearing of Thread-Topic: [PATCH v2 4/4] rtlwifi: Move the clearing of Thread-Index: AQHUpSX0RodfXaIwKEq/N5uCNJLVdQ== Date: Sat, 5 Jan 2019 18:39:13 +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: AM6PR03CA0009.eurprd03.prod.outlook.com (2603:10a6:20b::22) To DB7PR07MB5353.eurprd07.prod.outlook.com (2603:10a6:10:6e::26) x-incomingtopheadermarker: OriginalChecksum:090A82C17E26A6D897C006561CED22CA66ACE93483F6E2E7EE6D8C730044CE54;UpperCasedChecksum:CE12346D27DB8BE5C4139591D9A9F184114F666CCE1759271BFB10BD66EEC96F;SizeAsReceived:8691;Count:62 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [hObIGLOXRf8iggZZK5Gqb1eyufWxwzdN] x-microsoft-original-message-id: <2be8fc73-51c2-48b7-1659-1de30b284563@hotmail.de> x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB5EUR03HT051;6:gJgCd4IRrl6wy2w4LB23u2vsDxIc0zIK8rgj3EYVqrsdsazr7LbVOh293ArFCjVi4+yjdjinvz8tUNjkxjD8U5BYubujgjZ9YyXCjPgnqxConEv/UqKHFjOU6FBUnf6wj2iE7JSZt56jeFJkm9zALFKWckuQnV5kNdozv+FlDDvK7R/fNhIk8dHPAquchQiIlwR4MmsBEGv+Tx8GtCPE2QFGHRILau+ewGDEMpkShG5hEmmSTVjMrf3B1H1vfvTue+l9ekYGAhM+9a60Ivrz7czkCQ9N1jwidqLIg73CkVsCfINrysyc8tk0mUbVwyF6+vVKBJs7oIRSGDniVcDCpHWaEieODPQYtXGjGtp/lTvYKf4gMd4AjgyboL8/YG0Pb9XI9G0ZRXFDfw9Sqn65gZv7Nv8H3o0nhqze52qABDtKZLAnia4l4UwzNvCCN2iHnL+s2ghdp+QjHsYIeSwg1Q==;5:IeoQONhN7iPPEeBfVvlgrrDFRV93cAUJhFJihDMi9clfWwgAemqE3YfzQ+OQQlfNdsmDTQ7oUMw8i/JoCRtUwegMhC2YX/6qCsk/wD4IggDfrn9guPYKcapNE0l05UO22eSyI5cYZ7kllXHhsTv7Q7GSV16eE/gqltCfO7GhnTI=;7:b8VJuTd2PmQu8KOykcglyoX+ua9neo0FbidJJig8wzmdwwjejwXfp4lgGdy/BkGnN6BxAOnisT0e3R1afOHY2kVtAHk4Q6hrSU4ClPtYB46Dzq/+QfS5z1qBJQZejuupvVADhyRB4YfdHaXPmEKQaA== 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:DB5EUR03HT051; x-ms-traffictypediagnostic: DB5EUR03HT051: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(4566010)(82015058);SRVR:DB5EUR03HT051;BCL:0;PCL:0;RULEID:;SRVR:DB5EUR03HT051; x-microsoft-antispam-message-info: VU36SfuMqNEldXtCPjgvoLFDZvBZX8NrE+QFeH3kyzs8ZJoYazBcMF2Dn2iOImZu Content-ID: <266879AB98A84A41A65057C017D205D9@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: d549f8df-c99b-4f9c-5c2d-08d6733d16d2 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2019 18:39:12.7900 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR03HT051 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 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 --- 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 */