wifi: mt76: mt7996: enable configured beacon tx rate

The user is allowed to change beacon tx rate (HT/VHT/HE) from hostapd.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Ryder Lee 2023-04-14 04:23:33 +08:00 committed by Felix Fietkau
parent ab0eec4bf2
commit c2171b068b
3 changed files with 24 additions and 6 deletions

View File

@ -1077,6 +1077,8 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
if (mcast && mvif->mcast_rates_idx)
idx = mvif->mcast_rates_idx;
else if (beacon && mvif->beacon_rates_idx)
idx = mvif->beacon_rates_idx;
txwi[6] |= FIELD_PREP(MT_TXD6_TX_RATE, idx);
txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE);

View File

@ -504,14 +504,24 @@ mt7996_update_bss_color(struct ieee80211_hw *hw,
static u8
mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
bool mcast)
bool beacon, bool mcast)
{
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt76_phy *mphy = hw->priv;
u16 rate;
u8 i, idx;
u8 i, idx, ht;
rate = mt76_connac2_mac_tx_rate_val(mphy, vif, false, mcast);
rate = mt76_connac2_mac_tx_rate_val(mphy, vif, beacon, mcast);
ht = FIELD_GET(MT_TX_RATE_MODE, rate) > MT_PHY_TYPE_OFDM;
if (beacon && ht) {
struct mt7996_dev *dev = mt7996_hw_dev(hw);
/* must odd index */
idx = MT7996_BEACON_RATES_TBL + 2 * (mvif->mt76.idx % 20);
mt7996_mac_set_fixed_rate_table(dev, idx, rate);
return idx;
}
idx = FIELD_GET(MT_TX_RATE_IDX, rate);
for (i = 0; i < ARRAY_SIZE(mt76_rates); i++)
@ -560,11 +570,11 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_MCAST_RATE)
mvif->mcast_rates_idx =
mt7996_get_rates_table(hw, vif, true);
mt7996_get_rates_table(hw, vif, false, true);
if (changed & BSS_CHANGED_BASIC_RATES)
mvif->basic_rates_idx =
mt7996_get_rates_table(hw, vif, false);
mt7996_get_rates_table(hw, vif, false, false);
if (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon) {
mt7996_mcu_add_bss_info(phy, vif, true);
@ -582,8 +592,12 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
mt7996_update_bss_color(hw, vif, &info->he_bss_color);
if (changed & (BSS_CHANGED_BEACON |
BSS_CHANGED_BEACON_ENABLED))
BSS_CHANGED_BEACON_ENABLED)) {
mvif->beacon_rates_idx =
mt7996_get_rates_table(hw, vif, true, false);
mt7996_mcu_add_beacon(hw, vif, info->enable_beacon);
}
if (changed & BSS_CHANGED_UNSOL_BCAST_PROBE_RESP ||
changed & BSS_CHANGED_FILS_DISCOVERY)

View File

@ -45,6 +45,7 @@
/* NOTE: used to map mt76_rates. idx may change if firmware expands table */
#define MT7996_BASIC_RATES_TBL 11
#define MT7996_BEACON_RATES_TBL 25
struct mt7996_vif;
struct mt7996_sta;
@ -126,6 +127,7 @@ struct mt7996_vif {
u8 basic_rates_idx;
u8 mcast_rates_idx;
u8 beacon_rates_idx;
};
/* per-phy stats. */