Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3863421pxj; Mon, 7 Jun 2021 23:57:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE2WmKYazqF8whxUFCgSxZkFjDf90Y8MB0/zQexVOlBHNJUUjSEyLd4utcs4YolA4kOfap X-Received: by 2002:a17:906:81da:: with SMTP id e26mr8975863ejx.370.1623135473090; Mon, 07 Jun 2021 23:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623135473; cv=none; d=google.com; s=arc-20160816; b=GhoqpFyvb1nmhTYOy7vHMIVxZe7m4QsCUWrAsVdx4EGYAXuV2dJ5roruE9AYthqPdE oiL67DvWur/KIeU2ycuZ786pKgs9UquroTaz9Kcri6qjq+xwACjh0PAsgQ/glyLjvRbz i3fLIQMf1/okE403Y0CGpuZvB0GZqd3AhWlmMn56kBs8SpSFw3u5loCEgqW/X1pImNsR Tb669w0356YraTW6RGH9L7203x9/9G2APJrVbIDE/YDicEfFVRCoej9cvPy7QB9Ssafy F1l5wgIghB1h8YFP9ii6rktfwISM55+d5eUlQTfv0UMfit2i9RkFZxsmBKzoFpIJAQEO Tfsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=7Y82hC5tWVdp0SLeqCVx4z9rGUVdNDMLrRILb3grAqQ=; b=ulnk2h/QWR76IF01mXXnbfImZBkObDH20a5kY8I28/tMRBTl6MXTTf3zYjID9j/DsV Hqgl5deOZOSKDL9dBMMb6NGHDEWCxXn6dz8wj6zCd+Zc/bzotBdg610ntWgU0ISZMkO0 HYWg2d2SulnEN/KFux/kJHFSFVQlP0f1qpY9GEyV5n6evb3zTFV6WnvXfhlN5NDxTLxp Vd7ABqoCG6IUqxqUZHDx4ArhDmd8ZHweaQbGuXpqFkoxj1zFywoBYbW/lXbl7B5mN9m4 zaX84eW9Q0ytUbY2pUoNa6nx3D93wdsn9rflyoPWywpXtoVf5m45BvQdt3Qze/obIUot X5eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ba17si10965449edb.400.2021.06.07.23.57.26; Mon, 07 Jun 2021 23:57:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230345AbhFHG6R (ORCPT + 99 others); Tue, 8 Jun 2021 02:58:17 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:60347 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230197AbhFHG6R (ORCPT ); Tue, 8 Jun 2021 02:58:17 -0400 X-UUID: 3415d1186e6047789abffe5f28d307e7-20210608 X-UUID: 3415d1186e6047789abffe5f28d307e7-20210608 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1005538866; Tue, 08 Jun 2021 14:56:20 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 8 Jun 2021 14:56:19 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 8 Jun 2021 14:56:19 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , linux-mediatek , Shayne Chen Subject: [PATCH 2/2] mt76: mt7915: fix rx fcs error count in testmode Date: Tue, 8 Jun 2021 14:55:58 +0800 Message-ID: <20210608065558.8117-2-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210608065558.8117-1-shayne.chen@mediatek.com> References: <20210608065558.8117-1-shayne.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org FCS error packets are filtered by default and won't be reported to driver, so that RX fcs error and PER in testmode always show zero. Fix this issue by reading fcs error count from hw counter. We did't fix this issue by disabling fcs error rx filter since it may let HW suffer some SER errors. Fixes: 5d8a83f09941 ("mt76: mt7915: implement testmode rx support") Signed-off-by: Shayne Chen --- .../wireless/mediatek/mt76/mt7915/testmode.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c index f9d81e3..b220b33 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c @@ -464,10 +464,17 @@ mt7915_tm_set_tx_frames(struct mt7915_phy *phy, bool en) static void mt7915_tm_set_rx_frames(struct mt7915_phy *phy, bool en) { - if (en) + mt7915_tm_set_trx(phy, TM_MAC_RX_RXV, false); + + if (en) { + struct mt7915_dev *dev = phy->dev; + mt7915_tm_update_channel(phy); - mt7915_tm_set_trx(phy, TM_MAC_RX_RXV, en); + /* read-clear */ + mt76_rr(dev, MT_MIB_SDR3(phy != &dev->phy)); + mt7915_tm_set_trx(phy, TM_MAC_RX_RXV, en); + } } static int @@ -690,7 +697,11 @@ static int mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg) { struct mt7915_phy *phy = mphy->priv; + struct mt7915_dev *dev = phy->dev; + bool ext_phy = phy != &dev->phy; + enum mt76_rxq_id q; void *rx, *rssi; + u16 fcs_err; int i; rx = nla_nest_start(msg, MT76_TM_STATS_ATTR_LAST_RX); @@ -735,6 +746,12 @@ mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg) nla_nest_end(msg, rx); + fcs_err = mt76_get_field(dev, MT_MIB_SDR3(ext_phy), + MT_MIB_SDR3_FCS_ERR_MASK); + q = ext_phy ? MT_RXQ_EXT : MT_RXQ_MAIN; + mphy->test.rx_stats.packets[q] += fcs_err; + mphy->test.rx_stats.fcs_error[q] += fcs_err; + return 0; } -- 2.18.0