wifi: mt76: mt7615: rely on shared sta_poll_list and sta_poll_lock
authorLorenzo Bianconi <lorenzo@kernel.org>
Thu, 22 Jun 2023 16:50:20 +0000 (18:50 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 25 Jul 2023 19:59:42 +0000 (21:59 +0200)
Rely on sta_poll_list and sta_poll_lock fields in mt76_dev structure
and get rid of private copies.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7615/init.c
drivers/net/wireless/mediatek/mt76/mt7615/mac.c
drivers/net/wireless/mediatek/mt76/mt7615/main.c
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h

index ab475c8..18a50cc 100644 (file)
@@ -628,8 +628,6 @@ void mt7615_init_device(struct mt7615_dev *dev)
        INIT_DELAYED_WORK(&dev->coredump.work, mt7615_coredump_work);
        skb_queue_head_init(&dev->phy.scan_event_list);
        skb_queue_head_init(&dev->coredump.msg_list);
-       INIT_LIST_HEAD(&dev->sta_poll_list);
-       spin_lock_init(&dev->sta_poll_lock);
        init_waitqueue_head(&dev->reset_wait);
        init_waitqueue_head(&dev->phy.roc_wait);
 
index 6400248..f275c0f 100644 (file)
@@ -387,10 +387,11 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb)
                struct mt7615_sta *msta;
 
                msta = container_of(status->wcid, struct mt7615_sta, wcid);
-               spin_lock_bh(&dev->sta_poll_lock);
+               spin_lock_bh(&dev->mt76.sta_poll_lock);
                if (list_empty(&msta->poll_list))
-                       list_add_tail(&msta->poll_list, &dev->sta_poll_list);
-               spin_unlock_bh(&dev->sta_poll_lock);
+                       list_add_tail(&msta->poll_list,
+                                     &dev->mt76.sta_poll_list);
+               spin_unlock_bh(&dev->mt76.sta_poll_lock);
        }
 
        if (mt76_is_mmio(&dev->mt76) && (rxd0 & csum_mask) == csum_mask &&
@@ -905,9 +906,9 @@ void mt7615_mac_sta_poll(struct mt7615_dev *dev)
        int i;
 
        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);
+       spin_lock_bh(&dev->mt76.sta_poll_lock);
+       list_splice_init(&dev->mt76.sta_poll_list, &sta_poll_list);
+       spin_unlock_bh(&dev->mt76.sta_poll_lock);
 
        while (!list_empty(&sta_poll_list)) {
                bool clear = false;
@@ -915,9 +916,9 @@ void mt7615_mac_sta_poll(struct mt7615_dev *dev)
                msta = list_first_entry(&sta_poll_list, struct mt7615_sta,
                                        poll_list);
 
-               spin_lock_bh(&dev->sta_poll_lock);
+               spin_lock_bh(&dev->mt76.sta_poll_lock);
                list_del_init(&msta->poll_list);
-               spin_unlock_bh(&dev->sta_poll_lock);
+               spin_unlock_bh(&dev->mt76.sta_poll_lock);
 
                addr = mt7615_mac_wtbl_addr(dev, msta->wcid.idx) + 19 * 4;
 
@@ -1514,10 +1515,10 @@ static void mt7615_mac_add_txs(struct mt7615_dev *dev, void *data)
        msta = container_of(wcid, struct mt7615_sta, wcid);
        sta = wcid_to_sta(wcid);
 
-       spin_lock_bh(&dev->sta_poll_lock);
+       spin_lock_bh(&dev->mt76.sta_poll_lock);
        if (list_empty(&msta->poll_list))
-               list_add_tail(&msta->poll_list, &dev->sta_poll_list);
-       spin_unlock_bh(&dev->sta_poll_lock);
+               list_add_tail(&msta->poll_list, &dev->mt76.sta_poll_list);
+       spin_unlock_bh(&dev->mt76.sta_poll_lock);
 
        if (mt7615_mac_add_txs_skb(dev, msta, pid, txs_data))
                goto out;
index 4167aaf..e14f1f3 100644 (file)
@@ -274,10 +274,10 @@ static void mt7615_remove_interface(struct ieee80211_hw *hw,
 
        mt7615_mutex_release(dev);
 
-       spin_lock_bh(&dev->sta_poll_lock);
+       spin_lock_bh(&dev->mt76.sta_poll_lock);
        if (!list_empty(&msta->poll_list))
                list_del_init(&msta->poll_list);
-       spin_unlock_bh(&dev->sta_poll_lock);
+       spin_unlock_bh(&dev->mt76.sta_poll_lock);
 
        mt76_packet_id_flush(&dev->mt76, &mvif->sta.wcid);
 }
@@ -705,10 +705,10 @@ void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
        if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)
                mt7615_mcu_add_bss_info(phy, vif, sta, false);
 
-       spin_lock_bh(&dev->sta_poll_lock);
+       spin_lock_bh(&mdev->sta_poll_lock);
        if (!list_empty(&msta->poll_list))
                list_del_init(&msta->poll_list);
-       spin_unlock_bh(&dev->sta_poll_lock);
+       spin_unlock_bh(&mdev->sta_poll_lock);
 
        mt76_connac_power_save_sched(phy->mt76, &dev->pm);
 }
index 582d1b5..765ba98 100644 (file)
@@ -262,9 +262,6 @@ struct mt7615_dev {
        wait_queue_head_t reset_wait;
        u32 reset_state;
 
-       struct list_head sta_poll_list;
-       spinlock_t sta_poll_lock;
-
        struct {
                u8 n_pulses;
                u32 period;