wifi: mt76: mt7915: fix incorrect tx path number configuration

For a variant of mt7916, it supports up to 3 tx/rx paths but only 2
spatial streams. This implies that it has one more path to support
beamform. The correct tx/rx path number shall be configured to make sure
beamform works properly.

Fixes: bdaddc92f6b0 ("wifi: mt76: mt7915: deal with special variant of mt7916")
Reviewed-by: Shayne Chen <[email protected]>
Signed-off-by: Howard Hsu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Howard Hsu
2022-11-11 11:38:25 +01:00
committed by Felix Fietkau
parent a5e48378d2
commit 1e9060420c
2 changed files with 12 additions and 12 deletions
+4 -4
View File
@@ -965,7 +965,7 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_phy *phy = mt7915_hw_phy(hw);
int max_nss = hweight8(hw->wiphy->available_antennas_tx);
bool ext_phy = phy != &dev->phy;
u8 chainshift = dev->chainshift;
if (!tx_ant || tx_ant != rx_ant || ffs(tx_ant) > max_nss)
return -EINVAL;
@@ -975,10 +975,10 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
phy->mt76->antenna_mask = tx_ant;
/* handle a variant of mt7916 which has 3T3R but nss2 on 5 GHz band */
if (is_mt7916(&dev->mt76) && ext_phy && hweight8(tx_ant) == max_nss)
phy->mt76->chainmask = dev->chainmask >> dev->chainshift;
if (is_mt7916(&dev->mt76) && phy->band_idx && hweight8(tx_ant) == max_nss)
phy->mt76->chainmask = (dev->chainmask >> chainshift) << chainshift;
else
phy->mt76->chainmask = tx_ant << (dev->chainshift * ext_phy);
phy->mt76->chainmask = tx_ant << (chainshift * phy->band_idx);
mt76_set_stream_caps(phy->mt76, true);
mt7915_set_stream_vht_txbf_caps(phy);
+8 -8
View File
@@ -2638,8 +2638,8 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
u8 control_ch;
u8 center_ch;
u8 bw;
u8 tx_streams_num;
u8 rx_streams; /* mask or num */
u8 tx_path_num;
u8 rx_path; /* mask or num */
u8 switch_reason;
u8 band_idx;
u8 center_ch2; /* for 80+80 only */
@@ -2655,8 +2655,8 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
.control_ch = chandef->chan->hw_value,
.center_ch = ieee80211_frequency_to_channel(freq1),
.bw = mt76_connac_chan_bw(chandef),
.tx_streams_num = hweight8(phy->mt76->antenna_mask),
.rx_streams = phy->mt76->antenna_mask,
.tx_path_num = hweight16(phy->mt76->chainmask),
.rx_path = phy->mt76->chainmask >> (dev->chainshift * phy->band_idx),
.band_idx = phy->band_idx,
.channel_band = ch_band[chandef->chan->band],
};
@@ -2664,13 +2664,13 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
#ifdef CONFIG_NL80211_TESTMODE
if (phy->mt76->test.tx_antenna_mask &&
mt76_testmode_enabled(phy->mt76)) {
req.tx_streams_num = fls(phy->mt76->test.tx_antenna_mask);
req.rx_streams = phy->mt76->test.tx_antenna_mask;
req.tx_path_num = fls(phy->mt76->test.tx_antenna_mask);
req.rx_path = phy->mt76->test.tx_antenna_mask;
}
#endif
if (mt76_connac_spe_idx(phy->mt76->antenna_mask))
req.tx_streams_num = fls(phy->mt76->antenna_mask);
req.tx_path_num = fls(phy->mt76->antenna_mask);
if (cmd == MCU_EXT_CMD(SET_RX_PATH) ||
dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR)
@@ -2684,7 +2684,7 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
req.switch_reason = CH_SWITCH_NORMAL;
if (cmd == MCU_EXT_CMD(CHANNEL_SWITCH))
req.rx_streams = hweight8(req.rx_streams);
req.rx_path = hweight8(req.rx_path);
if (chandef->width == NL80211_CHAN_WIDTH_80P80) {
int freq2 = chandef->center_freq2;