Commit fbba711c authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

wifi: mt76: mt7915: move sta_poll_list and sta_poll_lock in mt76_dev

sta_poll_list and sta_poll_lock are used by most of the drivers, so move
them in mt76_dev structure.
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 037ae6d6
...@@ -661,6 +661,8 @@ mt76_alloc_device(struct device *pdev, unsigned int size, ...@@ -661,6 +661,8 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
idr_init(&dev->rx_token); idr_init(&dev->rx_token);
INIT_LIST_HEAD(&dev->wcid_list); INIT_LIST_HEAD(&dev->wcid_list);
INIT_LIST_HEAD(&dev->sta_poll_list);
spin_lock_init(&dev->sta_poll_lock);
INIT_LIST_HEAD(&dev->txwi_cache); INIT_LIST_HEAD(&dev->txwi_cache);
INIT_LIST_HEAD(&dev->rxwi_cache); INIT_LIST_HEAD(&dev->rxwi_cache);
......
...@@ -823,6 +823,9 @@ struct mt76_dev { ...@@ -823,6 +823,9 @@ struct mt76_dev {
struct mt76_wcid __rcu *wcid[MT76_N_WCIDS]; struct mt76_wcid __rcu *wcid[MT76_N_WCIDS];
struct list_head wcid_list; struct list_head wcid_list;
struct list_head sta_poll_list;
spinlock_t sta_poll_lock;
u32 rev; u32 rev;
struct tasklet_struct pre_tbtt_tasklet; struct tasklet_struct pre_tbtt_tasklet;
......
...@@ -1185,9 +1185,7 @@ int mt7915_register_device(struct mt7915_dev *dev) ...@@ -1185,9 +1185,7 @@ int mt7915_register_device(struct mt7915_dev *dev)
INIT_WORK(&dev->rc_work, mt7915_mac_sta_rc_work); INIT_WORK(&dev->rc_work, mt7915_mac_sta_rc_work);
INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7915_mac_work); INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7915_mac_work);
INIT_LIST_HEAD(&dev->sta_rc_list); INIT_LIST_HEAD(&dev->sta_rc_list);
INIT_LIST_HEAD(&dev->sta_poll_list);
INIT_LIST_HEAD(&dev->twt_list); INIT_LIST_HEAD(&dev->twt_list);
spin_lock_init(&dev->sta_poll_lock);
init_waitqueue_head(&dev->reset_wait); init_waitqueue_head(&dev->reset_wait);
INIT_WORK(&dev->reset_work, mt7915_mac_reset_work); INIT_WORK(&dev->reset_work, mt7915_mac_reset_work);
......
...@@ -105,9 +105,9 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev) ...@@ -105,9 +105,9 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
LIST_HEAD(sta_poll_list); LIST_HEAD(sta_poll_list);
int i; int i;
spin_lock_bh(&dev->sta_poll_lock); spin_lock_bh(&dev->mt76.sta_poll_lock);
list_splice_init(&dev->sta_poll_list, &sta_poll_list); list_splice_init(&dev->mt76.sta_poll_list, &sta_poll_list);
spin_unlock_bh(&dev->sta_poll_lock); spin_unlock_bh(&dev->mt76.sta_poll_lock);
rcu_read_lock(); rcu_read_lock();
...@@ -118,15 +118,15 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev) ...@@ -118,15 +118,15 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
s8 rssi[4]; s8 rssi[4];
u8 bw; u8 bw;
spin_lock_bh(&dev->sta_poll_lock); spin_lock_bh(&dev->mt76.sta_poll_lock);
if (list_empty(&sta_poll_list)) { if (list_empty(&sta_poll_list)) {
spin_unlock_bh(&dev->sta_poll_lock); spin_unlock_bh(&dev->mt76.sta_poll_lock);
break; break;
} }
msta = list_first_entry(&sta_poll_list, msta = list_first_entry(&sta_poll_list,
struct mt7915_sta, poll_list); struct mt7915_sta, poll_list);
list_del_init(&msta->poll_list); list_del_init(&msta->poll_list);
spin_unlock_bh(&dev->sta_poll_lock); spin_unlock_bh(&dev->mt76.sta_poll_lock);
idx = msta->wcid.idx; idx = msta->wcid.idx;
...@@ -326,10 +326,11 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb, ...@@ -326,10 +326,11 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb,
if (status->wcid) { if (status->wcid) {
msta = container_of(status->wcid, struct mt7915_sta, wcid); msta = container_of(status->wcid, struct mt7915_sta, wcid);
spin_lock_bh(&dev->sta_poll_lock); spin_lock_bh(&dev->mt76.sta_poll_lock);
if (list_empty(&msta->poll_list)) if (list_empty(&msta->poll_list))
list_add_tail(&msta->poll_list, &dev->sta_poll_list); list_add_tail(&msta->poll_list,
spin_unlock_bh(&dev->sta_poll_lock); &dev->mt76.sta_poll_list);
spin_unlock_bh(&dev->mt76.sta_poll_lock);
} }
status->freq = mphy->chandef.chan->center_freq; status->freq = mphy->chandef.chan->center_freq;
...@@ -892,10 +893,11 @@ mt7915_txwi_free(struct mt7915_dev *dev, struct mt76_txwi_cache *t, ...@@ -892,10 +893,11 @@ mt7915_txwi_free(struct mt7915_dev *dev, struct mt76_txwi_cache *t,
msta = container_of(wcid, struct mt7915_sta, wcid); msta = container_of(wcid, struct mt7915_sta, wcid);
sta = container_of((void *)msta, struct ieee80211_sta, sta = container_of((void *)msta, struct ieee80211_sta,
drv_priv); drv_priv);
spin_lock_bh(&dev->sta_poll_lock); spin_lock_bh(&mdev->sta_poll_lock);
if (list_empty(&msta->poll_list)) if (list_empty(&msta->poll_list))
list_add_tail(&msta->poll_list, &dev->sta_poll_list); list_add_tail(&msta->poll_list,
spin_unlock_bh(&dev->sta_poll_lock); &mdev->sta_poll_list);
spin_unlock_bh(&mdev->sta_poll_lock);
} }
} }
...@@ -987,10 +989,11 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len) ...@@ -987,10 +989,11 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
continue; continue;
msta = container_of(wcid, struct mt7915_sta, wcid); msta = container_of(wcid, struct mt7915_sta, wcid);
spin_lock_bh(&dev->sta_poll_lock); spin_lock_bh(&mdev->sta_poll_lock);
if (list_empty(&msta->poll_list)) if (list_empty(&msta->poll_list))
list_add_tail(&msta->poll_list, &dev->sta_poll_list); list_add_tail(&msta->poll_list,
spin_unlock_bh(&dev->sta_poll_lock); &mdev->sta_poll_list);
spin_unlock_bh(&mdev->sta_poll_lock);
continue; continue;
} }
...@@ -1099,10 +1102,10 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data) ...@@ -1099,10 +1102,10 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)
if (!wcid->sta) if (!wcid->sta)
goto out; goto out;
spin_lock_bh(&dev->sta_poll_lock); spin_lock_bh(&dev->mt76.sta_poll_lock);
if (list_empty(&msta->poll_list)) if (list_empty(&msta->poll_list))
list_add_tail(&msta->poll_list, &dev->sta_poll_list); list_add_tail(&msta->poll_list, &dev->mt76.sta_poll_list);
spin_unlock_bh(&dev->sta_poll_lock); spin_unlock_bh(&dev->mt76.sta_poll_lock);
out: out:
rcu_read_unlock(); rcu_read_unlock();
...@@ -2039,7 +2042,7 @@ void mt7915_mac_sta_rc_work(struct work_struct *work) ...@@ -2039,7 +2042,7 @@ void mt7915_mac_sta_rc_work(struct work_struct *work)
u32 changed; u32 changed;
LIST_HEAD(list); LIST_HEAD(list);
spin_lock_bh(&dev->sta_poll_lock); spin_lock_bh(&dev->mt76.sta_poll_lock);
list_splice_init(&dev->sta_rc_list, &list); list_splice_init(&dev->sta_rc_list, &list);
while (!list_empty(&list)) { while (!list_empty(&list)) {
...@@ -2047,7 +2050,7 @@ void mt7915_mac_sta_rc_work(struct work_struct *work) ...@@ -2047,7 +2050,7 @@ void mt7915_mac_sta_rc_work(struct work_struct *work)
list_del_init(&msta->rc_list); list_del_init(&msta->rc_list);
changed = msta->changed; changed = msta->changed;
msta->changed = 0; msta->changed = 0;
spin_unlock_bh(&dev->sta_poll_lock); spin_unlock_bh(&dev->mt76.sta_poll_lock);
sta = container_of((void *)msta, struct ieee80211_sta, drv_priv); sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);
vif = container_of((void *)msta->vif, struct ieee80211_vif, drv_priv); vif = container_of((void *)msta->vif, struct ieee80211_vif, drv_priv);
...@@ -2060,10 +2063,10 @@ void mt7915_mac_sta_rc_work(struct work_struct *work) ...@@ -2060,10 +2063,10 @@ void mt7915_mac_sta_rc_work(struct work_struct *work)
if (changed & IEEE80211_RC_SMPS_CHANGED) if (changed & IEEE80211_RC_SMPS_CHANGED)
mt7915_mcu_add_smps(dev, vif, sta); mt7915_mcu_add_smps(dev, vif, sta);
spin_lock_bh(&dev->sta_poll_lock); spin_lock_bh(&dev->mt76.sta_poll_lock);
} }
spin_unlock_bh(&dev->sta_poll_lock); spin_unlock_bh(&dev->mt76.sta_poll_lock);
} }
void mt7915_mac_work(struct work_struct *work) void mt7915_mac_work(struct work_struct *work)
......
...@@ -308,10 +308,10 @@ static void mt7915_remove_interface(struct ieee80211_hw *hw, ...@@ -308,10 +308,10 @@ static void mt7915_remove_interface(struct ieee80211_hw *hw,
phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx); phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx);
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);
spin_lock_bh(&dev->sta_poll_lock); spin_lock_bh(&dev->mt76.sta_poll_lock);
if (!list_empty(&msta->poll_list)) if (!list_empty(&msta->poll_list))
list_del_init(&msta->poll_list); list_del_init(&msta->poll_list);
spin_unlock_bh(&dev->sta_poll_lock); spin_unlock_bh(&dev->mt76.sta_poll_lock);
mt76_packet_id_flush(&dev->mt76, &msta->wcid); mt76_packet_id_flush(&dev->mt76, &msta->wcid);
} }
...@@ -749,12 +749,12 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, ...@@ -749,12 +749,12 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
for (i = 0; i < ARRAY_SIZE(msta->twt.flow); i++) for (i = 0; i < ARRAY_SIZE(msta->twt.flow); i++)
mt7915_mac_twt_teardown_flow(dev, msta, i); mt7915_mac_twt_teardown_flow(dev, msta, i);
spin_lock_bh(&dev->sta_poll_lock); spin_lock_bh(&mdev->sta_poll_lock);
if (!list_empty(&msta->poll_list)) if (!list_empty(&msta->poll_list))
list_del_init(&msta->poll_list); list_del_init(&msta->poll_list);
if (!list_empty(&msta->rc_list)) if (!list_empty(&msta->rc_list))
list_del_init(&msta->rc_list); list_del_init(&msta->rc_list);
spin_unlock_bh(&dev->sta_poll_lock); spin_unlock_bh(&mdev->sta_poll_lock);
} }
static void mt7915_tx(struct ieee80211_hw *hw, static void mt7915_tx(struct ieee80211_hw *hw,
...@@ -1109,11 +1109,11 @@ static void mt7915_sta_rc_work(void *data, struct ieee80211_sta *sta) ...@@ -1109,11 +1109,11 @@ static void mt7915_sta_rc_work(void *data, struct ieee80211_sta *sta)
struct mt7915_dev *dev = msta->vif->phy->dev; struct mt7915_dev *dev = msta->vif->phy->dev;
u32 *changed = data; u32 *changed = data;
spin_lock_bh(&dev->sta_poll_lock); spin_lock_bh(&dev->mt76.sta_poll_lock);
msta->changed |= *changed; msta->changed |= *changed;
if (list_empty(&msta->rc_list)) if (list_empty(&msta->rc_list))
list_add_tail(&msta->rc_list, &dev->sta_rc_list); list_add_tail(&msta->rc_list, &dev->sta_rc_list);
spin_unlock_bh(&dev->sta_poll_lock); spin_unlock_bh(&dev->mt76.sta_poll_lock);
} }
static void mt7915_sta_rc_update(struct ieee80211_hw *hw, static void mt7915_sta_rc_update(struct ieee80211_hw *hw,
......
...@@ -274,9 +274,7 @@ struct mt7915_dev { ...@@ -274,9 +274,7 @@ struct mt7915_dev {
#endif #endif
struct list_head sta_rc_list; struct list_head sta_rc_list;
struct list_head sta_poll_list;
struct list_head twt_list; struct list_head twt_list;
spinlock_t sta_poll_lock;
u32 hw_pattern; u32 hw_pattern;
......
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