summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Maciej Nowak2020-06-19 18:03:07 +0200
committerTomasz Maciej Nowak2020-06-19 18:03:07 +0200
commitd46d25207197b0d85620340d2a0e12191ca1fb9a (patch)
tree97b96996b1ff91523f7c54c5ad82cea7fab2f5ab
parent4fd7e7780748957f66e44ca02c0af86243b41508 (diff)
downloadaur-d46d25207197b0d85620340d2a0e12191ca1fb9a.tar.gz
upgpkg: mt76-git r2013.gd6d9a7e-1
fix build with kernel 5.4
-rw-r--r--.SRCINFO10
-rw-r--r--PKGBUILD12
-rw-r--r--Revert-mac80211-simplify-TX-aggregation-start.patch11
-rw-r--r--Revert-mt76-enable-Airtime-Queue-Limit-support.patch25
-rw-r--r--Revert-mt76-rely-on-mac80211-utility-routines-to-com.patch423
-rw-r--r--dkms.conf12
6 files changed, 487 insertions, 6 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 4496b018dd99..649342d3c9a0 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,5 +1,5 @@
pkgbase = mt76-git
- pkgver = r1970.gf85c1f3
+ pkgver = r2013.gd6d9a7e
pkgrel = 1
url = https://github.com/openwrt/mt76
arch = x86_64
@@ -10,11 +10,17 @@ pkgbase = mt76-git
arch = aarch64
makedepends = git
source = git+https://github.com/openwrt/mt76.git
+ source = Revert-mac80211-simplify-TX-aggregation-start.patch
+ source = Revert-mt76-enable-Airtime-Queue-Limit-support.patch
+ source = Revert-mt76-rely-on-mac80211-utility-routines-to-com.patch
source = wireless-mediatek-Replace-rcu_swap_protected-with-rc.patch
source = dkms.conf
sha256sums = SKIP
+ sha256sums = a0100102d806486713e290c788d9478c2bcd951eca09956140f685a4289af76d
+ sha256sums = bfd9729a0f19d3792e3c8a05fa133a18428ba3bf472c5e0e13fe2de841d52364
+ sha256sums = 553b685584ce5d4eebf1ac5d28010ccf5bf502abebc6c0a54206c44bfd6ed835
sha256sums = 464dcf601bbfbce3e0dd7fcb5008f44b979c6ad85325244d0e0aa3cdea7fb13e
- sha256sums = f98eb3f3a0b20ec76490aae595d264f770489c4ab8e17de6353b35ae579a92a1
+ sha256sums = 7f3e5a2d19f06e6e9c453a0b7d26ae128ee1c04eb1aee5be726fa53fe82c6364
pkgname = mt76-dkms-git
pkgdesc = mac80211 driver for MediaTek MT76x0e, MT76x2e, MT7603, MT7615, MT7628 and MT7688
diff --git a/PKGBUILD b/PKGBUILD
index dd772b7d6831..863e7f1b8625 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,17 +4,23 @@
pkgbase=mt76-git
pkgname=('mt76-dkms-git' 'mt76-firmware-git')
-pkgver=r1970.gf85c1f3
+pkgver=r2013.gd6d9a7e
pkgrel=1
arch=('x86_64' 'i686' 'arm' 'armv6h' 'armv7h' 'aarch64')
url='https://github.com/openwrt/mt76'
makedepends=('git')
source=("git+${url}.git"
+ 'Revert-mac80211-simplify-TX-aggregation-start.patch'
+ 'Revert-mt76-enable-Airtime-Queue-Limit-support.patch'
+ 'Revert-mt76-rely-on-mac80211-utility-routines-to-com.patch'
'wireless-mediatek-Replace-rcu_swap_protected-with-rc.patch'
'dkms.conf')
sha256sums=('SKIP'
+ 'a0100102d806486713e290c788d9478c2bcd951eca09956140f685a4289af76d'
+ 'bfd9729a0f19d3792e3c8a05fa133a18428ba3bf472c5e0e13fe2de841d52364'
+ '553b685584ce5d4eebf1ac5d28010ccf5bf502abebc6c0a54206c44bfd6ed835'
'464dcf601bbfbce3e0dd7fcb5008f44b979c6ad85325244d0e0aa3cdea7fb13e'
- 'f98eb3f3a0b20ec76490aae595d264f770489c4ab8e17de6353b35ae579a92a1')
+ '7f3e5a2d19f06e6e9c453a0b7d26ae128ee1c04eb1aee5be726fa53fe82c6364')
pkgver() {
cd ${srcdir}/mt76
@@ -31,7 +37,7 @@ package_mt76-dkms-git() {
install -dm755 ${pkgdir}/usr/src/mt76-${pkgver}/patches
cp -r ${srcdir}/mt76/* ${pkgdir}/usr/src/mt76-${pkgver}/
- cp ${srcdir}/wireless-mediatek-Replace-rcu_swap_protected-with-rc.patch ${pkgdir}/usr/src/mt76-${pkgver}/patches/
+ cp ${srcdir}/*.patch ${pkgdir}/usr/src/mt76-${pkgver}/patches/
rm -f -r ${pkgdir}/usr/src/mt76-${pkgver}/firmware
sed --follow-symlinks -e "s,@PKGVER@,${pkgver}," ${srcdir}/dkms.conf > ${pkgdir}/usr/src/mt76-${pkgver}/dkms.conf
}
diff --git a/Revert-mac80211-simplify-TX-aggregation-start.patch b/Revert-mac80211-simplify-TX-aggregation-start.patch
new file mode 100644
index 000000000000..b4dc2b54a53a
--- /dev/null
+++ b/Revert-mac80211-simplify-TX-aggregation-start.patch
@@ -0,0 +1,11 @@
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -616,7 +616,7 @@ mt7915_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ case IEEE80211_AMPDU_TX_START:
+ mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
+ mt7915_set_aggr_state(msta, tid, MT7915_AGGR_START);
+- ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
++ ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
+ break;
+ case IEEE80211_AMPDU_TX_STOP_CONT:
+ mtxq->aggr = false;
diff --git a/Revert-mt76-enable-Airtime-Queue-Limit-support.patch b/Revert-mt76-enable-Airtime-Queue-Limit-support.patch
new file mode 100644
index 000000000000..415454e64687
--- /dev/null
+++ b/Revert-mt76-enable-Airtime-Queue-Limit-support.patch
@@ -0,0 +1,25 @@
+From 0779bc5ac71ec7b8cd3609e05611c2a31490f34c Mon Sep 17 00:00:00 2001
+From: Tomasz Maciej Nowak <tomek_n@o2.pl>
+Date: Fri, 19 Jun 2020 15:49:01 +0200
+Subject: [PATCH] Revert "mt76: enable Airtime Queue Limit support"
+
+This reverts commit 62c447e2c75f8f6886db730363309e647f7a3f18.
+---
+ mac80211.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/mac80211.c b/mac80211.c
+index d8533d0c6e81..6f05371777a2 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -287,7 +287,6 @@ mt76_phy_init(struct mt76_dev *dev, struct ieee80211_hw *hw)
+
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS);
+- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_AQL);
+
+ wiphy->available_antennas_tx = dev->phy.antenna_mask;
+ wiphy->available_antennas_rx = dev->phy.antenna_mask;
+--
+2.27.0
+
diff --git a/Revert-mt76-rely-on-mac80211-utility-routines-to-com.patch b/Revert-mt76-rely-on-mac80211-utility-routines-to-com.patch
new file mode 100644
index 000000000000..1072d20436c9
--- /dev/null
+++ b/Revert-mt76-rely-on-mac80211-utility-routines-to-com.patch
@@ -0,0 +1,423 @@
+From 83b962a61249259039e2af60441bac9c017ab6c2 Mon Sep 17 00:00:00 2001
+From: Tomasz Maciej Nowak <tomek_n@o2.pl>
+Date: Fri, 19 Jun 2020 16:52:56 +0200
+Subject: [PATCH] Revert "mt76: rely on mac80211 utility routines to compute
+ airtime"
+
+This reverts commit 29fec3a9b0b446036198860f0e9a9caffd9f8103.
+---
+ Makefile | 2 +-
+ airtime.c | 326 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ mac80211.c | 10 +-
+ mt76.h | 4 +
+ mt76x02_mac.c | 2 +-
+ 5 files changed, 333 insertions(+), 11 deletions(-)
+ create mode 100644 airtime.c
+
+diff --git a/Makefile b/Makefile
+index ccb41729f726..ec1121507191 100644
+--- a/Makefile
++++ b/Makefile
+@@ -7,7 +7,7 @@ obj-$(CONFIG_MT76x02_USB) += mt76x02-usb.o
+
+ mt76-y := \
+ mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o \
+- tx.o agg-rx.o mcu.o
++ tx.o agg-rx.o mcu.o airtime.o
+
+ mt76-$(CONFIG_PCI) += pci.o
+
+diff --git a/airtime.c b/airtime.c
+new file mode 100644
+index 000000000000..a4a785467748
+--- /dev/null
++++ b/airtime.c
+@@ -0,0 +1,326 @@
++// SPDX-License-Identifier: ISC
++/*
++ * Copyright (C) 2019 Felix Fietkau <nbd@nbd.name>
++ */
++
++#include "mt76.h"
++
++#define AVG_PKT_SIZE 1024
++
++/* Number of bits for an average sized packet */
++#define MCS_NBITS (AVG_PKT_SIZE << 3)
++
++/* Number of symbols for a packet with (bps) bits per symbol */
++#define MCS_NSYMS(bps) DIV_ROUND_UP(MCS_NBITS, (bps))
++
++/* Transmission time (1024 usec) for a packet containing (syms) * symbols */
++#define MCS_SYMBOL_TIME(sgi, syms) \
++ (sgi ? \
++ ((syms) * 18 * 1024 + 4 * 1024) / 5 : /* syms * 3.6 us */ \
++ ((syms) * 1024) << 2 /* syms * 4 us */ \
++ )
++
++/* Transmit duration for the raw data part of an average sized packet */
++#define MCS_DURATION(streams, sgi, bps) \
++ MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps)))
++
++#define BW_20 0
++#define BW_40 1
++#define BW_80 2
++
++/*
++ * Define group sort order: HT40 -> SGI -> #streams
++ */
++#define MT_MAX_STREAMS 4
++#define MT_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */
++#define MT_VHT_STREAM_GROUPS 6 /* BW(=3) * SGI(=2) */
++
++#define MT_HT_GROUPS_NB (MT_MAX_STREAMS * \
++ MT_HT_STREAM_GROUPS)
++#define MT_VHT_GROUPS_NB (MT_MAX_STREAMS * \
++ MT_VHT_STREAM_GROUPS)
++#define MT_GROUPS_NB (MT_HT_GROUPS_NB + \
++ MT_VHT_GROUPS_NB)
++
++#define MT_HT_GROUP_0 0
++#define MT_VHT_GROUP_0 (MT_HT_GROUP_0 + MT_HT_GROUPS_NB)
++
++#define MCS_GROUP_RATES 10
++
++#define HT_GROUP_IDX(_streams, _sgi, _ht40) \
++ MT_HT_GROUP_0 + \
++ MT_MAX_STREAMS * 2 * _ht40 + \
++ MT_MAX_STREAMS * _sgi + \
++ _streams - 1
++
++#define _MAX(a, b) (((a)>(b))?(a):(b))
++
++#define GROUP_SHIFT(duration) \
++ _MAX(0, 16 - __builtin_clz(duration))
++
++/* MCS rate information for an MCS group */
++#define __MCS_GROUP(_streams, _sgi, _ht40, _s) \
++ [HT_GROUP_IDX(_streams, _sgi, _ht40)] = { \
++ .shift = _s, \
++ .duration = { \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26) >> _s, \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52) >> _s, \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78) >> _s, \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104) >> _s, \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156) >> _s, \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208) >> _s, \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234) >> _s, \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) >> _s \
++ } \
++}
++
++#define MCS_GROUP_SHIFT(_streams, _sgi, _ht40) \
++ GROUP_SHIFT(MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26))
++
++#define MCS_GROUP(_streams, _sgi, _ht40) \
++ __MCS_GROUP(_streams, _sgi, _ht40, \
++ MCS_GROUP_SHIFT(_streams, _sgi, _ht40))
++
++#define VHT_GROUP_IDX(_streams, _sgi, _bw) \
++ (MT_VHT_GROUP_0 + \
++ MT_MAX_STREAMS * 2 * (_bw) + \
++ MT_MAX_STREAMS * (_sgi) + \
++ (_streams) - 1)
++
++#define BW2VBPS(_bw, r3, r2, r1) \
++ (_bw == BW_80 ? r3 : _bw == BW_40 ? r2 : r1)
++
++#define __VHT_GROUP(_streams, _sgi, _bw, _s) \
++ [VHT_GROUP_IDX(_streams, _sgi, _bw)] = { \
++ .shift = _s, \
++ .duration = { \
++ MCS_DURATION(_streams, _sgi, \
++ BW2VBPS(_bw, 117, 54, 26)) >> _s, \
++ MCS_DURATION(_streams, _sgi, \
++ BW2VBPS(_bw, 234, 108, 52)) >> _s, \
++ MCS_DURATION(_streams, _sgi, \
++ BW2VBPS(_bw, 351, 162, 78)) >> _s, \
++ MCS_DURATION(_streams, _sgi, \
++ BW2VBPS(_bw, 468, 216, 104)) >> _s, \
++ MCS_DURATION(_streams, _sgi, \
++ BW2VBPS(_bw, 702, 324, 156)) >> _s, \
++ MCS_DURATION(_streams, _sgi, \
++ BW2VBPS(_bw, 936, 432, 208)) >> _s, \
++ MCS_DURATION(_streams, _sgi, \
++ BW2VBPS(_bw, 1053, 486, 234)) >> _s, \
++ MCS_DURATION(_streams, _sgi, \
++ BW2VBPS(_bw, 1170, 540, 260)) >> _s, \
++ MCS_DURATION(_streams, _sgi, \
++ BW2VBPS(_bw, 1404, 648, 312)) >> _s, \
++ MCS_DURATION(_streams, _sgi, \
++ BW2VBPS(_bw, 1560, 720, 346)) >> _s \
++ } \
++}
++
++#define VHT_GROUP_SHIFT(_streams, _sgi, _bw) \
++ GROUP_SHIFT(MCS_DURATION(_streams, _sgi, \
++ BW2VBPS(_bw, 117, 54, 26)))
++
++#define VHT_GROUP(_streams, _sgi, _bw) \
++ __VHT_GROUP(_streams, _sgi, _bw, \
++ VHT_GROUP_SHIFT(_streams, _sgi, _bw))
++
++struct mcs_group {
++ u8 shift;
++ u16 duration[MCS_GROUP_RATES];
++};
++
++static const struct mcs_group airtime_mcs_groups[] = {
++ MCS_GROUP(1, 0, BW_20),
++ MCS_GROUP(2, 0, BW_20),
++ MCS_GROUP(3, 0, BW_20),
++ MCS_GROUP(4, 0, BW_20),
++
++ MCS_GROUP(1, 1, BW_20),
++ MCS_GROUP(2, 1, BW_20),
++ MCS_GROUP(3, 1, BW_20),
++ MCS_GROUP(4, 1, BW_20),
++
++ MCS_GROUP(1, 0, BW_40),
++ MCS_GROUP(2, 0, BW_40),
++ MCS_GROUP(3, 0, BW_40),
++ MCS_GROUP(4, 0, BW_40),
++
++ MCS_GROUP(1, 1, BW_40),
++ MCS_GROUP(2, 1, BW_40),
++ MCS_GROUP(3, 1, BW_40),
++ MCS_GROUP(4, 1, BW_40),
++
++ VHT_GROUP(1, 0, BW_20),
++ VHT_GROUP(2, 0, BW_20),
++ VHT_GROUP(3, 0, BW_20),
++ VHT_GROUP(4, 0, BW_20),
++
++ VHT_GROUP(1, 1, BW_20),
++ VHT_GROUP(2, 1, BW_20),
++ VHT_GROUP(3, 1, BW_20),
++ VHT_GROUP(4, 1, BW_20),
++
++ VHT_GROUP(1, 0, BW_40),
++ VHT_GROUP(2, 0, BW_40),
++ VHT_GROUP(3, 0, BW_40),
++ VHT_GROUP(4, 0, BW_40),
++
++ VHT_GROUP(1, 1, BW_40),
++ VHT_GROUP(2, 1, BW_40),
++ VHT_GROUP(3, 1, BW_40),
++ VHT_GROUP(4, 1, BW_40),
++
++ VHT_GROUP(1, 0, BW_80),
++ VHT_GROUP(2, 0, BW_80),
++ VHT_GROUP(3, 0, BW_80),
++ VHT_GROUP(4, 0, BW_80),
++
++ VHT_GROUP(1, 1, BW_80),
++ VHT_GROUP(2, 1, BW_80),
++ VHT_GROUP(3, 1, BW_80),
++ VHT_GROUP(4, 1, BW_80),
++};
++
++static u32
++mt76_calc_legacy_rate_duration(const struct ieee80211_rate *rate, bool short_pre,
++ int len)
++{
++ u32 duration;
++
++ switch (rate->hw_value >> 8) {
++ case MT_PHY_TYPE_CCK:
++ duration = 144 + 48; /* preamble + PLCP */
++ if (short_pre)
++ duration >>= 1;
++
++ duration += 10; /* SIFS */
++ break;
++ case MT_PHY_TYPE_OFDM:
++ duration = 20 + 16; /* premable + SIFS */
++ break;
++ default:
++ WARN_ON_ONCE(1);
++ return 0;
++ }
++
++ len <<= 3;
++ duration += (len * 10) / rate->bitrate;
++
++ return duration;
++}
++
++u32 mt76_calc_rx_airtime(struct mt76_dev *dev, struct mt76_rx_status *status,
++ int len)
++{
++ struct ieee80211_supported_band *sband;
++ const struct ieee80211_rate *rate;
++ bool sgi = status->enc_flags & RX_ENC_FLAG_SHORT_GI;
++ bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE;
++ int bw, streams;
++ u32 duration;
++ int group, idx;
++
++ switch (status->bw) {
++ case RATE_INFO_BW_20:
++ bw = BW_20;
++ break;
++ case RATE_INFO_BW_40:
++ bw = BW_40;
++ break;
++ case RATE_INFO_BW_80:
++ bw = BW_80;
++ break;
++ default:
++ WARN_ON_ONCE(1);
++ return 0;
++ }
++
++ switch (status->encoding) {
++ case RX_ENC_LEGACY:
++ if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ))
++ return 0;
++
++ sband = dev->hw->wiphy->bands[status->band];
++ if (!sband || status->rate_idx >= sband->n_bitrates)
++ return 0;
++
++ rate = &sband->bitrates[status->rate_idx];
++
++ return mt76_calc_legacy_rate_duration(rate, sp, len);
++ case RX_ENC_VHT:
++ streams = status->nss;
++ idx = status->rate_idx;
++ group = VHT_GROUP_IDX(streams, sgi, bw);
++ break;
++ case RX_ENC_HT:
++ streams = ((status->rate_idx >> 3) & 3) + 1;
++ idx = status->rate_idx & 7;
++ group = HT_GROUP_IDX(streams, sgi, bw);
++ break;
++ default:
++ WARN_ON_ONCE(1);
++ return 0;
++ }
++
++ if (WARN_ON_ONCE(streams > 4))
++ return 0;
++
++ duration = airtime_mcs_groups[group].duration[idx];
++ duration <<= airtime_mcs_groups[group].shift;
++ duration *= len;
++ duration /= AVG_PKT_SIZE;
++ duration /= 1024;
++
++ duration += 36 + (streams << 2);
++
++ return duration;
++}
++
++u32 mt76_calc_tx_airtime(struct mt76_dev *dev, struct ieee80211_tx_info *info,
++ int len)
++{
++ struct mt76_rx_status stat = {
++ .band = info->band,
++ };
++ u32 duration = 0;
++ int i;
++
++ for (i = 0; i < ARRAY_SIZE(info->status.rates); i++) {
++ struct ieee80211_tx_rate *rate = &info->status.rates[i];
++ u32 cur_duration;
++
++ if (rate->idx < 0 || !rate->count)
++ break;
++
++ if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
++ stat.bw = RATE_INFO_BW_80;
++ else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
++ stat.bw = RATE_INFO_BW_40;
++ else
++ stat.bw = RATE_INFO_BW_20;
++
++ stat.enc_flags = 0;
++ if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
++ stat.enc_flags |= RX_ENC_FLAG_SHORTPRE;
++ if (rate->flags & IEEE80211_TX_RC_SHORT_GI)
++ stat.enc_flags |= RX_ENC_FLAG_SHORT_GI;
++
++ stat.rate_idx = rate->idx;
++ if (rate->flags & IEEE80211_TX_RC_VHT_MCS) {
++ stat.encoding = RX_ENC_VHT;
++ stat.rate_idx = ieee80211_rate_get_vht_mcs(rate);
++ stat.nss = ieee80211_rate_get_vht_nss(rate);
++ } else if (rate->flags & IEEE80211_TX_RC_MCS) {
++ stat.encoding = RX_ENC_HT;
++ } else {
++ stat.encoding = RX_ENC_LEGACY;
++ }
++
++ cur_duration = mt76_calc_rx_airtime(dev, &stat, len);
++ duration += cur_duration * rate->count;
++ }
++
++ return duration;
++}
++EXPORT_SYMBOL_GPL(mt76_calc_tx_airtime);
+diff --git a/mac80211.c b/mac80211.c
+index d8533d0c6e81..f4dd010ac73f 100644
+--- a/mac80211.c
++++ b/mac80211.c
+@@ -758,18 +758,10 @@ mt76_airtime_report(struct mt76_dev *dev, struct mt76_rx_status *status,
+ int len)
+ {
+ struct mt76_wcid *wcid = status->wcid;
+- struct ieee80211_rx_status info = {
+- .enc_flags = status->enc_flags,
+- .rate_idx = status->rate_idx,
+- .encoding = status->encoding,
+- .band = status->band,
+- .nss = status->nss,
+- .bw = status->bw,
+- };
+ struct ieee80211_sta *sta;
+ u32 airtime;
+
+- airtime = ieee80211_calc_rx_airtime(dev->hw, &info, len);
++ airtime = mt76_calc_rx_airtime(dev, status, len);
+ spin_lock(&dev->cc_lock);
+ dev->cur_cc_bss_rx += airtime;
+ spin_unlock(&dev->cc_lock);
+diff --git a/mt76.h b/mt76.h
+index d50871653de1..3476efe60fdb 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -886,6 +886,8 @@ void mt76_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ const u8 *mac);
+ void mt76_sw_scan_complete(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif);
++u32 mt76_calc_tx_airtime(struct mt76_dev *dev, struct ieee80211_tx_info *info,
++ int len);
+
+ /* internal */
+ static inline struct ieee80211_hw *
+@@ -910,6 +912,8 @@ void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
+ void mt76_rx_poll_complete(struct mt76_dev *dev, enum mt76_rxq_id q,
+ struct napi_struct *napi);
+ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames);
++u32 mt76_calc_rx_airtime(struct mt76_dev *dev, struct mt76_rx_status *status,
++ int len);
+
+ /* usb */
+ static inline bool mt76u_urb_error(struct urb *urb)
+diff --git a/mt76x02_mac.c b/mt76x02_mac.c
+index e4e03beabe43..7d4e0c394e94 100644
+--- a/mt76x02_mac.c
++++ b/mt76x02_mac.c
+@@ -634,7 +634,7 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev,
+ if (!len)
+ goto out;
+
+- duration = ieee80211_calc_tx_airtime(mt76_hw(dev), &info, len);
++ duration = mt76_calc_tx_airtime(&dev->mt76, &info, len);
+
+ spin_lock_bh(&dev->mt76.cc_lock);
+ dev->tx_airtime += duration;
+--
+2.27.0
+
diff --git a/dkms.conf b/dkms.conf
index 14f5cbf4823d..130a5becf236 100644
--- a/dkms.conf
+++ b/dkms.conf
@@ -74,4 +74,14 @@ BUILT_MODULE_NAME[12]="mt7915e"
BUILT_MODULE_LOCATION[12]="mt7915"
DEST_MODULE_LOCATION[12]="/extramodules/mt76"
-PATCH[0]="wireless-mediatek-Replace-rcu_swap_protected-with-rc.patch"
+PATCH[0]="Revert-mac80211-simplify-TX-aggregation-start.patch"
+PATCH_MATCH[0]="^5\.4(.*)"
+
+PATCH[1]="Revert-mt76-enable-Airtime-Queue-Limit-support.patch"
+PATCH_MATCH[1]="^5\.4(.*)"
+
+PATCH[2]="Revert-mt76-rely-on-mac80211-utility-routines-to-com.patch"
+PATCH_MATCH[2]="^5\.4(.*)"
+
+PATCH[3]="wireless-mediatek-Replace-rcu_swap_protected-with-rc.patch"
+PATCH_MATCH[3]="^5\.[6-9](.*)|^5\.[0-9][0-9](.*)|^[6-9].*"