Commit 3eb514dd authored by Felix Fietkau's avatar Felix Fietkau

mt76: mt7615: fix using VHT STBC rates

The hardware expects MT_TX_RATE_NSS to be filled with the number of
space/time streams. For non-STBC rates, this is equal to nss.
For 1-stream STBC, this needs to be set to 2.
This is relevant for VHT rates only, on HT, the value is derived from MCS
internally.
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent cf211051
...@@ -254,7 +254,7 @@ mt7615_mac_tx_rate_val(struct mt7615_dev *dev, ...@@ -254,7 +254,7 @@ mt7615_mac_tx_rate_val(struct mt7615_dev *dev,
bool stbc, u8 *bw) bool stbc, u8 *bw)
{ {
u8 phy, nss, rate_idx; u8 phy, nss, rate_idx;
u16 rateval; u16 rateval = 0;
*bw = 0; *bw = 0;
...@@ -292,12 +292,14 @@ mt7615_mac_tx_rate_val(struct mt7615_dev *dev, ...@@ -292,12 +292,14 @@ mt7615_mac_tx_rate_val(struct mt7615_dev *dev,
rate_idx = val & 0xff; rate_idx = val & 0xff;
} }
rateval = (FIELD_PREP(MT_TX_RATE_IDX, rate_idx) | if (stbc && nss == 1) {
FIELD_PREP(MT_TX_RATE_MODE, phy) | nss++;
FIELD_PREP(MT_TX_RATE_NSS, nss - 1));
if (stbc && nss == 1)
rateval |= MT_TX_RATE_STBC; rateval |= MT_TX_RATE_STBC;
}
rateval |= (FIELD_PREP(MT_TX_RATE_IDX, rate_idx) |
FIELD_PREP(MT_TX_RATE_MODE, phy) |
FIELD_PREP(MT_TX_RATE_NSS, nss - 1));
return rateval; return rateval;
} }
...@@ -771,6 +773,10 @@ static bool mt7615_fill_txs(struct mt7615_dev *dev, struct mt7615_sta *sta, ...@@ -771,6 +773,10 @@ static bool mt7615_fill_txs(struct mt7615_dev *dev, struct mt7615_sta *sta,
break; break;
case MT_PHY_TYPE_VHT: case MT_PHY_TYPE_VHT:
final_nss = FIELD_GET(MT_TX_RATE_NSS, final_rate); final_nss = FIELD_GET(MT_TX_RATE_NSS, final_rate);
if ((final_rate & MT_TX_RATE_STBC) && final_nss)
final_nss--;
final_rate_flags |= IEEE80211_TX_RC_VHT_MCS; final_rate_flags |= IEEE80211_TX_RC_VHT_MCS;
final_rate = (final_rate & MT_TX_RATE_IDX) | (final_nss << 4); final_rate = (final_rate & MT_TX_RATE_IDX) | (final_nss << 4);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment