From patchwork Tue Nov 26 20:40:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chad Monroe X-Patchwork-Id: 13886344 X-Patchwork-Delegate: nbd@nbd.name Received: from mail-0201.mail-europe.com (mail-0201.mail-europe.com [51.77.79.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDF688831 for ; Tue, 26 Nov 2024 20:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.77.79.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732653672; cv=none; b=pgV3MLX5TNWBzwFRYPcbFDhQO5peGmS3LnRxzv9tTR+MrZlBXrhY9WAvQn31M62eHi4JJj2WH5d1QtQZ8cgC1iJuqNntx6wzjRRoL9Wz5WbF/FnMys5n6tz//Az2woIAayI7Vfiaqt2X+Xcl9xSNHFjUAZRPhnepp1rvBSR+q0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732653672; c=relaxed/simple; bh=BHATuqEzXWan9Ue6g78j5Ob25RfRPbaHVDtMMsQf9QQ=; h=Date:To:From:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=tu0Eg5QzBj5eTTlenYRYsB7mn43WiY4xX2xWNYDZ/f4aEsV8WBVOvAy+mSXChonBLrOr3Yl0vjFAsPfZ1MEXaDJSux/c+C6kC+1Bk4VO8DSn0S9OByX8lRt/G+WYkOVPW1Lan09Qinmi1DLRdOlf+m8cl9kQUEV1tYbXfgVOFKU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=monroe.io; spf=pass smtp.mailfrom=monroe.io; dkim=pass (2048-bit key) header.d=monroe.io header.i=@monroe.io header.b=ZvS5CaD4; arc=none smtp.client-ip=51.77.79.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=monroe.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=monroe.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=monroe.io header.i=@monroe.io header.b="ZvS5CaD4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monroe.io; s=protonmail; t=1732653653; x=1732912853; bh=KG/Kg0ePMdkfS4t5EFLIRwRC4Dq4IlcBVb7Xm75eJbU=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=ZvS5CaD4YYZpKp/QfYVYA9QemezOwhZM6t4YgEV39H93i3QtHsjsItpbWecNF680e FVBvdFM+NiNbxPx+bef6wr7sa4cP5YP8GrkyXZLx2tPVp66we2OZxYHWaTqxP2hmq5 gomYJnk7xfZfcEXoZIK0fIxtYEu2xO1euXiZ9ZpI8Qa9OKtyFOM5nC5cjDdvuPLbKc v6dVm/2I4u6GBDP72Ihb1PTwtLwNYjULMeA1OxmKTJaq8NFHzdTb5RAmdOL5a+78PS 0Kk+DdNIZD/y3XHbjvFmlz6EVSsimdzp4u5tKSBActfwrMZIPXgfY/N/r4AjO8OI16 EGOuhQTU6qeJA== Date: Tue, 26 Nov 2024 20:40:49 +0000 To: Felix Fietkau , Johannes Berg From: Chad Monroe Cc: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , Ryder Lee , linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org, Chad Monroe Subject: [PATCH] wifi: mt76: mt7996: exclude tx backoff time from airtime Message-ID: <88821d8f08e2715927939b35e630a06171962636.1732653612.git.chad@monroe.io> Feedback-ID: 9731019:user:proton X-Pm-Message-ID: 8f0a5ca459019cf184da20d2b34238f678a70372 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This helps to make STA airtime counters more accurate. Signed-off-by: Chad Monroe Suggested-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 4 ++++ drivers/net/wireless/mediatek/mt76/mt7996/regs.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/init.c b/drivers/net/wireless/mediatek/mt76/mt7996/init.c index f6a010b61a8a..afc4884f7ba2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c @@ -460,6 +460,10 @@ mt7996_mac_init_band(struct mt7996_dev *dev, u8 band) mt76_clear(dev, MT_WF_RMAC_MIB_AIRTIME4(band), MT_WF_RMAC_MIB_QOS23_BACKOFF); + /* clear backoff time for Tx duration */ + mt76_clear(dev, MT_WTBLOFF_ACR(band), + MT_WTBLOFF_ADM_BACKOFFTIME); + /* clear backoff time and set software compensation for OBSS time */ mask = MT_WF_RMAC_MIB_OBSS_BACKOFF | MT_WF_RMAC_MIB_ED_OFFSET; set = FIELD_PREP(MT_WF_RMAC_MIB_OBSS_BACKOFF, 0) | diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/regs.h b/drivers/net/wireless/mediatek/mt76/mt7996/regs.h index 06e307b5b02e..1876a968c92d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/regs.h +++ b/drivers/net/wireless/mediatek/mt76/mt7996/regs.h @@ -175,6 +175,9 @@ enum offs_rev { #define MT_WTBLOFF_RSCR_RCPI_MODE GENMASK(31, 30) #define MT_WTBLOFF_RSCR_RCPI_PARAM GENMASK(25, 24) +#define MT_WTBLOFF_ACR(_band) MT_WTBLOFF(_band, 0x010) +#define MT_WTBLOFF_ADM_BACKOFFTIME BIT(29) + /* ETBF: band 0(0x820ea000), band 1(0x820fa000), band 2(0x830ea000) */ #define MT_WF_ETBF_BASE(_band) __BASE(WF_ETBF_BASE, (_band)) #define MT_WF_ETBF(_band, ofs) (MT_WF_ETBF_BASE(_band) + (ofs))