wifi: mt76: mt7996: remove periodic MPDU TXS request
authorBenjamin Lin <benjamin-jw.lin@mediatek.com>
Thu, 21 Sep 2023 21:04:03 +0000 (14:04 -0700)
committerFelix Fietkau <nbd@nbd.name>
Sat, 30 Sep 2023 18:17:18 +0000 (20:17 +0200)
Remove periodic MPDU TXS request. Get TID and FrameType from SKB
instead of TXWI, which is empty for Data Frame after MPDU TXS request
is removed, hence prohibiting the establishment of TX BA session.

Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Signed-off-by: Money Wang <Money.Wang@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7996/mac.c
drivers/net/wireless/mediatek/mt76/mt7996/main.c
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h

index ffd15bfab48c2d3cff1b842b462c042bf184c8df..04540833485fe8c82e5f872f6aacb3e04aada0bb 100644 (file)
@@ -950,15 +950,6 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
        if (!wcid)
                wcid = &dev->mt76.global_wcid;
 
-       if (sta) {
-               struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
-
-               if (time_after(jiffies, msta->jiffies + HZ / 4)) {
-                       info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
-                       msta->jiffies = jiffies;
-               }
-       }
-
        t = (struct mt76_txwi_cache *)(txwi + mdev->drv->txwi_size);
        t->skb = tx_info->skb;
 
@@ -1006,22 +997,35 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
 }
 
 static void
-mt7996_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
+mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb)
 {
        struct mt7996_sta *msta;
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
        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);
+       tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
        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 (is_8023) {
+               fc = IEEE80211_FTYPE_DATA |
+                    (sta->wme ? IEEE80211_STYPE_QOS_DATA : IEEE80211_STYPE_DATA);
+       } else {
+               /* No need to get precise TID for Action/Management Frame,
+                * since it will not meet the following Frame Control
+                * condition anyway.
+                */
+
+               struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+
+               fc = le16_to_cpu(hdr->frame_control) &
+                    (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE);
+       }
+
        if (unlikely(fc != (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA)))
                return;
 
@@ -1049,7 +1053,7 @@ mt7996_txwi_free(struct mt7996_dev *dev, struct mt76_txwi_cache *t,
                wcid_idx = wcid->idx;
 
                if (likely(t->skb->protocol != cpu_to_be16(ETH_P_PAE)))
-                       mt7996_tx_check_aggr(sta, txwi);
+                       mt7996_tx_check_aggr(sta, t->skb);
        } else {
                wcid_idx = le32_get_bits(txwi[9], MT_TXD9_WLAN_IDX);
        }
@@ -1320,7 +1324,7 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data)
        wcidx = le32_get_bits(txs_data[2], MT_TXS2_WCID);
        pid = le32_get_bits(txs_data[3], MT_TXS3_PID);
 
-       if (pid < MT_PACKET_ID_WED)
+       if (pid < MT_PACKET_ID_NO_SKB)
                return;
 
        if (wcidx >= mt7996_wtbl_size(dev))
index ce16637b45ce7f1e994454c05e7d3231d4095da4..09c7a28a3d511b54abbd2f94b67880d8050c1e34 100644 (file)
@@ -657,7 +657,6 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
        msta->wcid.idx = idx;
        msta->wcid.phy_idx = band_idx;
        msta->wcid.tx_info |= MT_WCID_TX_INFO_SET;
-       msta->jiffies = jiffies;
 
        ewma_avg_signal_init(&msta->avg_ack_signal);
 
index cb67a2d4c6d4bca839d05226a5e7f4cda37c2117..e53cf6a3704c4adc553705238d44c0ca3b47c182 100644 (file)
@@ -110,7 +110,6 @@ struct mt7996_sta {
        struct ewma_avg_signal avg_ack_signal;
 
        unsigned long changed;
-       unsigned long jiffies;
 
        struct mt76_connac_sta_key_conf bip;