wifi: mt76: mt7996: enable BSS_CHANGED_MCAST_RATE support

Similar to BSS_CHANGED_BASIC_RATES, this enables mcast rate
configuration through fixed rate tables.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Change-Id: Ifc305e8c7de9a7df4ad5f856e2097d721a886aaa
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Ryder Lee
2023-04-14 04:23:32 +08:00
committed by Felix Fietkau
parent 15ee62e737
commit ab0eec4bf2
4 changed files with 18 additions and 4 deletions

View File

@@ -1070,8 +1070,14 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,
mt7996_mac_write_txwi_80211(dev, txwi, skb, key);
if (txwi[1] & cpu_to_le32(MT_TXD1_FIXED_RATE)) {
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
bool mcast = ieee80211_is_data(hdr->frame_control) &&
is_multicast_ether_addr(hdr->addr1);
u8 idx = mvif->basic_rates_idx;
if (mcast && mvif->mcast_rates_idx)
idx = mvif->mcast_rates_idx;
txwi[6] |= FIELD_PREP(MT_TXD6_TX_RATE, idx);
txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE);
}

View File

@@ -503,14 +503,15 @@ mt7996_update_bss_color(struct ieee80211_hw *hw,
}
static u8
mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
mt7996_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
bool mcast)
{
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt76_phy *mphy = hw->priv;
u16 rate;
u8 i, idx;
rate = mt76_connac2_mac_tx_rate_val(mphy, vif, false, false);
rate = mt76_connac2_mac_tx_rate_val(mphy, vif, false, mcast);
idx = FIELD_GET(MT_TX_RATE_IDX, rate);
for (i = 0; i < ARRAY_SIZE(mt76_rates); i++)
@@ -557,8 +558,13 @@ 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);
if (changed & BSS_CHANGED_BASIC_RATES)
mvif->basic_rates_idx = mt7996_get_rates_table(hw, vif);
mvif->basic_rates_idx =
mt7996_get_rates_table(hw, vif, false);
if (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon) {
mt7996_mcu_add_bss_info(phy, vif, true);

View File

@@ -605,7 +605,8 @@ mt7996_mcu_bss_bmc_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
struct cfg80211_chan_def *chandef = &phy->mt76->chandef;
enum nl80211_band band = chandef->chan->band;
struct tlv *tlv;
u8 idx = mvif->basic_rates_idx;
u8 idx = mvif->mcast_rates_idx ?
mvif->mcast_rates_idx : mvif->basic_rates_idx;
tlv = mt7996_mcu_add_uni_tlv(skb, UNI_BSS_INFO_RATE, sizeof(*bmc));

View File

@@ -125,6 +125,7 @@ struct mt7996_vif {
struct cfg80211_bitrate_mask bitrate_mask;
u8 basic_rates_idx;
u8 mcast_rates_idx;
};
/* per-phy stats. */