From patchwork Mon Aug 29 22:57:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12958528 X-Patchwork-Delegate: nbd@nbd.name Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CA69ECAAD2 for ; Mon, 29 Aug 2022 22:57:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229643AbiH2W5x (ORCPT ); Mon, 29 Aug 2022 18:57:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbiH2W5w (ORCPT ); Mon, 29 Aug 2022 18:57:52 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2A8680F45 for ; Mon, 29 Aug 2022 15:57:50 -0700 (PDT) X-UUID: 72759a1b5b244ab6bca8374578c3b2c2-20220830 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=eQl4HguJF698EUmW3cND9JYx9xNxNepzFMaODTcI3wE=; b=X7dwxyekkX7bpN4zSqXQu03mctFyYMK71kvaqU/qp9K7eDST2BYY8Zyvej5XhvHOeAYXcwZjf1F6JtsNN3dggmHAI6x2Tl4CDYa62kmdm3iofR0lYxgS/W2MjjpT404/MRkTFLTwQrmqDOIBA1UJRmF/OcuePSWu59N5Qd+1Q6E=; X-CID-UNFAMILIAR: 1 X-CID-P-RULE: Spam_GS6885AD X-CID-O-INFO: VERSION:1.1.10,REQID:09321189-2782-4f14-b36e-2232da6ac837,OB:0,L OB:0,IP:0,URL:0,TC:0,Content:30,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Spam_ GS6885AD,ACTION:quarantine,TS:130 X-CID-INFO: VERSION:1.1.10,REQID:09321189-2782-4f14-b36e-2232da6ac837,OB:0,LOB :0,IP:0,URL:0,TC:0,Content:30,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Spam_GS 981B3D,ACTION:quarantine,TS:130 X-CID-META: VersionHash:84eae18,CLOUDID:c322f8cf-20bd-4e5e-ace8-00692b7ab380,C OID:655e3de17fda,Recheck:0,SF:28|16|19|48,TC:nil,Content:3,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 72759a1b5b244ab6bca8374578c3b2c2-20220830 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1221511592; Tue, 30 Aug 2022 06:57:47 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Tue, 30 Aug 2022 06:57:46 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 30 Aug 2022 06:57:46 +0800 From: To: , CC: , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2] mt76: mt7921: reset msta->airtime_ac while clearing up hw value Date: Tue, 30 Aug 2022 06:57:44 +0800 Message-ID: <1c3f22097ebc54bcf055208e8ae5f4d3807513c6.1661813328.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang We should reset mstat->airtime_ac along with clear up the entries in the hardware WLAN table for the Rx and Rx accumulative airtime. Otherwsie, the value msta->airtime_ac - [tx, rx]_last may be a negative and that is not the actual airtime the device took in the last run. Reported-by: YN Chen Signed-off-by: Sean Wang --- v2: only reset msta->airtime_ac at the assocation --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 1438a9f8d1fd..33bd64fe5c74 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -752,6 +752,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt7921_mac_wtbl_update(dev, msta->wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); + memset(msta->airtime_ac, 0, sizeof(msta->airtime_ac)); mt7921_mcu_sta_update(dev, sta, vif, true, MT76_STA_INFO_STATE_ASSOC);