From 32eab505a4b9e71125da1ba2b4f200b964e06824 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 1 Jul 2017 16:46:34 +0200 Subject: [PATCH] mt7603: set wtbl entry vif index Signed-off-by: Felix Fietkau --- mt7603.h | 2 +- mt7603_init.c | 2 +- mt7603_mac.c | 14 +++++++++++--- mt7603_main.c | 5 +++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/mt7603.h b/mt7603.h index a9edbe2e..be074be2 100644 --- a/mt7603.h +++ b/mt7603.h @@ -236,7 +236,7 @@ int mt7603_mcu_set_timing(struct mt7603_dev *dev, int slot, int sifs, int rifs, int eifs); void mt7603_mcu_exit(struct mt7603_dev *dev); -void mt7603_wtbl_init(struct mt7603_dev *dev, int idx, const u8 *addr); +void mt7603_wtbl_init(struct mt7603_dev *dev, int idx, int vif, const u8 *addr); void mt7603_wtbl_clear(struct mt7603_dev *dev, int idx); void mt7603_wtbl_update_cap(struct mt7603_dev *dev, struct ieee80211_sta *sta); void mt7603_wtbl_set_rates(struct mt7603_dev *dev, struct mt7603_sta *sta, diff --git a/mt7603_init.c b/mt7603_init.c index af8a85e6..4bc3b683 100644 --- a/mt7603_init.c +++ b/mt7603_init.c @@ -229,7 +229,7 @@ mt7603_mac_init(struct mt7603_dev *dev) mt7603_wtbl_clear(dev, i); eth_broadcast_addr(bc_addr); - mt7603_wtbl_init(dev, MT7603_WTBL_RESERVED, bc_addr); + mt7603_wtbl_init(dev, MT7603_WTBL_RESERVED, -1, bc_addr); dev->global_sta.wcid.idx = MT7603_WTBL_RESERVED; rcu_assign_pointer(dev->wcid[MT7603_WTBL_RESERVED], &dev->global_sta.wcid); diff --git a/mt7603_mac.c b/mt7603_mac.c index e7d1055b..5c8fd145 100644 --- a/mt7603_mac.c +++ b/mt7603_mac.c @@ -101,16 +101,24 @@ mt7603_wtbl4_addr(int idx) return base + idx * MT_WTBL4_SIZE; } -void mt7603_wtbl_init(struct mt7603_dev *dev, int idx, const u8 *mac_addr) +void mt7603_wtbl_init(struct mt7603_dev *dev, int idx, int vif, + const u8 *mac_addr) { const void *_mac = mac_addr; u32 addr = mt7603_wtbl1_addr(idx); + u32 w0; int i; + w0 = FIELD_PREP(MT_WTBL1_W0_ADDR_HI, get_unaligned_le16(_mac + 4)); + if (vif < 0) + vif = 0; + else + w0 |= MT_WTBL1_W0_RX_CHECK_A1; + w0 |= FIELD_PREP(MT_WTBL1_W0_MUAR_IDX, vif); + mt76_poll(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_BUSY, 0, 5000); - mt76_set(dev, addr + 0 * 4, - FIELD_PREP(MT_WTBL1_W0_ADDR_HI, get_unaligned_le16(_mac + 4))); + mt76_set(dev, addr + 0 * 4, w0); mt76_set(dev, addr + 1 * 4, FIELD_PREP(MT_WTBL1_W1_ADDR_LO, get_unaligned_le32(_mac))); mt76_set(dev, addr + 2 * 4, MT_WTBL1_W2_ADMISSION_CONTROL); diff --git a/mt7603_main.c b/mt7603_main.c index 58e08836..2243f9d6 100644 --- a/mt7603_main.c +++ b/mt7603_main.c @@ -94,7 +94,7 @@ mt7603_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mvif->sta.wcid.hw_key_idx = -1; eth_broadcast_addr(bc_addr); - mt7603_wtbl_init(dev, idx, bc_addr); + mt7603_wtbl_init(dev, idx, mvif->idx, bc_addr); rcu_assign_pointer(dev->wcid[idx], &mvif->sta.wcid); mt7603_txq_init(dev, vif->txq); @@ -257,6 +257,7 @@ mt7603_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, { struct mt7603_dev *dev = hw->priv; struct mt7603_sta *msta = (struct mt7603_sta *) sta->drv_priv; + struct mt7603_vif *mvif = (struct mt7603_vif *) vif->drv_priv; int i, idx; int ret = 0; @@ -272,7 +273,7 @@ mt7603_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt7603_txq_init(dev, sta->txq[i]); msta->wcid.idx = idx; - mt7603_wtbl_init(dev, idx, sta->addr); + mt7603_wtbl_init(dev, idx, mvif->idx, sta->addr); mt7603_wtbl_update_cap(dev, sta); rcu_assign_pointer(dev->wcid[idx], &msta->wcid);