mt76: mt7915: fix the nss setting in bitrates
authorMeiChia Chiu <meichia.chiu@mediatek.com>
Thu, 27 Jan 2022 13:32:26 +0000 (21:32 +0800)
committerFelix Fietkau <nbd@nbd.name>
Thu, 3 Feb 2022 12:58:00 +0000 (13:58 +0100)
without this change, the fixed MCS only supports 1 Nss.

Fixes: 70fd1333cd32f ("mt76: mt7915: rework .set_bitrate_mask() to support more options")
Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c

index e31eed6591f1c393128e44b2b561ab7feccfb277..e8c68e47b613b0859f78c67677210c44fe1e22a1 100644 (file)
@@ -1427,9 +1427,12 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
                        phy.sgi |= gi << (i << (_he));                          \
                        phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\
                }                                                               \
-               for (i = 0; i < ARRAY_SIZE(mask->control[band]._mcs); i++)      \
-                       nrates += hweight16(mask->control[band]._mcs[i]);       \
-               phy.mcs = ffs(mask->control[band]._mcs[0]) - 1;                 \
+               for (i = 0; i < ARRAY_SIZE(mask->control[band]._mcs); i++) {    \
+                       if (!mask->control[band]._mcs[i])                       \
+                               continue;                                       \
+                       nrates += hweight16(mask->control[band]._mcs[i]);       \
+                       phy.mcs = ffs(mask->control[band]._mcs[i]) - 1;         \
+               }                                                               \
        } while (0)
 
        if (sta->he_cap.has_he) {