[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-devtools/atenl/files/src/main.c b/recipes-devtools/atenl/files/src/main.c
index 36ac8f3..d6526ac 100644
--- a/recipes-devtools/atenl/files/src/main.c
+++ b/recipes-devtools/atenl/files/src/main.c
@@ -186,7 +186,7 @@
} else {
atenl_info("Currently using bridge name: %s\n", an->bridge_name);
}
-
+
/* background ourself */
if (!fork()) {
ret = atenl_eeprom_init(an, phy_idx);
diff --git a/recipes-kernel/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch b/recipes-kernel/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
index 19408f7..9339794 100644
--- a/recipes-kernel/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
+++ b/recipes-kernel/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
@@ -8,8 +8,8 @@
mt76_connac.h | 1 +
mt7915/mac.c | 11 +++++++----
mt7915/main.c | 4 ++--
- mt7915/mmio.c | 10 +++++++++-
- 4 files changed, 19 insertions(+), 7 deletions(-)
+ mt7915/mmio.c | 12 ++++++++++--
+ 4 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/mt76_connac.h b/mt76_connac.h
index 0915eb57..9a468878 100644
@@ -27,7 +27,7 @@
index 961b7afc..65e47f95 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
-@@ -826,9 +826,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
+@@ -828,9 +828,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
txp->token = cpu_to_le16(token_id);
txp->nbuf = 1;
@@ -39,7 +39,7 @@
}
static void
-@@ -944,6 +944,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
+@@ -946,6 +946,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
LIST_HEAD(free_list);
void *end = data + len;
bool v3, wake = false;
@@ -47,7 +47,7 @@
u16 total, count = 0;
u32 txd = le32_to_cpu(free->txd);
__le32 *cur_info;
-@@ -999,12 +1000,14 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
+@@ -1001,12 +1002,14 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
txwi = mt76_token_release(mdev, msdu, &wake);
if (!txwi)
continue;
@@ -98,6 +98,15 @@
module_param(wed_enable, bool, 0644);
static const u32 mt7915_reg[] = {
+@@ -525,7 +525,7 @@ static void mt7915_mmio_wed_offload_disable(struct mtk_wed_device *wed)
+ dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
+
+ spin_lock_bh(&dev->mt76.token_lock);
+- dev->mt76.token_size = MT7915_TOKEN_SIZE;
++ dev->mt76.token_size = wed->wlan.token_start;//MT7915_TOKEN_SIZE
+ spin_unlock_bh(&dev->mt76.token_lock);
+
+ /* MT_TXD5_TX_STATUS_HOST (MPDU format) has higher priority than
@@ -556,6 +556,9 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
wed->wlan.pci_dev = pci_dev;
diff --git a/recipes-kernel/linux-mt76/files/patches/3002-mt76-mt7915-add-wed-tx-wds-support-on-mt7986.patch b/recipes-kernel/linux-mt76/files/patches/3002-mt76-mt7915-add-wed-tx-wds-support-on-mt7986.patch
index 910365d..8addd3c 100644
--- a/recipes-kernel/linux-mt76/files/patches/3002-mt76-mt7915-add-wed-tx-wds-support-on-mt7986.patch
+++ b/recipes-kernel/linux-mt76/files/patches/3002-mt76-mt7915-add-wed-tx-wds-support-on-mt7986.patch
@@ -8,12 +8,12 @@
mac80211.c | 5 ++++-
mt76.h | 2 ++
mt7915/init.c | 9 +++++++++
- mt7915/main.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
+ mt7915/main.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
mt7915/mcu.c | 12 ++++++++++--
mt7915/mcu.h | 1 +
mt7915/mmio.c | 3 +++
mt7915/mt7915.h | 4 ++++
- 8 files changed, 75 insertions(+), 5 deletions(-)
+ 8 files changed, 76 insertions(+), 5 deletions(-)
diff --git a/mac80211.c b/mac80211.c
index b7c1b13..7571e83 100644
@@ -24,7 +24,7 @@
mt76_packet_id_flush(dev, wcid);
- mt76_wcid_mask_clear(dev->wcid_mask, idx);
-+ if (dev->drv->wed_wds_check(dev, sta))
++ if (dev->drv->wed_wds_check && dev->drv->wed_wds_check(dev, sta))
+ mt76_wcid_mask_clear(dev->wcid_wds_mask, idx);
+ else
+ mt76_wcid_mask_clear(dev->wcid_mask, idx);
@@ -120,7 +120,7 @@
if (idx < 0)
return -ENOSPC;
-@@ -1125,6 +1153,14 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
+@@ -1125,6 +1153,15 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
else
clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
@@ -129,13 +129,14 @@
+ (msta->wcid.idx < MT7915_WTBL_WDS_START ||
+ msta->wcid.idx > MT7915_WTBL_WDS_END)) {
+ mt7915_sta_remove(hw, vif, sta);
++ mt76_sta_pre_rcu_remove(hw, vif, sta);
+ mt7915_sta_add(hw, vif, sta);
+ }
+
mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
}
-@@ -1464,7 +1500,11 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1464,7 +1501,11 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
path->dev = ctx->dev;
path->mtk_wdma.wdma_idx = wed->wdma_idx;
path->mtk_wdma.bss = mvif->mt76.idx;
@@ -194,7 +195,7 @@
index 1eda361..6f0f262 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
-@@ -589,6 +589,8 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+@@ -596,6 +596,8 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
wed->wlan.init_buf = mt7915_wed_init_buf;
wed->wlan.offload_enable = mt7915_mmio_wed_offload_enable;
wed->wlan.offload_disable = mt7915_mmio_wed_offload_disable;
@@ -203,7 +204,7 @@
if (mtk_wed_device_attach(wed))
return 0;
-@@ -802,6 +804,7 @@ struct mt7915_dev *mt7915_mmio_probe(struct device *pdev,
+@@ -810,6 +812,7 @@ struct mt7915_dev *mt7915_mmio_probe(struct device *pdev,
.sta_add = mt7915_mac_sta_add,
.sta_remove = mt7915_mac_sta_remove,
.update_survey = mt7915_update_channel,
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
index 1f58eba..b86c1b9 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
@@ -673,74 +673,7 @@
return -1;
}
-#if defined(CONFIG_MEDIATEK_NETSYS_V2)
-unsigned int do_hnat_mape_w2l(struct sk_buff *skb, const struct net_device *in,
- const char *func)
-{
- struct ipv6hdr *ip6h = ipv6_hdr(skb);
- struct iphdr _iphdr;
- struct iphdr *iph;
- struct foe_entry *entry;
- struct tcpudphdr _ports;
- const struct tcpudphdr *pptr;
- int udp = 0;
-
- /* WAN -> LAN/WLAN MapE learn info(include innner IPv4 header info). */
- if (ip6h->nexthdr == NEXTHDR_IPIP) {
- entry = &hnat_priv->foe_table_cpu[skb_hnat_ppe(skb)][skb_hnat_entry(skb)];
-
- entry->ipv4_dslite.tunnel_sipv6_0 =
- ntohl(ip6h->saddr.s6_addr32[0]);
- entry->ipv4_dslite.tunnel_sipv6_1 =
- ntohl(ip6h->saddr.s6_addr32[1]);
- entry->ipv4_dslite.tunnel_sipv6_2 =
- ntohl(ip6h->saddr.s6_addr32[2]);
- entry->ipv4_dslite.tunnel_sipv6_3 =
- ntohl(ip6h->saddr.s6_addr32[3]);
-
- entry->ipv4_dslite.tunnel_dipv6_0 =
- ntohl(ip6h->daddr.s6_addr32[0]);
- entry->ipv4_dslite.tunnel_dipv6_1 =
- ntohl(ip6h->daddr.s6_addr32[1]);
- entry->ipv4_dslite.tunnel_dipv6_2 =
- ntohl(ip6h->daddr.s6_addr32[2]);
- entry->ipv4_dslite.tunnel_dipv6_3 =
- ntohl(ip6h->daddr.s6_addr32[3]);
-
- ppe_fill_flow_lbl(entry, ip6h);
-
- iph = skb_header_pointer(skb, IPV6_HDR_LEN,
- sizeof(_iphdr), &_iphdr);
- if (unlikely(!iph))
- return NF_ACCEPT;
-
- switch (iph->protocol) {
- case IPPROTO_UDP:
- udp = 1;
- case IPPROTO_TCP:
- break;
-
- default:
- return NF_ACCEPT;
- }
-
- pptr = skb_header_pointer(skb, IPV6_HDR_LEN + iph->ihl * 4,
- sizeof(_ports), &_ports);
- if (unlikely(!pptr))
- return NF_ACCEPT;
-
- entry->bfib1.udp = udp;
- entry->ipv4_mape.new_sip = ntohl(iph->saddr);
- entry->ipv4_mape.new_dip = ntohl(iph->daddr);
- entry->ipv4_mape.new_sport = ntohs(pptr->src);
- entry->ipv4_mape.new_dport = ntohs(pptr->dst);
-
- return 0;
- }
- return -1;
-}
-#endif
static unsigned int is_ppe_support_type(struct sk_buff *skb)
{
@@ -824,22 +757,19 @@
goto drop;
}
+
+#if !(defined(CONFIG_MEDIATEK_NETSYS_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3))
/* MapE need remove ipv6 header and pingpong. */
if (do_mape_w2l_fast(state->in, skb)) {
-#if defined(CONFIG_MEDIATEK_NETSYS_V2)
- if (mape_toggle && do_hnat_mape_w2l(skb, state->in, __func__))
- return NF_ACCEPT;
-#else
if (!do_hnat_mape_w2l_fast(skb, state->in, __func__))
return NF_STOLEN;
else
return NF_ACCEPT;
-#endif
}
if (is_from_mape(skb))
clr_from_extge(skb);
-
+#endif
return NF_ACCEPT;
drop:
printk_ratelimited(KERN_WARNING
@@ -958,6 +888,7 @@
}
}
+#if !(defined(CONFIG_MEDIATEK_NETSYS_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3))
/* MapE need remove ipv6 header and pingpong. (bridge mode) */
if (do_mape_w2l_fast(state->in, skb)) {
if (!do_hnat_mape_w2l_fast(skb, state->in, __func__))
@@ -965,7 +896,7 @@
else
return NF_ACCEPT;
}
-
+#endif
return NF_ACCEPT;
drop:
printk_ratelimited(KERN_WARNING
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c
index 062abae..27d13b9 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c
@@ -77,6 +77,9 @@
#define MTK_PHY_TANA_CAL_MODE (0xc1)
#define MTK_PHY_TANA_CAL_MODE_SHIFT (8)
+#define MTK_PHY_RXADC_CTRL_RG7 (0xc6)
+#define MTK_PHY_DA_AD_BUF_BIAS_LP_MASK GENMASK(9, 8)
+
#define MTK_PHY_RXADC_CTRL_RG9 (0xc8)
#define MTK_PHY_DA_RX_PSBN_TBT_MASK GENMASK(14, 12)
#define MTK_PHY_DA_RX_PSBN_HBT_MASK GENMASK(10, 8)
@@ -885,7 +888,24 @@
phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[i]);
}
+ /* TCT finetune */
phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_TX_FILTER, 0x5);
+
+ /* Disable TX power saving */
+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG7,
+ MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3);
+
+ /* Slave mode finetune*/
+ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
+ __phy_write(phydev, 0x12, 0x0);
+ __phy_write(phydev, 0x11, 0x700);
+ __phy_write(phydev, 0x10, 0x9686);
+
+ __phy_write(phydev, 0x12, 0x0);
+ __phy_write(phydev, 0x11, 0x64);
+ __phy_write(phydev, 0x10, 0x8f82);
+ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
+
}
static int mt798x_phy_calibration(struct phy_device *phydev)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986.cfg b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986.cfg
index a6664da..a8ecb3d 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986.cfg
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986.cfg
@@ -301,6 +301,7 @@
# CONFIG_MEDIATEK_GE_PHY is not set
CONFIG_MEDIATEK_MT6577_AUXADC=y
CONFIG_MEDIATEK_NETSYS_V2=y
+# CONFIG_MEDIATEK_NETSYS_V3 is not set
CONFIG_MEDIATEK_WATCHDOG=y
CONFIG_MEDIA_SUPPORT=y
CONFIG_MEMFD_CREATE=y