blob: be0645d10be7781e4b80ae1abcf634bf4daf7e81 [file] [log] [blame]
developerc2cfe0f2023-09-22 04:11:09 +08001From c1b3730e6c089fa9c22b94147373fdc7518a225c Mon Sep 17 00:00:00 2001
2From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
3Date: Thu, 27 Jul 2023 14:00:30 +0800
4Subject: [PATCH 20/22] wifi: mt76: mt7996: remove periodic MPDU TXS request
5
6---
7 mt7996/mac.c | 39 ++++++++++++++++++++++-----------------
8 mt7996/main.c | 1 -
9 mt7996/mt7996.h | 1 -
10 3 files changed, 22 insertions(+), 19 deletions(-)
11
12diff --git a/mt7996/mac.c b/mt7996/mac.c
13index e999cce39..d7751cf55 100644
14--- a/mt7996/mac.c
15+++ b/mt7996/mac.c
16@@ -895,15 +895,6 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
17 if (!wcid)
18 wcid = &dev->mt76.global_wcid;
19
20- if (sta) {
21- struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
22-
23- if (time_after(jiffies, msta->jiffies + HZ / 4)) {
24- info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
25- msta->jiffies = jiffies;
26- }
27- }
28-
29 t = (struct mt76_txwi_cache *)(txwi + mdev->drv->txwi_size);
30 t->skb = tx_info->skb;
31
32@@ -956,22 +947,36 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
33 }
34
35 static void
36-mt7996_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
37+mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb)
38 {
39 struct mt7996_sta *msta;
40+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
41+ bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
42 u16 fc, tid;
43- u32 val;
44
45 if (!sta || !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
46 return;
47
48- tid = le32_get_bits(txwi[1], MT_TXD1_TID);
49+ tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
50 if (tid >= 6) /* skip VO queue */
51 return;
52
53- val = le32_to_cpu(txwi[2]);
54- fc = FIELD_GET(MT_TXD2_FRAME_TYPE, val) << 2 |
55- FIELD_GET(MT_TXD2_SUB_TYPE, val) << 4;
56+ if (is_8023)
57+ fc = IEEE80211_FTYPE_DATA |
58+ (sta->wme ? IEEE80211_STYPE_QOS_DATA
59+ : IEEE80211_STYPE_DATA);
60+ else {
61+ /* No need to get precise TID for Action/Management Frame,
62+ * since it will not meet the following Frame Control
63+ * condition anyway.
64+ */
65+
66+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
67+
68+ fc = le16_to_cpu(hdr->frame_control) &
69+ (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE);
70+ }
71+
72 if (unlikely(fc != (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA)))
73 return;
74
75@@ -999,7 +1004,7 @@ mt7996_txwi_free(struct mt7996_dev *dev, struct mt76_txwi_cache *t,
76 wcid_idx = wcid->idx;
77
78 if (likely(t->skb->protocol != cpu_to_be16(ETH_P_PAE)))
79- mt7996_tx_check_aggr(sta, txwi);
80+ mt7996_tx_check_aggr(sta, t->skb);
81 } else {
82 wcid_idx = le32_get_bits(txwi[9], MT_TXD9_WLAN_IDX);
83 }
84@@ -1276,7 +1281,7 @@ static void mt7996_mac_add_txs(struct mt7996_dev *dev, void *data)
85 wcidx = le32_get_bits(txs_data[2], MT_TXS2_MLD_ID);
86 pid = le32_get_bits(txs_data[3], MT_TXS3_PID);
87
88- if (pid < MT_PACKET_ID_WED)
89+ if (pid < MT_PACKET_ID_NO_SKB)
90 return;
91
92 if (wcidx >= mt7996_wtbl_size(dev))
93diff --git a/mt7996/main.c b/mt7996/main.c
94index fa4a37f20..501ea2764 100644
95--- a/mt7996/main.c
96+++ b/mt7996/main.c
97@@ -666,7 +666,6 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
98 msta->wcid.idx = idx;
99 msta->wcid.phy_idx = band_idx;
100 msta->wcid.tx_info |= MT_WCID_TX_INFO_SET;
101- msta->jiffies = jiffies;
102
103 ewma_avg_signal_init(&msta->avg_ack_signal);
104
105diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
106index bf9960e30..4477b95d6 100644
107--- a/mt7996/mt7996.h
108+++ b/mt7996/mt7996.h
109@@ -120,7 +120,6 @@ struct mt7996_sta {
110 struct ewma_avg_signal avg_ack_signal;
111
112 unsigned long changed;
113- unsigned long jiffies;
114
115 struct mt76_connac_sta_key_conf bip;
116
117--
1182.39.2
119