An injected frame that asks for a legacy rate still goes out at the basic rate, because only HT and VHT rates from radiotap are used. Look the rate up in the bitrate table of the frame's own band, the table mac80211 indexed when it parsed radiotap, so a legacy request is honoured on 2.4 GHz as well as 5 GHz. Key on the injected frame and its rate entry. mac80211's injected rate flag shares space with the tx status area, which is cleared before the descriptor is written. Signed-off-by: Devin Wittmayer --- .../wireless/mediatek/mt76/mt76_connac_mac.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c index 33c5fca45296..3d0596868f0d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c @@ -636,6 +636,25 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi, FIELD_PREP(MT_TX_RATE_IDX, mcs) | FIELD_PREP(MT_TX_RATE_NSS, nss); val = MT_TXD6_FIXED_BW | FIELD_PREP(MT_TXD6_BW, bw); + } else if ((info->flags & IEEE80211_TX_CTL_INJECTED) && + info->control.rates[0].idx >= 0) { + /* An injected legacy rate indexes the bitrate table + * of the band the frame goes out on; without one, + * mac80211 has put its lowest rate here. The injected + * rate flag cannot be used: it shares space with the + * tx status area, which is cleared before this point. + */ + struct ieee80211_supported_band *sband; + int idx = info->control.rates[0].idx; + + sband = mphy->hw->wiphy->bands[info->band]; + if (sband && idx < sband->n_bitrates) { + u16 hw_value = sband->bitrates[idx].hw_value; + + rate = FIELD_PREP(MT_TX_RATE_MODE, hw_value >> 8) | + FIELD_PREP(MT_TX_RATE_IDX, + hw_value & GENMASK(7, 0)); + } } /* hardware won't add HTC for mgmt/ctrl frame */ -- 2.56.1