Commit 2ab33b8d authored by Felix Fietkau's avatar Felix Fietkau

mt76: move vif_mask back from mt76_phy to mt76_dev

Since it is global for all drivers, it belongs to the main device
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 51742a9e
...@@ -582,8 +582,6 @@ struct mt76_phy { ...@@ -582,8 +582,6 @@ struct mt76_phy {
u8 macaddr[ETH_ALEN]; u8 macaddr[ETH_ALEN];
u32 vif_mask;
int txpower_cur; int txpower_cur;
u8 antenna_mask; u8 antenna_mask;
u16 chainmask; u16 chainmask;
...@@ -641,6 +639,8 @@ struct mt76_dev { ...@@ -641,6 +639,8 @@ struct mt76_dev {
u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)]; u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)]; u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
u32 vif_mask;
struct mt76_wcid global_wcid; struct mt76_wcid global_wcid;
struct mt76_wcid __rcu *wcid[MT76_N_WCIDS]; struct mt76_wcid __rcu *wcid[MT76_N_WCIDS];
......
...@@ -44,7 +44,7 @@ mt7603_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -44,7 +44,7 @@ mt7603_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
mutex_lock(&dev->mt76.mutex); mutex_lock(&dev->mt76.mutex);
mvif->idx = ffs(~dev->mphy.vif_mask) - 1; mvif->idx = ffs(~dev->mt76.vif_mask) - 1;
if (mvif->idx >= MT7603_MAX_INTERFACES) { if (mvif->idx >= MT7603_MAX_INTERFACES) {
ret = -ENOSPC; ret = -ENOSPC;
goto out; goto out;
...@@ -65,7 +65,7 @@ mt7603_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -65,7 +65,7 @@ mt7603_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
} }
idx = MT7603_WTBL_RESERVED - 1 - mvif->idx; idx = MT7603_WTBL_RESERVED - 1 - mvif->idx;
dev->mphy.vif_mask |= BIT(mvif->idx); dev->mt76.vif_mask |= BIT(mvif->idx);
INIT_LIST_HEAD(&mvif->sta.poll_list); INIT_LIST_HEAD(&mvif->sta.poll_list);
mvif->sta.wcid.idx = idx; mvif->sta.wcid.idx = idx;
mvif->sta.wcid.hw_key_idx = -1; mvif->sta.wcid.hw_key_idx = -1;
...@@ -105,7 +105,7 @@ mt7603_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -105,7 +105,7 @@ mt7603_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
spin_unlock_bh(&dev->sta_poll_lock); spin_unlock_bh(&dev->sta_poll_lock);
mutex_lock(&dev->mt76.mutex); mutex_lock(&dev->mt76.mutex);
dev->mphy.vif_mask &= ~BIT(mvif->idx); dev->mt76.vif_mask &= ~BIT(mvif->idx);
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);
} }
......
...@@ -187,7 +187,7 @@ static int mt7615_add_interface(struct ieee80211_hw *hw, ...@@ -187,7 +187,7 @@ static int mt7615_add_interface(struct ieee80211_hw *hw,
is_zero_ether_addr(vif->addr)) is_zero_ether_addr(vif->addr))
phy->monitor_vif = vif; phy->monitor_vif = vif;
mvif->idx = ffs(~dev->mphy.vif_mask) - 1; mvif->idx = ffs(~dev->mt76.vif_mask) - 1;
if (mvif->idx >= MT7615_MAX_INTERFACES) { if (mvif->idx >= MT7615_MAX_INTERFACES) {
ret = -ENOSPC; ret = -ENOSPC;
goto out; goto out;
...@@ -207,7 +207,7 @@ static int mt7615_add_interface(struct ieee80211_hw *hw, ...@@ -207,7 +207,7 @@ static int mt7615_add_interface(struct ieee80211_hw *hw,
else else
mvif->wmm_idx = mvif->idx % MT7615_MAX_WMM_SETS; mvif->wmm_idx = mvif->idx % MT7615_MAX_WMM_SETS;
dev->mphy.vif_mask |= BIT(mvif->idx); dev->mt76.vif_mask |= BIT(mvif->idx);
dev->omac_mask |= BIT_ULL(mvif->omac_idx); dev->omac_mask |= BIT_ULL(mvif->omac_idx);
phy->omac_mask |= BIT_ULL(mvif->omac_idx); phy->omac_mask |= BIT_ULL(mvif->omac_idx);
...@@ -263,7 +263,7 @@ static void mt7615_remove_interface(struct ieee80211_hw *hw, ...@@ -263,7 +263,7 @@ static void mt7615_remove_interface(struct ieee80211_hw *hw,
rcu_assign_pointer(dev->mt76.wcid[idx], NULL); rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
dev->mphy.vif_mask &= ~BIT(mvif->idx); dev->mt76.vif_mask &= ~BIT(mvif->idx);
dev->omac_mask &= ~BIT_ULL(mvif->omac_idx); dev->omac_mask &= ~BIT_ULL(mvif->omac_idx);
phy->omac_mask &= ~BIT_ULL(mvif->omac_idx); phy->omac_mask &= ~BIT_ULL(mvif->omac_idx);
......
...@@ -416,7 +416,7 @@ static void mt76x02_reset_state(struct mt76x02_dev *dev) ...@@ -416,7 +416,7 @@ static void mt76x02_reset_state(struct mt76x02_dev *dev)
memset(msta, 0, sizeof(*msta)); memset(msta, 0, sizeof(*msta));
} }
dev->mphy.vif_mask = 0; dev->mt76.vif_mask = 0;
dev->mt76.beacon_mask = 0; dev->mt76.beacon_mask = 0;
} }
......
...@@ -304,7 +304,7 @@ mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -304,7 +304,7 @@ mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
unsigned int idx = 0; unsigned int idx = 0;
/* Allow to change address in HW if we create first interface. */ /* Allow to change address in HW if we create first interface. */
if (!dev->mphy.vif_mask && if (!dev->mt76.vif_mask &&
(((vif->addr[0] ^ dev->mphy.macaddr[0]) & ~GENMASK(4, 1)) || (((vif->addr[0] ^ dev->mphy.macaddr[0]) & ~GENMASK(4, 1)) ||
memcmp(vif->addr + 1, dev->mphy.macaddr + 1, ETH_ALEN - 1))) memcmp(vif->addr + 1, dev->mphy.macaddr + 1, ETH_ALEN - 1)))
mt76x02_mac_setaddr(dev, vif->addr); mt76x02_mac_setaddr(dev, vif->addr);
...@@ -329,11 +329,11 @@ mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -329,11 +329,11 @@ mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
idx += 8; idx += 8;
/* vif is already set or idx is 8 for AP/Mesh/... */ /* vif is already set or idx is 8 for AP/Mesh/... */
if (dev->mphy.vif_mask & BIT(idx) || if (dev->mt76.vif_mask & BIT(idx) ||
(vif->type != NL80211_IFTYPE_STATION && idx > 7)) (vif->type != NL80211_IFTYPE_STATION && idx > 7))
return -EBUSY; return -EBUSY;
dev->mphy.vif_mask |= BIT(idx); dev->mt76.vif_mask |= BIT(idx);
mt76x02_vif_init(dev, vif, idx); mt76x02_vif_init(dev, vif, idx);
return 0; return 0;
...@@ -346,7 +346,7 @@ void mt76x02_remove_interface(struct ieee80211_hw *hw, ...@@ -346,7 +346,7 @@ void mt76x02_remove_interface(struct ieee80211_hw *hw,
struct mt76x02_dev *dev = hw->priv; struct mt76x02_dev *dev = hw->priv;
struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
dev->mphy.vif_mask &= ~BIT(mvif->idx); dev->mt76.vif_mask &= ~BIT(mvif->idx);
} }
EXPORT_SYMBOL_GPL(mt76x02_remove_interface); EXPORT_SYMBOL_GPL(mt76x02_remove_interface);
......
...@@ -161,7 +161,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw, ...@@ -161,7 +161,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
is_zero_ether_addr(vif->addr)) is_zero_ether_addr(vif->addr))
phy->monitor_vif = vif; phy->monitor_vif = vif;
mvif->idx = ffs(~dev->mphy.vif_mask) - 1; mvif->idx = ffs(~dev->mt76.vif_mask) - 1;
if (mvif->idx >= MT7915_MAX_INTERFACES) { if (mvif->idx >= MT7915_MAX_INTERFACES) {
ret = -ENOSPC; ret = -ENOSPC;
goto out; goto out;
...@@ -186,7 +186,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw, ...@@ -186,7 +186,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
if (ret) if (ret)
goto out; goto out;
dev->mphy.vif_mask |= BIT(mvif->idx); dev->mt76.vif_mask |= BIT(mvif->idx);
phy->omac_mask |= BIT_ULL(mvif->omac_idx); phy->omac_mask |= BIT_ULL(mvif->omac_idx);
idx = MT7915_WTBL_RESERVED - mvif->idx; idx = MT7915_WTBL_RESERVED - mvif->idx;
...@@ -241,7 +241,7 @@ static void mt7915_remove_interface(struct ieee80211_hw *hw, ...@@ -241,7 +241,7 @@ static void mt7915_remove_interface(struct ieee80211_hw *hw,
rcu_assign_pointer(dev->mt76.wcid[idx], NULL); rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
mutex_lock(&dev->mt76.mutex); mutex_lock(&dev->mt76.mutex);
dev->mphy.vif_mask &= ~BIT(mvif->idx); dev->mt76.vif_mask &= ~BIT(mvif->idx);
phy->omac_mask &= ~BIT_ULL(mvif->omac_idx); phy->omac_mask &= ~BIT_ULL(mvif->omac_idx);
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment