diff options
author | Ryder Lee <ryder.lee@mediatek.com> | 2023-04-13 22:23:33 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2023-04-19 10:09:43 +0200 |
commit | c2171b068beea766311e4c2858ef8497504c6e6d (patch) | |
tree | 3cb0fb2e1d9bc7585d0208573116e5dcbc62ba57 /drivers/net/wireless/mediatek/mt76/mt7996 | |
parent | wifi: mt76: mt7996: enable BSS_CHANGED_MCAST_RATE support (diff) | |
download | linux-c2171b068beea766311e4c2858ef8497504c6e6d.tar.xz linux-c2171b068beea766311e4c2858ef8497504c6e6d.zip |
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>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7996')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7996/main.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h | 2 |
3 files changed, 24 insertions, 6 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c index fbb92c39beee..1ae2c85e66ac 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c @@ -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); diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c index f861fbb7de47..0975774fe244 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c @@ -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) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h index a1a6ee0de2ff..4d7dcb95a620 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h @@ -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. */ |