summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2020-08-20 11:41:16 +0200
committerFelix Fietkau <nbd@nbd.name>2020-09-24 18:10:16 +0200
commit0f1c443ca9cfa015f205bc003ddecc48531e511b (patch)
treefbcd9f21e9eb4581a5ac0145f0b7ab36d27abbcb /drivers/net/wireless/mediatek/mt76/mt7915/mac.c
parent68e6644bbd6eb1189b36e933b51632887838f825 (diff)
mt76: mt7915: optimize mt7915_mac_sta_poll
Since DMA completion does not imply tx completion, it makes more sense to poll for airtime from mt7915_mac_tx_free. Reduce the runtime of the function by moving all items from dev->sta_poll_list to a local list once and process any stations that were added afterwards on the next run Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7915/mac.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7915/mac.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index ff08a59c747c..06bb8d0103ba 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -97,7 +97,7 @@ static u32 mt7915_mac_wtbl_lmac_addr(struct mt7915_dev *dev, u16 wcid)
}
/* TODO: use txfree airtime info to avoid runtime accessing in the long run */
-void mt7915_mac_sta_poll(struct mt7915_dev *dev)
+static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
{
static const u8 ac_to_tid[] = {
[IEEE80211_AC_BE] = 0,
@@ -114,8 +114,13 @@ void mt7915_mac_sta_poll(struct mt7915_dev *dev)
struct ieee80211_sta *sta;
struct mt7915_sta *msta;
u32 tx_time[IEEE80211_NUM_ACS], rx_time[IEEE80211_NUM_ACS];
+ LIST_HEAD(sta_poll_list);
int i;
+ spin_lock_bh(&dev->sta_poll_lock);
+ list_splice_init(&dev->sta_poll_list, &sta_poll_list);
+ spin_unlock_bh(&dev->sta_poll_lock);
+
rcu_read_lock();
while (true) {
@@ -124,11 +129,11 @@ void mt7915_mac_sta_poll(struct mt7915_dev *dev)
u16 idx;
spin_lock_bh(&dev->sta_poll_lock);
- if (list_empty(&dev->sta_poll_list)) {
+ if (list_empty(&sta_poll_list)) {
spin_unlock_bh(&dev->sta_poll_lock);
break;
}
- msta = list_first_entry(&dev->sta_poll_list,
+ msta = list_first_entry(&sta_poll_list,
struct mt7915_sta, poll_list);
list_del_init(&msta->poll_list);
spin_unlock_bh(&dev->sta_poll_lock);
@@ -929,6 +934,8 @@ void mt7915_mac_tx_free(struct mt7915_dev *dev, struct sk_buff *skb)
mt76_put_txwi(mdev, txwi);
}
dev_kfree_skb(skb);
+
+ mt7915_mac_sta_poll(dev);
}
void mt7915_tx_complete_skb(struct mt76_dev *mdev, enum mt76_txq_id qid,