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

mt76: mt7615: rework mt7615_mac_sta_poll for usb code

Since usb code can't access device registers in interrupt context, move
rcu_read_lock/rcu_read_unlock in mt7615_poll_tx routine. Moreover loop
over a local msta list in mt7615_mac_sta_poll since mt7663u driver will
not be able to complete the inner while loop before sta_poll_list list
is refilled by mt7615_mac_add_txs/mt7615_mac_fill_rx
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent fdf43312
...@@ -121,7 +121,9 @@ static int mt7615_poll_tx(struct napi_struct *napi, int budget) ...@@ -121,7 +121,9 @@ static int mt7615_poll_tx(struct napi_struct *napi, int budget)
mt7615_tx_cleanup(dev); mt7615_tx_cleanup(dev);
rcu_read_lock();
mt7615_mac_sta_poll(dev); mt7615_mac_sta_poll(dev);
rcu_read_unlock();
tasklet_schedule(&dev->mt76.tx_tasklet); tasklet_schedule(&dev->mt76.tx_tasklet);
......
...@@ -724,22 +724,20 @@ void mt7615_mac_sta_poll(struct mt7615_dev *dev) ...@@ -724,22 +724,20 @@ void mt7615_mac_sta_poll(struct mt7615_dev *dev)
struct ieee80211_sta *sta; struct ieee80211_sta *sta;
struct mt7615_sta *msta; struct mt7615_sta *msta;
u32 addr, tx_time[4], rx_time[4]; u32 addr, tx_time[4], rx_time[4];
struct list_head sta_poll_list;
int i; int i;
rcu_read_lock(); INIT_LIST_HEAD(&sta_poll_list);
spin_lock_bh(&dev->sta_poll_lock);
list_splice_init(&dev->sta_poll_list, &sta_poll_list);
spin_unlock_bh(&dev->sta_poll_lock);
while (true) { while (!list_empty(&sta_poll_list)) {
bool clear = false; bool clear = false;
spin_lock_bh(&dev->sta_poll_lock); msta = list_first_entry(&sta_poll_list, struct mt7615_sta,
if (list_empty(&dev->sta_poll_list)) { poll_list);
spin_unlock_bh(&dev->sta_poll_lock);
break;
}
msta = list_first_entry(&dev->sta_poll_list,
struct mt7615_sta, poll_list);
list_del_init(&msta->poll_list); list_del_init(&msta->poll_list);
spin_unlock_bh(&dev->sta_poll_lock);
addr = mt7615_mac_wtbl_addr(dev, msta->wcid.idx) + 19 * 4; addr = mt7615_mac_wtbl_addr(dev, msta->wcid.idx) + 19 * 4;
...@@ -779,8 +777,6 @@ void mt7615_mac_sta_poll(struct mt7615_dev *dev) ...@@ -779,8 +777,6 @@ void mt7615_mac_sta_poll(struct mt7615_dev *dev)
rx_cur); rx_cur);
} }
} }
rcu_read_unlock();
} }
EXPORT_SYMBOL_GPL(mt7615_mac_sta_poll); EXPORT_SYMBOL_GPL(mt7615_mac_sta_poll);
......
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