Commit beffe070 authored by Felix Fietkau's avatar Felix Fietkau
Browse files

mt76: vif_mask to struct mt76_phy



All drivers use this in pretty much the same way. Moving it to core helps with
some checks for the upcoming testmode support

Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent b8c97866
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -491,6 +491,8 @@ struct mt76_phy {
	struct mt76_sband sband_2g;
	struct mt76_sband sband_5g;

	u32 vif_mask;

	int txpower_cur;
	u8 antenna_mask;
};
+3 −3
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ mt7603_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)

	mutex_lock(&dev->mt76.mutex);

	mvif->idx = ffs(~dev->vif_mask) - 1;
	mvif->idx = ffs(~dev->mphy.vif_mask) - 1;
	if (mvif->idx >= MT7603_MAX_INTERFACES) {
		ret = -ENOSPC;
		goto out;
@@ -65,7 +65,7 @@ mt7603_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
	}

	idx = MT7603_WTBL_RESERVED - 1 - mvif->idx;
	dev->vif_mask |= BIT(mvif->idx);
	dev->mphy.vif_mask |= BIT(mvif->idx);
	INIT_LIST_HEAD(&mvif->sta.poll_list);
	mvif->sta.wcid.idx = idx;
	mvif->sta.wcid.hw_key_idx = -1;
@@ -107,7 +107,7 @@ mt7603_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
	spin_unlock_bh(&dev->sta_poll_lock);

	mutex_lock(&dev->mt76.mutex);
	dev->vif_mask &= ~BIT(mvif->idx);
	dev->mphy.vif_mask &= ~BIT(mvif->idx);
	mutex_unlock(&dev->mt76.mutex);
}

+0 −2
Original line number Diff line number Diff line
@@ -108,8 +108,6 @@ struct mt7603_dev {

	u32 rxfilter;

	u8 vif_mask;

	struct list_head sta_poll_list;
	spinlock_t sta_poll_lock;

+3 −3
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ static int mt7615_add_interface(struct ieee80211_hw *hw,

	mutex_lock(&dev->mt76.mutex);

	mvif->idx = ffs(~dev->vif_mask) - 1;
	mvif->idx = ffs(~dev->mphy.vif_mask) - 1;
	if (mvif->idx >= MT7615_MAX_INTERFACES) {
		ret = -ENOSPC;
		goto out;
@@ -157,7 +157,7 @@ static int mt7615_add_interface(struct ieee80211_hw *hw,
	else
		mvif->wmm_idx = mvif->idx % MT7615_MAX_WMM_SETS;

	dev->vif_mask |= BIT(mvif->idx);
	dev->mphy.vif_mask |= BIT(mvif->idx);
	dev->omac_mask |= BIT(mvif->omac_idx);
	phy->omac_mask |= BIT(mvif->omac_idx);

@@ -204,7 +204,7 @@ static void mt7615_remove_interface(struct ieee80211_hw *hw,
		mt76_txq_remove(&dev->mt76, vif->txq);

	mutex_lock(&dev->mt76.mutex);
	dev->vif_mask &= ~BIT(mvif->idx);
	dev->mphy.vif_mask &= ~BIT(mvif->idx);
	dev->omac_mask &= ~BIT(mvif->omac_idx);
	phy->omac_mask &= ~BIT(mvif->omac_idx);
	mutex_unlock(&dev->mt76.mutex);
+0 −1
Original line number Diff line number Diff line
@@ -244,7 +244,6 @@ struct mt7615_dev {
	struct tasklet_struct irq_tasklet;

	struct mt7615_phy phy;
	u32 vif_mask;
	u32 omac_mask;

	u16 chainmask;
Loading