[][MAC80211][eth][Refactor internal patches]

[Description]
Refactor internal patches.

Refactor internal patches since coherent DMA functions have been
merged to the ETH driver.

[Release-log]
N/A


Change-Id: I3b3f4bd7122e9bc009bf6cb03962b1de27ed6978
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7216566
diff --git a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9990-mt7622-backport-nf-hw-offload-framework-and-ups.patch b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9990-mt7622-backport-nf-hw-offload-framework-and-ups.patch
index 42ebe98..13b754e 100755
--- a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9990-mt7622-backport-nf-hw-offload-framework-and-ups.patch
+++ b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9990-mt7622-backport-nf-hw-offload-framework-and-ups.patch
@@ -224,15 +224,14 @@
  };
  
  /* struct mtk_mac -	the structure that holds the info about the MACs of the
-@@ -1319,4 +1333,8 @@ int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id);
- void mtk_gdm_config(struct mtk_eth *eth, u32 config);
- void ethsys_reset(struct mtk_eth *eth, u32 reset_bits);
+@@ -1319,4 +1333,7 @@ int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id);
+ void mtk_usxgmii_reset(struct mtk_xgmii *ss, int mac_id);
+ int mtk_dump_usxgmii(struct regmap *pmap, char *name, u32 offset, u32 range);
  
 +int mtk_eth_offload_init(struct mtk_eth *eth);
 +int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type,
 +		     void *type_data);
-+
- int mtk_mac2xgmii_id(struct mtk_eth *eth, int mac_id);
+ void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev);
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
 new file mode 100644
 index 000000000..66298e223
diff --git a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9993-add-wed.patch b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9993-add-wed.patch
index b4f8e4e..04e4edc 100755
--- a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9993-add-wed.patch
+++ b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9993-add-wed.patch
@@ -138,14 +138,6 @@
 index 819d8a0be..2121335a1
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -9,6 +9,7 @@
- #include <linux/of_device.h>
- #include <linux/of_mdio.h>
- #include <linux/of_net.h>
-+#include <linux/of_address.h>
- #include <linux/mfd/syscon.h>
- #include <linux/regmap.h>
- #include <linux/clk.h>
 @@ -20,12 +21,14 @@
  #include <linux/pinctrl/devinfo.h>
  #include <linux/phylink.h>
@@ -161,84 +153,6 @@
  
  #if defined(CONFIG_NET_MEDIATEK_HNAT) || defined(CONFIG_NET_MEDIATEK_HNAT_MODULE)
  #include "mtk_hnat/nf_hnat_mtk.h"
-@@ -1116,7 +1119,7 @@ static int mtk_init_fq_dma(struct mtk_et
- 	int i;
- 
- 	if (!eth->soc->has_sram) {
--		eth->scratch_ring = dma_alloc_coherent(eth->dev,
-+		eth->scratch_ring = dma_alloc_coherent(eth->dma_dev,
- 					       cnt * soc->txrx.txd_size,
- 					       &eth->phy_scratch_ring,
- 					       GFP_KERNEL);
-@@ -1134,10 +1137,10 @@ static int mtk_init_fq_dma(struct mtk_et
- 	if (unlikely(!eth->scratch_head))
- 		return -ENOMEM;
- 
--	dma_addr = dma_map_single(eth->dev,
-+	dma_addr = dma_map_single(eth->dma_dev,
- 				  eth->scratch_head, cnt * MTK_QDMA_PAGE_SIZE,
- 				  DMA_FROM_DEVICE);
--	if (unlikely(dma_mapping_error(eth->dev, dma_addr)))
-+	if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr)))
- 		return -ENOMEM;
- 
- 	phy_ring_tail = eth->phy_scratch_ring +
-@@ -1201,26 +1204,26 @@ static void mtk_tx_unmap(struct mtk_eth
- {
- 	if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) {
- 		if (tx_buf->flags & MTK_TX_FLAGS_SINGLE0) {
--			dma_unmap_single(eth->dev,
-+			dma_unmap_single(eth->dma_dev,
- 					 dma_unmap_addr(tx_buf, dma_addr0),
- 					 dma_unmap_len(tx_buf, dma_len0),
- 					 DMA_TO_DEVICE);
- 		} else if (tx_buf->flags & MTK_TX_FLAGS_PAGE0) {
--			dma_unmap_page(eth->dev,
-+			dma_unmap_page(eth->dma_dev,
- 				       dma_unmap_addr(tx_buf, dma_addr0),
- 				       dma_unmap_len(tx_buf, dma_len0),
- 				       DMA_TO_DEVICE);
- 		}
- 	} else {
- 		if (dma_unmap_len(tx_buf, dma_len0)) {
--			dma_unmap_page(eth->dev,
-+			dma_unmap_page(eth->dma_dev,
- 				       dma_unmap_addr(tx_buf, dma_addr0),
- 				       dma_unmap_len(tx_buf, dma_len0),
- 				       DMA_TO_DEVICE);
- 		}
- 
- 		if (dma_unmap_len(tx_buf, dma_len1)) {
--			dma_unmap_page(eth->dev,
-+			dma_unmap_page(eth->dma_dev,
- 				       dma_unmap_addr(tx_buf, dma_addr1),
- 				       dma_unmap_len(tx_buf, dma_len1),
- 				       DMA_TO_DEVICE);
-@@ -1454,9 +1457,9 @@ static int mtk_tx_map(struct sk_buff *sk
- 	itx_buf = mtk_desc_to_tx_buf(ring, itxd, soc->txrx.txd_size);
- 	memset(itx_buf, 0, sizeof(*itx_buf));
- 
--	txd_info.addr = dma_map_single(eth->dev, skb->data, txd_info.size,
-+	txd_info.addr = dma_map_single(eth->dma_dev, skb->data, txd_info.size,
- 				       DMA_TO_DEVICE);
--	if (unlikely(dma_mapping_error(eth->dev, txd_info.addr)))
-+	if (unlikely(dma_mapping_error(eth->dma_dev, txd_info.addr)))
- 		return -ENOMEM;
- 
- 	mtk_tx_set_dma_desc(skb, dev, itxd, &txd_info);
-@@ -1497,10 +1500,10 @@ static int mtk_tx_map(struct sk_buff *sk
- 			txd_info.qid = skb->mark & MTK_QDMA_TX_MASK;
- 			txd_info.last = i == skb_shinfo(skb)->nr_frags - 1 &&
- 					!(frag_size - txd_info.size);
--			txd_info.addr = skb_frag_dma_map(eth->dev, frag,
-+			txd_info.addr = skb_frag_dma_map(eth->dma_dev, frag,
- 							 offset, txd_info.size,
- 							 DMA_TO_DEVICE);
--			if (unlikely(dma_mapping_error(eth->dev, txd_info.addr)))
-+			if (unlikely(dma_mapping_error(eth->dma_dev, txd_info.addr)))
-  				goto err_dma;
- 
- 			mtk_tx_set_dma_desc(skb, dev, txd, &txd_info);
 @@ -1737,6 +1740,7 @@ static int mtk_poll_rx(struct napi_struc
  		struct net_device *netdev = NULL;
  		unsigned int pktlen;
@@ -247,30 +161,6 @@
  		int mac = 0;
  
  		if (eth->hwlro)
-@@ -1787,12 +1791,12 @@ static int mtk_poll_rx(struct napi_struc
- 			netdev->stats.rx_dropped++;
- 			goto release_desc;
- 		}
--		dma_addr = dma_map_single(eth->dev,
-+		dma_addr = dma_map_single(eth->dma_dev,
- 					  new_data + NET_SKB_PAD +
- 					  eth->ip_align,
- 					  ring->buf_size,
- 					  DMA_FROM_DEVICE);
--		if (unlikely(dma_mapping_error(eth->dev, dma_addr))) {
-+		if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr))) {
- 			skb_free_frag(new_data);
- 			netdev->stats.rx_dropped++;
- 			goto release_desc;
-@@ -1801,7 +1805,7 @@ static int mtk_poll_rx(struct napi_struc
- 		addr64 = (MTK_HAS_CAPS(eth->soc->caps, MTK_8GB_ADDRESSING)) ?
- 			  ((u64)(trxd.rxd2 & 0xf)) << 32 : 0;
- 
--		dma_unmap_single(eth->dev,
-+		dma_unmap_single(eth->dma_dev,
- 				 (u64)(trxd.rxd1 | addr64),
- 				 ring->buf_size, DMA_FROM_DEVICE);
- 
 @@ -1827,6 +1831,17 @@ static int mtk_poll_rx(struct napi_struc
  			skb_checksum_none_assert(skb);
  		skb->protocol = eth_type_trans(skb, netdev);
@@ -289,91 +179,6 @@
  		if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
  			if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) ||
  			    MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) {
-@@ -2120,7 +2135,7 @@ static int mtk_tx_alloc(struct mtk_eth *
- 		goto no_tx_mem;
- 
- 	if (!eth->soc->has_sram)
--		ring->dma = dma_alloc_coherent(eth->dev, MTK_DMA_SIZE * sz,
-+		ring->dma = dma_alloc_coherent(eth->dma_dev, MTK_DMA_SIZE * sz,
- 					       &ring->phys, GFP_KERNEL);
- 	else {
- 		ring->dma =  eth->scratch_ring + MTK_DMA_SIZE * sz;
-@@ -2154,7 +2169,7 @@ static int mtk_tx_alloc(struct mtk_eth *
- 	 * descriptors in ring->dma_pdma.
- 	 */
- 	if (!MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) {
--		ring->dma_pdma = dma_alloc_coherent(eth->dev, MTK_DMA_SIZE * sz,
-+		ring->dma_pdma = dma_alloc_coherent(eth->dma_dev, MTK_DMA_SIZE * sz,
- 						    &ring->phys_pdma, GFP_KERNEL);
- 		if (!ring->dma_pdma)
- 			goto no_tx_mem;
-@@ -2215,14 +2230,14 @@ static void mtk_tx_clean(struct mtk_eth
- 	}
- 
- 	if (!eth->soc->has_sram && ring->dma) {
--		dma_free_coherent(eth->dev,
-+		dma_free_coherent(eth->dma_dev,
- 				  MTK_DMA_SIZE * soc->txrx.txd_size,
- 				  ring->dma, ring->phys);
- 		ring->dma = NULL;
- 	}
- 
- 	if (ring->dma_pdma) {
--		dma_free_coherent(eth->dev,
-+		dma_free_coherent(eth->dma_dev,
- 				  MTK_DMA_SIZE * soc->txrx.txd_size,
- 				  ring->dma_pdma, ring->phys_pdma);
- 		ring->dma_pdma = NULL;
-@@ -2267,7 +2282,7 @@ static int mtk_rx_alloc(struct mtk_eth *
- 
- 	if ((!eth->soc->has_sram) || (eth->soc->has_sram
- 				&& (rx_flag != MTK_RX_FLAGS_NORMAL)))
--		ring->dma = dma_alloc_coherent(eth->dev,
-+		ring->dma = dma_alloc_coherent(eth->dma_dev,
- 					       rx_dma_size * eth->soc->txrx.rxd_size,
- 					       &ring->phys, GFP_KERNEL);
- 	else {
-@@ -2284,11 +2299,11 @@ static int mtk_rx_alloc(struct mtk_eth *
- 	for (i = 0; i < rx_dma_size; i++) {
- 		struct mtk_rx_dma_v2 *rxd;
- 
--		dma_addr_t dma_addr = dma_map_single(eth->dev,
-+		dma_addr_t dma_addr = dma_map_single(eth->dma_dev,
- 				ring->data[i] + NET_SKB_PAD + eth->ip_align,
- 				ring->buf_size,
- 				DMA_FROM_DEVICE);
--		if (unlikely(dma_mapping_error(eth->dev, dma_addr)))
-+		if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr)))
- 			return -ENOMEM;
- 
- 		rxd = ring->dma + i * eth->soc->txrx.rxd_size;
-@@ -2360,7 +2375,7 @@ static void mtk_rx_clean(struct mtk_eth
- 					       MTK_8GB_ADDRESSING)) ?
- 				  ((u64)(rxd->rxd2 & 0xf)) << 32 : 0;
- 
--			dma_unmap_single(eth->dev,
-+			dma_unmap_single(eth->dma_dev,
- 					 (u64)(rxd->rxd1 | addr64),
- 					 ring->buf_size,
- 					 DMA_FROM_DEVICE);
-@@ -2374,7 +2389,7 @@ static void mtk_rx_clean(struct mtk_eth
- 		return;
- 
- 	if (ring->dma) {
--		dma_free_coherent(eth->dev,
-+		dma_free_coherent(eth->dma_dev,
- 				  ring->dma_size * eth->soc->txrx.rxd_size,
- 				  ring->dma,
- 				  ring->phys);
-@@ -2861,7 +2876,7 @@ static void mtk_dma_free(struct mtk_eth
- 		if (eth->netdev[i])
- 			netdev_reset_queue(eth->netdev[i]);
- 	if ( !eth->soc->has_sram && eth->scratch_ring) {
--		dma_free_coherent(eth->dev,
-+		dma_free_coherent(eth->dma_dev,
- 				  MTK_DMA_SIZE * soc->txrx.txd_size,
- 				  eth->scratch_ring, eth->phy_scratch_ring);
- 		eth->scratch_ring = NULL;
 @@ -3243,7 +3258,7 @@ static int mtk_stop(struct net_device *d
  	mtk_dma_free(eth);
  
@@ -383,87 +188,6 @@
  
  	return 0;
  }
-@@ -3320,6 +3335,8 @@ static int mtk_napi_init(struct mtk_eth
- 
- static int mtk_hw_init(struct mtk_eth *eth, u32 type)
- {
-+	u32 dma_mask = ETHSYS_DMA_AG_MAP_PDMA | ETHSYS_DMA_AG_MAP_QDMA |
-+		       ETHSYS_DMA_AG_MAP_PPE;
- 	int i, ret = 0;
- 	u32 val;
- 
-@@ -3338,6 +3355,10 @@ static int mtk_hw_init(struct mtk_eth *e
- 			goto err_disable_pm;
- 	}
- 
-+	if (eth->ethsys)
-+		regmap_update_bits(eth->ethsys, ETHSYS_DMA_AG_MAP, dma_mask,
-+				   of_dma_is_coherent(eth->dma_dev->of_node) * dma_mask);
-+
- 	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
- 		ret = device_reset(eth->dev);
- 		if (ret) {
-@@ -4091,6 +4112,35 @@ free_netdev:
- 	return err;
- }
- 
-+void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev)
-+{
-+	struct net_device *dev, *tmp;
-+	LIST_HEAD(dev_list);
-+	int i;
-+
-+	rtnl_lock();
-+
-+	for (i = 0; i < MTK_MAC_COUNT; i++) {
-+		dev = eth->netdev[i];
-+
-+		if (!dev || !(dev->flags & IFF_UP))
-+			continue;
-+
-+		list_add_tail(&dev->close_list, &dev_list);
-+	}
-+
-+	dev_close_many(&dev_list, false);
-+
-+	eth->dma_dev = dma_dev;
-+
-+	list_for_each_entry_safe(dev, tmp, &dev_list, close_list) {
-+		list_del_init(&dev->close_list);
-+		dev_open(dev, NULL);
-+	}
-+
-+	rtnl_unlock();
-+}
-+
- static int mtk_probe(struct platform_device *pdev)
- {
- 	struct device_node *mac_np;
-@@ -4104,6 +4154,7 @@ static int mtk_probe(struct platform_dev
- 	eth->soc = of_device_get_match_data(&pdev->dev);
- 
- 	eth->dev = &pdev->dev;
-+	eth->dma_dev = &pdev->dev;
- 	eth->base = devm_platform_ioremap_resource(pdev, 0);
- 	if (IS_ERR(eth->base))
- 		return PTR_ERR(eth->base);
-@@ -4176,6 +4227,16 @@ static int mtk_probe(struct platform_dev
- 		}
- 	}
- 
-+	if (of_dma_is_coherent(pdev->dev.of_node)) {
-+		struct regmap *cci;
-+
-+		cci = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
-+						      "mediatek,cci-control");
-+		/* enable CPU/bus coherency */
-+		if (!IS_ERR(cci))
-+			regmap_write(cci, 0, 3);
-+	}
-+
- 	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SGMII)) {
- 		eth->xgmii = devm_kzalloc(eth->dev, sizeof(*eth->xgmii),
- 					  GFP_KERNEL);
 @@ -4217,6 +4278,22 @@ static int mtk_probe(struct platform_dev
  		}
  	}
@@ -518,35 +242,6 @@
  /* QDMA descriptor txd4 */
  #define TX_DMA_CHKSUM		(0x7 << 29)
  #define TX_DMA_TSO		BIT(28)
-@@ -773,6 +776,12 @@
- #define ETHSYS_FE_RST_CHK_IDLE_EN 	0x28
- 
- 
-+/* ethernet dma channel agent map */
-+#define ETHSYS_DMA_AG_MAP	0x408
-+#define ETHSYS_DMA_AG_MAP_PDMA	BIT(0)
-+#define ETHSYS_DMA_AG_MAP_QDMA	BIT(1)
-+#define ETHSYS_DMA_AG_MAP_PPE	BIT(2)
-+
- /* SGMII subsystem config registers */
- /* Register to auto-negotiation restart */
- #define SGMSYS_PCS_CONTROL_1	0x0
-@@ -1520,6 +1529,7 @@ struct mtk_phylink_priv {
- /* struct mtk_eth -	This is the main datasructure for holding the state
-  *			of the driver
-  * @dev:		The device pointer
-+ * @dev:		The device pointer used for dma mapping/alloc
-  * @base:		The mapped register i/o base
-  * @page_lock:		Make sure that register operations are atomic
-  * @tx_irq__lock:	Make sure that IRQ register operations are atomic
-@@ -1554,6 +1564,7 @@ struct mtk_phylink_priv {
- 
- struct mtk_eth {
- 	struct device			*dev;
-+	struct device			*dma_dev;
- 	void __iomem			*base;
- 	void __iomem			*sram_base;
- 	spinlock_t			page_lock;
 @@ -1596,7 +1607,7 @@ struct mtk_eth {
  	spinlock_t			syscfg0_lock;
  	struct timer_list		mtk_dma_monitor_timer;
@@ -556,15 +251,6 @@
  	struct rhashtable		flow_table;
  };
  
-@@ -1655,6 +1666,7 @@ void ethsys_reset(struct mtk_eth *eth, u
- int mtk_eth_offload_init(struct mtk_eth *eth);
- int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type,
- 		     void *type_data);
-+void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev);
- 
- int mtk_mac2xgmii_id(struct mtk_eth *eth, int mac_id);
- int mtk_usxgmii_init(struct mtk_xgmii *ss, struct device_node *r);
-
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
 old mode 100644
 new mode 100755
diff --git a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9994-ethernet-update-ppe-from-mt7622-to-mt7986.patch b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9994-ethernet-update-ppe-from-mt7622-to-mt7986.patch
index 1bfb09a..1ef385d 100755
--- a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9994-ethernet-update-ppe-from-mt7622-to-mt7986.patch
+++ b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9994-ethernet-update-ppe-from-mt7622-to-mt7986.patch
@@ -46,7 +46,7 @@
  
  		if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
  			if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
-@@ -3926,12 +3937,13 @@ static const struct mtk_soc_data mt7986_data = {
+@@ -3926,13 +3937,14 @@ static const struct mtk_soc_data mt7986_data = {
  	.required_clks = MT7986_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = true,
@@ -54,6 +54,7 @@
  	.txrx = {
  		.txd_size = sizeof(struct mtk_tx_dma_v2),
  		.rxd_size = sizeof(struct mtk_rx_dma_v2),
+ 		.rx_dma_l4_valid = RX_DMA_L4_VALID_V2,
  		.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
  		.dma_len_offset = MTK_TX_DMA_BUF_SHIFT_V2,
  	},
diff --git a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9995-flow-offload-add-mkhnat-dual-ppe-new-v2.patch b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9995-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
index cfb1ad6..850afe4 100755
--- a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9995-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
+++ b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9995-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
@@ -165,21 +165,18 @@
  	struct rhashtable		flow_table;
  };
  
-@@ -1668,11 +1674,13 @@ int mtk_gmac_usxgmii_path_setup(struct m
- void mtk_gdm_config(struct mtk_eth *eth, u32 id, u32 config);
- void ethsys_reset(struct mtk_eth *eth, u32 reset_bits);
+@@ -1668,8 +1674,10 @@ int mtk_gmac_usxgmii_path_setup(struct m
+ void mtk_usxgmii_reset(struct mtk_xgmii *ss, int mac_id);
+ int mtk_dump_usxgmii(struct regmap *pmap, char *name, u32 offset, u32 range);
  
 -int mtk_eth_offload_init(struct mtk_eth *eth);
 +int mtk_eth_offload_init(struct mtk_eth *eth, int id);
  int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type,
  		     void *type_data);
  void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev);
- 
-+int mtk_ppe_debugfs_init(struct mtk_eth *eth);
 +
- int mtk_mac2xgmii_id(struct mtk_eth *eth, int mac_id);
- int mtk_usxgmii_init(struct mtk_xgmii *ss, struct device_node *r);
- int mtk_xfi_pextp_init(struct mtk_xgmii *ss, struct device_node *r);
++int mtk_ppe_debugfs_init(struct mtk_eth *eth);
+ #endif /* MTK_ETH_H */
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
 index d46e91178..3d6ff30ba 100755
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
diff --git a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9999-3-flow-offload-add-mtkhnat-qdma-qos.patch b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9999-3-flow-offload-add-mtkhnat-qdma-qos.patch
index d2e6ac2..570fbcd 100644
--- a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9999-3-flow-offload-add-mtkhnat-qdma-qos.patch
+++ b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9999-3-flow-offload-add-mtkhnat-qdma-qos.patch
@@ -12,10 +12,10 @@
  ifdef CONFIG_DEBUG_FS
  mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed_debugfs.o
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-index efdd2e6..9ffc46b 100644
+index ca76047..809c735 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -3992,6 +3992,8 @@ static int mtk_probe(struct platform_device *pdev)
+@@ -4787,6 +4787,8 @@ static int mtk_probe(struct platform_device *pdev)
  		}
  
  		mtk_ppe_debugfs_init(eth);
@@ -24,15 +24,15 @@
  	}
  
  	for (i = 0; i < MTK_MAX_DEVS; i++) {
-@@ -4101,6 +4103,7 @@ static const struct mtk_soc_data mt2701_data = {
- 		.rxd_size = sizeof(struct mtk_rx_dma),
+@@ -4901,6 +4903,7 @@ static const struct mtk_soc_data mt2701_data = {
+ 		.rx_dma_l4_valid = RX_DMA_L4_VALID,
  		.dma_max_len = MTK_TX_DMA_BUF_LEN,
  		.dma_len_offset = MTK_TX_DMA_BUF_SHIFT,
 +		.qdma_tx_sch = 2,
  	},
  };
  
-@@ -4118,6 +4121,7 @@ static const struct mtk_soc_data mt7621_data = {
+@@ -4920,6 +4923,7 @@ static const struct mtk_soc_data mt7621_data = {
  		.rxd_size = sizeof(struct mtk_rx_dma),
  		.dma_max_len = MTK_TX_DMA_BUF_LEN,
  		.dma_len_offset = MTK_TX_DMA_BUF_SHIFT,
@@ -40,40 +40,48 @@
  	},
  };
  
-@@ -4136,6 +4140,7 @@ static const struct mtk_soc_data mt7622_data = {
- 		.rxd_size = sizeof(struct mtk_rx_dma),
+@@ -4940,6 +4944,7 @@ static const struct mtk_soc_data mt7622_data = {
+ 		.rx_dma_l4_valid = RX_DMA_L4_VALID,
  		.dma_max_len = MTK_TX_DMA_BUF_LEN,
  		.dma_len_offset = MTK_TX_DMA_BUF_SHIFT,
 +		.qdma_tx_sch = 2,
  	},
  };
  
-@@ -4153,6 +4158,7 @@ static const struct mtk_soc_data mt7623_data = {
- 		.rxd_size = sizeof(struct mtk_rx_dma),
+@@ -4959,6 +4964,7 @@ static const struct mtk_soc_data mt7623_data = {
+ 		.rx_dma_l4_valid = RX_DMA_L4_VALID,
  		.dma_max_len = MTK_TX_DMA_BUF_LEN,
  		.dma_len_offset = MTK_TX_DMA_BUF_SHIFT,
 +		.qdma_tx_sch = 2,
  	},
  };
  
-@@ -4187,6 +4193,7 @@ static const struct mtk_soc_data mt7986_data = {
- 		.rxd_size = sizeof(struct mtk_rx_dma_v2),
+@@ -4997,6 +5003,7 @@ static const struct mtk_soc_data mt7986_data = {
+ 		.rx_dma_l4_valid = RX_DMA_L4_VALID_V2,
  		.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
  		.dma_len_offset = MTK_TX_DMA_BUF_SHIFT_V2,
 +		.qdma_tx_sch = 4,
  	},
  };
  
-@@ -4205,6 +4212,7 @@ static const struct mtk_soc_data mt7981_data = {
- 		.rxd_size = sizeof(struct mtk_rx_dma_v2),
+@@ -5017,6 +5024,7 @@ static const struct mtk_soc_data mt7981_data = {
+ 		.rx_dma_l4_valid = RX_DMA_L4_VALID_V2,
  		.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
  		.dma_len_offset = MTK_TX_DMA_BUF_SHIFT_V2,
 +		.qdma_tx_sch = 4,
  	},
  };
  
-@@ -4220,6 +4228,7 @@ static const struct mtk_soc_data rt5350_data = {
- 		.rxd_size = sizeof(struct mtk_rx_dma),
+@@ -5034,6 +5042,7 @@ static const struct mtk_soc_data mt7988_data = {
+ 		.rx_dma_l4_valid = RX_DMA_L4_VALID_V2,
+ 		.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
+ 		.dma_len_offset = MTK_TX_DMA_BUF_SHIFT_V2,
++		.qdma_tx_sch = 4,
+ 	},
+ };
+ 
+@@ -5051,6 +5060,7 @@ static const struct mtk_soc_data rt5350_data = {
+ 		.rx_dma_l4_valid = RX_DMA_L4_VALID_PDMA,
  		.dma_max_len = MTK_TX_DMA_BUF_LEN,
  		.dma_len_offset = MTK_TX_DMA_BUF_SHIFT,
 +		.qdma_tx_sch = 4,
@@ -81,10 +89,10 @@
  };
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-index c87a823..955bb27 100644
+index c6afff5..bd73c27 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -352,10 +352,21 @@
+@@ -385,10 +385,21 @@
  
  /* QDMA TX Queue Configuration Registers */
  #define MTK_QTX_CFG(x)		(QDMA_BASE + (x * 0x10))
@@ -106,7 +114,7 @@
  
  /* QDMA RX Base Pointer Register */
  #define MTK_QRX_BASE_PTR0	(QDMA_BASE + 0x100)
-@@ -373,7 +384,9 @@
+@@ -406,7 +417,9 @@
  #define MTK_QRX_DRX_IDX0	(QDMA_BASE + 0x10c)
  
  /* QDMA Page Configuration Register */
@@ -117,7 +125,7 @@
  
  /* QDMA Global Configuration Register */
  #define MTK_QDMA_GLO_CFG	(QDMA_BASE + 0x204)
-@@ -410,6 +423,9 @@
+@@ -443,6 +456,9 @@
  #define FC_THRES_DROP_EN	(7 << 16)
  #define FC_THRES_MIN		0x4444
  
@@ -126,8 +134,8 @@
 +
  /* QDMA Interrupt Status Register */
  #define MTK_QDMA_INT_STATUS	(QDMA_BASE + 0x218)
- #if defined(CONFIG_MEDIATEK_NETSYS_V2)
-@@ -444,6 +460,11 @@
+ #if defined(CONFIG_MEDIATEK_NETSYS_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3)
+@@ -478,6 +494,11 @@
  /* QDMA Interrupt Mask Register */
  #define MTK_QDMA_HRED2		(QDMA_BASE + 0x244)
  
@@ -139,7 +147,7 @@
  /* QDMA TX Forward CPU Pointer Register */
  #define MTK_QTX_CTX_PTR		(QDMA_BASE +0x300)
  
-@@ -471,6 +492,14 @@
+@@ -505,6 +526,14 @@
  /* QDMA FQ Free Page Buffer Length Register */
  #define MTK_QDMA_FQ_BLEN	(QDMA_BASE +0x32c)
  
@@ -152,17 +160,17 @@
 +#define MTK_QDMA_TX_SCH_RATE_EXP	GENMASK(3, 0)
 +
  /* WDMA Registers */
+ #define MTK_WDMA_CTX_PTR(x)	(WDMA_BASE(x) + 0x8)
  #define MTK_WDMA_DTX_PTR(x)	(WDMA_BASE(x) + 0xC)
- #define MTK_WDMA_GLO_CFG(x)	(WDMA_BASE(x) + 0x204)
-@@ -1223,6 +1252,7 @@ struct mtk_soc_data {
- 		u32	rxd_size;
+@@ -1596,6 +1625,7 @@ struct mtk_soc_data {
+ 		u32	rx_dma_l4_valid;
  		u32	dma_max_len;
  		u32	dma_len_offset;
 +		u32	qdma_tx_sch;
  	} txrx;
  };
  
-@@ -1353,6 +1383,7 @@ struct mtk_eth {
+@@ -1736,6 +1766,7 @@ struct mtk_eth {
  	spinlock_t			syscfg0_lock;
  	struct timer_list		mtk_dma_monitor_timer;
  
@@ -170,13 +178,13 @@
  	u8				ppe_num;
  	struct mtk_ppe			*ppe[MTK_MAX_PPE_NUM];
  	struct rhashtable		flow_table;
-@@ -1412,4 +1443,6 @@ void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev);
+@@ -1815,4 +1846,6 @@ int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev);
  
  int mtk_ppe_debugfs_init(struct mtk_eth *eth);
- 
-+int mtk_qdma_debugfs_init(struct mtk_eth *eth);
 +
- int mtk_mac2xgmii_id(struct mtk_eth *eth, int mac_id);
++int mtk_qdma_debugfs_init(struct mtk_eth *eth);
+ #endif /* MTK_ETH_H */
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
 index a49275f..1767823 100755
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
diff --git a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9999-6-ethernet-update-ppe-from-mt7986-to-mt7988.patch b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9999-6-ethernet-update-ppe-from-mt7986-to-mt7988.patch
index e590ce2..1a13d74 100644
--- a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9999-6-ethernet-update-ppe-from-mt7986-to-mt7988.patch
+++ b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9999-6-ethernet-update-ppe-from-mt7986-to-mt7988.patch
@@ -34,7 +34,7 @@
  						   2, eth->soc->hash_way, i,
  						   eth->soc->has_accounting);
  			if (!eth->ppe[i]) {
-@@ -4626,11 +4626,15 @@ static const struct mtk_soc_data mt7988_data = {
+@@ -4626,13 +4626,16 @@ static const struct mtk_soc_data mt7988_data = {
  	.required_clks = MT7988_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = true,
@@ -44,9 +44,10 @@
  	.txrx = {
  		.txd_size = sizeof(struct mtk_tx_dma_v2),
  		.rxd_size = sizeof(struct mtk_rx_dma_v2),
+ 		.rx_dma_l4_valid = RX_DMA_L4_VALID_V2,
  		.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
  		.dma_len_offset = MTK_TX_DMA_BUF_SHIFT_V2,
-+		.qdma_tx_sch = 4,
+ 		.qdma_tx_sch = 4,
  	},
  };