]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mt76: fix the issue of missing txpwr settings from ch153 to ch177
authorMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Wed, 7 Feb 2024 03:31:23 +0000 (11:31 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:16:49 +0000 (18:16 -0400)
[ Upstream commit e9a46175a79fbc591c48d433020444b8fa2750ee ]

Because the number of channels to be configured is calculated using the %,
and it results in 0 when there's an exact division, this leads to some
channels not having their tx power configured.

Fixes: 7801da338856 ("wifi: mt76: mt7921: enable set txpower for UNII-4")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c

index ea7ffa16a4b12ef5337994860295c88720981bfe..ae19174b46ee505daa356a65277a17eaf01a5919 100644 (file)
@@ -2101,7 +2101,7 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
                int j, msg_len, num_ch;
                struct sk_buff *skb;
 
-               num_ch = i == batch_size - 1 ? n_chan % batch_len : batch_len;
+               num_ch = i == batch_size - 1 ? n_chan - i * batch_len : batch_len;
                msg_len = sizeof(tx_power_tlv) + num_ch * sizeof(sku_tlbv);
                skb = mt76_mcu_msg_alloc(dev, NULL, msg_len);
                if (!skb) {