diff mbox series

[09/15] mt76: mt7915: fix rate rix and flags in txs path

Message ID 20210811214439.17458-10-greearb@candelatech.com (mailing list archive)
State Superseded
Delegated to: Felix Fietkau
Headers show
Series mt7915 stats and debugging improvements. | expand

Commit Message

Ben Greear Aug. 11, 2021, 9:44 p.m. UTC
From: Ben Greear <greearb@candelatech.com>

Do not initialize rix to -1, build the rix and set flags
based on the mcs, nss, and mode.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index 138059278ac0..7ca06b8c9671 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -1541,8 +1541,6 @@  mt7915_mac_parse_txs(struct mt7915_dev *dev, struct mt76_wcid *wcid,
 	info->status.ampdu_ack_len = !!(info->flags &
 					IEEE80211_TX_STAT_ACK);
 
-	info->status.rates[0].idx = -1;
-
 	txrate = FIELD_GET(MT_TXS0_TX_RATE, txs);
 
 	rate->mcs = FIELD_GET(MT_TX_RATE_IDX, txrate);
@@ -1575,6 +1573,7 @@  mt7915_mac_parse_txs(struct mt7915_dev *dev, struct mt76_wcid *wcid,
 
 		rate->mcs = mt76_get_rate(mphy->dev, sband, rate->mcs, cck);
 		rate->legacy = sband->bitrates[rate->mcs].bitrate;
+		info->status.rates[0].idx = rate->mcs;
 		break;
 	case MT_PHY_TYPE_HT:
 	case MT_PHY_TYPE_HT_GF:
@@ -1585,6 +1584,8 @@  mt7915_mac_parse_txs(struct mt7915_dev *dev, struct mt76_wcid *wcid,
 		rate->flags = RATE_INFO_FLAGS_MCS;
 		if (wcid->rate_short_gi)
 			rate->flags |= RATE_INFO_FLAGS_SHORT_GI;
+		info->status.rates[0].idx = rate->mcs + rate->nss * 8;
+		info->status.rates[0].flags |= IEEE80211_TX_RC_MCS;
 		break;
 	case MT_PHY_TYPE_VHT:
 		if (rate->mcs > 9)
@@ -1593,6 +1594,8 @@  mt7915_mac_parse_txs(struct mt7915_dev *dev, struct mt76_wcid *wcid,
 		rate->flags = RATE_INFO_FLAGS_VHT_MCS;
 		if (wcid->rate_short_gi)
 			rate->flags |= RATE_INFO_FLAGS_SHORT_GI;
+		info->status.rates[0].idx = (rate->nss << 4) | rate->mcs;
+		info->status.rates[0].flags |= IEEE80211_TX_RC_VHT_MCS;
 		break;
 	case MT_PHY_TYPE_HE_SU:
 	case MT_PHY_TYPE_HE_EXT_SU:
@@ -1604,6 +1607,7 @@  mt7915_mac_parse_txs(struct mt7915_dev *dev, struct mt76_wcid *wcid,
 		rate->he_gi = wcid->rate_he_gi;
 		rate->he_dcm = FIELD_GET(MT_TX_RATE_DCM, txrate);
 		rate->flags = RATE_INFO_FLAGS_HE_MCS;
+		info->status.rates[0].idx = (rate->nss << 4) | rate->mcs;
 		break;
 	default:
 		WARN_ON_ONCE(true);