| From 508127725db04741df06adee31b2cadf53ef11f6 Mon Sep 17 00:00:00 2001 |
| From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| Date: Tue, 25 Oct 2022 14:22:52 +0800 |
| Subject: [PATCH] Fix parameter in channel switch mcu command. use Tx path |
| instead of Tx stream in mt7915_set_chan_info(). |
| |
| Change-Id: Ia5e7da735dbe0c5f702352ad58ea69277096e54a |
| --- |
| mt7915/main.c | 8 ++++---- |
| mt7915/mcu.c | 16 ++++++++-------- |
| 2 files changed, 12 insertions(+), 12 deletions(-) |
| |
| diff --git a/mt7915/main.c b/mt7915/main.c |
| index 01d64b2f..aa18e557 100644 |
| --- a/mt7915/main.c |
| +++ b/mt7915/main.c |
| @@ -1016,7 +1016,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; |
| @@ -1026,10 +1026,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); |
| diff --git a/mt7915/mcu.c b/mt7915/mcu.c |
| index 38a08b9a..b8f06957 100644 |
| --- a/mt7915/mcu.c |
| +++ b/mt7915/mcu.c |
| @@ -2776,8 +2776,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 */ |
| @@ -2793,8 +2793,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], |
| }; |
| @@ -2802,13 +2802,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) |
| @@ -2822,7 +2822,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; |
| -- |
| 2.18.0 |
| |