wifi: mt76: use atomic iface iteration for pre-TBTT work

In addition to the previous series I posted, over time I'd
also like to get rid of the iflist_mtx in mac80211. That
isn't easy now since lots of places use iteration and would
have to be audited, but even a cursory look suggests that
mt76 might be more problematic than most since holding the
wiphy lock for the latency-sensitive pre-TBTT work could be
an issue.

Convert the pre-TBTT work to use atomic iteration and then
sending the device commands outside of it.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Johannes Berg
2023-09-11 15:13:56 +02:00
committed by Felix Fietkau
parent cd371fcc98
commit d71f8d1b17
3 changed files with 22 additions and 10 deletions
+10 -3
View File
@@ -182,7 +182,9 @@ static void mt76x02u_pre_tbtt_work(struct work_struct *work)
{
struct mt76x02_dev *dev =
container_of(work, struct mt76x02_dev, pre_tbtt_work);
struct beacon_bc_data data = {};
struct beacon_bc_data data = {
.dev = dev,
};
struct sk_buff *skb;
int nbeacons;
@@ -192,15 +194,20 @@ static void mt76x02u_pre_tbtt_work(struct work_struct *work)
if (mt76_hw(dev)->conf.flags & IEEE80211_CONF_OFFCHANNEL)
return;
__skb_queue_head_init(&data.q);
mt76x02_resync_beacon_timer(dev);
/* Prevent corrupt transmissions during update */
mt76_set(dev, MT_BCN_BYPASS_MASK, 0xffff);
dev->beacon_data_count = 0;
ieee80211_iterate_active_interfaces(mt76_hw(dev),
ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev),
IEEE80211_IFACE_ITER_RESUME_ALL,
mt76x02_update_beacon_iter, dev);
mt76x02_update_beacon_iter, &data);
while ((skb = __skb_dequeue(&data.q)) != NULL)
mt76x02_mac_set_beacon(dev, skb);
mt76_csa_check(&dev->mt76);