public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ankit Dange <ankitdange37@gmail.com>
To: nbd@nbd.name, lorenzo@kernel.org, linux-wireless@vger.kernel.org
Cc: ryder.lee@mediatek.com, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org, ankitdange37@gmail.com
Subject: [PATCH] wifi: mt76: mt7915: fix GENMASK for chain 3 RSSI in mt7915_mac_sta_poll()
Date: Wed, 29 Apr 2026 00:52:28 +0530	[thread overview]
Message-ID: <20260428192228.144654-1-ankitdange37@gmail.com> (raw)

The RCPI values of response frames are stored as four consecutive
bytes in WTBL DW30. The bitmask for extracting chain 3 RCPI uses
GENMASK(31, 14) which is an 18-bit field overlapping with chains 1
and 2. Fix it to GENMASK(31, 24) to correctly extract the 8-bit
RCPI value for chain 3.

On devices with fewer than 4 antenna chains this bug is masked
because mt76_rx_signal() skips chains not present in antenna_mask.
On 4x4 configurations the corrupted chain 3 value feeds into the
combined ACK signal strength calculation.

Tested on Yuncore AX820 (MT7915, 2x2) by reading raw DW30 register
values and comparing FIELD_GET results for both masks. With
GENMASK(31, 14), chain 3 produces garbage values (e.g., -112 dBm
from a register value of 0xFFFF4248 where the correct result is
+17, indicating an unused chain). No regression on 2x2 operation.

Fixes: 94b335fa88e1 ("wifi: mt76: mt7915: add ack signal support")
Signed-off-by: Ankit Dange <ankitdange37@gmail.com>
---
 mt7915/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mt7915/mac.c b/mt7915/mac.c
index b581d8f9..3d7d71ac 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -221,7 +221,7 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
 		rssi[0] = to_rssi(GENMASK(7, 0), val);
 		rssi[1] = to_rssi(GENMASK(15, 8), val);
 		rssi[2] = to_rssi(GENMASK(23, 16), val);
-		rssi[3] = to_rssi(GENMASK(31, 14), val);
+		rssi[3] = to_rssi(GENMASK(31, 24), val);
 
 		msta->ack_signal =
 			mt76_rx_signal(msta->vif->phy->mt76->antenna_mask, rssi);
-- 
2.43.0


                 reply	other threads:[~2026-04-28 19:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260428192228.144654-1-ankitdange37@gmail.com \
    --to=ankitdange37@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox