Commit 0f1c443c authored by Felix Fietkau's avatar Felix Fietkau

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: default avatarFelix Fietkau <nbd@nbd.name>
parent 68e6644b
...@@ -95,7 +95,6 @@ static int mt7915_poll_tx(struct napi_struct *napi, int budget) ...@@ -95,7 +95,6 @@ static int mt7915_poll_tx(struct napi_struct *napi, int budget)
dev = container_of(napi, struct mt7915_dev, mt76.tx_napi); dev = container_of(napi, struct mt7915_dev, mt76.tx_napi);
mt7915_tx_cleanup(dev); mt7915_tx_cleanup(dev);
mt7915_mac_sta_poll(dev);
tasklet_schedule(&dev->mt76.tx_tasklet); tasklet_schedule(&dev->mt76.tx_tasklet);
......
...@@ -97,7 +97,7 @@ static u32 mt7915_mac_wtbl_lmac_addr(struct mt7915_dev *dev, u16 wcid) ...@@ -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 */ /* 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[] = { static const u8 ac_to_tid[] = {
[IEEE80211_AC_BE] = 0, [IEEE80211_AC_BE] = 0,
...@@ -114,8 +114,13 @@ void mt7915_mac_sta_poll(struct mt7915_dev *dev) ...@@ -114,8 +114,13 @@ void mt7915_mac_sta_poll(struct mt7915_dev *dev)
struct ieee80211_sta *sta; struct ieee80211_sta *sta;
struct mt7915_sta *msta; struct mt7915_sta *msta;
u32 tx_time[IEEE80211_NUM_ACS], rx_time[IEEE80211_NUM_ACS]; u32 tx_time[IEEE80211_NUM_ACS], rx_time[IEEE80211_NUM_ACS];
LIST_HEAD(sta_poll_list);
int i; 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(); rcu_read_lock();
while (true) { while (true) {
...@@ -124,11 +129,11 @@ void mt7915_mac_sta_poll(struct mt7915_dev *dev) ...@@ -124,11 +129,11 @@ void mt7915_mac_sta_poll(struct mt7915_dev *dev)
u16 idx; u16 idx;
spin_lock_bh(&dev->sta_poll_lock); 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); spin_unlock_bh(&dev->sta_poll_lock);
break; break;
} }
msta = list_first_entry(&dev->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->sta_poll_lock);
...@@ -929,6 +934,8 @@ void mt7915_mac_tx_free(struct mt7915_dev *dev, struct sk_buff *skb) ...@@ -929,6 +934,8 @@ void mt7915_mac_tx_free(struct mt7915_dev *dev, struct sk_buff *skb)
mt76_put_txwi(mdev, txwi); mt76_put_txwi(mdev, txwi);
} }
dev_kfree_skb(skb); dev_kfree_skb(skb);
mt7915_mac_sta_poll(dev);
} }
void mt7915_tx_complete_skb(struct mt76_dev *mdev, enum mt76_txq_id qid, void mt7915_tx_complete_skb(struct mt76_dev *mdev, enum mt76_txq_id qid,
......
...@@ -436,7 +436,6 @@ mt7915_l2_rmw(struct mt7915_dev *dev, u32 addr, u32 mask, u32 val) ...@@ -436,7 +436,6 @@ mt7915_l2_rmw(struct mt7915_dev *dev, u32 addr, u32 mask, u32 val)
bool mt7915_mac_wtbl_update(struct mt7915_dev *dev, int idx, u32 mask); bool mt7915_mac_wtbl_update(struct mt7915_dev *dev, int idx, u32 mask);
void mt7915_mac_reset_counters(struct mt7915_phy *phy); void mt7915_mac_reset_counters(struct mt7915_phy *phy);
void mt7915_mac_cca_stats_reset(struct mt7915_phy *phy); void mt7915_mac_cca_stats_reset(struct mt7915_phy *phy);
void mt7915_mac_sta_poll(struct mt7915_dev *dev);
void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi, void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi,
struct sk_buff *skb, struct mt76_wcid *wcid, struct sk_buff *skb, struct mt76_wcid *wcid,
struct ieee80211_key_conf *key, bool beacon); struct ieee80211_key_conf *key, bool beacon);
......
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