Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp635299ybi; Fri, 14 Jun 2019 00:25:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4x5as/UtTi15CSsvB+jMm5fcDoY1FNmmqdRYcws9qUdM6BuJPCjO0t2UidFhvUr8aAtSJ X-Received: by 2002:a65:5845:: with SMTP id s5mr3715229pgr.286.1560497137158; Fri, 14 Jun 2019 00:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560497137; cv=none; d=google.com; s=arc-20160816; b=hmxHV3r/NITeXEVlSjLCm4rVCjyI9chJD4NPvNUFTa+WzrUfPDXk1Dz3ZbiDDdGJvX mswSiByDWo5PvEesXejVwTKcx+6tdiz0ptGq1fh1CbGlBqPENu42punVsxy2HSJJt9U9 8NTVeiUg3gUyF6dfFN4Lq/RGUGwy0YQed2HTzCfg+YmCa9r8EM+FcUVzgBv0GrnieA+4 pGNuVpa7JLbbdSZDPKNxD1liOwqLDayLbcQ8fMRAZAcEy+VTTA2BzzsitfHdCXPFtCIL O6WIHrc/nSu1K1wdpBY9rx//Y5zWKJlJnGGZe1mxfLrKaq5mWsD5ATnjcZ/ULPSA0Ln3 0BAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=wFmm6mvNDxoY49jSnwU/lIFvAW1Z+rLMAu3C7H2EIrk=; b=0TiQegrOKXLI7xukfMoOYSg3UOFNSWC/dXVKVn87CrwgVeoajiCNNx6zCgXqdqCg8W J5t90IE+EA98rUJ+w6FsXy/2KL1mpzrnM6e6Qu5/YE+WLtr3VkODL0fruXlc3KmFXYm5 +1wgFJJz2tWi81FIaSpHSkSnIB4XoR3xmcbuGqpDfm43ldgPfwo0J+tipJOeRyLlPKdg 9kGPb26kzfhjwidYW10M8oc52AR4HrFt5QxqE1xdM6SXa4gipEjsOv+JYMxmccjhh0GT fbfIT+hxp4Zj+NsPq2fggo/GOdr5afgLouVnhrDJ4iSAtmzK8Qgi6nSKnaMlIpAEgUWl t+mQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g145si1632020pfb.173.2019.06.14.00.25.21; Fri, 14 Jun 2019 00:25:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726632AbfFNHY2 (ORCPT + 99 others); Fri, 14 Jun 2019 03:24:28 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:48176 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726603AbfFNHY2 (ORCPT ); Fri, 14 Jun 2019 03:24:28 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x5E7OOZv024947, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcasv01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x5E7OOZv024947 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 14 Jun 2019 15:24:24 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.439.0; Fri, 14 Jun 2019 15:24:23 +0800 From: To: CC: Subject: [PATCH v2 07/11] rtw88: 8822c: use more accurate ofdm fa counting Date: Fri, 14 Jun 2019 15:24:11 +0800 Message-ID: <1560497055-17197-8-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560497055-17197-1-git-send-email-yhchuang@realtek.com> References: <1560497055-17197-1-git-send-email-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang 8822c used to count OFDM FA count by subtracting tx count from FA count. But it need to substract more counters to be accurate. However, we can count it by adding up all of the FA counters we want. And it is simpler to add than list all of the components to substract. Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/rtw8822c.c | 25 +++++++++++++++++++++---- drivers/net/wireless/realtek/rtw88/rtw8822c.h | 5 +++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c index 22380b1..bbe61cc 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c @@ -1491,13 +1491,30 @@ static void rtw8822c_false_alarm_statistics(struct rtw_dev *rtwdev) u32 cck_enable; u32 cck_fa_cnt; u32 ofdm_fa_cnt; - u32 ofdm_tx_counter; + u32 ofdm_fa_cnt1, ofdm_fa_cnt2, ofdm_fa_cnt3, ofdm_fa_cnt4, ofdm_fa_cnt5; + u16 parity_fail, rate_illegal, crc8_fail, mcs_fail, sb_search_fail, + fast_fsync, crc8_fail_vhta, mcs_fail_vht; cck_enable = rtw_read32(rtwdev, REG_ENCCK) & BIT_CCK_BLK_EN; cck_fa_cnt = rtw_read16(rtwdev, REG_CCK_FACNT); - ofdm_fa_cnt = rtw_read16(rtwdev, REG_OFDM_FACNT); - ofdm_tx_counter = rtw_read16(rtwdev, REG_OFDM_TXCNT); - ofdm_fa_cnt -= ofdm_tx_counter; + + ofdm_fa_cnt1 = rtw_read32(rtwdev, REG_OFDM_FACNT1); + ofdm_fa_cnt2 = rtw_read32(rtwdev, REG_OFDM_FACNT2); + ofdm_fa_cnt3 = rtw_read32(rtwdev, REG_OFDM_FACNT3); + ofdm_fa_cnt4 = rtw_read32(rtwdev, REG_OFDM_FACNT4); + ofdm_fa_cnt5 = rtw_read32(rtwdev, REG_OFDM_FACNT5); + + parity_fail = FIELD_GET(GENMASK(31, 16), ofdm_fa_cnt1); + rate_illegal = FIELD_GET(GENMASK(15, 0), ofdm_fa_cnt2); + crc8_fail = FIELD_GET(GENMASK(31, 16), ofdm_fa_cnt2); + crc8_fail_vhta = FIELD_GET(GENMASK(15, 0), ofdm_fa_cnt3); + mcs_fail = FIELD_GET(GENMASK(15, 0), ofdm_fa_cnt4); + mcs_fail_vht = FIELD_GET(GENMASK(31, 16), ofdm_fa_cnt4); + fast_fsync = FIELD_GET(GENMASK(15, 0), ofdm_fa_cnt5); + sb_search_fail = FIELD_GET(GENMASK(31, 16), ofdm_fa_cnt5); + + ofdm_fa_cnt = parity_fail + rate_illegal + crc8_fail + crc8_fail_vhta + + mcs_fail + mcs_fail_vht + fast_fsync + sb_search_fail; dm_info->cck_fa_cnt = cck_fa_cnt; dm_info->ofdm_fa_cnt = ofdm_fa_cnt; diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.h b/drivers/net/wireless/realtek/rtw88/rtw8822c.h index 33125e7..06fbabc 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.h +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.h @@ -188,6 +188,11 @@ struct rtw8822c_efuse { #define REG_CNT_CTRL 0x1eb4 #define BIT_ALL_CNT_RST BIT(25) #define REG_OFDM_FACNT 0x2d00 +#define REG_OFDM_FACNT1 0x2d04 +#define REG_OFDM_FACNT2 0x2d08 +#define REG_OFDM_FACNT3 0x2d0c +#define REG_OFDM_FACNT4 0x2d10 +#define REG_OFDM_FACNT5 0x2d20 #define REG_OFDM_TXCNT 0x2de0 #define REG_ORITXCODE2 0x4100 #define REG_3WIRE2 0x410c -- 2.7.4