]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mt76: use mac_wcid_set_drop in mt76x0
authorStanislaw Gruszka <sgruszka@redhat.com>
Wed, 29 Aug 2018 11:16:41 +0000 (13:16 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 4 Sep 2018 08:03:04 +0000 (11:03 +0300)
Move mt76x02_mac_wcid_set_drop to common code and use it in mt76x0.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mediatek/mt76/mt76x0/main.c
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
drivers/net/wireless/mediatek/mt76/mt76x2_common.c
drivers/net/wireless/mediatek/mt76/mt76x2_mac.h
drivers/net/wireless/mediatek/mt76/mt76x2_mac_common.c
drivers/net/wireless/mediatek/mt76/mt76x2_main.c
drivers/net/wireless/mediatek/mt76/mt76x2_tx.c

index 2c15c7ae12ef3f4e156cb6586555e0fff88b9803..a5bdd324f6ec7d94bab348a4d361f56097f46e26 100644 (file)
@@ -175,6 +175,7 @@ mt76x0_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        msta->wcid.idx = idx;
        msta->wcid.hw_key_idx = -1;
        mt76x02_mac_wcid_setup(&dev->mt76, idx, mvif->idx, sta->addr);
+       mt76x02_mac_wcid_set_drop(&dev->mt76, idx, false);
        mt76_clear(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx));
        rcu_assign_pointer(dev->wcid[idx], &msta->wcid);
        mt76x0_mac_set_ampdu_factor(dev);
@@ -195,7 +196,7 @@ mt76x0_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 
        mutex_lock(&dev->mt76.mutex);
        rcu_assign_pointer(dev->wcid[idx], NULL);
-       mt76_set(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx));
+       mt76x02_mac_wcid_set_drop(&dev->mt76, idx, true);
        dev->wcid_mask[idx / BITS_PER_LONG] &= ~BIT(idx % BITS_PER_LONG);
        mt76x02_mac_wcid_setup(&dev->mt76, idx, 0, NULL);
        mt76x0_mac_set_ampdu_factor(dev);
index 119229b2dd71e59b2ab52be5fdf3fe9023cd11d4..2242c0d7e200b1d095f553a941a8eb8d7a78df07 100644 (file)
@@ -119,3 +119,14 @@ void mt76x02_mac_wcid_setup(struct mt76_dev *dev, u8 idx, u8 vif_idx, u8 *mac)
        __mt76_wr_copy(dev, MT_WCID_ADDR(idx), &addr, sizeof(addr));
 }
 EXPORT_SYMBOL_GPL(mt76x02_mac_wcid_setup);
+
+void mt76x02_mac_wcid_set_drop(struct mt76_dev *dev, u8 idx, bool drop)
+{
+       u32 val = __mt76_rr(dev, MT_WCID_DROP(idx));
+       u32 bit = MT_WCID_DROP_MASK(idx);
+
+       /* prevent unnecessary writes */
+       if ((val & bit) != (bit * drop))
+               __mt76_wr(dev, MT_WCID_DROP(idx), (val & ~bit) | (bit * drop));
+}
+EXPORT_SYMBOL_GPL(mt76x02_mac_wcid_set_drop);
index 2fb8b581bf4c9178693f1685700edc343d2fbaae..7dc11cf70f7e089f53f1e84ed440af6d7c195c13 100644 (file)
@@ -47,4 +47,5 @@ int mt76x02_mac_shared_key_setup(struct mt76_dev *dev, u8 vif_idx, u8 key_idx,
 int mt76x02_mac_wcid_set_key(struct mt76_dev *dev, u8 idx,
                            struct ieee80211_key_conf *key);
 void mt76x02_mac_wcid_setup(struct mt76_dev *dev, u8 idx, u8 vif_idx, u8 *mac);
+void mt76x02_mac_wcid_set_drop(struct mt76_dev *dev, u8 idx, bool drop);
 #endif
index 706dedee867422e7b9c89f76a666fd1859345f19..9ef692930d89d9aa55a902db0551f4ae03d8cfac 100644 (file)
@@ -116,7 +116,7 @@ int mt76x2_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        msta->wcid.idx = idx;
        msta->wcid.hw_key_idx = -1;
        mt76x02_mac_wcid_setup(&dev->mt76, idx, mvif->idx, sta->addr);
-       mt76x2_mac_wcid_set_drop(dev, idx, false);
+       mt76x02_mac_wcid_set_drop(&dev->mt76, idx, false);
        for (i = 0; i < ARRAY_SIZE(sta->txq); i++)
                mt76x2_txq_init(dev, sta->txq[i]);
 
@@ -146,7 +146,7 @@ int mt76x2_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        rcu_assign_pointer(dev->wcid[idx], NULL);
        for (i = 0; i < ARRAY_SIZE(sta->txq); i++)
                mt76_txq_remove(&dev->mt76, sta->txq[i]);
-       mt76x2_mac_wcid_set_drop(dev, idx, true);
+       mt76x02_mac_wcid_set_drop(&dev->mt76, idx, true);
        mt76_wcid_free(dev->wcid_mask, idx);
        mt76x02_mac_wcid_setup(&dev->mt76, idx, 0, NULL);
        mutex_unlock(&dev->mt76.mutex);
index 1b156a04fb7f52a9191c3d4ae632ab9ec4d1bda0..ad22d375c847a88602aae92f4070a6930ea32dd3 100644 (file)
@@ -170,7 +170,6 @@ void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x2_txwi *txwi,
                           struct ieee80211_sta *sta, int len);
 void mt76x2_mac_wcid_set_rate(struct mt76x2_dev *dev, struct mt76_wcid *wcid,
                              const struct ieee80211_tx_rate *rate);
-void mt76x2_mac_wcid_set_drop(struct mt76x2_dev *dev, u8 idx, bool drop);
 
 int mt76x2_mac_set_beacon(struct mt76x2_dev *dev, u8 vif_idx,
                          struct sk_buff *skb);
index f4e72a28013207f4841f8a157edc853e84b4935e..f4ae0f157aaaded28614c7f67a4101ff6aef6a59 100644 (file)
@@ -383,17 +383,6 @@ void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x2_txwi *txwi,
 }
 EXPORT_SYMBOL_GPL(mt76x2_mac_write_txwi);
 
-void mt76x2_mac_wcid_set_drop(struct mt76x2_dev *dev, u8 idx, bool drop)
-{
-       u32 val = mt76_rr(dev, MT_WCID_DROP(idx));
-       u32 bit = MT_WCID_DROP_MASK(idx);
-
-       /* prevent unnecessary writes */
-       if ((val & bit) != (bit * drop))
-               mt76_wr(dev, MT_WCID_DROP(idx), (val & ~bit) | (bit * drop));
-}
-EXPORT_SYMBOL_GPL(mt76x2_mac_wcid_set_drop);
-
 static int
 mt76x2_mac_process_rate(struct mt76_rx_status *status, u16 rate)
 {
index 577c6ee39fb8f13f4ca474f495851fe36d368846..7d2b4a4195664dba739e6f2867530fa1ee807ca8 100644 (file)
@@ -207,7 +207,7 @@ mt76x2_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps)
        int idx = msta->wcid.idx;
 
        mt76_stop_tx_queues(&dev->mt76, sta, true);
-       mt76x2_mac_wcid_set_drop(dev, idx, ps);
+       mt76x02_mac_wcid_set_drop(&dev->mt76, idx, ps);
 }
 
 static void
index 4c907882e8b0b349dac643492e496cb5b571837e..6874db52b846940290750a66277160275d8a87fb 100644 (file)
@@ -34,7 +34,7 @@ int mt76x2_tx_prepare_skb(struct mt76_dev *mdev, void *txwi,
        int ret;
 
        if (q == &dev->mt76.q_tx[MT_TXQ_PSD] && wcid && wcid->idx < 128)
-               mt76x2_mac_wcid_set_drop(dev, wcid->idx, false);
+               mt76x02_mac_wcid_set_drop(&dev->mt76, wcid->idx, false);
 
        mt76x2_mac_write_txwi(dev, txwi, skb, wcid, sta, skb->len);