From: Evelyn Tsai Date: Fri, 11 Nov 2022 07:36:15 +0000 (+0800) Subject: wifi: mt76: connac: update nss calculation in txs X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=fa67120bc8c78e66bc23d385e6dfbc1de6c25134;p=users%2Fjedix%2Flinux-maple.git wifi: mt76: connac: update nss calculation in txs The hardware reports the number of transmitting antennas not the actual number of spatial streams Co-developed-by: Peter Chiu Signed-off-by: Peter Chiu Signed-off-by: Evelyn Tsai Signed-off-by: Felix Fietkau --- diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c index 8b7ec64abc95..fd60123fb284 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c @@ -567,7 +567,7 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid, struct mt76_phy *mphy; struct rate_info rate = {}; bool cck = false; - u32 txrate, txs, mode; + u32 txrate, txs, mode, stbc; txs = le32_to_cpu(txs_data[0]); @@ -587,6 +587,10 @@ bool mt76_connac2_mac_fill_txs(struct mt76_dev *dev, struct mt76_wcid *wcid, rate.mcs = FIELD_GET(MT_TX_RATE_IDX, txrate); rate.nss = FIELD_GET(MT_TX_RATE_NSS, txrate) + 1; + stbc = FIELD_GET(MT_TX_RATE_STBC, txrate); + + if (stbc && rate.nss > 1) + rate.nss >>= 1; if (rate.nss - 1 < ARRAY_SIZE(stats->tx_nss)) stats->tx_nss[rate.nss - 1]++;