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: 1020994 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 43X9Rk0Ksnz9rxp for ; Sun, 6 Jan 2019 05:39:30 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726533AbfAESjI (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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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;