[][MAC80211][mt76][refactor internal patches]
[Description]
Fix patch fails and build errors for rebasing the internal patches to
the latest mt76 codebase.
[Release-log]
N/A
Change-Id: I23d60090954fa9869a0e0222e3e045cc6d195271
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6144109
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/1111-mt76-testmode-additional-supports.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/1111-mt76-testmode-additional-supports.patch
index fcea41b..aee7bfc 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/1111-mt76-testmode-additional-supports.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/1111-mt76-testmode-additional-supports.patch
@@ -1,7 +1,7 @@
-From 2e542afa1d9932b4ec588ad2c622c74a16fa1edd Mon Sep 17 00:00:00 2001
+From c355ab2ff11c55754536215d29d9659b3ff4cfe2 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 21 Apr 2022 15:43:19 +0800
-Subject: [PATCH] mt76: testmode: additional supports
+Subject: [PATCH 1111/1115] mt76: testmode: additional supports
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
@@ -13,8 +13,8 @@
.../net/wireless/mediatek/mt76/mt7915/init.c | 2 +-
.../net/wireless/mediatek/mt76/mt7915/mac.c | 37 +-
.../net/wireless/mediatek/mt76/mt7915/main.c | 2 +-
- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 11 +-
- .../net/wireless/mediatek/mt76/mt7915/mcu.h | 31 +-
+ .../net/wireless/mediatek/mt76/mt7915/mcu.c | 10 +-
+ .../net/wireless/mediatek/mt76/mt7915/mcu.h | 29 +-
.../net/wireless/mediatek/mt76/mt7915/mmio.c | 2 +
.../wireless/mediatek/mt76/mt7915/mt7915.h | 14 +-
.../net/wireless/mediatek/mt76/mt7915/regs.h | 3 +
@@ -24,7 +24,7 @@
drivers/net/wireless/mediatek/mt76/testmode.h | 75 ++
.../net/wireless/mediatek/mt76/tools/fields.c | 80 ++
drivers/net/wireless/mediatek/mt76/tx.c | 3 +-
- 19 files changed, 1963 insertions(+), 152 deletions(-)
+ 19 files changed, 1962 insertions(+), 150 deletions(-)
diff --git a/dma.c b/dma.c
index 30de8be4..f6f5f129 100644
@@ -41,7 +41,7 @@
#endif
diff --git a/mac80211.c b/mac80211.c
-index 31602d7f..49b99f36 100644
+index c1df063f..dc3c63e9 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -55,6 +55,13 @@ static const struct ieee80211_channel mt76_channels_5ghz[] = {
@@ -71,7 +71,7 @@
static const struct ieee80211_channel mt76_channels_6ghz[] = {
diff --git a/mt76.h b/mt76.h
-index 8f6279c5..3d1e893d 100644
+index 28720ee4..062c5ce4 100644
--- a/mt76.h
+++ b/mt76.h
@@ -602,6 +602,21 @@ struct mt76_testmode_ops {
@@ -235,10 +235,10 @@
static inline void mt76_testmode_reset(struct mt76_phy *phy, bool disable)
{
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 4e495d4f..ebb78d33 100644
+index 261181dc..cd350689 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
-@@ -389,6 +389,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb,
+@@ -391,6 +391,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb,
switch (vif->type) {
case NL80211_IFTYPE_MESH_POINT:
case NL80211_IFTYPE_AP:
@@ -246,7 +246,7 @@
if (vif->p2p)
conn_type = CONNECTION_P2P_GC;
else
-@@ -570,6 +571,9 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev,
+@@ -572,6 +573,9 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev,
rx->rca2 = 1;
rx->rv = 1;
@@ -257,10 +257,10 @@
return;
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 82498039..a3bbf5ca 100644
+index 32e540cc..a0e6fa6e 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -816,6 +816,7 @@ enum {
+@@ -967,6 +967,7 @@ enum {
MCU_EXT_EVENT_FW_LOG_2_HOST = 0x13,
MCU_EXT_EVENT_THERMAL_PROTECT = 0x22,
MCU_EXT_EVENT_ASSERT_DUMP = 0x23,
@@ -268,7 +268,7 @@
MCU_EXT_EVENT_RDD_REPORT = 0x3a,
MCU_EXT_EVENT_CSA_NOTIFY = 0x4f,
MCU_EXT_EVENT_BCC_NOTIFY = 0x75,
-@@ -993,6 +994,7 @@ enum {
+@@ -1144,6 +1145,7 @@ enum {
MCU_EXT_CMD_PHY_STAT_INFO = 0xad,
/* for vendor csi and air monitor */
MCU_EXT_CMD_SMESH_CTRL = 0xae,
@@ -277,10 +277,10 @@
MCU_EXT_CMD_CSI_CTRL = 0xc2,
};
diff --git a/mt7915/init.c b/mt7915/init.c
-index e4f6617f..25a9b5de 100644
+index 0d5109a3..b549fa04 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -573,7 +573,7 @@ static void mt7915_init_work(struct work_struct *work)
+@@ -576,7 +576,7 @@ static void mt7915_init_work(struct work_struct *work)
struct mt7915_dev *dev = container_of(work, struct mt7915_dev,
init_work);
@@ -290,10 +290,10 @@
mt7915_init_txpower(dev, &dev->mphy.sband_2g.sband);
mt7915_init_txpower(dev, &dev->mphy.sband_5g.sband);
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index ffb0037b..12afb204 100644
+index 05932707..8fd46183 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
-@@ -914,17 +914,39 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi,
+@@ -565,17 +565,39 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi,
{
#ifdef CONFIG_NL80211_TESTMODE
struct mt76_testmode_data *td = &phy->mt76->test;
@@ -336,7 +336,7 @@
switch (td->tx_rate_mode) {
case MT76_TM_TX_MODE_HT:
nss = 1 + (rate_idx >> 3);
-@@ -1013,14 +1035,13 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi,
+@@ -664,14 +686,13 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi,
if (mode >= MT_PHY_TYPE_HE_SU)
val |= FIELD_PREP(MT_TXD6_HELTF, td->tx_ltf);
@@ -356,10 +356,10 @@
}
diff --git a/mt7915/main.c b/mt7915/main.c
-index f2a6d9da..942b8a9a 100644
+index 42a0ece7..41bc2c30 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -221,7 +221,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
+@@ -220,7 +220,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
mvif->phy = phy;
mvif->mt76.band_idx = phy->band_idx;
@@ -369,18 +369,10 @@
mvif->mt76.wmm_idx += 2;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 8a3bd33f..8ed8700d 100755
+index e9169ed5..ee3b1d76 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -360,7 +360,6 @@ mt7915_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
- if (mcu_txd->ext_cid) {
- mcu_txd->ext_cid_ack = 1;
-
-- /* do not use Q_SET for efuse */
- if (cmd & __MCU_CMD_FIELD_QUERY)
- mcu_txd->set_query = MCU_Q_QUERY;
- else
-@@ -536,6 +535,11 @@ mt7915_mcu_rx_ext_event(struct mt7915_dev *dev, struct sk_buff *skb)
+@@ -434,6 +434,11 @@ mt7915_mcu_rx_ext_event(struct mt7915_dev *dev, struct sk_buff *skb)
case MCU_EXT_EVENT_BCC_NOTIFY:
mt7915_mcu_rx_bcc_notify(dev, skb);
break;
@@ -392,7 +384,7 @@
default:
break;
}
-@@ -565,6 +569,7 @@ void mt7915_mcu_rx_event(struct mt7915_dev *dev, struct sk_buff *skb)
+@@ -465,6 +470,7 @@ void mt7915_mcu_rx_event(struct mt7915_dev *dev, struct sk_buff *skb)
rxd->ext_eid == MCU_EXT_EVENT_ASSERT_DUMP ||
rxd->ext_eid == MCU_EXT_EVENT_PS_SYNC ||
rxd->ext_eid == MCU_EXT_EVENT_BCC_NOTIFY ||
@@ -400,7 +392,7 @@
!rxd->seq)
mt7915_mcu_rx_unsolicited_event(dev, skb);
else
-@@ -3030,14 +3035,14 @@ static int mt7915_mcu_set_eeprom_flash(struct mt7915_dev *dev)
+@@ -2812,14 +2818,14 @@ static int mt7915_mcu_set_eeprom_flash(struct mt7915_dev *dev)
return 0;
}
@@ -418,10 +410,10 @@
return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(EFUSE_BUFFER_MODE),
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index adf71f10..82c21168 100644
+index d96b1a66..f6b7d1c3 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
-@@ -27,10 +27,15 @@ struct mt7915_mcu_txd {
+@@ -8,10 +8,15 @@
enum {
MCU_ATE_SET_TRX = 0x1,
@@ -436,8 +428,8 @@
+ MCU_ATE_SET_MU_RX_AID = 0x1e,
};
- struct mt7915_mcu_rxd {
-@@ -455,6 +460,12 @@ enum {
+ struct mt7915_mcu_thermal_ctrl {
+@@ -431,6 +436,12 @@ enum {
enum {
MT_BF_SOUNDING_ON = 1,
@@ -450,17 +442,15 @@
MT_BF_TYPE_UPDATE = 20,
MT_BF_MODULE_UPDATE = 25
};
-@@ -681,12 +692,20 @@ struct mt7915_muru {
- #define MURU_OFDMA_SCH_TYPE_DL BIT(0)
+@@ -662,11 +673,19 @@ struct mt7915_muru {
#define MURU_OFDMA_SCH_TYPE_UL BIT(1)
--/* Common Config */
+ /* Common Config */
-#define MURU_COMM_PPDU_FMT BIT(0)
-#define MURU_COMM_SCH_TYPE BIT(1)
-#define MURU_COMM_SET (MURU_COMM_PPDU_FMT | MURU_COMM_SCH_TYPE)
-
-/* DL&UL User config*/
-+/* Common Config */
+/* #define MURU_COMM_PPDU_FMT BIT(0) */
+/* #define MURU_COMM_SCH_TYPE BIT(1) */
+/* #define MURU_COMM_SET (MURU_COMM_PPDU_FMT | MURU_COMM_SCH_TYPE) */
@@ -478,10 +468,10 @@
enum {
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index b3de3a7a..bbf8b16c 100644
+index bccb1084..a84970d7 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
-@@ -73,6 +73,7 @@ static const u32 mt7915_offs[] = {
+@@ -76,6 +76,7 @@ static const u32 mt7915_offs[] = {
[ARB_DRNGR0] = 0x194,
[ARB_SCR] = 0x080,
[RMAC_MIB_AIRTIME14] = 0x3b8,
@@ -489,7 +479,7 @@
[AGG_AWSCR0] = 0x05c,
[AGG_PCR0] = 0x06c,
[AGG_ACR0] = 0x084,
-@@ -147,6 +148,7 @@ static const u32 mt7916_offs[] = {
+@@ -150,6 +151,7 @@ static const u32 mt7916_offs[] = {
[ARB_DRNGR0] = 0x1e0,
[ARB_SCR] = 0x000,
[RMAC_MIB_AIRTIME14] = 0x0398,
@@ -498,10 +488,10 @@
[AGG_PCR0] = 0x040,
[AGG_ACR0] = 0x054,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index cf0630c8..4b375629 100644
+index 20aeca77..1a279844 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -294,6 +294,9 @@ struct mt7915_phy {
+@@ -303,6 +303,9 @@ struct mt7915_phy {
u8 last_snr;
u8 spe_idx;
@@ -511,7 +501,7 @@
} test;
#endif
-@@ -382,6 +385,14 @@ struct mt7915_dev {
+@@ -394,6 +397,14 @@ struct mt7915_dev {
void __iomem *dcm;
void __iomem *sku;
@@ -526,7 +516,7 @@
#ifdef MTK_DEBUG
u16 wlan_idx;
struct {
-@@ -572,7 +583,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
+@@ -570,7 +581,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
void *data, u32 field);
@@ -535,7 +525,7 @@
int mt7915_mcu_get_eeprom(struct mt7915_dev *dev, u32 offset);
int mt7915_mcu_get_eeprom_free_block(struct mt7915_dev *dev, u8 *block_num);
int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
-@@ -605,6 +616,7 @@ int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl);
+@@ -603,6 +614,7 @@ int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl);
int mt7915_mcu_fw_dbg_ctrl(struct mt7915_dev *dev, u32 module, u8 level);
void mt7915_mcu_rx_event(struct mt7915_dev *dev, struct sk_buff *skb);
void mt7915_mcu_exit(struct mt7915_dev *dev);
@@ -544,10 +534,10 @@
static inline u16 mt7915_wtbl_size(struct mt7915_dev *dev)
{
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 99834310..6ba5e9fe 100644
+index 47bae86e..444440e1 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
-@@ -50,6 +50,7 @@ enum offs_rev {
+@@ -51,6 +51,7 @@ enum offs_rev {
ARB_DRNGR0,
ARB_SCR,
RMAC_MIB_AIRTIME14,
@@ -555,7 +545,7 @@
AGG_AWSCR0,
AGG_PCR0,
AGG_ACR0,
-@@ -458,6 +459,8 @@ enum offs_rev {
+@@ -467,6 +468,8 @@ enum offs_rev {
#define MT_WF_AGG_BASE(_band) ((_band) ? 0x820f2000 : 0x820e2000)
#define MT_WF_AGG(_band, ofs) (MT_WF_AGG_BASE(_band) + (ofs))
@@ -565,7 +555,7 @@
(_n) * 4))
#define MT_AGG_PCR0(_band, _n) MT_WF_AGG(_band, (__OFFS(AGG_PCR0) + \
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index e8bf616c..16c9e4ae 100644
+index 123ceaf9..a0a9f7be 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -9,6 +9,9 @@
@@ -660,7 +650,7 @@
}
static int
-@@ -182,11 +230,737 @@ mt7915_tm_set_tam_arb(struct mt7915_phy *phy, bool enable, bool mu)
+@@ -182,12 +230,738 @@ mt7915_tm_set_tam_arb(struct mt7915_phy *phy, bool enable, bool mu)
return mt7915_mcu_set_muru_ctrl(dev, MURU_SET_ARB_OP_MODE, op_mode);
}
@@ -1225,7 +1215,7 @@
+#define BF_CAL_PHASE 21
+ u8 format_id;
+
-+ skb_pull(skb, sizeof(struct mt7915_mcu_rxd));
++ skb_pull(skb, sizeof(struct mt76_connac2_mcu_rxd));
+ format_id = *(u8 *)skb->data;
+
+ if (format_id == BF_PFMU_TAG) {
@@ -1387,10 +1377,11 @@
+}
+
static int
- mt7915_tm_set_wmm_qid(struct mt7915_dev *dev, u8 qid, u8 aifs, u8 cw_min,
+ mt7915_tm_set_wmm_qid(struct mt7915_phy *phy, u8 qid, u8 aifs, u8 cw_min,
- u16 cw_max, u16 txop)
+ u16 cw_max, u16 txop, u8 tx_cmd)
{
+ struct mt7915_vif *mvif = (struct mt7915_vif *)phy->monitor_vif->drv_priv;
- struct mt7915_mcu_tx req = { .total = 1 };
+ struct mt7915_mcu_tx req = {
+ .valid = true,
@@ -1399,10 +1390,10 @@
+ };
struct edca *e = &req.edca[0];
- e->queue = qid;
-@@ -261,7 +1035,8 @@ done:
+ e->queue = qid + mvif->mt76.wmm_idx * MT76_CONNAC_MAX_WMM_SETS;
+@@ -262,7 +1036,8 @@ done:
- return mt7915_tm_set_wmm_qid(dev,
+ return mt7915_tm_set_wmm_qid(phy,
mt76_connac_lmac_mapping(IEEE80211_AC_BE),
- aifsn, cw, cw, 0);
+ aifsn, cw, cw, 0,
@@ -1410,7 +1401,7 @@
}
static int
-@@ -337,7 +1112,7 @@ mt7915_tm_set_tx_len(struct mt7915_phy *phy, u32 tx_time)
+@@ -338,7 +1113,7 @@ mt7915_tm_set_tx_len(struct mt7915_phy *phy, u32 tx_time)
bitrate = cfg80211_calculate_bitrate(&rate);
tx_len = bitrate * tx_time / 10 / 8;
@@ -1419,7 +1410,7 @@
if (ret)
return ret;
-@@ -455,18 +1230,180 @@ mt7915_tm_init(struct mt7915_phy *phy, bool en)
+@@ -456,18 +1231,180 @@ mt7915_tm_init(struct mt7915_phy *phy, bool en)
phy->mt76->test.flag |= MT_TM_FW_RX_COUNT;
@@ -1606,7 +1597,7 @@
}
static void
-@@ -475,47 +1412,48 @@ mt7915_tm_set_tx_frames(struct mt7915_phy *phy, bool en)
+@@ -476,47 +1413,48 @@ mt7915_tm_set_tx_frames(struct mt7915_phy *phy, bool en)
static const u8 spe_idx_map[] = {0, 0, 1, 0, 3, 2, 4, 0,
9, 8, 6, 10, 16, 12, 18, 0};
struct mt76_testmode_data *td = &phy->mt76->test;
@@ -1680,7 +1671,7 @@
mt7915_tm_set_trx(phy, TM_MAC_TX, en);
}
-@@ -544,10 +1482,6 @@ mt7915_tm_get_rx_stats(struct mt7915_phy *phy, bool clear)
+@@ -545,10 +1483,6 @@ mt7915_tm_get_rx_stats(struct mt7915_phy *phy, bool clear)
return ret;
rs_band = (struct mt7915_tm_rx_stat_band *)skb->data;
@@ -1691,7 +1682,7 @@
if (!clear) {
enum mt76_rxq_id q = req.band ? MT_RXQ_EXT : MT_RXQ_MAIN;
-@@ -562,13 +1496,61 @@ mt7915_tm_get_rx_stats(struct mt7915_phy *phy, bool clear)
+@@ -563,13 +1497,61 @@ mt7915_tm_get_rx_stats(struct mt7915_phy *phy, bool clear)
return 0;
}
@@ -1754,7 +1745,7 @@
/* read-clear */
mt7915_tm_get_rx_stats(phy, true);
-@@ -576,9 +1558,12 @@ mt7915_tm_set_rx_frames(struct mt7915_phy *phy, bool en)
+@@ -577,9 +1559,12 @@ mt7915_tm_set_rx_frames(struct mt7915_phy *phy, bool en)
/* clear fw count */
mt7915_tm_set_phy_count(phy, 0);
mt7915_tm_set_phy_count(phy, 1);
@@ -1769,7 +1760,7 @@
}
static int
-@@ -615,35 +1600,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en)
+@@ -616,35 +1601,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en)
tx_cont->center_ch = freq1;
tx_cont->tx_ant = td->tx_antenna_mask;
tx_cont->band = phy != &dev->phy;
@@ -1806,7 +1797,7 @@
if (!en) {
req.op.rf.param.func_data = cpu_to_le32(phy != &dev->phy);
-@@ -727,6 +1684,12 @@ mt7915_tm_update_params(struct mt7915_phy *phy, u32 changed)
+@@ -728,6 +1685,12 @@ mt7915_tm_update_params(struct mt7915_phy *phy, u32 changed)
mt7915_tm_set_freq_offset(phy, en, en ? td->freq_offset : 0);
if (changed & BIT(TM_CHANGED_TXPOWER))
mt7915_tm_set_tx_power(phy);
@@ -1819,7 +1810,7 @@
}
static int
-@@ -800,6 +1763,7 @@ static int
+@@ -801,6 +1764,7 @@ static int
mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg)
{
struct mt7915_phy *phy = mphy->priv;
@@ -1827,7 +1818,7 @@
void *rx, *rssi;
int i;
-@@ -845,11 +1809,68 @@ mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg)
+@@ -846,11 +1810,68 @@ mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg)
nla_nest_end(msg, rx);