@@ -328,14 +328,15 @@ mt7921_mcu_tx_rate_parse(struct mt76_phy *mphy,
struct rate_info *rate, u16 r)
{
struct ieee80211_supported_band *sband;
- u16 flags = 0;
+ u16 flags = 0, rate_idx;
u8 txmode = FIELD_GET(MT_WTBL_RATE_TX_MODE, r);
u8 gi = 0;
u8 bw = 0;
+ bool cck = false;
+ memset(rate, 0, sizeof(*rate));
rate->mcs = FIELD_GET(MT_WTBL_RATE_MCS, r);
rate->nss = FIELD_GET(MT_WTBL_RATE_NSS, r) + 1;
-
switch (peer->bw) {
case IEEE80211_STA_RX_BW_160:
gi = peer->g16;
@@ -357,13 +358,18 @@ mt7921_mcu_tx_rate_parse(struct mt76_phy *mphy,
switch (txmode) {
case MT_PHY_TYPE_CCK:
+ cck = true;
+ fallthrough;
case MT_PHY_TYPE_OFDM:
if (mphy->chandef.chan->band == NL80211_BAND_5GHZ)
sband = &mphy->sband_5g.sband;
else
sband = &mphy->sband_2g.sband;
- rate->legacy = sband->bitrates[rate->mcs].bitrate;
+ rate_idx = FIELD_GET(MT_TX_RATE_IDX, r);
+ rate_idx = mt76_get_rate(mphy->dev, sband, rate_idx,
+ cck);
+ rate->legacy = sband->bitrates[rate_idx].bitrate;
break;
case MT_PHY_TYPE_HT:
case MT_PHY_TYPE_HT_GF: