[rdk-b][common][bsp][Refactor and sync kernel/wifi from Openwrt]
[Description]
Refactor and sync kernel/wifi from Openwrt
[Release-log]
N/A
diff --git a/recipes-wifi/linux-mt76/files/patches/1111-mt76-testmode-additional-supports.patch b/recipes-wifi/linux-mt76/files/patches/1111-mt76-testmode-additional-supports.patch
index 3ca4b85..78ab5ee 100644
--- a/recipes-wifi/linux-mt76/files/patches/1111-mt76-testmode-additional-supports.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1111-mt76-testmode-additional-supports.patch
@@ -1,7 +1,7 @@
-From 8758539453946b5e3941f2e46d7ae4f933823dd2 Mon Sep 17 00:00:00 2001
+From b30eb7fc2770ee278bfcf775dc8eca0710cf9d65 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 1111/1128] mt76: testmode: additional supports
+Subject: [PATCH 1111/1127] mt76: testmode: additional supports
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
@@ -18,19 +18,19 @@
mt7915/mmio.c | 2 +
mt7915/mt7915.h | 14 +-
mt7915/regs.h | 3 +
- mt7915/testmode.c | 1171 ++++++++++++++++++++++++++++++++++++++++++---
+ mt7915/testmode.c | 1170 ++++++++++++++++++++++++++++++++++++++++++---
mt7915/testmode.h | 278 +++++++++++
testmode.c | 275 +++++++++--
testmode.h | 75 +++
tools/fields.c | 80 ++++
tx.c | 3 +-
- 19 files changed, 1962 insertions(+), 147 deletions(-)
+ 19 files changed, 1962 insertions(+), 146 deletions(-)
diff --git a/dma.c b/dma.c
-index 4b181305..82b4da26 100644
+index ae22b959..d2891c64 100644
--- a/dma.c
+++ b/dma.c
-@@ -426,8 +426,7 @@ free:
+@@ -535,8 +535,7 @@ free:
if (mt76_is_testmode_skb(dev, skb, &hw)) {
struct mt76_phy *phy = hw->priv;
@@ -41,7 +41,7 @@
#endif
diff --git a/mac80211.c b/mac80211.c
-index e5d8f45b..4b63ec69 100644
+index 9a908c9a..f8ca7ba1 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -55,6 +55,13 @@ static const struct ieee80211_channel mt76_channels_5ghz[] = {
@@ -71,10 +71,10 @@
static const struct ieee80211_channel mt76_channels_6ghz[] = {
diff --git a/mt76.h b/mt76.h
-index 3a177fff..e79d74a4 100644
+index 0d87f135..32e2dea0 100644
--- a/mt76.h
+++ b/mt76.h
-@@ -624,6 +624,21 @@ struct mt76_testmode_ops {
+@@ -635,6 +635,21 @@ struct mt76_testmode_ops {
int (*set_params)(struct mt76_phy *phy, struct nlattr **tb,
enum mt76_testmode_state new_state);
int (*dump_stats)(struct mt76_phy *phy, struct sk_buff *msg);
@@ -96,7 +96,7 @@
};
#define MT_TM_FW_RX_COUNT BIT(0)
-@@ -632,16 +647,11 @@ struct mt76_testmode_data {
+@@ -643,16 +658,11 @@ struct mt76_testmode_data {
enum mt76_testmode_state state;
u32 param_set[DIV_ROUND_UP(NUM_MT76_TM_ATTRS, 32)];
@@ -113,7 +113,7 @@
u8 tx_rate_stbc;
u8 tx_ltf;
-@@ -657,10 +667,37 @@ struct mt76_testmode_data {
+@@ -668,10 +678,37 @@ struct mt76_testmode_data {
u8 tx_power[4];
u8 tx_power_control;
@@ -152,7 +152,7 @@
u32 tx_pending;
u32 tx_queued;
u16 tx_queued_limit;
-@@ -1115,6 +1152,59 @@ static inline bool mt76_testmode_enabled(struct mt76_phy *phy)
+@@ -1132,6 +1169,59 @@ static inline bool mt76_testmode_enabled(struct mt76_phy *phy)
#endif
}
@@ -212,7 +212,7 @@
static inline bool mt76_is_testmode_skb(struct mt76_dev *dev,
struct sk_buff *skb,
struct ieee80211_hw **hw)
-@@ -1125,7 +1215,8 @@ static inline bool mt76_is_testmode_skb(struct mt76_dev *dev,
+@@ -1142,7 +1232,8 @@ static inline bool mt76_is_testmode_skb(struct mt76_dev *dev,
for (i = 0; i < ARRAY_SIZE(dev->phys); i++) {
struct mt76_phy *phy = dev->phys[i];
@@ -222,7 +222,7 @@
*hw = dev->phys[i]->hw;
return true;
}
-@@ -1227,7 +1318,8 @@ int mt76_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1244,7 +1335,8 @@ int mt76_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
int mt76_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb,
struct netlink_callback *cb, void *data, int len);
int mt76_testmode_set_state(struct mt76_phy *phy, enum mt76_testmode_state state);
@@ -233,10 +233,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 7ab491d6..afdd42ff 100644
+index a48903ca..4f17954e 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
-@@ -393,6 +393,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb,
+@@ -394,6 +394,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb,
switch (vif->type) {
case NL80211_IFTYPE_MESH_POINT:
case NL80211_IFTYPE_AP:
@@ -244,7 +244,7 @@
if (vif->p2p)
conn_type = CONNECTION_P2P_GC;
else
-@@ -574,6 +575,9 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev,
+@@ -575,6 +576,9 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev,
rx->rca2 = 1;
rx->rv = 1;
@@ -255,10 +255,10 @@
return;
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index c4262f39..858a2676 100644
+index 172a926a..e10e92b6 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
-@@ -980,6 +980,7 @@ enum {
+@@ -983,6 +983,7 @@ enum {
MCU_EXT_EVENT_FW_LOG_2_HOST = 0x13,
MCU_EXT_EVENT_THERMAL_PROTECT = 0x22,
MCU_EXT_EVENT_ASSERT_DUMP = 0x23,
@@ -266,7 +266,7 @@
MCU_EXT_EVENT_RDD_REPORT = 0x3a,
MCU_EXT_EVENT_CSA_NOTIFY = 0x4f,
MCU_EXT_EVENT_BCC_NOTIFY = 0x75,
-@@ -1158,6 +1159,7 @@ enum {
+@@ -1184,6 +1185,7 @@ enum {
MCU_EXT_CMD_PHY_STAT_INFO = 0xad,
/* for vendor csi and air monitor */
MCU_EXT_CMD_SMESH_CTRL = 0xae,
@@ -275,10 +275,10 @@
MCU_EXT_CMD_CSI_CTRL = 0xc2,
};
diff --git a/mt7915/init.c b/mt7915/init.c
-index 442e19e8..69465dd0 100644
+index d4105835..2f3453b0 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -600,7 +600,7 @@ static void mt7915_init_work(struct work_struct *work)
+@@ -603,7 +603,7 @@ static void mt7915_init_work(struct work_struct *work)
struct mt7915_dev *dev = container_of(work, struct mt7915_dev,
init_work);
@@ -288,10 +288,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 d0aa305a..9af86163 100644
+index 28c6ab35..3b144ad0 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
-@@ -597,16 +597,38 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi,
+@@ -629,16 +629,38 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi,
{
#ifdef CONFIG_NL80211_TESTMODE
struct mt76_testmode_data *td = &phy->mt76->test;
@@ -333,7 +333,7 @@
switch (td->tx_rate_mode) {
case MT76_TM_TX_MODE_HT:
-@@ -696,13 +718,14 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi,
+@@ -728,13 +750,14 @@ 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);
@@ -351,7 +351,7 @@
#endif
}
-@@ -1452,7 +1475,7 @@ mt7915_mac_restart(struct mt7915_dev *dev)
+@@ -1483,7 +1506,7 @@ mt7915_mac_restart(struct mt7915_dev *dev)
goto out;
/* set the necessary init items */
@@ -361,7 +361,7 @@
goto out;
diff --git a/mt7915/main.c b/mt7915/main.c
-index 97bf5117..b4564e33 100644
+index 75073363..e84d6132 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -223,7 +223,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
@@ -374,10 +374,10 @@
mvif->mt76.wmm_idx += 2;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 2a18dd53..adc14d53 100644
+index 696ca11b..5687e136 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -363,6 +363,11 @@ mt7915_mcu_rx_ext_event(struct mt7915_dev *dev, struct sk_buff *skb)
+@@ -367,6 +367,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;
@@ -389,7 +389,7 @@
default:
break;
}
-@@ -394,6 +399,7 @@ void mt7915_mcu_rx_event(struct mt7915_dev *dev, struct sk_buff *skb)
+@@ -398,6 +403,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 ||
@@ -397,7 +397,7 @@
!rxd->seq)
mt7915_mcu_rx_unsolicited_event(dev, skb);
else
-@@ -2755,14 +2761,14 @@ static int mt7915_mcu_set_eeprom_flash(struct mt7915_dev *dev)
+@@ -2781,14 +2787,14 @@ static int mt7915_mcu_set_eeprom_flash(struct mt7915_dev *dev)
return 0;
}
@@ -415,7 +415,7 @@
return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(EFUSE_BUFFER_MODE),
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 8eaf984a..1388eda0 100644
+index 6a145aef..4bc58c98 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -8,10 +8,15 @@
@@ -434,7 +434,7 @@
};
struct mt7915_mcu_thermal_ctrl {
-@@ -434,6 +439,12 @@ enum {
+@@ -464,6 +469,12 @@ enum {
enum {
MT_BF_SOUNDING_ON = 1,
@@ -447,7 +447,7 @@
MT_BF_TYPE_UPDATE = 20,
MT_BF_MODULE_UPDATE = 25
};
-@@ -668,10 +679,19 @@ struct mt7915_muru {
+@@ -698,10 +709,19 @@ struct mt7915_muru {
#define MURU_OFDMA_SCH_TYPE_UL BIT(1)
/* Common Config */
@@ -472,10 +472,10 @@
enum {
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 813d6f40..63b66e40 100644
+index 19518cb5..fef4b126 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
-@@ -127,6 +127,7 @@ static const u32 mt7915_offs[] = {
+@@ -132,6 +132,7 @@ static const u32 mt7915_offs[] = {
[ARB_DRNGR0] = 0x194,
[ARB_SCR] = 0x080,
[RMAC_MIB_AIRTIME14] = 0x3b8,
@@ -483,7 +483,7 @@
[AGG_AWSCR0] = 0x05c,
[AGG_PCR0] = 0x06c,
[AGG_ACR0] = 0x084,
-@@ -202,6 +203,7 @@ static const u32 mt7916_offs[] = {
+@@ -207,6 +208,7 @@ static const u32 mt7916_offs[] = {
[ARB_DRNGR0] = 0x1e0,
[ARB_SCR] = 0x000,
[RMAC_MIB_AIRTIME14] = 0x0398,
@@ -492,10 +492,10 @@
[AGG_PCR0] = 0x040,
[AGG_ACR0] = 0x054,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 6458e356..0217c6c3 100644
+index e6c000a7..cf7fcdfc 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -314,6 +314,9 @@ struct mt7915_phy {
+@@ -316,6 +316,9 @@ struct mt7915_phy {
u8 last_snr;
u8 spe_idx;
@@ -505,7 +505,7 @@
} test;
#endif
-@@ -413,6 +416,14 @@ struct mt7915_dev {
+@@ -415,6 +418,14 @@ struct mt7915_dev {
void __iomem *dcm;
void __iomem *sku;
@@ -520,7 +520,7 @@
#ifdef MTK_DEBUG
u16 wlan_idx;
struct {
-@@ -584,7 +595,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
+@@ -586,7 +597,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
void *data, u32 field);
@@ -529,7 +529,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,
-@@ -617,6 +628,7 @@ int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl);
+@@ -623,6 +634,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);
@@ -538,10 +538,10 @@
static inline u16 mt7915_wtbl_size(struct mt7915_dev *dev)
{
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 947f02f2..3bf9e150 100644
+index 688f7dee..ae4695ae 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
-@@ -61,6 +61,7 @@ enum offs_rev {
+@@ -62,6 +62,7 @@ enum offs_rev {
ARB_DRNGR0,
ARB_SCR,
RMAC_MIB_AIRTIME14,
@@ -549,7 +549,7 @@
AGG_AWSCR0,
AGG_PCR0,
AGG_ACR0,
-@@ -481,6 +482,8 @@ enum offs_rev {
+@@ -482,6 +483,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))
@@ -559,7 +559,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 8d99edcb..8f250db1 100644
+index 931d1db2..d9d43cb7 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -9,6 +9,9 @@
@@ -635,7 +635,7 @@
.testmode_en = 1,
.param_idx = MCU_ATE_CLEAN_TXQUEUE,
- .param.clean.wcid = wcid,
- .param.clean.band = phy != &dev->phy,
+ .param.clean.band = phy->band_idx,
};
- return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(ATE_CTRL), &req,
@@ -1762,11 +1762,10 @@
}
static int
-@@ -613,35 +1598,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en)
- tx_cont->center_ch = freq1;
+@@ -614,34 +1599,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en)
tx_cont->tx_ant = td->tx_antenna_mask;
- tx_cont->band = phy != &dev->phy;
--
+ tx_cont->band = phy->band_idx;
+
- switch (chandef->width) {
- case NL80211_CHAN_WIDTH_40:
- tx_cont->bw = CMD_CBW_40MHZ;
@@ -1798,8 +1797,8 @@
+ tx_cont->bw = mt7915_tm_chan_bw(chandef->width);
if (!en) {
- req.op.rf.param.func_data = cpu_to_le32(phy != &dev->phy);
-@@ -725,6 +1682,12 @@ mt7915_tm_update_params(struct mt7915_phy *phy, u32 changed)
+ req.op.rf.param.func_data = cpu_to_le32(phy->band_idx);
+@@ -725,6 +1683,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);
@@ -1812,7 +1811,7 @@
}
static int
-@@ -804,6 +1767,7 @@ static int
+@@ -804,6 +1768,7 @@ static int
mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg)
{
struct mt7915_phy *phy = mphy->priv;
@@ -1820,7 +1819,7 @@
void *rx, *rssi;
int i;
-@@ -849,11 +1813,68 @@ mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg)
+@@ -849,11 +1814,68 @@ mt7915_tm_dump_stats(struct mt76_phy *mphy, struct sk_buff *msg)
nla_nest_end(msg, rx);
@@ -2903,7 +2902,7 @@
};
diff --git a/tx.c b/tx.c
-index 65e2b7c1..8b33186b 100644
+index c8d78b0a..c7cd842c 100644
--- a/tx.c
+++ b/tx.c
@@ -245,8 +245,7 @@ void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *