1: fc21cc875c1f ! 1: c55d1f3d96b9 wifi: mt76: connac: honour injected HT/VHT rate and bandwidth @@ Metadata ## Commit message ## wifi: mt76: connac: honour injected HT/VHT rate and bandwidth  - On connac2 parts (mt7921u/mt7925u) the fixed-rate TXD path uses the - basic rate from mt76_connac2_mac_tx_rate_val() and ignores the rate - carried in an injected frame's radiotap header, so monitor-mode - injection always goes out at a legacy 20 MHz rate and cannot choose the - modulation or channel width. + On connac2 parts the fixed-rate TXD path uses the basic rate from + mt76_connac2_mac_tx_rate_val() and ignores the rate carried in an + injected frame's radiotap header, so monitor-mode injection always goes + out at a legacy 20 MHz rate and cannot choose the modulation or channel + width.  When info->control.rates[0] contains an HT or VHT MCS, set the TXD6 rate - from it instead: mode (HT/VHT), MCS, NSS, and the 40/80 MHz bandwidth. - Legacy injection and the normal (non-fixed-rate) data path are unchanged. + from it instead: mode (HT/VHT), MCS, NSS, and the channel width from the + rate flags; for HT the whole MCS index is used, as mt7615 does. Legacy + injection and the normal (non-fixed-rate) data path are unchanged.  - This makes 20/40/80 MHz HT/VHT injection work on mt7921u/mt7925u. + This makes 20/40/80 MHz HT/VHT injection work on mt7921u. mt7925 and + mt7996 build their own TX descriptor and are not affected.  Signed-off-by: Aaron Beckendorf   @@ drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c: void mt76_connac2_mac_writ  + nss = ieee80211_rate_get_vht_nss(tr) - 1;  + } else {  + mode = MT_PHY_TYPE_HT; -+ mcs = tr->idx & 0x7; ++ /* the HT rate index encodes NSS in its upper ++ * bits, so pass it whole, as mt7615 does ++ */ ++ mcs = tr->idx;  + nss = tr->idx >> 3;  + }  + @@ drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c: void mt76_connac2_mac_writ  + bw = 2;  + else if (tr->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)  + bw = 1; ++ else if (tr->flags & IEEE80211_TX_RC_160_MHZ_WIDTH) ++ bw = 3;  +  + rate = FIELD_PREP(MT_TX_RATE_MODE, mode) |  + FIELD_PREP(MT_TX_RATE_IDX, mcs) |