mt76: avoid queue/status spinlocks while passing tx status to mac80211

There is some code in the mac80211 tx status processing code that could
potentially call back into the tx codepath.
To avoid deadlocks, make sure that no tx related spinlocks are taken
during the ieee80211_tx_status call.

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2018-11-05 21:11:42 +01:00
parent eb53745a3a
commit ef06c3074f
8 changed files with 83 additions and 43 deletions
+6 -5
View File
@@ -440,12 +440,13 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev,
struct mt76_wcid *wcid = NULL;
struct mt76x02_sta *msta = NULL;
struct mt76_dev *mdev = &dev->mt76;
struct sk_buff_head list;
if (stat->pktid == MT_PACKET_ID_NO_ACK)
return;
rcu_read_lock();
spin_lock_bh(&mdev->status_list.lock);
mt76_tx_status_lock(mdev, &list);
if (stat->wcid < ARRAY_SIZE(dev->mt76.wcid))
wcid = rcu_dereference(dev->mt76.wcid[stat->wcid]);
@@ -461,7 +462,7 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev,
if (wcid) {
if (stat->pktid)
status.skb = mt76_tx_status_skb_get(mdev, wcid,
stat->pktid);
stat->pktid, &list);
if (status.skb)
status.info = IEEE80211_SKB_CB(status.skb);
}
@@ -492,12 +493,12 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev,
}
if (status.skb)
mt76_tx_status_skb_done(mdev, status.skb);
mt76_tx_status_skb_done(mdev, status.skb, &list);
else
ieee80211_tx_status_ext(mt76_hw(dev), &status);
out:
spin_unlock_bh(&mdev->status_list.lock);
mt76_tx_status_unlock(mdev, &list);
rcu_read_unlock();
}
@@ -821,7 +822,7 @@ void mt76x02_mac_work(struct work_struct *work)
if (!dev->beacon_mask)
mt76x02_check_mac_err(dev);
mt76_tx_status_check(&dev->mt76);
mt76_tx_status_check(&dev->mt76, NULL, false);
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
MT_CALIBRATE_INTERVAL);