mt76: connac: move more mt7921/mt7915 mac shared code in connac lib
[linux-2.6-microblaze.git] / drivers / net / wireless / mediatek / mt76 / mt7921 / mac.c
index 3e58974..368f927 100644 (file)
@@ -511,30 +511,6 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
        return 0;
 }
 
-static void mt7921_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
-{
-       struct mt7921_sta *msta;
-       u16 fc, tid;
-       u32 val;
-
-       if (!sta || !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
-               return;
-
-       tid = le32_get_bits(txwi[1], MT_TXD1_TID);
-       if (tid >= 6) /* skip VO queue */
-               return;
-
-       val = le32_to_cpu(txwi[2]);
-       fc = FIELD_GET(MT_TXD2_FRAME_TYPE, val) << 2 |
-            FIELD_GET(MT_TXD2_SUB_TYPE, val) << 4;
-       if (unlikely(fc != (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA)))
-               return;
-
-       msta = (struct mt7921_sta *)sta->drv_priv;
-       if (!test_and_set_bit(tid, &msta->wcid.ampdu_state))
-               ieee80211_start_tx_ba_session(sta, tid, 0);
-}
-
 void mt7921_mac_add_txs(struct mt7921_dev *dev, void *data)
 {
        struct mt7921_sta *msta = NULL;
@@ -576,37 +552,6 @@ out:
        rcu_read_unlock();
 }
 
-void mt7921_txwi_free(struct mt7921_dev *dev, struct mt76_txwi_cache *t,
-                     struct ieee80211_sta *sta, bool clear_status,
-                     struct list_head *free_list)
-{
-       struct mt76_dev *mdev = &dev->mt76;
-       __le32 *txwi;
-       u16 wcid_idx;
-
-       mt76_connac_txp_skb_unmap(mdev, t);
-       if (!t->skb)
-               goto out;
-
-       txwi = (__le32 *)mt76_get_txwi_ptr(mdev, t);
-       if (sta) {
-               struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
-
-               if (likely(t->skb->protocol != cpu_to_be16(ETH_P_PAE)))
-                       mt7921_tx_check_aggr(sta, txwi);
-
-               wcid_idx = wcid->idx;
-       } else {
-               wcid_idx = le32_get_bits(txwi[1], MT_TXD1_WLAN_IDX);
-       }
-
-       __mt76_tx_complete_skb(mdev, wcid_idx, t->skb, free_list);
-out:
-       t->skb = NULL;
-       mt76_put_txwi(mdev, t);
-}
-EXPORT_SYMBOL_GPL(mt7921_txwi_free);
-
 static void mt7921_mac_tx_free(struct mt7921_dev *dev, void *data, int len)
 {
        struct mt76_connac_tx_free *free = data;
@@ -669,7 +614,7 @@ static void mt7921_mac_tx_free(struct mt7921_dev *dev, void *data, int len)
                if (!txwi)
                        continue;
 
-               mt7921_txwi_free(dev, txwi, sta, stat, &free_list);
+               mt76_connac2_txwi_free(mdev, txwi, sta, &free_list);
        }
 
        if (wake)
@@ -1235,7 +1180,7 @@ void mt7921_usb_sdio_tx_complete_skb(struct mt76_dev *mdev,
        sta = wcid_to_sta(wcid);
 
        if (sta && likely(e->skb->protocol != cpu_to_be16(ETH_P_PAE)))
-               mt7921_tx_check_aggr(sta, txwi);
+               mt76_connac2_tx_check_aggr(sta, txwi);
 
        skb_pull(e->skb, headroom);
        mt76_tx_complete_skb(mdev, e->wcid, e->skb);