[rdkb][common][bsp][Refactor and sync kernel from openwrt]

[Description]
b3f7f9ba [Kernel][mt7988][hnat][Fix WAN->1G_LAN HNAT entry bind wrong in MAPE]
4c41dab9 [openwrt][mt7988][tops][fix tops-tool code defects]
38be77f9 [openwrt][common][crypto][revert SDK patch for upgrading openssl]
f50c9553 [kernel][common][app][Fix compile issue for the regs utility]
a857db18 [kernel][mt7986][eth][Fix high CPU utilization issue for the ADMAv1 RSS]
801a635d [kernel][mt7986][eth][Change QDMA queue and scheduler mapping]
225d539c [kernel][common][app][Fix Coverity issue for the regs utility]
e74e1017 [kernel][common][eth][Fix Coverity scan warning]
58668349 [kernel][mt7988][i2.5gphy][net: phy: Fix RTL8156B 100Mbps EEE link down issue by setting lpi_SigEnLoThresh100 to 0]
3b2d84b7 [MAC80211][app][Update smp-mp76.sh 4-RSS scenario for the mt7986]
a02c3e6d [openwrt][mt7988][tops][Fix L2TP/IPSec deadlock and check if TOPS HW exists]
f7b55488 [openwrt][common][eth][Add a Airoha EN8811H 2.5G PHY driver package]
8528fc00 [MAC80211][misc][Refactor wed/flowblock/mtk_ppe patches]
6cf5e8ef [MAC80211][hnat][Fix patch fail issue]
93fbba83 [openwrt][mt7988][pce][fix uninitialized variable]
750cc50b [kernel][mt7986/mt7981][eth][Add Ethernet RSS support for Panther and Cheetah]
55eeab91 [MAC80211][wed][change wed hw tx token to 8K]
9c12f44d [kernel][mt7988][eth][Add SFP support based on the DSA-10G DTS]

[Release-log]

Change-Id: Ie1ec2d751f84596c68eff9ca1d983bfb61129823
diff --git a/recipes-devtools/regs/files/src/regs.c b/recipes-devtools/regs/files/src/regs.c
index 2e54c1d..8e85074 100644
--- a/recipes-devtools/regs/files/src/regs.c
+++ b/recipes-devtools/regs/files/src/regs.c
@@ -68,7 +68,7 @@
 	    (start_bit + data_len > 32)) {
 		fprintf(stderr,
 			"Startbit range[0~31], and DataLen range[1~32], and Startbit + DataLen <= 32\n");
-		return;
+		exit(1);
 	}
 
 	for (i = 0; i < data_len; i++) {
@@ -107,7 +107,7 @@
 	    (start_bit + data_len > 32)) {
 		fprintf(stderr,
 			"Startbit range[0~31], and DataLen range[1~32], and Startbit + DataLen <= 32\n");
-		return;
+		exit(1);
 	}
 
 	for (i = 0; i < data_len; i++) {
@@ -150,6 +150,7 @@
 		"\tRead    : regs r 0x1b100000 29 3      //read 0x1b100000[29:31]\n"
 		"\tWrite   : regs w 0x1b100000 0x1234    //write 0x1b100000=0x1234\n"
 		"\tModify  : regs m 0x1b100000 0x0 29 3  //modify 0x1b100000[29:31]=0\n");
+	exit(1);
 }
 
 int main(int argc, char **argv)
@@ -182,7 +183,11 @@
 
 	/* Map one page */
 	offset = strtoul(argv[2], NULL, 16);
-	map_base = mmap(0, 2*MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset & ~MAP_MASK);
+	if (offset > 0xFFFFFFFFFFFFUL)
+		PRINT_ERROR;
+
+	map_base = mmap(0, 2 * MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
+			fd, offset & ~MAP_MASK);
 	if(map_base == (void *) -1)
 		PRINT_ERROR;
 
@@ -194,12 +199,20 @@
 	switch(access_type) {
 		case 'm':
 			writeval = strtoul(argv[3], 0, 16);
+			if (writeval > 0xFFFFFFFFUL)
+				PRINT_ERROR;
 			startbit = strtoul(argv[4], 0, 10);
+			if (startbit > 32)
+				PRINT_ERROR;
 			datalen  = strtoul(argv[5], 0, 10);
+			if (datalen > 32)
+				PRINT_ERROR;
 			reg_mod_bits((uint32_t *)virt_addr, writeval, startbit, datalen);
 			break;
 		case 'w':
 			writeval = strtoul(argv[3], 0, 16);
+			if (writeval > 0xFFFFFFFFUL)
+				PRINT_ERROR;
 			*((uint32_t *) virt_addr) = writeval;
 			printf("Written 0x%X; ", writeval);
 			break;
@@ -215,7 +228,11 @@
 					      0, 32);
 			else {
 				startbit = strtoul(argv[3], 0, 10);
-				datalen  = strtoul(argv[4], 0, 10);
+				if (startbit > 32)
+					PRINT_ERROR;
+				datalen = strtoul(argv[4], 0, 10);
+				if (datalen > 32)
+					PRINT_ERROR;
 				reg_read_bits((uint32_t *)virt_addr,
 					      (uint32_t *)map_base,
 					      (uint32_t *)(offset & ~MAP_MASK),
@@ -223,7 +240,7 @@
 			}
 			goto out;
 		default:
-			fprintf(stderr, "Illegal data type '%c'.\n", access_type);
+			printf("Illegal data type '%c'.\n", access_type);
 			goto out;
 	}
 
diff --git a/recipes-devtools/smp/files/smp-mt76.sh b/recipes-devtools/smp/files/smp-mt76.sh
index 709e228..f383cf6 100644
--- a/recipes-devtools/smp/files/smp-mt76.sh
+++ b/recipes-devtools/smp/files/smp-mt76.sh
@@ -168,7 +168,11 @@
 	DEFAULT_RPS=0
 
 	#Physical IRQ# setting
-	eth_irq_rx=221
+	#Ethernet RSS feature enables 4 Rx rings
+	eth_irq_rx0=221
+	eth_irq_rx1=222
+	eth_irq_rx2=223
+	eth_irq_rx3=224
 	eth_irq_tx=229
 	wifi1_irq=
 	wifi2_irq=
@@ -217,36 +221,35 @@
 
 	for vif in $NET_IF_LIST;
 	do
-		if [[ "$vif" == "lan"* ]] ||  \
-		[[ "$vif" == "wlan"* ]] || [[ "$vif" == "phy"* ]]; then
-			LAN_IF_LIST="$LAN_IF_LIST $vif"
+		if [[ "$vif" == "wlan"* ]] || [[ "$vif" == "phy"* ]]; then
+			WIFI_IF_LIST="$WIFI_IF_LIST $vif"
 		fi
 	done;
-	dbg2 "$LAN_IF_LIST = $LAN_IF_LIST"
+	dbg2 "$WIFI_IF_LIST = $WIFI_IF_LIST"
 	# Please update the CPU binding in each cases.
 	# CPU#_AFFINITY="add binding irq number here"
 	# CPU#_RPS="add binding interface name here"
 	if [ "$num_of_wifi" = "0" ]; then
-		CPU0_AFFINITY="$eth_irq_rx"
-		CPU1_AFFINITY="$eth_irq_tx"
-		CPU2_AFFINITY=""
-		CPU3_AFFINITY=""
+		CPU0_AFFINITY="$eth_irq_rx0"
+		CPU1_AFFINITY="$eth_irq_rx1 $eth_irq_tx"
+		CPU2_AFFINITY="$eth_irq_rx2"
+		CPU3_AFFINITY="$eth_irq_rx3"
 
-		CPU0_RPS="$RPS_IF_LIST"
-		CPU1_RPS="$RPS_IF_LIST"
-		CPU2_RPS="$RPS_IF_LIST"
-		CPU3_RPS="$RPS_IF_LIST"
+		CPU0_RPS=""
+		CPU1_RPS=""
+		CPU2_RPS=""
+		CPU3_RPS=""
 	else
 		#we bound all wifi card to cpu1 and bound eth to cpu0
-		CPU0_AFFINITY="$eth_irq_rx"
-		CPU1_AFFINITY="$eth_irq_tx"
-		CPU2_AFFINITY="$wifi2_irq $wifi3_irq"
-		CPU3_AFFINITY="$wifi1_irq"
+		CPU0_AFFINITY="$eth_irq_rx0"
+		CPU1_AFFINITY="$eth_irq_rx1 $eth_irq_tx"
+		CPU2_AFFINITY="$eth_irq_rx2 $wifi2_irq $wifi3_irq"
+		CPU3_AFFINITY="$eth_irq_rx3 $wifi1_irq"
 
-		CPU0_RPS="$LAN_IF_LIST"
-		CPU1_RPS="$LAN_IF_LIST"
-		CPU2_RPS="$RPS_IF_LIST"
-		CPU3_RPS="$RPS_IF_LIST"
+		CPU0_RPS="$WIFI_IF_LIST"
+		CPU1_RPS="$WIFI_IF_LIST"
+		CPU2_RPS="$WIFI_IF_LIST"
+		CPU3_RPS="$WIFI_IF_LIST"
 	fi
 	dbg2 "CPU0_AFFINITY = $CPU0_AFFINITY"
 	dbg2 "CPU1_AFFINITY = $CPU1_AFFINITY"
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-clkitg.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-clkitg.dtsi
index 0d6d91d..40e26d4 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-clkitg.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-clkitg.dtsi
@@ -176,10 +176,10 @@
 			<&topckgen CK_TOP_SYSAXI_SEL>,
 			<&topckgen CK_TOP_SYSAPB_SEL>,
 			<&topckgen CK_TOP_ARM_DB_MAIN_SEL>,
-			<&topckgen CK_TOP_AP2CNN_HOST_SEL>,
+			<&clk40m>,
 			<&topckgen CK_TOP_NETSYS_SEL>,
 			<&topckgen CK_TOP_NETSYS_500M_SEL>,
-			<&topckgen CK_TOP_NETSYS_MCU_SEL>,
+			<&clk40m>,
 			<&clk40m>,
 			<&clk40m>,
 			<&topckgen CK_TOP_SGM_REG_SEL>,
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-emmc-rfb.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-emmc-rfb.dts
index f8a8566..d0f834a 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-emmc-rfb.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-emmc-rfb.dts
@@ -137,6 +137,12 @@
 	status = "disabled";
 };
 
+&wbsys {
+	status = "okay";
+	pinctrl-names = "dbdc";
+	pinctrl-0 = <&wf_dbdc_pins>;
+};
+
 &pio {
 
 	spic_pins: spi1-pins {
@@ -159,6 +165,21 @@
 			groups = "emmc_45";
 		};
 	};
+
+	wf_dbdc_pins: wf_dbdc-pins {
+		mux {
+			function = "eth";
+			groups = "wf0_mode1";
+		};
+		conf {
+			pins = "WF_HB1", "WF_HB2", "WF_HB3", "WF_HB4",
+			       "WF_HB0", "WF_HB0_B", "WF_HB5", "WF_HB6",
+			       "WF_HB7", "WF_HB8", "WF_HB9", "WF_HB10",
+			       "WF_TOP_CLK", "WF_TOP_DATA", "WF_XO_REQ",
+			       "WF_CBA_RESETB", "WF_DIG_RESETB";
+			drive-strength = <MTK_DRIVE_4mA>;
+		};
+	};
 };
 
 &xhci {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-snfi-nand-2500wan-p5.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-snfi-nand-2500wan-p5.dts
index 7967ea8..24eb1d7 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-snfi-nand-2500wan-p5.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-snfi-nand-2500wan-p5.dts
@@ -192,6 +192,13 @@
         status = "okay";
 };
 
+&wbsys {
+	mediatek,mtd-eeprom = <&factory 0x0000>;
+	status = "okay";
+	pinctrl-names = "dbdc";
+	pinctrl-0 = <&wf_dbdc_pins>;
+};
+
 &pio {
 
         pcie_pins: pcie-pins {
@@ -214,6 +221,21 @@
 			groups = "spi1_1";
 		};
 	};
+
+	wf_dbdc_pins: wf_dbdc-pins {
+		mux {
+			function = "eth";
+			groups = "wf0_mode1";
+		};
+		conf {
+			pins = "WF_HB1", "WF_HB2", "WF_HB3", "WF_HB4",
+			       "WF_HB0", "WF_HB0_B", "WF_HB5", "WF_HB6",
+			       "WF_HB7", "WF_HB8", "WF_HB9", "WF_HB10",
+			       "WF_TOP_CLK", "WF_TOP_DATA", "WF_XO_REQ",
+			       "WF_CBA_RESETB", "WF_DIG_RESETB";
+			drive-strength = <MTK_DRIVE_4mA>;
+		};
+	};
 };
 
 &xhci {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-2500wan-gmac2.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-2500wan-gmac2.dts
index 5745509..e57bba9 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-2500wan-gmac2.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-2500wan-gmac2.dts
@@ -53,7 +53,7 @@
 				reg = <0x0100000 0x0080000>;
 			};
 
-			partition@180000 {
+			factory: partition@180000 {
 				label = "Factory";
 				reg = <0x180000 0x0200000>;
 			};
@@ -204,6 +204,13 @@
 	};
 };
 
+&wbsys {
+	mediatek,mtd-eeprom = <&factory 0x0000>;
+	status = "okay";
+	pinctrl-names = "dbdc";
+	pinctrl-0 = <&wf_dbdc_pins>;
+};
+
 &pio {
 
 	i2c_pins: i2c-pins-g0 {
@@ -280,6 +287,21 @@
                         groups = "uart2_1";
                 };
         };
+
+	wf_dbdc_pins: wf_dbdc-pins {
+		mux {
+			function = "eth";
+			groups = "wf0_mode1";
+		};
+		conf {
+			pins = "WF_HB1", "WF_HB2", "WF_HB3", "WF_HB4",
+			       "WF_HB0", "WF_HB0_B", "WF_HB5", "WF_HB6",
+			       "WF_HB7", "WF_HB8", "WF_HB9", "WF_HB10",
+			       "WF_TOP_CLK", "WF_TOP_DATA", "WF_XO_REQ",
+			       "WF_CBA_RESETB", "WF_DIG_RESETB";
+			drive-strength = <MTK_DRIVE_4mA>;
+		};
+	};
 };
 
 &xhci {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-gsw.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-gsw.dts
index 998a401..192a457 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-gsw.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-gsw.dts
@@ -53,7 +53,7 @@
 				reg = <0x0100000 0x0080000>;
 			};
 
-			partition@180000 {
+			factory: partition@180000 {
 				label = "Factory";
 				reg = <0x180000 0x0200000>;
 			};
@@ -218,6 +218,13 @@
 	};
 };
 
+&wbsys {
+	mediatek,mtd-eeprom = <&factory 0x0000>;
+	status = "okay";
+	pinctrl-names = "dbdc";
+	pinctrl-0 = <&wf_dbdc_pins>;
+};
+
 &pio {
 
 	i2c_pins: i2c-pins-g0 {
@@ -294,6 +301,21 @@
                         groups = "uart2_1";
                 };
         };
+
+	wf_dbdc_pins: wf_dbdc-pins {
+		mux {
+			function = "eth";
+			groups = "wf0_mode1";
+		};
+		conf {
+			pins = "WF_HB1", "WF_HB2", "WF_HB3", "WF_HB4",
+			       "WF_HB0", "WF_HB0_B", "WF_HB5", "WF_HB6",
+			       "WF_HB7", "WF_HB8", "WF_HB9", "WF_HB10",
+			       "WF_TOP_CLK", "WF_TOP_DATA", "WF_XO_REQ",
+			       "WF_CBA_RESETB", "WF_DIG_RESETB";
+			drive-strength = <MTK_DRIVE_4mA>;
+		};
+	};
 };
 
 &xhci {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-rfb.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-rfb.dts
index e7a7719..726447f 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-rfb.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-rfb.dts
@@ -53,7 +53,7 @@
 				reg = <0x0100000 0x0080000>;
 			};
 
-			partition@180000 {
+			factory: partition@180000 {
 				label = "Factory";
 				reg = <0x180000 0x0200000>;
 			};
@@ -234,6 +234,13 @@
 	};
 };
 
+&wbsys {
+	mediatek,mtd-eeprom = <&factory 0x0000>;
+	status = "okay";
+	pinctrl-names = "dbdc";
+	pinctrl-0 = <&wf_dbdc_pins>;
+};
+
 &pio {
 
 	i2c_pins: i2c-pins-g0 {
@@ -310,6 +317,21 @@
                         groups = "uart2_1";
                 };
         };
+
+	wf_dbdc_pins: wf_dbdc-pins {
+		mux {
+			function = "eth";
+			groups = "wf0_mode1";
+		};
+		conf {
+			pins = "WF_HB1", "WF_HB2", "WF_HB3", "WF_HB4",
+			       "WF_HB0", "WF_HB0_B", "WF_HB5", "WF_HB6",
+			       "WF_HB7", "WF_HB8", "WF_HB9", "WF_HB10",
+			       "WF_TOP_CLK", "WF_TOP_DATA", "WF_XO_REQ",
+			       "WF_CBA_RESETB", "WF_DIG_RESETB";
+			drive-strength = <MTK_DRIVE_4mA>;
+		};
+	};
 };
 
 &xhci {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nor-rfb.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nor-rfb.dts
index 270a7cd..3fa55a0 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nor-rfb.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nor-rfb.dts
@@ -143,7 +143,7 @@
 			label = "u-boot-env";
 			reg = <0x40000 0x0010000>;
 		};
-		partition@50000 {
+		factory: partition@50000 {
 			label = "Factory";
 			reg = <0x50000 0x00B0000>;
 		};
@@ -158,6 +158,13 @@
 	};
 };
 
+&wbsys {
+	mediatek,mtd-eeprom = <&factory 0x0000>;
+	status = "okay";
+	pinctrl-names = "dbdc";
+	pinctrl-0 = <&wf_dbdc_pins>;
+};
+
 &pio {
 	spic_pins: spi1-pins {
 		mux {
@@ -184,6 +191,21 @@
 			bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
 		};
 	};
+
+	wf_dbdc_pins: wf_dbdc-pins {
+		mux {
+			function = "eth";
+			groups = "wf0_mode1";
+		};
+		conf {
+			pins = "WF_HB1", "WF_HB2", "WF_HB3", "WF_HB4",
+			       "WF_HB0", "WF_HB0_B", "WF_HB5", "WF_HB6",
+			       "WF_HB7", "WF_HB8", "WF_HB9", "WF_HB10",
+			       "WF_TOP_CLK", "WF_TOP_DATA", "WF_XO_REQ",
+			       "WF_CBA_RESETB", "WF_DIG_RESETB";
+			drive-strength = <MTK_DRIVE_4mA>;
+		};
+	};
 };
 
 &xhci {  
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi
index bfc734e..ccaf0ad 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi
@@ -20,6 +20,7 @@
 #include <dt-bindings/pinctrl/mt65xx.h>
 #include <dt-bindings/input/linux-event-codes.h>
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/reset/mt7986-resets.h>
 
 / {
 	compatible = "mediatek,mt7981-rfb";
@@ -227,7 +228,7 @@
 	};
 
 	watchdog: watchdog@1001c000 {
-		compatible = "mediatek,mt7622-wdt",
+		compatible = "mediatek,mt7986-wdt",
 			     "mediatek,mt6589-wdt";
 		reg = <0 0x1001c000 0 0x1000>;
 		interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
@@ -490,13 +491,22 @@
         };
 
 	wbsys: wbsys@18000000 {
-		compatible = "mediatek,wbsys";
-		reg = <0 0x18000000 0  0x1000000>;
+		compatible = "mediatek,wbsys",
+			     "mediatek,mt7981-wmac";
+		resets = <&watchdog MT7986_TOPRGU_CONSYS_RST>;
+		reset-names = "consys";
+		clocks = <&topckgen CK_TOP_NETSYS_MCU_SEL>,
+			 <&topckgen CK_TOP_AP2CNN_HOST_SEL>;
+		clock-names = "mcu", "ap2conn";
+		reg = <0 0x18000000 0 0x1000000>,
+		      <0 0x10003000 0 0x1000>,
+		      <0 0x11d10000 0 0x1000>;
 		interrupts = <GIC_SPI 213 IRQ_TYPE_LEVEL_HIGH>,
-					 <GIC_SPI 214 IRQ_TYPE_LEVEL_HIGH>,
-					 <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>,
-					 <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH>;
+			     <GIC_SPI 214 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH>;
 		chip_id = <0x7981>;
+		memory-region = <&wmcpu_emi>;
 	};
 
 	wed_pcie: wed_pcie@10003000 {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988.dtsi
index 561450e..d99c1d5 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988.dtsi
@@ -700,6 +700,10 @@
 			#interrupt-cells = <1>;
 			interrupt-controller;
 		};
+
+		slot1: pcie@0,0 {
+			reg = <0x0000 0 0 0 0>;
+		};
 	};
 
 	pcie2: pcie@11280000 {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sfp-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sfp-spim-nand.dts
new file mode 100644
index 0000000..c3e4f5c
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sfp-spim-nand.dts
@@ -0,0 +1,493 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2021 MediaTek Inc.
+ * Author: Sam.Shih <sam.shih@mediatek.com>
+ */
+
+/dts-v1/;
+#include "mt7988.dtsi"
+
+/ {
+	model = "MediaTek MT7988A DSA 10G SFP SPIM-NAND RFB";
+	compatible = "mediatek,mt7988a-dsa-10g-sfp-spim-snand",
+		     /* Reserve this for DVFS if creating new dts */
+		     "mediatek,mt7988";
+
+	chosen {
+		bootargs = "console=ttyS0,115200n1 loglevel=8  \
+			    earlycon=uart8250,mmio32,0x11000000 \
+			    pci=pcie_bus_perf";
+	};
+
+	memory {
+		reg = <0 0x40000000 0 0x10000000>;
+	};
+
+	nmbm_spim_nand {
+		compatible = "generic,nmbm";
+
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		lower-mtd-device = <&spi_nand>;
+		forced-create;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "BL2";
+				reg = <0x00000 0x0100000>;
+				read-only;
+			};
+
+			partition@100000 {
+				label = "u-boot-env";
+				reg = <0x0100000 0x0080000>;
+			};
+
+			factory: partition@180000 {
+				label = "Factory";
+				reg = <0x180000 0x0400000>;
+			};
+
+			partition@580000 {
+				label = "FIP";
+				reg = <0x580000 0x0200000>;
+			};
+
+			partition@780000 {
+				label = "ubi";
+				reg = <0x780000 0x7080000>;
+			};
+		};
+	};
+
+	wsys_adie: wsys_adie@0 {
+	// fpga cases need to manual change adie_id / sku_type for dvt only
+		compatible = "mediatek,rebb-mt7988-adie";
+		adie_id = <7976>;
+		sku_type = <3000>;
+	};
+
+	sfp_esp0: sfp@0 {
+		compatible = "sff,sfp";
+		i2c-bus = <&i2c1>;
+		mod-def0-gpios = <&pio 35 1>;
+		los-gpios = <&pio 33 0>;
+		tx-disable-gpios = <&pio 29 0>;
+		maximum-power-milliwatt = <3000>;
+	};
+
+	sfp_esp1: sfp@1 {
+		compatible = "sff,sfp";
+		i2c-bus = <&i2c2>;
+		mod-def0-gpios = <&pio 82 1>;
+		los-gpios = <&pio 81 0>;
+		tx-disable-gpios = <&pio 36 0>;
+		maximum-power-milliwatt = <3000>;
+	};
+};
+
+&fan {
+	pwms = <&pwm 0 50000 0>;
+	status = "okay";
+};
+
+&pwm {
+	status = "okay";
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c0_pins>;
+	status = "okay";
+
+	rt5190a_64: rt5190a@64 {
+		compatible = "richtek,rt5190a";
+		reg = <0x64>;
+		/*interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;*/
+		vin2-supply = <&rt5190_buck1>;
+		vin3-supply = <&rt5190_buck1>;
+		vin4-supply = <&rt5190_buck1>;
+
+		regulators {
+			rt5190_buck1: buck1 {
+				regulator-name = "rt5190a-buck1";
+				regulator-min-microvolt = <5090000>;
+				regulator-max-microvolt = <5090000>;
+				regulator-allowed-modes =
+				<RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
+				regulator-boot-on;
+			};
+			buck2 {
+				regulator-name = "vcore";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1400000>;
+				regulator-boot-on;
+			};
+			buck3 {
+				regulator-name = "proc";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1400000>;
+				regulator-boot-on;
+			};
+			buck4 {
+				regulator-name = "rt5190a-buck4";
+				regulator-min-microvolt = <850000>;
+				regulator-max-microvolt = <850000>;
+				regulator-allowed-modes =
+				<RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
+				regulator-boot-on;
+			};
+			ldo {
+				regulator-name = "rt5190a-ldo";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-boot-on;
+			};
+		};
+	};
+};
+
+&i2c1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c1_pins>;
+	status = "okay";
+};
+
+&i2c2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c2_pins>;
+	status = "okay";
+};
+
+&spi0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi0_flash_pins>;
+	status = "okay";
+
+	spi_nand: spi_nand@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "spi-nand";
+		spi-cal-enable;
+		spi-cal-mode = "read-data";
+		spi-cal-datalen = <7>;
+		spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>;
+		spi-cal-addrlen = <5>;
+		spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
+		reg = <0>;
+		spi-max-frequency = <52000000>;
+		spi-tx-bus-width = <4>;
+		spi-rx-bus-width = <4>;
+	};
+};
+
+&spi1 {
+	pinctrl-names = "default";
+	/* pin shared with snfi */
+	pinctrl-0 = <&spic_pins>;
+	status = "disabled";
+
+	proslic_spi: proslic_spi@0 {
+		compatible = "silabs,proslic_spi";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+		spi-cpha = <1>;
+		spi-cpol = <1>;
+		channel_count = <1>;
+		debug_level = <4>;       /* 1 = TRC, 2 = DBG, 4 = ERR */
+		reset_gpio = <&pio 54 0>;
+		ig,enable-spi = <1>;     /* 1: Enable, 0: Disable */
+	};
+};
+
+&pcie0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie0_pins>;
+	status = "okay";
+};
+
+&pcie1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie1_pins>;
+	status = "okay";
+};
+
+&pcie2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie2_pins>;
+	status = "disabled";
+};
+
+&pcie3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie3_pins>;
+	status = "okay";
+};
+
+&pio {
+	gbe0_led0_pins: gbe0-pins {
+		mux {
+			function = "led";
+			groups = "gbe0_led0";
+		};
+	};
+
+	gbe1_led0_pins: gbe1-pins {
+		mux {
+			function = "led";
+			groups = "gbe1_led0";
+		};
+	};
+
+	gbe2_led0_pins: gbe2-pins {
+		mux {
+			function = "led";
+			groups = "gbe2_led0";
+		};
+	};
+
+	gbe3_led0_pins: gbe3-pins {
+		mux {
+			function = "led";
+			groups = "gbe3_led0";
+		};
+	};
+
+	i2c0_pins: i2c0-pins-g0 {
+		mux {
+			function = "i2c";
+			groups = "i2c0_1";
+		};
+	};
+
+	i2c1_pins: i2c1-pins-g0 {
+		mux {
+			function = "i2c";
+			groups = "i2c1_sfp";
+		};
+
+		conf {
+			groups = "i2c1_sfp";
+			drive-strength = <MTK_DRIVE_8mA>;
+		};
+	};
+
+	i2c2_pins: i2c2-pins-g0 {
+		mux {
+			function = "i2c";
+			groups = "i2c2_0";
+		};
+
+		conf {
+			groups = "i2c2_0";
+			drive-strength = <MTK_DRIVE_8mA>;
+		};
+	};
+
+	pcie0_pins: pcie0-pins {
+		mux {
+			function = "pcie";
+			groups = "pcie_2l_0_pereset", "pcie_clk_req_n0_0",
+				 "pcie_wake_n0_0";
+		};
+	};
+
+	pcie1_pins: pcie1-pins {
+		mux {
+			function = "pcie";
+			groups = "pcie_2l_1_pereset", "pcie_clk_req_n1",
+				 "pcie_wake_n1_0";
+		};
+	};
+
+	pcie2_pins: pcie2-pins {
+		mux {
+			function = "pcie";
+			groups = "pcie_1l_0_pereset", "pcie_clk_req_n2_0",
+				 "pcie_wake_n2_0";
+		};
+	};
+
+	pcie3_pins: pcie3-pins {
+		mux {
+			function = "pcie";
+			groups = "pcie_1l_1_pereset", "pcie_clk_req_n3",
+				 "pcie_wake_n3_0";
+		};
+	};
+
+	spi0_flash_pins: spi0-pins {
+		mux {
+			function = "spi";
+			groups = "spi0", "spi0_wp_hold";
+		};
+	};
+
+	spic_pins: spi1-pins {
+		mux {
+			function = "spi";
+			groups = "spi1";
+		};
+	};
+};
+
+&watchdog {
+	status = "disabled";
+};
+
+&eth {
+	status = "okay";
+
+	gmac0: mac@0 {
+		compatible = "mediatek,eth-mac";
+		reg = <0>;
+		mac-type = "xgdm";
+		phy-mode = "10gbase-kr";
+
+		fixed-link {
+			speed = <10000>;
+			full-duplex;
+			pause;
+		};
+	};
+
+	gmac1: mac@1 {
+		compatible = "mediatek,eth-mac";
+		reg = <1>;
+		mac-type = "xgdm";
+		phy-mode = "10gbase-kr";
+		managed = "in-band-status";
+		sfp = <&sfp_esp1>;
+	};
+
+	gmac2: mac@2 {
+		compatible = "mediatek,eth-mac";
+		reg = <2>;
+		mac-type = "xgdm";
+		phy-mode = "10gbase-kr";
+		managed = "in-band-status";
+		sfp = <&sfp_esp0>;
+	};
+
+	mdio: mdio-bus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		switch@0 {
+			compatible = "mediatek,mt7988";
+			reg = <31>;
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				port@0 {
+					reg = <0>;
+					label = "lan0";
+					phy-mode = "gmii";
+					phy-handle = <&sphy0>;
+				};
+
+				port@1 {
+					reg = <1>;
+					label = "lan1";
+					phy-mode = "gmii";
+					phy-handle = <&sphy1>;
+				};
+
+				port@2 {
+					reg = <2>;
+					label = "lan2";
+					phy-mode = "gmii";
+					phy-handle = <&sphy2>;
+				};
+
+				port@3 {
+					reg = <3>;
+					label = "lan3";
+					phy-mode = "gmii";
+					phy-handle = <&sphy3>;
+				};
+
+				port@6 {
+					reg = <6>;
+					label = "cpu";
+					ethernet = <&gmac0>;
+					phy-mode = "10gbase-kr";
+
+					fixed-link {
+						speed = <10000>;
+						full-duplex;
+						pause;
+					};
+				};
+			};
+
+			mdio {
+				compatible = "mediatek,dsa-slave-mdio";
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				sphy0: switch_phy0@0 {
+					compatible = "ethernet-phy-id03a2.9481";
+					reg = <0>;
+					pinctrl-names = "gbe-led";
+					pinctrl-0 = <&gbe0_led0_pins>;
+					nvmem-cells = <&phy_calibration_p0>;
+					nvmem-cell-names = "phy-cal-data";
+				};
+
+				sphy1: switch_phy1@1 {
+					compatible = "ethernet-phy-id03a2.9481";
+					reg = <1>;
+					pinctrl-names = "gbe-led";
+					pinctrl-0 = <&gbe1_led0_pins>;
+					nvmem-cells = <&phy_calibration_p1>;
+					nvmem-cell-names = "phy-cal-data";
+				};
+
+				sphy2: switch_phy2@2 {
+					compatible = "ethernet-phy-id03a2.9481";
+					reg = <2>;
+					pinctrl-names = "gbe-led";
+					pinctrl-0 = <&gbe2_led0_pins>;
+					nvmem-cells = <&phy_calibration_p2>;
+					nvmem-cell-names = "phy-cal-data";
+				};
+
+				sphy3: switch_phy3@3 {
+					compatible = "ethernet-phy-id03a2.9481";
+					reg = <3>;
+					pinctrl-names = "gbe-led";
+					pinctrl-0 = <&gbe3_led0_pins>;
+					nvmem-cells = <&phy_calibration_p3>;
+					nvmem-cell-names = "phy-cal-data";
+				};
+			};
+		};
+	};
+};
+
+&hnat {
+	mtketh-wan = "eth1";
+	mtketh-lan = "lan";
+	mtketh-lan2 = "eth2";
+	mtketh-max-gmac = <3>;
+	status = "okay";
+};
+
+&slot0 {
+	mt7996@0,0 {
+		reg = <0x0000 0 0 0 0>;
+		device_type = "pci";
+		mediatek,mtd-eeprom = <&factory 0x0>;
+	};
+};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
index 0f94eea..003fb51 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
@@ -549,3 +549,11 @@
 		mediatek,mtd-eeprom = <&factory 0x0>;
 	};
 };
+
+&slot1 {
+	mt7992@0,0 {
+		reg = <0x0000 0 0 0 0>;
+		device_type = "pci";
+		mediatek,mtd-eeprom = <&factory 0x0>;
+	};
+};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sfp-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sfp-spim-nand.dts
new file mode 100644
index 0000000..ed91a18
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sfp-spim-nand.dts
@@ -0,0 +1,475 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2021 MediaTek Inc.
+ * Author: Sam.Shih <sam.shih@mediatek.com>
+ */
+
+/dts-v1/;
+#include "mt7988.dtsi"
+
+/ {
+	model = "MediaTek MT7988D DSA 10G SFP SPIM-NAND RFB";
+	compatible = "mediatek,mt7988d-dsa-10g-sfp-spim-snand",
+		     /* Reserve this for DVFS if creating new dts */
+		     "mediatek,mt7988";
+
+	chosen {
+		bootargs = "console=ttyS0,115200n1 loglevel=8  \
+			    earlycon=uart8250,mmio32,0x11000000 \
+			    pci=pcie_bus_perf";
+	};
+
+	cpus {
+		/delete-node/ cpu@3;
+	};
+
+	memory {
+		reg = <0 0x40000000 0 0x10000000>;
+	};
+
+	nmbm_spim_nand {
+		compatible = "generic,nmbm";
+
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		lower-mtd-device = <&spi_nand>;
+		forced-create;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "BL2";
+				reg = <0x00000 0x0100000>;
+				read-only;
+			};
+
+			partition@100000 {
+				label = "u-boot-env";
+				reg = <0x0100000 0x0080000>;
+			};
+
+			factory: partition@180000 {
+				label = "Factory";
+				reg = <0x180000 0x0400000>;
+			};
+
+			partition@580000 {
+				label = "FIP";
+				reg = <0x580000 0x0200000>;
+			};
+
+			partition@780000 {
+				label = "ubi";
+				reg = <0x780000 0x7080000>;
+			};
+		};
+	};
+
+	wsys_adie: wsys_adie@0 {
+	// fpga cases need to manual change adie_id / sku_type for dvt only
+		compatible = "mediatek,rebb-mt7988-adie";
+		adie_id = <7976>;
+		sku_type = <3000>;
+	};
+
+	sfp_esp0: sfp@0 {
+		compatible = "sff,sfp";
+		i2c-bus = <&i2c1>;
+		mod-def0-gpios = <&pio 0 1>;
+		los-gpios = <&pio 30 0>;
+		tx-disable-gpios = <&pio 29 0>;
+	};
+};
+
+&fan {
+	pwms = <&pwm 0 50000 0>;
+	status = "okay";
+};
+
+&pwm {
+	status = "okay";
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c0_pins>;
+	status = "okay";
+
+	rt5190a_64: rt5190a@64 {
+		compatible = "richtek,rt5190a";
+		reg = <0x64>;
+		/*interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;*/
+		vin2-supply = <&rt5190_buck1>;
+		vin3-supply = <&rt5190_buck1>;
+		vin4-supply = <&rt5190_buck1>;
+
+		regulators {
+			rt5190_buck1: buck1 {
+				regulator-name = "rt5190a-buck1";
+				regulator-min-microvolt = <5090000>;
+				regulator-max-microvolt = <5090000>;
+				regulator-allowed-modes =
+				<RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
+				regulator-boot-on;
+			};
+			buck2 {
+				regulator-name = "vcore";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1400000>;
+				regulator-boot-on;
+			};
+			buck3 {
+				regulator-name = "proc";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <1400000>;
+				regulator-boot-on;
+			};
+			buck4 {
+				regulator-name = "rt5190a-buck4";
+				regulator-min-microvolt = <850000>;
+				regulator-max-microvolt = <850000>;
+				regulator-allowed-modes =
+				<RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
+				regulator-boot-on;
+			};
+			ldo {
+				regulator-name = "rt5190a-ldo";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-boot-on;
+			};
+		};
+	};
+};
+
+&i2c1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c1_pins>;
+	status = "okay";
+};
+
+&spi0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi0_flash_pins>;
+	status = "okay";
+
+	spi_nand: spi_nand@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "spi-nand";
+		spi-cal-enable;
+		spi-cal-mode = "read-data";
+		spi-cal-datalen = <7>;
+		spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>;
+		spi-cal-addrlen = <5>;
+		spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
+		reg = <0>;
+		spi-max-frequency = <52000000>;
+		spi-tx-bus-width = <4>;
+		spi-rx-bus-width = <4>;
+	};
+};
+
+&spi1 {
+	pinctrl-names = "default";
+	/* pin shared with snfi */
+	pinctrl-0 = <&spic_pins>;
+	status = "disabled";
+
+	proslic_spi: proslic_spi@0 {
+		compatible = "silabs,proslic_spi";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+		spi-cpha = <1>;
+		spi-cpol = <1>;
+		channel_count = <1>;
+		debug_level = <4>;       /* 1 = TRC, 2 = DBG, 4 = ERR */
+		reset_gpio = <&pio 54 0>;
+		ig,enable-spi = <1>;     /* 1: Enable, 0: Disable */
+	};
+};
+
+&pcie0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie0_pins>;
+	status = "okay";
+};
+
+&pcie1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie1_pins>;
+	status = "disabled";
+};
+
+&pcie2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie2_pins>;
+	status = "disabled";
+};
+
+&pcie3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie3_pins>;
+	status = "okay";
+};
+
+&pio {
+	gbe0_led0_pins: gbe0-pins {
+		mux {
+			function = "led";
+			groups = "gbe0_led0";
+		};
+	};
+
+	gbe1_led0_pins: gbe1-pins {
+		mux {
+			function = "led";
+			groups = "gbe1_led0";
+		};
+	};
+
+	gbe2_led0_pins: gbe2-pins {
+		mux {
+			function = "led";
+			groups = "gbe2_led0";
+		};
+	};
+
+	gbe3_led0_pins: gbe3-pins {
+		mux {
+			function = "led";
+			groups = "gbe3_led0";
+		};
+	};
+
+	i2p5gbe_led0_pins: 2p5gbe-pins {
+		mux {
+			function = "led";
+			groups = "2p5gbe_led0";
+		};
+	};
+
+	i2c0_pins: i2c0-pins-g0 {
+		mux {
+			function = "i2c";
+			groups = "i2c0_1";
+		};
+	};
+
+	i2c1_pins: i2c1-pins-g0 {
+		mux {
+			function = "i2c";
+			groups = "i2c1_sfp";
+		};
+
+		conf {
+			groups = "i2c1_sfp";
+			drive-strength = <MTK_DRIVE_8mA>;
+		};
+	};
+
+	pcie0_pins: pcie0-pins {
+		mux {
+			function = "pcie";
+			groups = "pcie_2l_0_pereset", "pcie_clk_req_n0_0",
+				 "pcie_wake_n0_0";
+		};
+	};
+
+	pcie1_pins: pcie1-pins {
+		mux {
+			function = "pcie";
+			groups = "pcie_2l_1_pereset", "pcie_clk_req_n1",
+				 "pcie_wake_n1_0";
+		};
+	};
+
+	pcie2_pins: pcie2-pins {
+		mux {
+			function = "pcie";
+			groups = "pcie_1l_0_pereset", "pcie_clk_req_n2_0",
+				 "pcie_wake_n2_0";
+		};
+	};
+
+	pcie3_pins: pcie3-pins {
+		mux {
+			function = "pcie";
+			groups = "pcie_1l_1_pereset", "pcie_clk_req_n3",
+				 "pcie_wake_n3_0";
+		};
+	};
+
+	spi0_flash_pins: spi0-pins {
+		mux {
+			function = "spi";
+			groups = "spi0", "spi0_wp_hold";
+		};
+	};
+
+	spic_pins: spi1-pins {
+		mux {
+			function = "spi";
+			groups = "spi1";
+		};
+	};
+};
+
+&watchdog {
+	status = "disabled";
+};
+
+&eth {
+	status = "okay";
+
+	gmac0: mac@0 {
+		compatible = "mediatek,eth-mac";
+		reg = <0>;
+		mac-type = "xgdm";
+		phy-mode = "10gbase-kr";
+
+		fixed-link {
+			speed = <10000>;
+			full-duplex;
+			pause;
+		};
+	};
+
+	gmac1: mac@1 {
+		compatible = "mediatek,eth-mac";
+		reg = <1>;
+		mac-type = "xgdm";
+		phy-mode = "xgmii";
+		phy-handle = <&phy0>;
+	};
+
+	gmac2: mac@2 {
+		compatible = "mediatek,eth-mac";
+		reg = <2>;
+		mac-type = "xgdm";
+		phy-mode = "10gbase-kr";
+		managed = "in-band-status";
+		sfp = <&sfp_esp0>;
+	};
+
+	mdio: mdio-bus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		phy0: ethernet-phy@0 {
+			pinctrl-names = "i2p5gbe-led";
+			pinctrl-0 = <&i2p5gbe_led0_pins>;
+			reg = <15>;
+			compatible = "ethernet-phy-ieee802.3-c45";
+			phy-mode = "xgmii";
+		};
+
+		switch@0 {
+			compatible = "mediatek,mt7988";
+			reg = <31>;
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				port@0 {
+					reg = <0>;
+					label = "lan0";
+					phy-mode = "gmii";
+					phy-handle = <&sphy0>;
+				};
+
+				port@1 {
+					reg = <1>;
+					label = "lan1";
+					phy-mode = "gmii";
+					phy-handle = <&sphy1>;
+				};
+
+				port@2 {
+					reg = <2>;
+					label = "lan2";
+					phy-mode = "gmii";
+					phy-handle = <&sphy2>;
+				};
+
+				port@3 {
+					reg = <3>;
+					label = "lan3";
+					phy-mode = "gmii";
+					phy-handle = <&sphy3>;
+				};
+
+				port@6 {
+					reg = <6>;
+					label = "cpu";
+					ethernet = <&gmac0>;
+					phy-mode = "10gbase-kr";
+
+					fixed-link {
+						speed = <10000>;
+						full-duplex;
+						pause;
+					};
+				};
+			};
+
+			mdio {
+				compatible = "mediatek,dsa-slave-mdio";
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				sphy0: switch_phy0@0 {
+					compatible = "ethernet-phy-id03a2.9481";
+					reg = <0>;
+					pinctrl-names = "gbe-led";
+					pinctrl-0 = <&gbe0_led0_pins>;
+					nvmem-cells = <&phy_calibration_p0>;
+					nvmem-cell-names = "phy-cal-data";
+				};
+
+				sphy1: switch_phy1@1 {
+					compatible = "ethernet-phy-id03a2.9481";
+					reg = <1>;
+					pinctrl-names = "gbe-led";
+					pinctrl-0 = <&gbe1_led0_pins>;
+					nvmem-cells = <&phy_calibration_p1>;
+					nvmem-cell-names = "phy-cal-data";
+				};
+
+				sphy2: switch_phy2@2 {
+					compatible = "ethernet-phy-id03a2.9481";
+					reg = <2>;
+					pinctrl-names = "gbe-led";
+					pinctrl-0 = <&gbe2_led0_pins>;
+					nvmem-cells = <&phy_calibration_p2>;
+					nvmem-cell-names = "phy-cal-data";
+				};
+
+				sphy3: switch_phy3@3 {
+					compatible = "ethernet-phy-id03a2.9481";
+					reg = <3>;
+					pinctrl-names = "gbe-led";
+					pinctrl-0 = <&gbe3_led0_pins>;
+					nvmem-cells = <&phy_calibration_p3>;
+					nvmem-cell-names = "phy-cal-data";
+				};
+			};
+		};
+	};
+};
+
+&hnat {
+	mtketh-wan = "eth1";
+	mtketh-lan = "lan";
+	mtketh-lan2 = "eth2";
+	mtketh-max-gmac = <3>;
+	status = "okay";
+};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
index e158c6a..1f8952d 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
@@ -526,3 +526,11 @@
 	mtketh-max-gmac = <3>;
 	status = "okay";
 };
+
+&slot0 {
+	mt7996@0,0 {
+		reg = <0x0000 0 0 0 0>;
+		device_type = "pci";
+		mediatek,mtd-eeprom = <&factory 0x0>;
+	};
+};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index b0cfc66..1c1eb75 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -3141,9 +3141,6 @@
 		/* Enable RSS dly int supoort */
 		val |= MTK_LRO_DLY_INT_EN;
 		mtk_w32(eth, val, MTK_PDMA_LRO_CTRL_DW0);
-
-		/* Set RSS delay config int ring1 */
-		mtk_w32(eth, MTK_MAX_DELAY_INT, MTK_LRO_RX1_DLY_INT);
 	}
 
 	/* Hash Type */
@@ -3182,7 +3179,12 @@
 	mtk_w32(eth, 0x210FFFF2, MTK_FE_INT_GRP);
 
 	/* Enable RSS delay interrupt */
-	mtk_w32(eth, 0x8f0f8f0f, MTK_PDMA_RSS_DELAY_INT);
+	if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_RX_V2)) {
+		mtk_w32(eth, MTK_MAX_DELAY_INT, MTK_LRO_RX1_DLY_INT);
+		mtk_w32(eth, MTK_MAX_DELAY_INT, MTK_LRO_RX2_DLY_INT);
+		mtk_w32(eth, MTK_MAX_DELAY_INT, MTK_LRO_RX3_DLY_INT);
+	} else
+		mtk_w32(eth, MTK_MAX_DELAY_INT_V2, MTK_PDMA_RSS_DELAY_INT);
 
 	return 0;
 }
@@ -4667,8 +4669,7 @@
 	const __be32 *_id = of_get_property(np, "reg", NULL);
 	struct device_node *child;
 	struct mtk_mux *mux;
-	unsigned int id;
-	int err;
+	int id, err;
 
 	if (!_id) {
 		dev_err(eth->dev, "missing attach mac id\n");
@@ -5339,7 +5340,7 @@
 	.required_clks = MT7986_CLKS_BITMAP,
 	.required_pctl = false,
 	.has_sram = false,
-	.rss_num = 0,
+	.rss_num = 4,
 	.txrx = {
 		.txd_size = sizeof(struct mtk_tx_dma_v2),
 		.rxd_size = sizeof(struct mtk_rx_dma),
@@ -5357,7 +5358,7 @@
 	.required_clks = MT7981_CLKS_BITMAP,
 	.required_pctl = false,
 	.has_sram = false,
-	.rss_num = 0,
+	.rss_num = 4,
 	.txrx = {
 		.txd_size = sizeof(struct mtk_tx_dma_v2),
 		.rxd_size = sizeof(struct mtk_rx_dma),
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 88df3b2..737031e 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -263,11 +263,10 @@
 /* PDMA RSS Control Registers */
 #if defined(CONFIG_MEDIATEK_NETSYS_RX_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3)
 #define MTK_PDMA_RSS_GLO_CFG		(PDMA_BASE + 0x800)
-#define MTK_RX_NAPI_NUM			(4)
 #else
 #define MTK_PDMA_RSS_GLO_CFG		0x2800
-#define MTK_RX_NAPI_NUM			(1)
 #endif
+#define MTK_RX_NAPI_NUM			(4)
 #define MTK_RSS_RING(x)			(x)
 #define MTK_RSS_EN			BIT(0)
 #define MTK_RSS_CFG_REQ			BIT(2)
@@ -326,8 +325,11 @@
 #else
 #define MTK_PDMA_INT_GRP3	(PDMA_BASE + 0x22c)
 #endif
-#define MTK_LRO_RX1_DLY_INT	0xa70
-#define MTK_MAX_DELAY_INT	0x8f0f8f0f
+#define MTK_LRO_RX1_DLY_INT	(PDMA_BASE + 0x270)
+#define MTK_LRO_RX2_DLY_INT	(PDMA_BASE + 0x274)
+#define MTK_LRO_RX3_DLY_INT	(PDMA_BASE + 0x278)
+#define MTK_MAX_DELAY_INT	0x8f0f
+#define MTK_MAX_DELAY_INT_V2	0x8f0f8f0f
 
 /* PDMA HW LRO IP Setting Registers */
 #if defined(CONFIG_MEDIATEK_NETSYS_RX_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3)
@@ -455,8 +457,8 @@
 	 ((ring_no) ? BIT(16 + (ring_no)) : BIT(14)))
 #else
 #define MTK_RX_DONE_INT(ring_no)						\
-	(MTK_HAS_CAPS(eth->soc->caps, MTK_RSS) ? (BIT(16 + (ring_no))) :	\
-	 ((ring_no) ? BIT(24 + (ring_no)) : BIT(30)))
+	(MTK_HAS_CAPS(eth->soc->caps, MTK_RSS) ? ((ring_no) ? BIT(24 + (ring_no)) : BIT(30)) :	\
+	 (BIT(16 + (ring_no))))
 #endif
 #define MTK_RX_DONE_INT3	BIT(19)
 #define MTK_RX_DONE_INT2	BIT(18)
@@ -1553,12 +1555,12 @@
 
 #define MT7986_CAPS   (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | \
                        MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \
-			MTK_NETSYS_V2)
+			MTK_NETSYS_V2 | MTK_RSS)
 
 #define MT7981_CAPS   (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | MTK_GMAC2_GEPHY | \
 			MTK_MUX_GMAC12_TO_GEPHY_SGMII | MTK_QDMA | \
 			MTK_MUX_U3_GMAC2_TO_QPHY | MTK_U3_COPHY_V2 | \
-			MTK_NETSYS_V2)
+			MTK_NETSYS_V2 | MTK_RSS)
 
 #define MT7988_CAPS   (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | MTK_GMAC3_SGMII | \
 		       MTK_MUX_GMAC123_TO_GEPHY_SGMII | MTK_QDMA | \
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
index a3eef58..37d5d20 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
@@ -409,8 +409,13 @@
 	hnat_priv->g_ppdev = dev_get_by_name(&init_net, hnat_priv->ppd);
 	hnat_priv->g_wandev = dev_get_by_name(&init_net, hnat_priv->wan);
 
+	if (hnat_priv->data->version == MTK_HNAT_V3) {
+		cr_set_field(hnat_priv->ppe_base[ppe_id] + PPE_GLO_CFG, TSID_EN, 1);
+		cr_set_field(hnat_priv->ppe_base[ppe_id] + PPE_TB_CFG, DSCP_TRFC_ECN_EN, 1);
+	}
 	dev_info(hnat_priv->dev, "PPE%d hwnat start\n", ppe_id);
 
+	spin_lock_init(&hnat_priv->entry_lock);
 	return 0;
 }
 
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
index 331fce9..d770db5 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
@@ -146,6 +146,7 @@
 #define SCAN_MODE (0x3 << 16) /* RW */
 #define XMODE (0x3 << 18) /* RW */
 #define TICK_SEL (0x1 << 24) /* RW */
+#define DSCP_TRFC_ECN_EN (0x1 << 25) /* RW */
 
 
 /*PPE_CAH_CTRL mask*/
@@ -183,6 +184,7 @@
 
 /*PPE_GLO_CFG mask*/
 #define PPE_EN (0x1 << 0) /* RW */
+#define TSID_EN (0x1 << 1) /* RW */
 #define TTL0_DRP (0x1 << 4) /* RW */
 #define MCAST_TB_EN (0x1 << 7) /* RW */
 #define MCAST_HASH (0x3 << 12) /* RW */
@@ -378,7 +380,14 @@
 	u16 m_timestamp; /* For mcast*/
 	u16 resv1;
 	u32 resv2;
-	u32 resv3 : 26;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+	u32 resv3_1 : 9;
+	u32 eg_keep_ecn : 1;
+	u32 eg_keep_dscp : 1;
+	u32 resv3_2:15;
+#else
+	u32 resv3:26;
+#endif
 	u32 act_dp : 6; /* UDF */
 	u16 vlan1;
 	u16 etype;
@@ -433,7 +442,14 @@
 	u8 flow_lbl[3]; /* in order to consist with Linux kernel (should be 20bits) */
 	u8 priority;    /* in order to consist with Linux kernel (should be 8bits) */
 	u32 hop_limit : 8;
-	u32 resv2 : 18;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+		u32 resv2_1 : 1;
+		u32 eg_keep_ecn : 1;
+		u32 eg_keep_cls : 1;
+		u32 resv2_2 : 15;
+#else
+		u32 resv2 : 18;
+#endif
 	u32 act_dp : 6; /* UDF */
 
 	union {
@@ -495,7 +511,14 @@
 	u8 flow_lbl[3]; /* in order to consist with Linux kernel (should be 20bits) */
 	u8 priority;    /* in order to consist with Linux kernel (should be 8bits) */
 	u32 hop_limit : 8;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+		u32 resv2_1 : 1;
+		u32 eg_keep_ecn : 1;
+		u32 eg_keep_dscp : 1;
+		u32 resv2_2 : 15;
+#else
 	u32 resv2 : 18;
+#endif
 	u32 act_dp : 6; /* UDF */
 
 	union {
@@ -561,7 +584,14 @@
 	u32 resv1;
 	u32 resv2;
 	u32 resv3;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+	u32 resv4_1 : 9;
+	u32 eg_keep_ecn : 1;
+	u32 eg_keep_cls : 1;
+	u32 resv4_2 : 15;
+#else
 	u32 resv4 : 26;
+#endif
 	u32 act_dp : 6; /* UDF */
 
 	union {
@@ -618,7 +648,14 @@
 	u32 resv1;
 	u32 resv2;
 	u32 resv3;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+	u32 resv4_1 : 9;
+	u32 eg_keep_ecn : 1;
+	u32 eg_keep_cls : 1;
+	u32 resv4_2 : 15;
+#else
 	u32 resv4 : 26;
+#endif
 	u32 act_dp : 6; /* UDF */
 
 	union {
@@ -679,9 +716,19 @@
 	u32 dscp : 8;
 	u32 ttl : 8;
 	u32 flag : 3;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+	u32 resv1_1 : 6;
+	u32 eg_keep_ecn : 1;
+	u32 eg_keep_cls : 1;
+	u32 eg_keep_tnl_qos : 1;
+	u32 resv1_2 : 4;
+	u32 per_flow_6rd_id : 1;
+	u32 resv2 : 9;
+#else
 	u32 resv1 : 13;
 	u32 per_flow_6rd_id : 1;
 	u32 resv2 : 9;
+#endif
 	u32 act_dp : 6; /* UDF */
 
 	union {
@@ -904,6 +951,7 @@
 	struct timer_list hnat_mcast_check_timer;
 	bool nf_stat_en;
 	struct xlat_conf xlat;
+	spinlock_t		entry_lock;
 };
 
 struct extdev_entry {
@@ -1170,6 +1218,13 @@
 #define UDF_PINGPONG_IFIDX GENMASK(3, 0)
 #define UDF_HNAT_PRE_FILLED BIT(4)
 
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+#define TPORT_FLAG(dev, skb)				\
+	((IS_HQOS_UL_MODE && IS_WAN(dev)) ||		\
+	 (IS_HQOS_DL_MODE && IS_LAN_GRP(dev)) ||	\
+	 (IS_PPPQ_MODE && IS_PPPQ_PATH(dev, skb)))
+#endif
+
 extern const struct of_device_id of_hnat_match[];
 extern struct mtk_hnat *hnat_priv;
 
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
index f648386..fc7d216 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
@@ -917,7 +917,7 @@
 	entry = h->foe_table_cpu[ppe_id];
 	end = h->foe_table_cpu[ppe_id] + hnat_priv->foe_etry_num;
 	while (entry < end) {
-		if (!entry->bfib1.state) {
+		if ((!entry->bfib1.state) && (debug_level < 7)) {
 			entry++;
 			entry_index++;
 			continue;
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 d34ac9d..85c38e0 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
@@ -1284,6 +1284,10 @@
 							ntohs(pptr->src);
 					entry.ipv4_mape.new_dport =
 							ntohs(pptr->dst);
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+					entry.ipv4_mape.eg_keep_ecn = 1;
+					entry.ipv4_mape.eg_keep_dscp = 1;
+#endif
 				}
 #endif
 
@@ -1311,6 +1315,11 @@
 				if (hnat_priv->data->per_flow_accounting)
 					entry.ipv4_dslite.iblk2.mibf = 1;
 
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+				entry.ipv4_dslite.eg_keep_ecn = 1;
+				entry.ipv4_dslite.eg_keep_cls = 1;
+#endif
+
 			} else {
 				entry.ipv4_hnapt.iblk2.dscp = iph->tos;
 				if (hnat_priv->data->per_flow_accounting)
@@ -1350,6 +1359,11 @@
 				entry.ipv4_hnapt.new_dport = ntohs(pptr->dst);
 			}
 
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+			entry.ipv4_hnapt.eg_keep_ecn = 1;
+			entry.ipv4_hnapt.eg_keep_dscp = 1;
+#endif
+
 			break;
 
 		default:
@@ -1393,6 +1407,11 @@
 					foe->ipv6_6rd.tunnel_sipv4;
 				entry.ipv6_6rd.tunnel_dipv4 =
 					foe->ipv6_6rd.tunnel_dipv4;
+
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+				entry.ipv6_6rd.eg_keep_ecn = 1;
+				entry.ipv6_6rd.eg_keep_cls = 1;
+#endif
 			}
 
 			entry.ipv6_3t_route.ipv6_sip0 =
@@ -1418,6 +1437,10 @@
 					foe->ipv6_3t_route.prot;
 				entry.ipv6_3t_route.hph =
 					foe->ipv6_3t_route.hph;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+				entry.ipv6_3t_route.eg_keep_ecn = 1;
+				entry.ipv6_3t_route.eg_keep_cls = 1;
+#endif
 			}
 
 			if (IS_IPV6_5T_ROUTE(foe) || IS_IPV6_6RD(foe)) {
@@ -1425,6 +1448,10 @@
 					foe->ipv6_5t_route.sport;
 				entry.ipv6_5t_route.dport =
 					foe->ipv6_5t_route.dport;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+				entry.ipv6_5t_route.eg_keep_ecn = 1;
+				entry.ipv6_5t_route.eg_keep_cls = 1;
+#endif
 			}
 
 			if (ct && (ct->status & IPS_SRC_NAT)) {
@@ -1463,6 +1490,10 @@
 
 				entry.ipv6_hnapt.new_sport = ntohs(pptr->src);
 				entry.ipv6_hnapt.new_dport = ntohs(pptr->dst);
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+				entry.ipv6_hnapt.eg_keep_ecn = 1;
+				entry.ipv6_hnapt.eg_keep_cls = 1;
+#endif
 #else
 				return -1;
 #endif
@@ -1518,6 +1549,10 @@
 				entry.ipv4_dslite.vlan1 = hw_path->vlan_id;
 				if (hnat_priv->data->per_flow_accounting)
 					entry.ipv4_dslite.iblk2.mibf = 1;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+				entry.ipv4_dslite.eg_keep_ecn = 1;
+				entry.ipv4_dslite.eg_keep_cls = 1;
+#endif
 				/* Map-E LAN->WAN record inner IPv4 header info. */
 #if defined(CONFIG_MEDIATEK_NETSYS_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3)
 				if (mape_toggle) {
@@ -1526,6 +1561,10 @@
 					entry.ipv4_mape.new_dip = foe->ipv4_mape.new_dip;
 					entry.ipv4_mape.new_sport = foe->ipv4_mape.new_sport;
 					entry.ipv4_mape.new_dport = foe->ipv4_mape.new_dport;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+					entry.ipv4_mape.eg_keep_ecn = 1;
+					entry.ipv4_mape.eg_keep_dscp = 1;
+#endif
 				}
 #endif
 			} else if (mape_toggle &&
@@ -1582,6 +1621,10 @@
 				entry.ipv4_hnapt.new_dport =
 					foe->ipv4_hnapt.new_dport;
 				mape_l2w_v6h = *ip6h;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+				entry.ipv4_hnapt.eg_keep_ecn = 1;
+				entry.ipv4_hnapt.eg_keep_dscp = 1;
+#endif
 			}
 			break;
 
@@ -1621,6 +1664,11 @@
 			entry.ipv6_6rd.vlan1 = hw_path->vlan_id;
 			if (hnat_priv->data->per_flow_accounting)
 				entry.ipv6_6rd.iblk2.mibf = 1;
+
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+			entry.ipv6_6rd.eg_keep_ecn = 1;
+			entry.ipv6_6rd.eg_keep_cls = 1;
+#endif
 			break;
 
 		default:
@@ -1777,13 +1825,19 @@
 				entry.ipv6_5t_route.iblk2.fqos = 0;
 			else
 #if defined(CONFIG_MEDIATEK_NETSYS_V3)
-				if ((IS_HQOS_UL_MODE && IS_WAN(dev)) ||
-					(IS_HQOS_DL_MODE && IS_LAN_GRP(dev)) ||
-					(IS_PPPQ_MODE &&
-					 IS_PPPQ_PATH(dev, skb)))
-					entry.ipv6_5t_route.tport_id = 1;
-				else
-					entry.ipv6_5t_route.tport_id = 0;
+				switch (foe->bfib1.pkt_type) {
+				case IPV4_MAP_E:
+				case IPV4_MAP_T:
+					entry.ipv4_mape.tport_id = TPORT_FLAG(dev, skb) ? 1 : 0;
+					break;
+				case IPV6_HNAPT:
+				case IPV6_HNAT:
+					entry.ipv6_hnapt.tport_id = TPORT_FLAG(dev, skb) ? 1 : 0;
+					break;
+				default:
+					entry.ipv6_5t_route.tport_id = TPORT_FLAG(dev, skb) ? 1 : 0;
+					break;
+				}
 #else
 				entry.ipv6_5t_route.iblk2.fqos =
 					(!IS_PPPQ_MODE ||
@@ -1823,9 +1877,8 @@
 
 int mtk_sw_nat_hook_tx(struct sk_buff *skb, int gmac_no)
 {
-	struct foe_entry *entry;
+	struct foe_entry *hw_entry, entry;
 	struct ethhdr *eth;
-	struct hnat_bind_info_blk bfib1_tx;
 
 	if (skb_hnat_alg(skb) ||
 	    !is_magic_tag_valid(skb) || !IS_SPACE_AVAILABLE_HEAD(skb))
@@ -1851,38 +1904,39 @@
 	    skb_hnat_ppe(skb) >= CFG_PPE_NUM)
 		return NF_ACCEPT;
 
-	entry = &hnat_priv->foe_table_cpu[skb_hnat_ppe(skb)][skb_hnat_entry(skb)];
-	if (entry_hnat_is_bound(entry))
+	hw_entry = &hnat_priv->foe_table_cpu[skb_hnat_ppe(skb)][skb_hnat_entry(skb)];
+	memcpy(&entry, hw_entry, sizeof(entry));
+	if (entry.bfib1.state == BIND)
 		return NF_ACCEPT;
 
 	if (skb_hnat_reason(skb) != HIT_UNBIND_RATE_REACH)
 		return NF_ACCEPT;
 
-	if (!is_hnat_pre_filled(entry))
+	if (!is_hnat_pre_filled(&entry))
 		return NF_ACCEPT;
 
 	eth = eth_hdr(skb);
-	memcpy(&bfib1_tx, &entry->bfib1, sizeof(entry->bfib1));
 
 	/*not bind multicast if PPE mcast not enable*/
 	if (!hnat_priv->data->mcast) {
 		if (is_multicast_ether_addr(eth->h_dest))
 			return NF_ACCEPT;
 
-		if (IS_IPV4_GRP(entry))
-			entry->ipv4_hnapt.iblk2.mcast = 0;
+		if (IS_IPV4_GRP(&entry))
+			entry.ipv4_hnapt.iblk2.mcast = 0;
 		else
-			entry->ipv6_5t_route.iblk2.mcast = 0;
+			entry.ipv6_5t_route.iblk2.mcast = 0;
 	}
 
+	spin_lock(&hnat_priv->entry_lock);
 	/* Some mt_wifi virtual interfaces, such as apcli,
 	 * will change the smac for specail purpose.
 	 */
-	switch ((int)bfib1_tx.pkt_type) {
+	switch ((int)entry.bfib1.pkt_type) {
 	case IPV4_HNAPT:
 	case IPV4_HNAT:
-		entry->ipv4_hnapt.smac_hi = swab32(*((u32 *)eth->h_source));
-		entry->ipv4_hnapt.smac_lo = swab16(*((u16 *)&eth->h_source[4]));
+		entry.ipv4_hnapt.smac_hi = swab32(*((u32 *)eth->h_source));
+		entry.ipv4_hnapt.smac_lo = swab16(*((u16 *)&eth->h_source[4]));
 		break;
 	case IPV4_DSLITE:
 	case IPV4_MAP_E:
@@ -1891,167 +1945,251 @@
 	case IPV6_3T_ROUTE:
 	case IPV6_HNAPT:
 	case IPV6_HNAT:
-		entry->ipv6_5t_route.smac_hi = swab32(*((u32 *)eth->h_source));
-		entry->ipv6_5t_route.smac_lo = swab16(*((u16 *)&eth->h_source[4]));
+		entry.ipv6_5t_route.smac_hi = swab32(*((u32 *)eth->h_source));
+		entry.ipv6_5t_route.smac_lo = swab16(*((u16 *)&eth->h_source[4]));
 		break;
 	}
 
 	if (skb_vlan_tagged(skb)) {
-		bfib1_tx.vlan_layer = 1;
-		bfib1_tx.vpm = 1;
-		if (IS_IPV4_GRP(entry)) {
-			entry->ipv4_hnapt.etype = htons(ETH_P_8021Q);
-			entry->ipv4_hnapt.vlan1 = skb->vlan_tci;
-		} else if (IS_IPV6_GRP(entry)) {
-			entry->ipv6_5t_route.etype = htons(ETH_P_8021Q);
-			entry->ipv6_5t_route.vlan1 = skb->vlan_tci;
+		entry.bfib1.vlan_layer = 1;
+		entry.bfib1.vpm = 1;
+		if (IS_IPV4_GRP(&entry)) {
+			entry.ipv4_hnapt.etype = htons(ETH_P_8021Q);
+			entry.ipv4_hnapt.vlan1 = skb->vlan_tci;
+		} else if (IS_IPV6_GRP(&entry)) {
+			entry.ipv6_5t_route.etype = htons(ETH_P_8021Q);
+			entry.ipv6_5t_route.vlan1 = skb->vlan_tci;
 		}
 	} else {
-		bfib1_tx.vpm = 0;
-		bfib1_tx.vlan_layer = 0;
+		entry.bfib1.vpm = 0;
+		entry.bfib1.vlan_layer = 0;
 	}
 
 	/* MT7622 wifi hw_nat not support QoS */
-	if (IS_IPV4_GRP(entry)) {
-		entry->ipv4_hnapt.iblk2.fqos = 0;
+	if (IS_IPV4_GRP(&entry)) {
+		entry.ipv4_hnapt.iblk2.fqos = 0;
 		if ((hnat_priv->data->version == MTK_HNAT_V1_2 &&
 		     gmac_no == NR_WHNAT_WDMA_PORT) ||
 		    ((hnat_priv->data->version == MTK_HNAT_V2 ||
 		      hnat_priv->data->version == MTK_HNAT_V3) &&
 		     (gmac_no == NR_WDMA0_PORT || gmac_no == NR_WDMA1_PORT ||
 		      gmac_no == NR_WDMA2_PORT))) {
-			entry->ipv4_hnapt.winfo.bssid = skb_hnat_bss_id(skb);
-			entry->ipv4_hnapt.winfo.wcid = skb_hnat_wc_id(skb);
+			entry.ipv4_hnapt.winfo.bssid = skb_hnat_bss_id(skb);
+			entry.ipv4_hnapt.winfo.wcid = skb_hnat_wc_id(skb);
 #if defined(CONFIG_MEDIATEK_NETSYS_V3)
-			entry->ipv4_hnapt.tport_id = IS_HQOS_DL_MODE ? 1 : 0;
-			entry->ipv4_hnapt.iblk2.rxid = skb_hnat_rx_id(skb);
-			entry->ipv4_hnapt.iblk2.winfoi = 1;
-			entry->ipv4_hnapt.winfo_pao.usr_info =
+			entry.ipv4_hnapt.tport_id = IS_HQOS_DL_MODE ? 1 : 0;
+			entry.ipv4_hnapt.iblk2.rxid = skb_hnat_rx_id(skb);
+			entry.ipv4_hnapt.iblk2.winfoi = 1;
+			entry.ipv4_hnapt.winfo_pao.usr_info =
 				skb_hnat_usr_info(skb);
-			entry->ipv4_hnapt.winfo_pao.tid = skb_hnat_tid(skb);
-			entry->ipv4_hnapt.winfo_pao.is_fixedrate =
+			entry.ipv4_hnapt.winfo_pao.tid = skb_hnat_tid(skb);
+			entry.ipv4_hnapt.winfo_pao.is_fixedrate =
 				skb_hnat_is_fixedrate(skb);
-			entry->ipv4_hnapt.winfo_pao.is_prior =
+			entry.ipv4_hnapt.winfo_pao.is_prior =
 				skb_hnat_is_prior(skb);
-			entry->ipv4_hnapt.winfo_pao.is_sp = skb_hnat_is_sp(skb);
-			entry->ipv4_hnapt.winfo_pao.hf = skb_hnat_hf(skb);
-			entry->ipv4_hnapt.winfo_pao.amsdu = skb_hnat_amsdu(skb);
+			entry.ipv4_hnapt.winfo_pao.is_sp = skb_hnat_is_sp(skb);
+			entry.ipv4_hnapt.winfo_pao.hf = skb_hnat_hf(skb);
+			entry.ipv4_hnapt.winfo_pao.amsdu = skb_hnat_amsdu(skb);
 #elif defined(CONFIG_MEDIATEK_NETSYS_V2)
-			entry->ipv4_hnapt.iblk2.rxid = skb_hnat_rx_id(skb);
-			entry->ipv4_hnapt.iblk2.winfoi = 1;
+			entry.ipv4_hnapt.iblk2.rxid = skb_hnat_rx_id(skb);
+			entry.ipv4_hnapt.iblk2.winfoi = 1;
 #else
-			entry->ipv4_hnapt.winfo.rxid = skb_hnat_rx_id(skb);
-			entry->ipv4_hnapt.iblk2w.winfoi = 1;
-			entry->ipv4_hnapt.iblk2w.wdmaid = skb_hnat_wdma_id(skb);
+			entry.ipv4_hnapt.winfo.rxid = skb_hnat_rx_id(skb);
+			entry.ipv4_hnapt.iblk2w.winfoi = 1;
+			entry.ipv4_hnapt.iblk2w.wdmaid = skb_hnat_wdma_id(skb);
 #endif
 		} else {
 			if (IS_GMAC1_MODE && !hnat_dsa_is_enable(hnat_priv)) {
-				bfib1_tx.vpm = 1;
-				bfib1_tx.vlan_layer = 1;
+				entry.bfib1.vpm = 1;
+				entry.bfib1.vlan_layer = 1;
 
 				if (FROM_GE_LAN_GRP(skb))
-					entry->ipv4_hnapt.vlan1 = 1;
+					entry.ipv4_hnapt.vlan1 = 1;
 				else if (FROM_GE_WAN(skb) || FROM_GE_VIRTUAL(skb))
-					entry->ipv4_hnapt.vlan1 = 2;
+					entry.ipv4_hnapt.vlan1 = 2;
 			}
 
 			if (IS_HQOS_MODE &&
 			    (FROM_GE_LAN_GRP(skb) || FROM_GE_WAN(skb) || FROM_GE_VIRTUAL(skb))) {
-				bfib1_tx.vpm = 0;
-				bfib1_tx.vlan_layer = 1;
-				entry->ipv4_hnapt.etype = htons(HQOS_MAGIC_TAG);
-				entry->ipv4_hnapt.vlan1 = skb_hnat_entry(skb);
-				entry->ipv4_hnapt.iblk2.fqos = 1;
+				entry.bfib1.vpm = 0;
+				entry.bfib1.vlan_layer = 1;
+				entry.ipv4_hnapt.etype = htons(HQOS_MAGIC_TAG);
+				entry.ipv4_hnapt.vlan1 = skb_hnat_entry(skb);
+				entry.ipv4_hnapt.iblk2.fqos = 1;
 			}
 		}
-		entry->ipv4_hnapt.iblk2.dp = gmac_no;
+		entry.ipv4_hnapt.iblk2.dp = gmac_no;
 #if defined(CONFIG_MEDIATEK_NETSYS_V3)
-	} else if (IS_IPV6_HNAPT(entry) || IS_IPV6_HNAT(entry)) {
-		entry->ipv6_hnapt.iblk2.dp = gmac_no;
-		entry->ipv6_hnapt.iblk2.rxid = skb_hnat_rx_id(skb);
-		entry->ipv6_hnapt.iblk2.winfoi = 1;
+	} else if (IS_IPV6_HNAPT(&entry) || IS_IPV6_HNAT(&entry)) {
+		entry.ipv6_hnapt.iblk2.dp = gmac_no;
+		entry.ipv6_hnapt.iblk2.rxid = skb_hnat_rx_id(skb);
+		entry.ipv6_hnapt.iblk2.winfoi = 1;
 
-		entry->ipv6_hnapt.winfo.bssid = skb_hnat_bss_id(skb);
-		entry->ipv6_hnapt.winfo.wcid = skb_hnat_wc_id(skb);
-		entry->ipv6_hnapt.winfo_pao.usr_info = skb_hnat_usr_info(skb);
-		entry->ipv6_hnapt.winfo_pao.tid = skb_hnat_tid(skb);
-		entry->ipv6_hnapt.winfo_pao.is_fixedrate =
+		entry.ipv6_hnapt.winfo.bssid = skb_hnat_bss_id(skb);
+		entry.ipv6_hnapt.winfo.wcid = skb_hnat_wc_id(skb);
+		entry.ipv6_hnapt.winfo_pao.usr_info = skb_hnat_usr_info(skb);
+		entry.ipv6_hnapt.winfo_pao.tid = skb_hnat_tid(skb);
+		entry.ipv6_hnapt.winfo_pao.is_fixedrate =
 			skb_hnat_is_fixedrate(skb);
-		entry->ipv6_hnapt.winfo_pao.is_prior = skb_hnat_is_prior(skb);
-		entry->ipv6_hnapt.winfo_pao.is_sp = skb_hnat_is_sp(skb);
-		entry->ipv6_hnapt.winfo_pao.hf = skb_hnat_hf(skb);
-		entry->ipv6_hnapt.winfo_pao.amsdu = skb_hnat_amsdu(skb);
-		entry->ipv6_hnapt.tport_id = IS_HQOS_DL_MODE ? 1 : 0;
+		entry.ipv6_hnapt.winfo_pao.is_prior = skb_hnat_is_prior(skb);
+		entry.ipv6_hnapt.winfo_pao.is_sp = skb_hnat_is_sp(skb);
+		entry.ipv6_hnapt.winfo_pao.hf = skb_hnat_hf(skb);
+		entry.ipv6_hnapt.winfo_pao.amsdu = skb_hnat_amsdu(skb);
+		entry.ipv6_hnapt.tport_id = IS_HQOS_DL_MODE ? 1 : 0;
 #endif
 	} else {
-		entry->ipv6_5t_route.iblk2.fqos = 0;
+		entry.ipv6_5t_route.iblk2.fqos = 0;
 		if ((hnat_priv->data->version == MTK_HNAT_V1_2 &&
 		     gmac_no == NR_WHNAT_WDMA_PORT) ||
 		    ((hnat_priv->data->version == MTK_HNAT_V2 ||
 		      hnat_priv->data->version == MTK_HNAT_V3) &&
 		     (gmac_no == NR_WDMA0_PORT || gmac_no == NR_WDMA1_PORT ||
 		      gmac_no == NR_WDMA2_PORT))) {
-			entry->ipv6_5t_route.winfo.bssid = skb_hnat_bss_id(skb);
-			entry->ipv6_5t_route.winfo.wcid = skb_hnat_wc_id(skb);
 #if defined(CONFIG_MEDIATEK_NETSYS_V3)
-			entry->ipv6_5t_route.tport_id = IS_HQOS_DL_MODE ? 1 : 0;
-			entry->ipv6_5t_route.iblk2.rxid = skb_hnat_rx_id(skb);
-			entry->ipv6_5t_route.iblk2.winfoi = 1;
-			entry->ipv6_5t_route.winfo_pao.usr_info =
-				skb_hnat_usr_info(skb);
-			entry->ipv6_5t_route.winfo_pao.tid =
-				skb_hnat_tid(skb);
-			entry->ipv6_5t_route.winfo_pao.is_fixedrate =
-				skb_hnat_is_fixedrate(skb);
-			entry->ipv6_5t_route.winfo_pao.is_prior =
-				skb_hnat_is_prior(skb);
-			entry->ipv6_5t_route.winfo_pao.is_sp =
-				skb_hnat_is_sp(skb);
-			entry->ipv6_5t_route.winfo_pao.hf =
-				skb_hnat_hf(skb);
-			entry->ipv6_5t_route.winfo_pao.amsdu =
-				skb_hnat_amsdu(skb);
+			switch (entry.bfib1.pkt_type) {
+			case IPV4_MAP_E:
+			case IPV4_MAP_T:
+				entry.ipv4_mape.winfo.bssid = skb_hnat_bss_id(skb);
+				entry.ipv4_mape.winfo.wcid = skb_hnat_wc_id(skb);
+				entry.ipv4_mape.tport_id = IS_HQOS_DL_MODE ? 1 : 0;
+				entry.ipv4_mape.iblk2.rxid = skb_hnat_rx_id(skb);
+				entry.ipv4_mape.iblk2.winfoi = 1;
+				entry.ipv4_mape.winfo_pao.usr_info =
+					skb_hnat_usr_info(skb);
+				entry.ipv4_mape.winfo_pao.tid =
+					skb_hnat_tid(skb);
+				entry.ipv4_mape.winfo_pao.is_fixedrate =
+					skb_hnat_is_fixedrate(skb);
+				entry.ipv4_mape.winfo_pao.is_prior =
+					skb_hnat_is_prior(skb);
+				entry.ipv4_mape.winfo_pao.is_sp =
+					skb_hnat_is_sp(skb);
+				entry.ipv4_mape.winfo_pao.hf =
+					skb_hnat_hf(skb);
+				entry.ipv4_mape.winfo_pao.amsdu =
+					skb_hnat_amsdu(skb);
+				break;
+			default:
+				entry.ipv6_5t_route.winfo.bssid = skb_hnat_bss_id(skb);
+				entry.ipv6_5t_route.winfo.wcid = skb_hnat_wc_id(skb);
+				entry.ipv6_5t_route.tport_id = IS_HQOS_DL_MODE ? 1 : 0;
+				entry.ipv6_5t_route.iblk2.rxid = skb_hnat_rx_id(skb);
+				entry.ipv6_5t_route.iblk2.winfoi = 1;
+				entry.ipv6_5t_route.winfo_pao.usr_info =
+					skb_hnat_usr_info(skb);
+				entry.ipv6_5t_route.winfo_pao.tid =
+					skb_hnat_tid(skb);
+				entry.ipv6_5t_route.winfo_pao.is_fixedrate =
+					skb_hnat_is_fixedrate(skb);
+				entry.ipv6_5t_route.winfo_pao.is_prior =
+					skb_hnat_is_prior(skb);
+				entry.ipv6_5t_route.winfo_pao.is_sp =
+					skb_hnat_is_sp(skb);
+				entry.ipv6_5t_route.winfo_pao.hf =
+					skb_hnat_hf(skb);
+				entry.ipv6_5t_route.winfo_pao.amsdu =
+					skb_hnat_amsdu(skb);
+				break;
+			}
 #elif defined(CONFIG_MEDIATEK_NETSYS_V2)
-			entry->ipv6_5t_route.iblk2.rxid = skb_hnat_rx_id(skb);
-			entry->ipv6_5t_route.iblk2.winfoi = 1;
+			entry.ipv6_5t_route.winfo.bssid = skb_hnat_bss_id(skb);
+			entry.ipv6_5t_route.winfo.wcid = skb_hnat_wc_id(skb);
+			entry.ipv6_5t_route.iblk2.rxid = skb_hnat_rx_id(skb);
+			entry.ipv6_5t_route.iblk2.winfoi = 1;
 #else
-			entry->ipv6_5t_route.winfo.rxid = skb_hnat_rx_id(skb);
-			entry->ipv6_5t_route.iblk2w.winfoi = 1;
-			entry->ipv6_5t_route.iblk2w.wdmaid = skb_hnat_wdma_id(skb);
+			entry.ipv6_5t_route.winfo.bssid = skb_hnat_bss_id(skb);
+			entry.ipv6_5t_route.winfo.wcid = skb_hnat_wc_id(skb);
+			entry.ipv6_5t_route.winfo.rxid = skb_hnat_rx_id(skb);
+			entry.ipv6_5t_route.iblk2w.winfoi = 1;
+			entry.ipv6_5t_route.iblk2w.wdmaid = skb_hnat_wdma_id(skb);
 #endif
 		} else {
 			if (IS_GMAC1_MODE && !hnat_dsa_is_enable(hnat_priv)) {
-				bfib1_tx.vpm = 1;
-				bfib1_tx.vlan_layer = 1;
+				entry.bfib1.vpm = 1;
+				entry.bfib1.vlan_layer = 1;
 
 				if (FROM_GE_LAN_GRP(skb))
-					entry->ipv6_5t_route.vlan1 = 1;
+					entry.ipv6_5t_route.vlan1 = 1;
 				else if (FROM_GE_WAN(skb) || FROM_GE_VIRTUAL(skb))
-					entry->ipv6_5t_route.vlan1 = 2;
+					entry.ipv6_5t_route.vlan1 = 2;
 			}
 
 			if (IS_HQOS_MODE &&
 			    (FROM_GE_LAN_GRP(skb) || FROM_GE_WAN(skb) || FROM_GE_VIRTUAL(skb))) {
-				bfib1_tx.vpm = 0;
-				bfib1_tx.vlan_layer = 1;
-				entry->ipv6_5t_route.etype = htons(HQOS_MAGIC_TAG);
-				entry->ipv6_5t_route.vlan1 = skb_hnat_entry(skb);
-				entry->ipv6_5t_route.iblk2.fqos = 1;
+				entry.bfib1.vpm = 0;
+				entry.bfib1.vlan_layer = 1;
+				entry.ipv6_5t_route.etype = htons(HQOS_MAGIC_TAG);
+				entry.ipv6_5t_route.vlan1 = skb_hnat_entry(skb);
+				entry.ipv6_5t_route.iblk2.fqos = 1;
 			}
 		}
-		entry->ipv6_5t_route.iblk2.dp = gmac_no;
+		entry.ipv6_5t_route.iblk2.dp = gmac_no;
 	}
 
-	bfib1_tx.ttl = 1;
-	bfib1_tx.state = BIND;
+	entry.bfib1.ttl = 1;
+	entry.bfib1.state = BIND;
+	if (IS_IPV4_GRP(&entry))
+		entry.ipv4_hnapt.act_dp &= ~UDF_HNAT_PRE_FILLED;
+	else
+		entry.ipv6_5t_route.act_dp &= ~UDF_HNAT_PRE_FILLED;
+	/* We must ensure all info has been updated before set to hw */
 	wmb();
-	memcpy(&entry->bfib1, &bfib1_tx, sizeof(bfib1_tx));
+	memcpy(hw_entry, &entry, sizeof(entry));
 
-	if (IS_IPV4_GRP(entry))
-		entry->ipv4_hnapt.act_dp &= ~UDF_HNAT_PRE_FILLED;
-	else
-		entry->ipv6_5t_route.act_dp &= ~UDF_HNAT_PRE_FILLED;
+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
+	if (debug_level >= 7) {
+		pr_info("%s %d dp:%d rxid:%d tid:%d usr_info:%d bssid:%d wcid:%d hsh-idx:%d sp:%d\n",
+			__func__, __LINE__,
+			gmac_no, skb_hnat_rx_id(skb), skb_hnat_tid(skb),
+			skb_hnat_usr_info(skb), skb_hnat_bss_id(skb),
+			skb_hnat_wc_id(skb), skb_hnat_entry(skb),
+			skb_hnat_sport(skb));
 
+		if (IS_IPV4_GRP(&entry)) {
+			pr_info("%s %d dp:%d rxid:%d tid:%d uinfo:%d bssid:%d wcid:%d hsh-idx:%d sp:%d\n",
+				__func__, __LINE__,
+				(hw_entry->ipv4_hnapt.iblk2.dp),
+				(hw_entry->ipv4_hnapt.iblk2.rxid),
+				(hw_entry->ipv4_hnapt.winfo_pao.tid),
+				(hw_entry->ipv4_hnapt.winfo_pao.usr_info),
+				(hw_entry->ipv4_hnapt.winfo.bssid),
+				(hw_entry->ipv4_hnapt.winfo.wcid),
+				skb_hnat_entry(skb), skb_hnat_sport(skb));
+			pr_info("%s %d dip:%x sip:%x dp:%x sp:%x hsh-idx:%d\n",
+				__func__, __LINE__,
+				hw_entry->ipv4_hnapt.dip, hw_entry->ipv4_hnapt.sip,
+				hw_entry->ipv4_hnapt.dport, hw_entry->ipv4_hnapt.sport,
+				skb_hnat_entry(skb));
+			pr_info("%s %d new_dip:%x new_sip:%x new_dp:%x new_sp:%x hsh-idx:%d\n",
+				__func__, __LINE__,
+				hw_entry->ipv4_hnapt.new_dip, hw_entry->ipv4_hnapt.new_sip,
+				hw_entry->ipv4_hnapt.new_dport,
+				hw_entry->ipv4_hnapt.new_sport, skb_hnat_entry(skb));
+		} else {
+			pr_info("%s %d dp:%d rxid:%d tid:%d uinfo:%d bssid:%d wcid:%d hidx:%d sp:%d\n",
+				__func__, __LINE__,
+				(hw_entry->ipv6_5t_route.iblk2.dp),
+				(hw_entry->ipv6_5t_route.iblk2.rxid),
+				(hw_entry->ipv6_5t_route.winfo_pao.tid),
+				(hw_entry->ipv6_5t_route.winfo_pao.usr_info),
+				(hw_entry->ipv6_5t_route.winfo.bssid),
+				(hw_entry->ipv6_5t_route.winfo.wcid),
+				skb_hnat_entry(skb), skb_hnat_sport(skb));
+			pr_info("sip:%x-:%x-:%x-:%x dip0:%x-:%x-:%x-:%x dport:%x sport:%x\n",
+				hw_entry->ipv6_5t_route.ipv6_sip0,
+				hw_entry->ipv6_5t_route.ipv6_sip1,
+				hw_entry->ipv6_5t_route.ipv6_sip2,
+				hw_entry->ipv6_5t_route.ipv6_sip3,
+				hw_entry->ipv6_5t_route.ipv6_dip0,
+				hw_entry->ipv6_5t_route.ipv6_dip1,
+				hw_entry->ipv6_5t_route.ipv6_dip2,
+				hw_entry->ipv6_5t_route.ipv6_dip3,
+				hw_entry->ipv6_5t_route.dport,
+				hw_entry->ipv6_5t_route.sport);
+		}
+	}
+#endif
+	spin_unlock(&hnat_priv->entry_lock);
 	return NF_ACCEPT;
 }
 
@@ -2190,8 +2328,9 @@
 	}
 
 	if (flag) {
-		if (debug_level >= 2)
-			pr_info("Delete entry idx=%d.\n", skb_hnat_entry(skb));
+		if (debug_level >= 7)
+			pr_info("%s %d Delete entry idx=%d\n", __func__, __LINE__,
+			skb_hnat_entry(skb));
 		memset(entry, 0, sizeof(struct foe_entry));
 		hnat_cache_ebl(1);
 	}
@@ -2553,7 +2692,9 @@
 		if (fn && fn(skb, arp_dev, &hw_path))
 			break;
 
+		spin_lock(&hnat_priv->entry_lock);
 		skb_to_hnat_info(skb, out, entry, &hw_path);
+		spin_unlock(&hnat_priv->entry_lock);
 		break;
 	case HIT_BIND_KEEPALIVE_DUP_OLD_HDR:
 		/* update hnat count to nf_conntrack by keepalive */
@@ -2564,7 +2705,8 @@
 			break;
 
 		/* update dscp for qos */
-		mtk_hnat_dscp_update(skb, entry);
+		if (hnat_priv->data->version != MTK_HNAT_V3)
+			mtk_hnat_dscp_update(skb, entry);
 
 		/* update mcast timestamp*/
 		if (hnat_priv->data->version == MTK_HNAT_V1_3 &&
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-2p5ge.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-2p5ge.c
index 1047943..8cbe4ac 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-2p5ge.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-2p5ge.c
@@ -26,6 +26,9 @@
 #define MTK_PHY_LINK_STATUS_MISC               (0xa2)
 #define   MTK_PHY_FDX_ENABLE                   BIT(5)
 
+#define MTK_PHY_LPI_PCS_DSP_CTRL		(0x121)
+#define   MTK_PHY_LPI_SIG_EN_LO_THRESH100_MASK	GENMASK(12, 8)
+
 /* Registers on MDIO_MMD_VEND2 */
 #define MTK_PHY_LED0_ON_CTRL			(0x24)
 #define   MTK_PHY_LED0_ON_LINK1000		BIT(0)
@@ -98,6 +101,9 @@
 	writew(reg | MD32_EN, mcucsr_base + MD32_EN_CFG);
 	dev_info(dev, "Firmware loading/trigger ok.\n");
 
+	phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LPI_PCS_DSP_CTRL,
+		       MTK_PHY_LPI_SIG_EN_LO_THRESH100_MASK, 0);
+
 	/* Setup LED */
 	phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL,
 			 MTK_PHY_LED0_POLARITY | MTK_PHY_LED0_ON_LINK10 |
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3002-ovs-add-multicast-to-unicast-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3000-ovs-add-multicast-to-unicast-support.patch
old mode 100755
new mode 100644
similarity index 94%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3002-ovs-add-multicast-to-unicast-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3000-ovs-add-multicast-to-unicast-support.patch
index c707ee2..11c2c8e
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3002-ovs-add-multicast-to-unicast-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3000-ovs-add-multicast-to-unicast-support.patch
@@ -1,3 +1,16 @@
+From 0a78a8c88b4db2a49aad7544c085078d65dbd343 Mon Sep 17 00:00:00 2001
+From: mtk22468 <Xuzhu.Wang@mediatek.com>
+Date: Mon, 18 Sep 2023 10:50:36 +0800
+Subject: [PATCH 01/22] ovs add multicast to unicast support
+
+---
+ net/openvswitch/actions.c  |  30 ++++
+ net/openvswitch/datapath.c | 289 +++++++++++++++++++++++++++++++++++++
+ net/openvswitch/datapath.h |  32 ++++
+ net/openvswitch/vport.c    |   8 +
+ net/openvswitch/vport.h    |  26 ++++
+ 5 files changed, 385 insertions(+)
+
 diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
 index 9e8a5c4..d5bf30d 100644
 --- a/net/openvswitch/actions.c
@@ -47,7 +60,7 @@
  		} else if (mru <= vport->dev->mtu) {
  			struct net *net = read_pnet(&dp->net);
 diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
-index 4f097bd..9a2a8c0 100644
+index 4c537e7..40b4795 100644
 --- a/net/openvswitch/datapath.c
 +++ b/net/openvswitch/datapath.c
 @@ -11,6 +11,9 @@
@@ -60,7 +73,7 @@
  #include <linux/jhash.h>
  #include <linux/delay.h>
  #include <linux/time.h>
-@@ -530,6 +533,270 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
+@@ -538,6 +541,270 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
  	return err;
  }
  
@@ -331,7 +344,7 @@
  static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
  {
  	struct ovs_header *ovs_header = info->userhdr;
-@@ -604,6 +871,9 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
+@@ -612,6 +879,9 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
  	OVS_CB(packet)->input_vport = input_vport;
  	sf_acts = rcu_dereference(flow->sf_acts);
  
@@ -341,7 +354,7 @@
  	local_bh_disable();
  	err = ovs_execute_actions(dp, packet, sf_acts, &flow->key);
  	local_bh_enable();
-@@ -2183,6 +2453,9 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
+@@ -2199,6 +2469,9 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
  	struct datapath *dp;
  	struct vport *vport;
  	unsigned int new_headroom;
@@ -351,7 +364,7 @@
  	int err;
  
  	reply = ovs_vport_cmd_alloc_info();
-@@ -2210,6 +2483,22 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
+@@ -2226,6 +2499,22 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
  	if (netdev_get_fwd_headroom(vport->dev) == dp->max_headroom)
  		update_headroom = true;
  
@@ -480,3 +493,6 @@
  };
  
  /**
+-- 
+2.18.0
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3003-mt7622-backport-nf-hw-offload-framework-and-ups.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3001-mt7622-backport-nf-hw-offload-framework-and-upstream.patch
old mode 100755
new mode 100644
similarity index 96%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3003-mt7622-backport-nf-hw-offload-framework-and-ups.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3001-mt7622-backport-nf-hw-offload-framework-and-upstream.patch
index 9ccf9ce..ec6efb9
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3003-mt7622-backport-nf-hw-offload-framework-and-ups.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3001-mt7622-backport-nf-hw-offload-framework-and-upstream.patch
@@ -1,17 +1,17 @@
-From 6ad9bd65769003ab526e504577e0f747eba14287 Mon Sep 17 00:00:00 2001
+From b80c745d2b90b30558e4f5b12060af956ae8e76d Mon Sep 17 00:00:00 2001
 From: Bo Jiao <Bo.Jiao@mediatek.com>
-Date: Wed, 22 Jun 2022 09:42:19 +0800
-Subject: [PATCH 1/8] 
- 9990-mt7622-backport-nf-hw-offload-framework-and-upstream-hnat-plus-xt-FLOWOFFLOAD-update-v2
+Date: Mon, 18 Sep 2023 10:52:27 +0800
+Subject: [PATCH 02/22] mt7622 backport nf hw offload framework and upstream
+ hnat plus xt-FLOWOFFLOAD update v2
 
 ---
  drivers/net/ethernet/mediatek/Makefile        |    3 +-
- drivers/net/ethernet/mediatek/mtk_eth_soc.c   |   28 +-
- drivers/net/ethernet/mediatek/mtk_eth_soc.h   |   20 +-
- drivers/net/ethernet/mediatek/mtk_ppe.c       |  509 +++++++
+ drivers/net/ethernet/mediatek/mtk_eth_soc.c   |   25 +-
+ drivers/net/ethernet/mediatek/mtk_eth_soc.h   |   19 +-
+ drivers/net/ethernet/mediatek/mtk_ppe.c       |  510 +++++++
  drivers/net/ethernet/mediatek/mtk_ppe.h       |  288 ++++
  .../net/ethernet/mediatek/mtk_ppe_debugfs.c   |  214 +++
- .../net/ethernet/mediatek/mtk_ppe_offload.c   |  526 ++++++++
+ .../net/ethernet/mediatek/mtk_ppe_offload.c   |  535 ++++++++
  drivers/net/ethernet/mediatek/mtk_ppe_regs.h  |  144 ++
  drivers/net/ppp/ppp_generic.c                 |   22 +
  drivers/net/ppp/pppoe.c                       |   24 +
@@ -23,7 +23,7 @@
  .../net/netfilter/ipv6/nf_conntrack_ipv6.h    |    3 -
  include/net/netfilter/nf_conntrack.h          |   12 +
  include/net/netfilter/nf_conntrack_acct.h     |   11 +
- include/net/netfilter/nf_flow_table.h         |  264 +++-
+ include/net/netfilter/nf_flow_table.h         |  266 +++-
  include/net/netns/conntrack.h                 |    6 +
  .../linux/netfilter/nf_conntrack_common.h     |    9 +-
  include/uapi/linux/netfilter/xt_FLOWOFFLOAD.h |   17 +
@@ -33,7 +33,7 @@
  net/bridge/br_vlan.c                          |   55 +
  net/core/dev.c                                |   46 +
  net/dsa/dsa.c                                 |    9 +
- net/dsa/slave.c                               |   41 +-
+ net/dsa/slave.c                               |   37 +-
  net/ipv4/netfilter/Kconfig                    |    4 +-
  net/ipv6/ip6_output.c                         |    2 +-
  net/ipv6/netfilter/Kconfig                    |    3 +-
@@ -44,11 +44,14 @@
  net/netfilter/nf_conntrack_proto_tcp.c        |    4 +
  net/netfilter/nf_conntrack_proto_udp.c        |    4 +
  net/netfilter/nf_conntrack_standalone.c       |   34 +-
- net/netfilter/nf_flow_table_core.c            |  446 +++---
- net/netfilter/nf_flow_table_ip.c              |  455 ++++---
- net/netfilter/nf_flow_table_offload.c         | 1191 +++++++++++++++++
- net/netfilter/xt_FLOWOFFLOAD.c                |  719 ++++++++++
- 43 files changed, 4913 insertions(+), 432 deletions(-)
+ net/netfilter/nf_flow_table_core.c            |  462 ++++---
+ net/netfilter/nf_flow_table_ip.c              |  447 +++---
+ net/netfilter/nf_flow_table_offload.c         | 1199 +++++++++++++++++
+ net/netfilter/xt_FLOWOFFLOAD.c                |  794 +++++++++++
+ 43 files changed, 5005 insertions(+), 435 deletions(-)
+ mode change 100644 => 100755 drivers/net/ethernet/mediatek/Makefile
+ mode change 100644 => 100755 drivers/net/ethernet/mediatek/mtk_eth_soc.c
+ mode change 100644 => 100755 drivers/net/ethernet/mediatek/mtk_eth_soc.h
  create mode 100644 drivers/net/ethernet/mediatek/mtk_ppe.c
  create mode 100644 drivers/net/ethernet/mediatek/mtk_ppe.h
  create mode 100644 drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c
@@ -59,7 +62,9 @@
  create mode 100644 net/netfilter/xt_FLOWOFFLOAD.c
 
 diff --git a/drivers/net/ethernet/mediatek/Makefile b/drivers/net/ethernet/mediatek/Makefile
-index 13c5b4e8f..0a6af99f1 100755
+old mode 100644
+new mode 100755
+index 634640d..5f342f4
 --- a/drivers/net/ethernet/mediatek/Makefile
 +++ b/drivers/net/ethernet/mediatek/Makefile
 @@ -4,5 +4,6 @@
@@ -71,20 +76,22 @@
 +	     mtk_ppe.o mtk_ppe_debugfs.o mtk_ppe_offload.o
  obj-$(CONFIG_NET_MEDIATEK_HNAT)			+= mtk_hnat/
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-index 2b21f7ed0..819d8a0be 100755
+old mode 100644
+new mode 100755
+index c4bea4d..9c85e16
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -3081,6 +3081,7 @@ static int mtk_open(struct net_device *d
- 	struct mtk_phylink_priv *phylink_priv = &mac->phylink_priv;
+@@ -3573,6 +3573,7 @@ static int mtk_open(struct net_device *dev)
+ 	u32 id = mtk_mac2xgmii_id(eth, mac->id);
  	int err, i;
  	struct device_node *phy_node;
 +	u32 gdm_config = MTK_GDMA_TO_PDMA;
  
  	err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0);
  	if (err) {
-@@ -3157,7 +3158,10 @@ static int mtk_open(struct net_device *d
- 	if (!phy_node && eth->xgmii->regmap_sgmii[mac->id])
- 		regmap_write(eth->xgmii->regmap_sgmii[mac->id], SGMSYS_QPHY_PWR_STATE_CTRL, 0);
+@@ -3650,7 +3651,10 @@ static int mtk_open(struct net_device *dev)
+ 		regmap_write(eth->sgmii->pcs[id].regmap,
+ 			     SGMSYS_QPHY_PWR_STATE_CTRL, 0);
  
 -	mtk_gdm_config(eth, mac->id, MTK_GDMA_TO_PDMA);
 +	if (eth->soc->offload_version && mtk_ppe_start(&eth->ppe) == 0)
@@ -94,7 +101,7 @@
  
  	return 0;
  }
-@@ -3238,6 +3242,9 @@ static int mtk_stop(struct net_device *d
+@@ -3730,6 +3734,9 @@ static int mtk_stop(struct net_device *dev)
  
  	mtk_dma_free(eth);
  
@@ -104,15 +111,15 @@
  	return 0;
  }
  
-@@ -3915,6 +3922,7 @@ static const struct net_device_ops mtk_n
+@@ -4576,6 +4583,7 @@ static const struct net_device_ops mtk_netdev_ops = {
  #ifdef CONFIG_NET_POLL_CONTROLLER
  	.ndo_poll_controller	= mtk_poll_controller,
  #endif
 +	.ndo_setup_tc		= mtk_eth_setup_tc,
  };
  
- static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
-@@ -4308,6 +4316,17 @@ static int mtk_probe(struct platform_dev
+ static void mux_poll(struct work_struct *work)
+@@ -5161,6 +5169,17 @@ static int mtk_probe(struct platform_device *pdev)
  			goto err_free_dev;
  	}
  
@@ -130,40 +137,42 @@
  	for (i = 0; i < MTK_MAX_DEVS; i++) {
  		if (!eth->netdev[i])
  			continue;
-@@ -4410,6 +4429,7 @@ static const struct mtk_soc_data mt2701_
+@@ -5254,6 +5273,7 @@ static const struct mtk_soc_data mt2701_data = {
  	.required_clks = MT7623_CLKS_BITMAP,
  	.required_pctl = true,
  	.has_sram = false,
 +	.offload_version = 2,
-	.rss_num = 0,
+ 	.rss_num = 0,
  	.txrx = {
  		.txd_size = sizeof(struct mtk_tx_dma),
-@@ -4424,6 +4444,7 @@ static const struct mtk_soc_data mt7621_
+@@ -5271,6 +5291,7 @@ static const struct mtk_soc_data mt7621_data = {
  	.required_clks = MT7621_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.offload_version = 2,
-	.rss_num = 0,
+ 	.rss_num = 0,
  	.txrx = {
  		.txd_size = sizeof(struct mtk_tx_dma),
-@@ -4439,6 +4460,7 @@ static const struct mtk_soc_data mt7622_
+@@ -5289,6 +5310,7 @@ static const struct mtk_soc_data mt7622_data = {
  	.required_clks = MT7622_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.offload_version = 2,
-	.rss_num = 0,
+ 	.rss_num = 0,
  	.txrx = {
  		.txd_size = sizeof(struct mtk_tx_dma),
-@@ -4453,6 +4475,7 @@ static const struct mtk_soc_data mt7623_
+@@ -5306,6 +5328,7 @@ static const struct mtk_soc_data mt7623_data = {
  	.required_clks = MT7623_CLKS_BITMAP,
  	.required_pctl = true,
  	.has_sram = false,
 +	.offload_version = 2,
-	.rss_num = 0,
+ 	.rss_num = 0,
  	.txrx = {
  		.txd_size = sizeof(struct mtk_tx_dma),
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-index b6380ffeb..349f98503 100755
+old mode 100644
+new mode 100755
+index 8a9b615..a87e46d
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 @@ -15,6 +15,8 @@
@@ -175,7 +184,7 @@
  
  #define MTK_QDMA_PAGE_SIZE	2048
  #define	MTK_MAX_RX_LENGTH	1536
-@@ -37,7 +39,8 @@
+@@ -44,7 +46,8 @@
  				 NETIF_F_HW_VLAN_CTAG_TX | \
  				 NETIF_F_SG | NETIF_F_TSO | \
  				 NETIF_F_TSO6 | \
@@ -185,15 +194,15 @@
  #define MTK_SET_FEATURES	(NETIF_F_LRO | \
  				 NETIF_F_HW_VLAN_CTAG_RX)
  #define MTK_HW_FEATURES_MT7628	(NETIF_F_SG | NETIF_F_RXCSUM)
-@@ -107,6 +110,7 @@
- #define MTK_GDMA_TCS_EN		BIT(21)
+@@ -127,6 +130,7 @@
  #define MTK_GDMA_UCS_EN		BIT(20)
+ #define MTK_GDMA_STRP_CRC	BIT(16)
  #define MTK_GDMA_TO_PDMA	0x0
 +#define MTK_GDMA_TO_PPE		0x4444
  #define MTK_GDMA_DROP_ALL	0x7777
  
- /* Unicast Filter MAC Address Register - Low */
-@@ -547,6 +551,12 @@
+ /* GDM Egress Control Register */
+@@ -617,6 +621,12 @@
  #define RX_DMA_TCI(_x)		((_x) & (VLAN_PRIO_MASK | VLAN_VID_MASK))
  #define RX_DMA_VPID(_x)		(((_x) >> 16) & 0xffff)
  
@@ -206,15 +215,15 @@
  /* QDMA descriptor rxd4 */
  #define RX_DMA_L4_VALID		BIT(24)
  #define RX_DMA_L4_VALID_PDMA	BIT(30)		/* when PDMA is used */
-@@ -1158,6 +1168,7 @@ struct mtk_soc_data {
- 	u32		caps;
- 	u32		required_clks;
+@@ -1651,6 +1661,7 @@ struct mtk_soc_data {
+ 	u64		caps;
+ 	u64		required_clks;
  	bool		required_pctl;
 +	u8		offload_version;
  	netdev_features_t hw_features;
  	bool		has_sram;
- };
-@@ -1271,6 +1282,9 @@ struct mtk_eth {
+ 	struct {
+@@ -1847,6 +1858,9 @@ struct mtk_eth {
  	int				ip_align;
  	spinlock_t			syscfg0_lock;
  	struct timer_list		mtk_dma_monitor_timer;
@@ -224,17 +233,19 @@
  };
  
  /* struct mtk_mac -	the structure that holds the info about the MACs of the
-@@ -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);
+@@ -1927,6 +1941,9 @@ int mtk_toprgu_init(struct mtk_eth *eth, struct device_node *r);
  int mtk_dump_usxgmii(struct regmap *pmap, char *name, u32 offset, u32 range);
+ void mtk_usxgmii_link_poll(struct work_struct *work);
  
 +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);
+ u32 mtk_rss_indr_table(struct mtk_rss_params *rss_params, int index);
+ #endif /* MTK_ETH_H */
 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
+index 0000000..27b5be5
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
 @@ -0,0 +1,510 @@
@@ -750,7 +761,7 @@
 +}
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.h b/drivers/net/ethernet/mediatek/mtk_ppe.h
 new file mode 100644
-index 000000000..242fb8f2a
+index 0000000..242fb8f
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
 @@ -0,0 +1,288 @@
@@ -1044,7 +1055,7 @@
 +#endif
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c b/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c
 new file mode 100644
-index 000000000..d4b482340
+index 0000000..d4b4823
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c
 @@ -0,0 +1,214 @@
@@ -1264,7 +1275,7 @@
 +}
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 new file mode 100644
-index 000000000..4294f0c74
+index 0000000..1380ef0
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 @@ -0,0 +1,535 @@
@@ -1805,7 +1816,7 @@
 +}
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_regs.h b/drivers/net/ethernet/mediatek/mtk_ppe_regs.h
 new file mode 100644
-index 000000000..0c45ea090
+index 0000000..0c45ea0
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_regs.h
 @@ -0,0 +1,144 @@
@@ -1954,7 +1965,7 @@
 +
 +#endif
 diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
-index a085213dc..813e30495 100644
+index 078c0f4..f8a98d8 100644
 --- a/drivers/net/ppp/ppp_generic.c
 +++ b/drivers/net/ppp/ppp_generic.c
 @@ -1378,12 +1378,34 @@ static void ppp_dev_priv_destructor(struct net_device *dev)
@@ -1993,7 +2004,7 @@
  
  static struct device_type ppp_type = {
 diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
-index 087b01684..7a8c246ab 100644
+index 087b016..7a8c246 100644
 --- a/drivers/net/ppp/pppoe.c
 +++ b/drivers/net/ppp/pppoe.c
 @@ -974,8 +974,32 @@ static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb)
@@ -2030,10 +2041,10 @@
  
  static int pppoe_recvmsg(struct socket *sock, struct msghdr *m,
 diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
-index 38af42bf8..9f64504ac 100644
+index 631d158..ef44d9a 100644
 --- a/include/linux/netdevice.h
 +++ b/include/linux/netdevice.h
-@@ -829,6 +829,59 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
+@@ -838,6 +838,59 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
  				       struct sk_buff *skb,
  				       struct net_device *sb_dev);
  
@@ -2093,7 +2104,7 @@
  enum tc_setup_type {
  	TC_SETUP_QDISC_MQPRIO,
  	TC_SETUP_CLSU32,
-@@ -844,6 +897,7 @@ enum tc_setup_type {
+@@ -853,6 +906,7 @@ enum tc_setup_type {
  	TC_SETUP_ROOT_QDISC,
  	TC_SETUP_QDISC_GRED,
  	TC_SETUP_QDISC_TAPRIO,
@@ -2101,7 +2112,7 @@
  };
  
  /* These structures hold the attributes of bpf state that are being passed
-@@ -1239,6 +1293,8 @@ struct tlsdev_ops;
+@@ -1248,6 +1302,8 @@ struct tlsdev_ops;
   *	Get devlink port instance associated with a given netdev.
   *	Called with a reference on the netdevice and devlink locks only,
   *	rtnl_lock is not held.
@@ -2110,7 +2121,7 @@
   */
  struct net_device_ops {
  	int			(*ndo_init)(struct net_device *dev);
-@@ -1436,6 +1492,8 @@ struct net_device_ops {
+@@ -1445,6 +1501,8 @@ struct net_device_ops {
  	int			(*ndo_xsk_wakeup)(struct net_device *dev,
  						  u32 queue_id, u32 flags);
  	struct devlink_port *	(*ndo_get_devlink_port)(struct net_device *dev);
@@ -2119,7 +2130,7 @@
  };
  
  /**
-@@ -2661,6 +2719,8 @@ void dev_remove_offload(struct packet_offload *po);
+@@ -2670,6 +2728,8 @@ void dev_remove_offload(struct packet_offload *po);
  
  int dev_get_iflink(const struct net_device *dev);
  int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
@@ -2129,7 +2140,7 @@
  				      unsigned short mask);
  struct net_device *dev_get_by_name(struct net *net, const char *name);
 diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
-index 98966064e..91f9a9283 100644
+index 9896606..91f9a92 100644
 --- a/include/linux/ppp_channel.h
 +++ b/include/linux/ppp_channel.h
 @@ -28,6 +28,9 @@ struct ppp_channel_ops {
@@ -2143,10 +2154,10 @@
  
  struct ppp_channel {
 diff --git a/include/net/dsa.h b/include/net/dsa.h
-index 05f66d487..cafc74218 100644
+index d29ee9e..43f65cb 100644
 --- a/include/net/dsa.h
 +++ b/include/net/dsa.h
-@@ -561,6 +561,8 @@ struct dsa_switch_ops {
+@@ -562,6 +562,8 @@ struct dsa_switch_ops {
  					  struct sk_buff *skb);
  };
  
@@ -2155,7 +2166,7 @@
  struct dsa_switch_driver {
  	struct list_head	list;
  	const struct dsa_switch_ops *ops;
-@@ -653,6 +655,14 @@ static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev,
+@@ -654,6 +656,14 @@ static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev,
  #define BRCM_TAG_GET_PORT(v)		((v) >> 8)
  #define BRCM_TAG_GET_QUEUE(v)		((v) & 0xff)
  
@@ -2171,7 +2182,7 @@
  netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev);
  int dsa_port_get_phy_strings(struct dsa_port *dp, uint8_t *data);
 diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
-index c6f7bd22d..59b873653 100644
+index c6f7bd2..59b8736 100644
 --- a/include/net/flow_offload.h
 +++ b/include/net/flow_offload.h
 @@ -138,6 +138,7 @@ enum flow_action_id {
@@ -2193,7 +2204,7 @@
  };
  
 diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
-index 2c739fc75..89ab8f180 100644
+index 2c739fc..89ab8f1 100644
 --- a/include/net/ip6_route.h
 +++ b/include/net/ip6_route.h
 @@ -314,12 +314,13 @@ static inline bool rt6_duplicate_nexthop(struct fib6_info *a, struct fib6_info *
@@ -2213,7 +2224,7 @@
  		if (mtu)
  			goto out;
 diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
-index 7b3c873f8..e95483192 100644
+index 7b3c873..e954831 100644
 --- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
 +++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
 @@ -4,7 +4,4 @@
@@ -2225,7 +2236,7 @@
 -
  #endif /* _NF_CONNTRACK_IPV6_H*/
 diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
-index 90690e37a..ce0bc3e62 100644
+index 90690e3..ce0bc3e 100644
 --- a/include/net/netfilter/nf_conntrack.h
 +++ b/include/net/netfilter/nf_conntrack.h
 @@ -279,6 +279,18 @@ static inline bool nf_ct_should_gc(const struct nf_conn *ct)
@@ -2248,7 +2259,7 @@
  
  int nf_conntrack_set_hashsize(const char *val, const struct kernel_param *kp);
 diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h
-index f7a060c6e..7f44a7715 100644
+index f7a060c..7f44a77 100644
 --- a/include/net/netfilter/nf_conntrack_acct.h
 +++ b/include/net/netfilter/nf_conntrack_acct.h
 @@ -65,6 +65,17 @@ static inline void nf_ct_set_acct(struct net *net, bool enable)
@@ -2270,7 +2281,7 @@
  
  int nf_conntrack_acct_init(void);
 diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
-index 68d7fc92..7cf89767 100644
+index 68d7fc9..feac793 100644
 --- a/include/net/netfilter/nf_flow_table.h
 +++ b/include/net/netfilter/nf_flow_table.h
 @@ -8,31 +8,99 @@
@@ -2573,7 +2584,7 @@
  
  struct flow_ports {
  	__be16 source, dest;
-@@ -126,4 +298,41 @@ unsigned int nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
+@@ -126,4 +299,41 @@ unsigned int nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
  #define MODULE_ALIAS_NF_FLOWTABLE(family)	\
  	MODULE_ALIAS("nf-flowtable-" __stringify(family))
  
@@ -2616,7 +2627,7 @@
 +
  #endif /* _NF_FLOW_TABLE_H */
 diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
-index 806454e76..9e3963c8f 100644
+index 806454e..9e3963c 100644
 --- a/include/net/netns/conntrack.h
 +++ b/include/net/netns/conntrack.h
 @@ -27,6 +27,9 @@ struct nf_tcp_net {
@@ -2640,7 +2651,7 @@
  
  struct nf_icmp_net {
 diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h
-index 336014bf8..ae698d11c 100644
+index 336014b..ae698d1 100644
 --- a/include/uapi/linux/netfilter/nf_conntrack_common.h
 +++ b/include/uapi/linux/netfilter/nf_conntrack_common.h
 @@ -105,14 +105,19 @@ enum ip_conntrack_status {
@@ -2667,7 +2678,7 @@
  /* Connection tracking event types */
 diff --git a/include/uapi/linux/netfilter/xt_FLOWOFFLOAD.h b/include/uapi/linux/netfilter/xt_FLOWOFFLOAD.h
 new file mode 100644
-index 000000000..5841bbe0e
+index 0000000..5841bbe
 --- /dev/null
 +++ b/include/uapi/linux/netfilter/xt_FLOWOFFLOAD.h
 @@ -0,0 +1,17 @@
@@ -2689,7 +2700,7 @@
 +
 +#endif /* _XT_FLOWOFFLOAD_H */
 diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
-index 589615ec4..444ab5fae 100644
+index 0a3a167..6112266 100644
 --- a/net/8021q/vlan_dev.c
 +++ b/net/8021q/vlan_dev.c
 @@ -747,6 +747,26 @@ static int vlan_dev_get_iflink(const struct net_device *dev)
@@ -2728,7 +2739,7 @@
  
  static void vlan_dev_free(struct net_device *dev)
 diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
-index 501f77f0f..0940b44cd 100644
+index 501f77f..0940b44 100644
 --- a/net/bridge/br_device.c
 +++ b/net/bridge/br_device.c
 @@ -377,6 +377,54 @@ static int br_del_slave(struct net_device *dev, struct net_device *slave_dev)
@@ -2795,7 +2806,7 @@
  
  static struct device_type br_type = {
 diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
-index a736be8a1..4bd9e9b57 100644
+index a736be8..4bd9e9b 100644
 --- a/net/bridge/br_private.h
 +++ b/net/bridge/br_private.h
 @@ -912,6 +912,13 @@ void br_vlan_port_event(struct net_bridge_port *p, unsigned long event);
@@ -2833,7 +2844,7 @@
  					const struct net_bridge *br)
  {
 diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
-index 9257292bd..bcfd16924 100644
+index 9257292..bcfd169 100644
 --- a/net/bridge/br_vlan.c
 +++ b/net/bridge/br_vlan.c
 @@ -1268,6 +1268,61 @@ int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid)
@@ -2899,7 +2910,7 @@
  		     struct bridge_vlan_info *p_vinfo)
  {
 diff --git a/net/core/dev.c b/net/core/dev.c
-index fe2c856b9..4f0edb218 100644
+index 54cc544..a117bd0 100644
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
 @@ -639,6 +639,52 @@ int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
@@ -2956,7 +2967,7 @@
   *	__dev_get_by_name	- find a device by its name
   *	@net: the applicable net namespace
 diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
-index ca80f8699..35a1249a9 100644
+index ca80f86..35a1249 100644
 --- a/net/dsa/dsa.c
 +++ b/net/dsa/dsa.c
 @@ -329,6 +329,15 @@ int call_dsa_notifiers(unsigned long val, struct net_device *dev,
@@ -2976,10 +2987,10 @@
  {
  	int rc;
 diff --git a/net/dsa/slave.c b/net/dsa/slave.c
-index 036fda317..2dfaa1eac 100644
+index e2b91b3..2dfaa1e 100644
 --- a/net/dsa/slave.c
 +++ b/net/dsa/slave.c
-@@ -1033,14 +1031,32 @@ static int dsa_slave_setup_tc_block(struct net_device *dev,
+@@ -1031,14 +1031,32 @@ static int dsa_slave_setup_tc_block(struct net_device *dev,
  	}
  }
  
@@ -3013,7 +3024,7 @@
  
  	if (!ds->ops->port_setup_tc)
  		return -EOPNOTSUPP;
-@@ -1226,6 +1242,21 @@ static struct devlink_port *dsa_slave_get_devlink_port(struct net_device *dev)
+@@ -1224,6 +1242,21 @@ static struct devlink_port *dsa_slave_get_devlink_port(struct net_device *dev)
  	return dp->ds->devlink ? &dp->devlink_port : NULL;
  }
  
@@ -3035,7 +3046,7 @@
  static const struct net_device_ops dsa_slave_netdev_ops = {
  	.ndo_open	 	= dsa_slave_open,
  	.ndo_stop		= dsa_slave_close,
-@@ -1250,6 +1281,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
+@@ -1248,6 +1281,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
  	.ndo_vlan_rx_add_vid	= dsa_slave_vlan_rx_add_vid,
  	.ndo_vlan_rx_kill_vid	= dsa_slave_vlan_rx_kill_vid,
  	.ndo_get_devlink_port	= dsa_slave_get_devlink_port,
@@ -3043,8 +3054,7 @@
  };
  
  static struct device_type dsa_type = {
-@@ -1497,7 +1529,8 @@ void dsa_slave_destroy(struct net_device *slave_dev)
- bool dsa_slave_dev_check(const struct net_device *dev)
+@@ -1499,6 +1533,7 @@ bool dsa_slave_dev_check(const struct net_device *dev)
  {
  	return dev->netdev_ops == &dsa_slave_netdev_ops;
  }
@@ -3053,7 +3063,7 @@
  static int dsa_slave_changeupper(struct net_device *dev,
  				 struct netdev_notifier_changeupper_info *info)
 diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
-index f17b40211..803b92e4c 100644
+index f17b402..803b92e 100644
 --- a/net/ipv4/netfilter/Kconfig
 +++ b/net/ipv4/netfilter/Kconfig
 @@ -56,8 +56,6 @@ config NF_TABLES_ARP
@@ -3075,7 +3085,7 @@
  	tristate "Netfilter IPv4 packet duplication to alternate destination"
  	depends on !NF_CONNTRACK || NF_CONNTRACK
 diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
-index 5585e3a94..bb76f6061 100644
+index 8231a7a..7176d7f 100644
 --- a/net/ipv6/ip6_output.c
 +++ b/net/ipv6/ip6_output.c
 @@ -607,7 +607,7 @@ int ip6_forward(struct sk_buff *skb)
@@ -3088,7 +3098,7 @@
  		mtu = IPV6_MIN_MTU;
  
 diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig
-index 69443e9a3..0b481d236 100644
+index 69443e9..0b481d2 100644
 --- a/net/ipv6/netfilter/Kconfig
 +++ b/net/ipv6/netfilter/Kconfig
 @@ -45,7 +45,6 @@ config NFT_FIB_IPV6
@@ -3109,7 +3119,7 @@
  	tristate "Netfilter IPv6 packet duplication to alternate destination"
  	depends on !NF_CONNTRACK || NF_CONNTRACK
 diff --git a/net/ipv6/route.c b/net/ipv6/route.c
-index 98aaf0b79..2b357ac71 100644
+index 43d185c..82a752c 100644
 --- a/net/ipv6/route.c
 +++ b/net/ipv6/route.c
 @@ -83,7 +83,7 @@ enum rt6_nud_state {
@@ -3149,10 +3159,10 @@
  
  /* MTU selection:
 diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
-index b967763f5..c040e713a 100644
+index b6e0a62..5d690ab 100644
 --- a/net/netfilter/Kconfig
 +++ b/net/netfilter/Kconfig
-@@ -690,8 +690,6 @@ config NFT_FIB_NETDEV
+@@ -689,8 +689,6 @@ config NFT_FIB_NETDEV
  
  endif # NF_TABLES_NETDEV
  
@@ -3161,7 +3171,7 @@
  config NF_FLOW_TABLE_INET
  	tristate "Netfilter flow table mixed IPv4/IPv6 module"
  	depends on NF_FLOW_TABLE
-@@ -700,11 +698,12 @@ config NF_FLOW_TABLE_INET
+@@ -699,11 +697,12 @@ config NF_FLOW_TABLE_INET
  
  	  To compile it as a module, choose M here.
  
@@ -3175,7 +3185,7 @@
  	help
  	  This option adds the flow table core infrastructure.
  
-@@ -984,6 +983,15 @@ config NETFILTER_XT_TARGET_NOTRACK
+@@ -983,6 +982,15 @@ config NETFILTER_XT_TARGET_NOTRACK
  	depends on NETFILTER_ADVANCED
  	select NETFILTER_XT_TARGET_CT
  
@@ -3192,7 +3202,7 @@
  	tristate '"RATEEST" target support'
  	depends on NETFILTER_ADVANCED
 diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile
-index 4fc075b61..d93a121bc 100644
+index 4fc075b..d93a121 100644
 --- a/net/netfilter/Makefile
 +++ b/net/netfilter/Makefile
 @@ -120,7 +120,8 @@ obj-$(CONFIG_NFT_FWD_NETDEV)	+= nft_fwd_netdev.o
@@ -3214,10 +3224,10 @@
  obj-$(CONFIG_NETFILTER_XT_TARGET_HMARK) += xt_HMARK.o
  obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o
 diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
-index f6ab6f484..f689e19d8 100644
+index f6ab6f4..f689e19 100644
 --- a/net/netfilter/nf_conntrack_core.c
 +++ b/net/netfilter/nf_conntrack_core.c
-@@ -864,9 +864,8 @@ out:
+@@ -864,9 +864,8 @@ nf_conntrack_hash_check_insert(struct nf_conn *ct)
  }
  EXPORT_SYMBOL_GPL(nf_conntrack_hash_check_insert);
  
@@ -3283,10 +3293,10 @@
  	return nf_ct_delete(ct, 0, 0);
  }
 diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
-index 7204f0366..3742bae21 100644
+index e219b6f..5cdc627 100644
 --- a/net/netfilter/nf_conntrack_proto_tcp.c
 +++ b/net/netfilter/nf_conntrack_proto_tcp.c
-@@ -1453,6 +1453,10 @@ void nf_conntrack_tcp_init_net(struct net *net)
+@@ -1463,6 +1463,10 @@ void nf_conntrack_tcp_init_net(struct net *net)
  	tn->tcp_loose = nf_ct_tcp_loose;
  	tn->tcp_be_liberal = nf_ct_tcp_be_liberal;
  	tn->tcp_max_retrans = nf_ct_tcp_max_retrans;
@@ -3298,7 +3308,7 @@
  
  const struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp =
 diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
-index e3a2d018f..a1579d6c3 100644
+index e3a2d01..a1579d6 100644
 --- a/net/netfilter/nf_conntrack_proto_udp.c
 +++ b/net/netfilter/nf_conntrack_proto_udp.c
 @@ -267,6 +267,10 @@ void nf_conntrack_udp_init_net(struct net *net)
@@ -3313,7 +3323,7 @@
  
  const struct nf_conntrack_l4proto nf_conntrack_l4proto_udp =
 diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
-index 9c6259c28..10d9f93ce 100644
+index 0b600b4..a2cfafa 100644
 --- a/net/netfilter/nf_conntrack_standalone.c
 +++ b/net/netfilter/nf_conntrack_standalone.c
 @@ -353,7 +353,9 @@ static int ct_seq_show(struct seq_file *s, void *v)
@@ -3345,7 +3355,7 @@
  	NF_SYSCTL_CT_PROTO_TIMEOUT_ICMP,
  	NF_SYSCTL_CT_PROTO_TIMEOUT_ICMPV6,
  #ifdef CONFIG_NF_CT_PROTO_SCTP
-@@ -812,6 +820,14 @@ static struct ctl_table nf_ct_sysctl_table[] = {
+@@ -811,6 +819,14 @@ static struct ctl_table nf_ct_sysctl_table[] = {
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec_jiffies,
  	},
@@ -3360,7 +3370,7 @@
  	[NF_SYSCTL_CT_PROTO_TCP_LOOSE] = {
  		.procname	= "nf_conntrack_tcp_loose",
  		.maxlen		= sizeof(int),
-@@ -846,6 +862,14 @@ static struct ctl_table nf_ct_sysctl_table[] = {
+@@ -845,6 +861,14 @@ static struct ctl_table nf_ct_sysctl_table[] = {
  		.mode		= 0644,
  		.proc_handler	= proc_dointvec_jiffies,
  	},
@@ -3375,7 +3385,7 @@
  	[NF_SYSCTL_CT_PROTO_TIMEOUT_ICMP] = {
  		.procname	= "nf_conntrack_icmp_timeout",
  		.maxlen		= sizeof(unsigned int),
-@@ -1028,6 +1052,11 @@ static void nf_conntrack_standalone_init_tcp_sysctl(struct net *net,
+@@ -1021,6 +1045,11 @@ static void nf_conntrack_standalone_init_tcp_sysctl(struct net *net,
  	XASSIGN(LIBERAL, &tn->tcp_be_liberal);
  	XASSIGN(MAX_RETRANS, &tn->tcp_max_retrans);
  #undef XASSIGN
@@ -3387,7 +3397,7 @@
  }
  
  static void nf_conntrack_standalone_init_sctp_sysctl(struct net *net,
-@@ -1115,6 +1144,9 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net)
+@@ -1107,6 +1136,9 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net)
  	table[NF_SYSCTL_CT_PROTO_TIMEOUT_ICMPV6].data = &nf_icmpv6_pernet(net)->timeout;
  	table[NF_SYSCTL_CT_PROTO_TIMEOUT_UDP].data = &un->timeouts[UDP_CT_UNREPLIED];
  	table[NF_SYSCTL_CT_PROTO_TIMEOUT_UDP_STREAM].data = &un->timeouts[UDP_CT_REPLIED];
@@ -3398,7 +3408,7 @@
  	nf_conntrack_standalone_init_tcp_sysctl(net, table);
  	nf_conntrack_standalone_init_sctp_sysctl(net, table);
 diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
-index f212cec0..10365581 100644
+index f212cec..c3054af 100644
 --- a/net/netfilter/nf_flow_table_core.c
 +++ b/net/netfilter/nf_flow_table_core.c
 @@ -7,43 +7,21 @@
@@ -3963,7 +3973,7 @@
  }
  
  static void nf_flow_offload_work_gc(struct work_struct *work)
-@@ -387,30 +484,20 @@ static void nf_flow_offload_work_gc(struct work_struct *work)
+@@ -387,30 +487,20 @@ static void nf_flow_offload_work_gc(struct work_struct *work)
  	queue_delayed_work(system_power_efficient_wq, &flow_table->gc_work, HZ);
  }
  
@@ -3998,7 +4008,7 @@
  	udph = (void *)(skb_network_header(skb) + thoff);
  	if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) {
  		inet_proto_csum_replace2(&udph->check, skb, port,
-@@ -418,38 +505,28 @@ static int nf_flow_nat_port_udp(struct sk_buff *skb, unsigned int thoff,
+@@ -418,38 +508,28 @@ static int nf_flow_nat_port_udp(struct sk_buff *skb, unsigned int thoff,
  		if (!udph->check)
  			udph->check = CSUM_MANGLED_0;
  	}
@@ -4044,7 +4054,7 @@
  	hdr = (void *)(skb_network_header(skb) + thoff);
  
  	switch (dir) {
-@@ -463,25 +540,19 @@ int nf_flow_snat_port(const struct flow_offload *flow,
+@@ -463,25 +543,19 @@ int nf_flow_snat_port(const struct flow_offload *flow,
  		new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port;
  		hdr->dest = new_port;
  		break;
@@ -4074,7 +4084,7 @@
  	hdr = (void *)(skb_network_header(skb) + thoff);
  
  	switch (dir) {
-@@ -495,11 +566,9 @@ int nf_flow_dnat_port(const struct flow_offload *flow,
+@@ -495,11 +569,9 @@ int nf_flow_dnat_port(const struct flow_offload *flow,
  		new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_port;
  		hdr->source = new_port;
  		break;
@@ -4087,7 +4097,7 @@
  }
  EXPORT_SYMBOL_GPL(nf_flow_dnat_port);
  
-@@ -507,7 +576,9 @@ int nf_flow_table_init(struct nf_flowtable *flowtable)
+@@ -507,7 +579,9 @@ int nf_flow_table_init(struct nf_flowtable *flowtable)
  {
  	int err;
  
@@ -4098,7 +4108,7 @@
  
  	err = rhashtable_init(&flowtable->rhashtable,
  			      &nf_flow_offload_rhash_params);
-@@ -528,25 +599,24 @@ EXPORT_SYMBOL_GPL(nf_flow_table_init);
+@@ -528,25 +602,24 @@ EXPORT_SYMBOL_GPL(nf_flow_table_init);
  static void nf_flow_table_do_cleanup(struct flow_offload *flow, void *data)
  {
  	struct net_device *dev = data;
@@ -4130,7 +4140,7 @@
  }
  
  void nf_flow_table_cleanup(struct net_device *dev)
-@@ -555,7 +625,7 @@ void nf_flow_table_cleanup(struct net_device *dev)
+@@ -555,7 +628,7 @@ void nf_flow_table_cleanup(struct net_device *dev)
  
  	mutex_lock(&flowtable_lock);
  	list_for_each_entry(flowtable, &flowtables, list)
@@ -4139,7 +4149,7 @@
  	mutex_unlock(&flowtable_lock);
  }
  EXPORT_SYMBOL_GPL(nf_flow_table_cleanup);
-@@ -565,9 +635,14 @@ void nf_flow_table_free(struct nf_flowtable *flow_table)
+@@ -565,9 +638,14 @@ void nf_flow_table_free(struct nf_flowtable *flow_table)
  	mutex_lock(&flowtable_lock);
  	list_del(&flow_table->list);
  	mutex_unlock(&flowtable_lock);
@@ -4154,7 +4164,7 @@
  	rhashtable_destroy(&flow_table->rhashtable);
  }
  EXPORT_SYMBOL_GPL(nf_flow_table_free);
-@@ -591,12 +666,23 @@ static struct notifier_block flow_offload_netdev_notifier = {
+@@ -591,12 +669,23 @@ static struct notifier_block flow_offload_netdev_notifier = {
  
  static int __init nf_flow_table_module_init(void)
  {
@@ -4179,13 +4189,13 @@
  }
  
  module_init(nf_flow_table_module_init);
-@@ -604,3 +690,4 @@ module_exit(nf_flow_table_module_exit);
+@@ -604,3 +693,4 @@ module_exit(nf_flow_table_module_exit);
  
  MODULE_LICENSE("GPL");
  MODULE_AUTHOR("Pablo Neira Ayuso <pablo@netfilter.org>");
 +MODULE_DESCRIPTION("Netfilter flow table module");
 diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
-index 397129b2..6257d87c 100644
+index 397129b..6257d87 100644
 --- a/net/netfilter/nf_flow_table_ip.c
 +++ b/net/netfilter/nf_flow_table_ip.c
 @@ -7,11 +7,13 @@
@@ -4914,7 +4924,7 @@
  EXPORT_SYMBOL_GPL(nf_flow_offload_ipv6_hook);
 diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c
 new file mode 100644
-index 000000000..d94c6fb92
+index 0000000..50f2f2e
 --- /dev/null
 +++ b/net/netfilter/nf_flow_table_offload.c
 @@ -0,0 +1,1199 @@
@@ -6119,7 +6129,7 @@
 +}
 diff --git a/net/netfilter/xt_FLOWOFFLOAD.c b/net/netfilter/xt_FLOWOFFLOAD.c
 new file mode 100644
-index 0000000..12f067c
+index 0000000..2cab008
 --- /dev/null
 +++ b/net/netfilter/xt_FLOWOFFLOAD.c
 @@ -0,0 +1,794 @@
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3004-dts-mt7986-wed-changes.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3002-dts-netsys2-wed-changes.patch
old mode 100755
new mode 100644
similarity index 64%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3004-dts-mt7986-wed-changes.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3002-dts-netsys2-wed-changes.patch
index 3b965ac..eacae85
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3004-dts-mt7986-wed-changes.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3002-dts-netsys2-wed-changes.patch
@@ -1,7 +1,7 @@
-From b83743c16da6fa4da206df3e5a1a9c29485bb613 Mon Sep 17 00:00:00 2001
+From be48305fd2e3ecd9a9853f2ae11fb9432e40b299 Mon Sep 17 00:00:00 2001
 From: Bo Jiao <Bo.Jiao@mediatek.com>
-Date: Wed, 22 Jun 2022 16:36:42 +0800
-Subject: [PATCH 3/8] 9992-dts-mt7986-wed-changes
+Date: Mon, 18 Sep 2023 10:55:08 +0800
+Subject: [PATCH 03/22] dts mt7986 wed changes
 
 ---
  arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 33 ++++++++---------------
@@ -9,7 +9,7 @@
  2 files changed, 22 insertions(+), 44 deletions(-)
 
 diff --git a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
-index ba27b95f5..7f78de6b9 100644
+index e43c306..e5d4e12 100644
 --- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
 +++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
 @@ -58,32 +58,20 @@
@@ -55,7 +55,7 @@
  	};
  
  	ap2woccif: ap2woccif@151A5000 {
-@@ -490,6 +478,7 @@
+@@ -507,6 +495,7 @@
  					 <&topckgen CK_TOP_CB_SGM_325M>;
                  mediatek,ethsys = <&ethsys>;
  		mediatek,sgmiisys = <&sgmiisys0>, <&sgmiisys1>;
@@ -64,7 +64,7 @@
                  #address-cells = <1>;
                  #size-cells = <0>;
 diff --git a/arch/arm64/boot/dts/mediatek/mt7986b.dtsi b/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
-index 523d585cb..0e5f116a2 100644
+index 21d8357..2d2207f 100644
 --- a/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
 +++ b/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
 @@ -58,32 +58,20 @@
@@ -110,7 +110,7 @@
  	};
  
  	ap2woccif: ap2woccif@151A5000 {
-@@ -405,6 +393,7 @@
+@@ -409,6 +397,7 @@
  					 <&topckgen CK_TOP_CB_SGM_325M>;
                  mediatek,ethsys = <&ethsys>;
  		mediatek,sgmiisys = <&sgmiisys0>, <&sgmiisys1>;
@@ -118,6 +118,62 @@
                  #reset-cells = <1>;
                  #address-cells = <1>;
                  #size-cells = <0>;
+diff --git a/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/arch/arm64/boot/dts/mediatek/mt7981.dtsi
+index ccaf0ad0..b2f53b13 100644
+--- a/arch/arm64/boot/dts/mediatek/mt7981.dtsi
++++ b/arch/arm64/boot/dts/mediatek/mt7981.dtsi
+@@ -90,22 +90,12 @@
+ 		#io-channel-cells = <1>;
+ 	};
+ 
+-	wed: wed@15010000 {
+-		compatible = "mediatek,wed";
+-		wed_num = <2>;
+-		/* add this property for wed get the pci slot number. */
+-		pci_slot_map = <0>, <1>;
+-		reg = <0 0x15010000 0 0x1000>,
+-		      <0 0x15011000 0 0x1000>;
++	wed0: wed@15010000 {
++		compatible = "mediatek,mt7981-wed",
++			     "syscon";
++		reg = <0 0x15010000 0 0x1000>;
+ 		interrupt-parent = <&gic>;
+-		interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>,
+-			     <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
+-	};
+-
+-	wdma: wdma@15104800 {
+-		compatible = "mediatek,wed-wdma";
+-		reg = <0 0x15104800 0 0x400>,
+-		      <0 0x15104c00 0 0x400>;
++		interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
+ 	};
+ 
+ 	ap2woccif: ap2woccif@151A5000 {
+@@ -423,6 +413,7 @@
+                 mediatek,ethsys = <&ethsys>;
+ 		mediatek,sgmiisys = <&sgmiisys0>, <&sgmiisys1>;
+ 		mediatek,infracfg = <&topmisc>;
++		mediatek,wed = <&wed0>;
+                 #reset-cells = <1>;
+                 #address-cells = <1>;
+                 #size-cells = <0>;
+diff --git a/arch/arm64/boot/dts/mediatek/mt7981-spim-nor-rfb.dts b/arch/arm64/boot/dts/mediatek/mt7981-spim-nor-rfb.dts
+index 3fa55a07..f5c70a4e 100755
+--- a/arch/arm64/boot/dts/mediatek/mt7981-spim-nor-rfb.dts
++++ b/arch/arm64/boot/dts/mediatek/mt7981-spim-nor-rfb.dts
+@@ -211,11 +211,3 @@
+ &xhci {  
+         status = "okay";
+ };
+-
+-&wed {
+-	dy_txbm_enable = "true";
+-	dy_txbm_budget = <8>;
+-	txbm_init_sz = <8>;
+-	txbm_max_sz = <32>;
+-	status = "okay";
+-};
 -- 
 2.18.0
 
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3005-add-wed.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3003-add-wed.patch
old mode 100755
new mode 100644
similarity index 97%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3005-add-wed.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3003-add-wed.patch
index fe2dc53..ae4e9c1
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3005-add-wed.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3003-add-wed.patch
@@ -1,16 +1,15 @@
-From 342fdc50b761309e75974554cdcf790a2d09e134 Mon Sep 17 00:00:00 2001
+From cdb36beeb6725bcef3faad499c017c26bc17fd4a Mon Sep 17 00:00:00 2001
 From: Sujuan Chen <sujuan.chen@mediatek.com>
-Date: Thu, 2 Jun 2022 15:32:07 +0800
-Subject: [PATCH 4/8] 9993-add-wed
+Date: Mon, 18 Sep 2023 10:56:21 +0800
+Subject: [PATCH 04/22] add wed
 
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
 ---
  arch/arm64/boot/dts/mediatek/mt7622.dtsi      |  32 +-
  drivers/net/ethernet/mediatek/Kconfig         |   4 +
  drivers/net/ethernet/mediatek/Makefile        |   5 +
- drivers/net/ethernet/mediatek/mtk_eth_soc.c   | 136 ++-
- drivers/net/ethernet/mediatek/mtk_eth_soc.h   |  14 +-
- drivers/net/ethernet/mediatek/mtk_ppe.c       | 373 +++++++-
+ drivers/net/ethernet/mediatek/mtk_eth_soc.c   |  39 +-
+ drivers/net/ethernet/mediatek/mtk_eth_soc.h   |   5 +-
+ drivers/net/ethernet/mediatek/mtk_ppe.c       | 378 +++++++-
  drivers/net/ethernet/mediatek/mtk_ppe.h       |  89 +-
  .../net/ethernet/mediatek/mtk_ppe_debugfs.c   |   4 +-
  .../net/ethernet/mediatek/mtk_ppe_offload.c   | 167 +++-
@@ -22,7 +21,7 @@
  include/linux/netdevice.h                     |   7 +
  include/linux/soc/mediatek/mtk_wed.h          | 131 +++
  net/core/dev.c                                |   4 +
- 17 files changed, 2283 insertions(+), 128 deletions(-)
+ 17 files changed, 2207 insertions(+), 103 deletions(-)
  mode change 100755 => 100644 drivers/net/ethernet/mediatek/Kconfig
  mode change 100755 => 100644 drivers/net/ethernet/mediatek/Makefile
  mode change 100755 => 100644 drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -36,7 +35,7 @@
  create mode 100644 include/linux/soc/mediatek/mtk_wed.h
 
 diff --git a/arch/arm64/boot/dts/mediatek/mt7622.dtsi b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
-index 369e01389..d0fbc367e 100644
+index 753a97a..e46566a 100644
 --- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
 +++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
 @@ -338,7 +338,7 @@
@@ -48,7 +47,7 @@
  			interface-type = "ace";
  			reg = <0x5000 0x1000>;
  		};
-@@ -920,6 +920,11 @@
+@@ -921,6 +921,11 @@
  		};
  	};
  
@@ -60,7 +59,7 @@
  	ethsys: syscon@1b000000 {
  		compatible = "mediatek,mt7622-ethsys",
  			     "syscon";
-@@ -938,6 +943,26 @@
+@@ -939,6 +944,26 @@
  		#dma-cells = <1>;
  	};
  
@@ -87,7 +86,7 @@
  	eth: ethernet@1b100000 {
  		compatible = "mediatek,mt7622-eth",
  			     "mediatek,mt2701-eth",
-@@ -964,6 +989,11 @@
+@@ -965,6 +990,11 @@
  		power-domains = <&scpsys MT7622_POWER_DOMAIN_ETHSYS>;
  		mediatek,ethsys = <&ethsys>;
  		mediatek,sgmiisys = <&sgmiisys>;
@@ -102,7 +101,7 @@
 diff --git a/drivers/net/ethernet/mediatek/Kconfig b/drivers/net/ethernet/mediatek/Kconfig
 old mode 100755
 new mode 100644
-index 42e6b38d2..8ab6615a3
+index 7bfc78b..1574af9
 --- a/drivers/net/ethernet/mediatek/Kconfig
 +++ b/drivers/net/ethernet/mediatek/Kconfig
 @@ -7,6 +7,10 @@ config NET_VENDOR_MEDIATEK
@@ -119,12 +118,12 @@
 diff --git a/drivers/net/ethernet/mediatek/Makefile b/drivers/net/ethernet/mediatek/Makefile
 old mode 100755
 new mode 100644
-index 0a6af99f1..3528f1b3c
+index 5f342f4..4090132
 --- a/drivers/net/ethernet/mediatek/Makefile
 +++ b/drivers/net/ethernet/mediatek/Makefile
 @@ -6,4 +6,9 @@
  obj-$(CONFIG_NET_MEDIATEK_SOC)			+= mtk_eth.o
- mtk_eth-y := mtk_eth_soc.o mtk_sgmii.o mtk_eth_path.o mtk_eth_dbg.o mtk_eth_reset.o	\
+ mtk_eth-y := mtk_eth_soc.o mtk_sgmii.o mtk_usxgmii.o mtk_eth_path.o mtk_eth_dbg.o mtk_eth_reset.o	\
  	     mtk_ppe.o mtk_ppe_debugfs.o mtk_ppe_offload.o
 +mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed.o
 +ifdef CONFIG_DEBUG_FS
@@ -135,10 +134,10 @@
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 old mode 100755
 new mode 100644
-index 819d8a0be..2121335a1
+index 9c85e16..88b38e2
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -20,11 +21,13 @@
+@@ -21,11 +21,13 @@
  #include <linux/pinctrl/devinfo.h>
  #include <linux/phylink.h>
  #include <linux/gpio/consumer.h>
@@ -152,15 +151,15 @@
  
  #if defined(CONFIG_NET_MEDIATEK_HNAT) || defined(CONFIG_NET_MEDIATEK_HNAT_MODULE)
  #include "mtk_hnat/nf_hnat_mtk.h"
-@@ -1737,6 +1740,7 @@ static int mtk_poll_rx(struct napi_struc
+@@ -2191,6 +2193,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
+ 		unsigned int pktlen, *rxdcsum;
  		struct net_device *netdev = NULL;
- 		unsigned int pktlen;
  		dma_addr_t dma_addr = 0;
 +		u32 hash, reason;
  		int mac = 0;
  
  		if (eth->hwlro)
-@@ -1827,6 +1831,17 @@ static int mtk_poll_rx(struct napi_struc
+@@ -2282,6 +2285,17 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
  			skb_checksum_none_assert(skb);
  		skb->protocol = eth_type_trans(skb, netdev);
  
@@ -176,9 +175,9 @@
 +					  trxd.rxd4 & MTK_RXD4_FOE_ENTRY);
 +
  		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)) {
-@@ -3243,7 +3258,7 @@ static int mtk_stop(struct net_device *d
+ 			if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_RX_V2)) {
+ 				if (trxd.rxd3 & RX_DMA_VTAG_V2)
+@@ -3735,7 +3749,7 @@ static int mtk_stop(struct net_device *dev)
  	mtk_dma_free(eth);
  
  	if (eth->soc->offload_version)
@@ -187,7 +186,7 @@
  
  	return 0;
  }
-@@ -4217,6 +4278,22 @@ static int mtk_probe(struct platform_dev
+@@ -5044,6 +5058,22 @@ static int mtk_probe(struct platform_device *pdev)
  		}
  	}
  
@@ -208,9 +207,9 @@
 +	}
 +
  	for (i = 0; i < MTK_PDMA_IRQ_NUM; i++)
-		eth->irq_pdma[i] = platform_get_irq(pdev, i);
-
-@@ -4320,10 +4397,11 @@ static int mtk_probe(struct platform_dev
+ 		eth->irq_pdma[i] = platform_get_irq(pdev, i);
+ 
+@@ -5170,10 +5200,11 @@ static int mtk_probe(struct platform_device *pdev)
  	}
  
  	if (eth->soc->offload_version) {
@@ -228,10 +227,10 @@
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 old mode 100755
 new mode 100644
-index 349f98503..b52378bd6
+index a87e46d..15337d3
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -549,6 +549,9 @@
+@@ -578,6 +578,9 @@
  #define RX_DMA_SPORT_MASK       0x7
  #define RX_DMA_SPORT_MASK_V2    0xf
  
@@ -241,7 +240,7 @@
  /* QDMA descriptor txd4 */
  #define TX_DMA_CHKSUM		(0x7 << 29)
  #define TX_DMA_TSO		BIT(28)
-@@ -1596,7 +1607,7 @@ struct mtk_eth {
+@@ -1859,7 +1862,7 @@ struct mtk_eth {
  	spinlock_t			syscfg0_lock;
  	struct timer_list		mtk_dma_monitor_timer;
  
@@ -253,7 +252,7 @@
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
 old mode 100644
 new mode 100755
-index 66298e223..3d75c22be
+index 27b5be5..86741bf
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
 @@ -6,9 +6,22 @@
@@ -520,7 +519,7 @@
  	memcpy(&hwe->data, &entry->data, sizeof(hwe->data));
  	wmb();
  	hwe->ib1 = entry->ib1;
-@@ -362,32 +519,201 @@ int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry,
+@@ -362,32 +520,201 @@ int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry,
  	dma_wmb();
  
  	mtk_ppe_cache_clear(ppe);
@@ -726,7 +725,7 @@
  }
  
  static void mtk_ppe_init_foe_table(struct mtk_ppe *ppe)
-@@ -395,7 +717,7 @@ static void mtk_ppe_init_foe_table(struct mtk_ppe *ppe)
+@@ -395,7 +722,7 @@ static void mtk_ppe_init_foe_table(struct mtk_ppe *ppe)
  	static const u8 skip[] = { 12, 25, 38, 51, 76, 89, 102 };
  	int i, k;
  
@@ -735,7 +734,7 @@
  
  	if (!IS_ENABLED(CONFIG_SOC_MT7621))
  		return;
-@@ -443,7 +765,6 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
+@@ -443,7 +770,6 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
  	      MTK_PPE_FLOW_CFG_IP4_NAT |
  	      MTK_PPE_FLOW_CFG_IP4_NAPT |
  	      MTK_PPE_FLOW_CFG_IP4_DSLITE |
@@ -744,7 +743,7 @@
  	ppe_w32(ppe, MTK_PPE_FLOW_CFG, val);
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.h b/drivers/net/ethernet/mediatek/mtk_ppe.h
-index 242fb8f2a..1f5cf1c9a 100644
+index 242fb8f..1f5cf1c 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.h
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
 @@ -6,6 +6,7 @@
@@ -900,7 +899,7 @@
  
  #endif
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c b/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c
-index d4b482340..a591ab1fd 100644
+index d4b4823..a591ab1 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c
 @@ -32,7 +32,6 @@ static const char *mtk_foe_pkt_type_str(int type)
@@ -922,7 +921,7 @@
  	debugfs_create_file("bind", S_IRUGO, root, ppe, &fops_bind);
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-index 4294f0c74..d4a012608 100644
+index 1380ef0..8a28572 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 @@ -11,6 +11,7 @@
@@ -1229,16 +1228,16 @@
  	f->stats.lastused = jiffies - idle * HZ;
  
  	return 0;
-@@ -470,7 +536,7 @@ mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
- 	struct flow_block_cb *block_cb;
+@@ -471,7 +537,7 @@ mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
  	flow_setup_cb_t *cb;
+ 	int err = 0;
  
 -	if (!eth->ppe.foe_table)
 +	if (!eth->ppe || !eth->ppe->foe_table)
  		return -EOPNOTSUPP;
  
  	if (f->binder_type != FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS)
-@@ -511,15 +577,18 @@ mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
+@@ -520,15 +586,18 @@ mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
  int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type,
  		     void *type_data)
  {
@@ -1263,7 +1262,7 @@
  	return rhashtable_init(&eth->flow_table, &mtk_flow_ht_params);
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
 new file mode 100644
-index 000000000..ea1cbdf1a
+index 0000000..ea1cbdf
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
 @@ -0,0 +1,876 @@
@@ -2145,7 +2144,7 @@
 +}
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.h b/drivers/net/ethernet/mediatek/mtk_wed.h
 new file mode 100644
-index 000000000..981ec613f
+index 0000000..981ec61
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.h
 @@ -0,0 +1,135 @@
@@ -2286,7 +2285,7 @@
 +#endif
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
 new file mode 100644
-index 000000000..a81d3fd1a
+index 0000000..a81d3fd
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
 @@ -0,0 +1,175 @@
@@ -2467,7 +2466,7 @@
 +}
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_ops.c b/drivers/net/ethernet/mediatek/mtk_wed_ops.c
 new file mode 100644
-index 000000000..a5d9d8a5b
+index 0000000..a5d9d8a
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_ops.c
 @@ -0,0 +1,8 @@
@@ -2481,7 +2480,7 @@
 +EXPORT_SYMBOL_GPL(mtk_soc_wed_ops);
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_regs.h b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 new file mode 100644
-index 000000000..0a0465ea5
+index 0000000..0a0465e
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 @@ -0,0 +1,251 @@
@@ -2737,10 +2736,10 @@
 +
 +#endif
 diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
-index 9f64504ac..35998b1a7 100644
+index ef44d9a..59a3e96 100644
 --- a/include/linux/netdevice.h
 +++ b/include/linux/netdevice.h
-@@ -835,6 +835,7 @@ enum net_device_path_type {
+@@ -844,6 +844,7 @@ enum net_device_path_type {
  	DEV_PATH_BRIDGE,
  	DEV_PATH_PPPOE,
  	DEV_PATH_DSA,
@@ -2748,7 +2747,7 @@
  };
  
  struct net_device_path {
-@@ -860,6 +861,12 @@ struct net_device_path {
+@@ -869,6 +870,12 @@ struct net_device_path {
  			int port;
  			u16 proto;
  		} dsa;
@@ -2763,7 +2762,7 @@
  
 diff --git a/include/linux/soc/mediatek/mtk_wed.h b/include/linux/soc/mediatek/mtk_wed.h
 new file mode 100644
-index 000000000..7e00cca06
+index 0000000..7e00cca
 --- /dev/null
 +++ b/include/linux/soc/mediatek/mtk_wed.h
 @@ -0,0 +1,131 @@
@@ -2899,7 +2898,7 @@
 +
 +#endif
 diff --git a/net/core/dev.c b/net/core/dev.c
-index 4f0edb218..031ac7c6f 100644
+index a117bd0..1b6d42b 100644
 --- a/net/core/dev.c
 +++ b/net/core/dev.c
 @@ -675,6 +675,10 @@ int dev_fill_forward_path(const struct net_device *dev, const u8 *daddr,
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3006-ethernet-update-ppe-from-mt7622-to-mt7986.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3004-ethernet-update-ppe-from-netsys1-to-netsys2.patch
old mode 100755
new mode 100644
similarity index 81%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3006-ethernet-update-ppe-from-mt7622-to-mt7986.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3004-ethernet-update-ppe-from-netsys1-to-netsys2.patch
index dcfd527..d613ce8
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3006-ethernet-update-ppe-from-mt7622-to-mt7986.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3004-ethernet-update-ppe-from-netsys1-to-netsys2.patch
@@ -1,23 +1,22 @@
-From d86af0076cbf7d99bdb4f28115159643b79ad3fa Mon Sep 17 00:00:00 2001
+From 3562f05aedc6c2d793b34b3ee3eb78e8352804c8 Mon Sep 17 00:00:00 2001
 From: Sujuan Chen <sujuan.chen@mediatek.com>
-Date: Wed, 18 May 2022 11:08:15 +0800
-Subject: [PATCH 5/8] 9994-ethernet-update-ppe-from-mt7622-to-mt7986
+Date: Mon, 18 Sep 2023 10:58:32 +0800
+Subject: [PATCH 05/22] ethernet update ppe from mt7622 to mt7986
 
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
 ---
- drivers/net/ethernet/mediatek/mtk_eth_soc.c   | 14 +++-
- drivers/net/ethernet/mediatek/mtk_eth_soc.h   |  7 +-
- drivers/net/ethernet/mediatek/mtk_ppe.c       | 24 ++++---
- drivers/net/ethernet/mediatek/mtk_ppe.h       | 69 ++++++++++---------
- .../net/ethernet/mediatek/mtk_ppe_offload.c   |  7 +-
- drivers/net/ethernet/mediatek/mtk_ppe_regs.h  | 10 +++
- 6 files changed, 86 insertions(+), 45 deletions(-)
+ drivers/net/ethernet/mediatek/mtk_eth_soc.c   | 14 ++++-
+ drivers/net/ethernet/mediatek/mtk_eth_soc.h   |  7 ++-
+ drivers/net/ethernet/mediatek/mtk_ppe.c       | 29 +++++++++--
+ drivers/net/ethernet/mediatek/mtk_ppe.h       | 51 +++++++++++++++++++
+ .../net/ethernet/mediatek/mtk_ppe_offload.c   |  8 +++
+ drivers/net/ethernet/mediatek/mtk_ppe_regs.h  | 10 ++++
+ 6 files changed, 113 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-index 2121335a1..01fc1e5c0 100644
+index 88b38e2..bfda873 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -1467,16 +1467,27 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
+@@ -2285,16 +2285,27 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
  			skb_checksum_none_assert(skb);
  		skb->protocol = eth_type_trans(skb, netdev);
  
@@ -45,36 +44,29 @@
 +#endif
  
  		if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
- 			if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
-@@ -3926,13 +3937,14 @@ static const struct mtk_soc_data mt7986_data = {
+ 			if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_RX_V2)) {
+@@ -5396,6 +5407,7 @@ static const struct mtk_soc_data mt7986_data = {
  	.required_clks = MT7986_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.offload_version = 2,
-	.rss_num = 0,
+ 	.rss_num = 4,
  	.txrx = {
  		.txd_size = sizeof(struct mtk_tx_dma_v2),
- 		.rxd_size = sizeof(struct mtk_rx_dma),
- 		.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/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-index b52378bd6..fce1a7172 100644
+index 15337d3..a385df5 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -110,7 +110,7 @@
- #define MTK_GDMA_TCS_EN		BIT(21)
+@@ -130,7 +130,7 @@
  #define MTK_GDMA_UCS_EN		BIT(20)
+ #define MTK_GDMA_STRP_CRC	BIT(16)
  #define MTK_GDMA_TO_PDMA	0x0
 -#define MTK_GDMA_TO_PPE		0x4444
 +#define MTK_GDMA_TO_PPE		0x3333
  #define MTK_GDMA_DROP_ALL	0x7777
  
- /* Unicast Filter MAC Address Register - Low */
-@@ -560,6 +560,11 @@
+ /* GDM Egress Control Register */
+@@ -630,6 +630,11 @@
  #define MTK_RXD4_SRC_PORT	GENMASK(21, 19)
  #define MTK_RXD4_ALG		GENMASK(31, 22)
  
@@ -87,7 +79,7 @@
  #define RX_DMA_L4_VALID		BIT(24)
  #define RX_DMA_L4_VALID_PDMA	BIT(30)		/* when PDMA is used */
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
-index 3d75c22be..d46e91178 100755
+index 86741bf..ef8acbc 100755
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
 @@ -122,7 +122,7 @@ static u32 mtk_ppe_hash_entry(struct mtk_foe_entry *e)
@@ -102,7 +94,7 @@
 @@ -171,8 +171,12 @@ int mtk_foe_entry_prepare(struct mtk_foe_entry *entry, int type, int l4proto,
  	      MTK_FOE_IB1_BIND_CACHE;
  	entry->ib1 = val;
-
+ 
 +#if defined(CONFIG_MEDIATEK_NETSYS_V2)
 +	val = FIELD_PREP(MTK_FOE_IB2_PORT_AG, 0xf) |
 +#else
@@ -112,7 +104,7 @@
  	      FIELD_PREP(MTK_FOE_IB2_DEST_PORT, pse_port);
  
  	if (is_multicast_ether_addr(dest_mac))
-@@ -359,12 +358,19 @@ int mtk_foe_entry_set_wdma(struct mtk_foe_entry *entry, int wdma_idx, int txq,
+@@ -359,12 +363,19 @@ int mtk_foe_entry_set_wdma(struct mtk_foe_entry *entry, int wdma_idx, int txq,
  
  	*ib2 &= ~MTK_FOE_IB2_PORT_MG;
  	*ib2 |= MTK_FOE_IB2_WDMA_WINFO;
@@ -132,7 +124,7 @@
  
  	return 0;
  }
-@@ -741,6 +738,9 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
+@@ -746,6 +757,9 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
  	      MTK_PPE_TB_CFG_AGE_TCP |
  	      MTK_PPE_TB_CFG_AGE_UDP |
  	      MTK_PPE_TB_CFG_AGE_TCP_FIN |
@@ -142,18 +134,18 @@
  	      FIELD_PREP(MTK_PPE_TB_CFG_SEARCH_MISS,
  			 MTK_PPE_SEARCH_MISS_ACTION_FORWARD_BUILD) |
  	      FIELD_PREP(MTK_PPE_TB_CFG_KEEPALIVE,
-@@ -757,7 +755,8 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
+@@ -762,15 +776,17 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
  
  	mtk_ppe_cache_enable(ppe, true);
  
 -	val = MTK_PPE_FLOW_CFG_IP4_TCP_FRAG |
+-	      MTK_PPE_FLOW_CFG_IP4_UDP_FRAG |
 +	val = MTK_PPE_MD_TOAP_BYP_CRSN0 |
 +	      MTK_PPE_MD_TOAP_BYP_CRSN1 |
 +	      MTK_PPE_MD_TOAP_BYP_CRSN2 |
--	      MTK_PPE_FLOW_CFG_IP4_UDP_FRAG |
  	      MTK_PPE_FLOW_CFG_IP6_3T_ROUTE |
  	      MTK_PPE_FLOW_CFG_IP6_5T_ROUTE |
-@@ -765,7 +765,8 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
+ 	      MTK_PPE_FLOW_CFG_IP6_6RD |
  	      MTK_PPE_FLOW_CFG_IP4_NAT |
  	      MTK_PPE_FLOW_CFG_IP4_NAPT |
  	      MTK_PPE_FLOW_CFG_IP4_DSLITE |
@@ -163,10 +155,10 @@
  	ppe_w32(ppe, MTK_PPE_FLOW_CFG, val);
  
  	val = FIELD_PREP(MTK_PPE_UNBIND_AGE_MIN_PACKETS, 1000) |
-@@ -800,6 +801,11 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
+@@ -806,6 +822,11 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
  
  	ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT, 0);
-
+ 
 +#if defined(CONFIG_MEDIATEK_NETSYS_V2)
 +	ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT1, 0xcb777);
 +	ppe_w32(ppe, MTK_PPE_SBW_CTRL, 0x7f);
@@ -176,13 +168,13 @@
  }
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.h b/drivers/net/ethernet/mediatek/mtk_ppe.h
-index 1f5cf1c9a..a76f4b0ac 100644
+index 1f5cf1c..7012351 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.h
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
 @@ -8,7 +8,11 @@
  #include <linux/bitfield.h>
  #include <linux/rhashtable.h>
-
+ 
 +#if defined(CONFIG_MEDIATEK_NETSYS_V2)
 +#define MTK_ETH_PPE_BASE		0x2000
 +#else
@@ -191,7 +183,7 @@
  
  #define MTK_PPE_ENTRIES_SHIFT		3
  #define MTK_PPE_ENTRIES			(1024 << MTK_PPE_ENTRIES_SHIFT)
-@@ -16,20 +16,40 @@
+@@ -16,6 +20,24 @@
  #define MTK_PPE_WAIT_TIMEOUT_US		1000000
  
  #define MTK_FOE_IB1_UNBIND_TIMESTAMP	GENMASK(7, 0)
@@ -216,14 +208,7 @@
  #define MTK_FOE_IB1_UNBIND_PACKETS	GENMASK(23, 8)
  #define MTK_FOE_IB1_UNBIND_PREBIND	BIT(24)
  
- #define MTK_FOE_IB1_BIND_TIMESTAMP	GENMASK(14, 0)
- #define MTK_FOE_IB1_BIND_KEEPALIVE	BIT(15)
- #define MTK_FOE_IB1_BIND_VLAN_LAYER	GENMASK(18, 16)
- #define MTK_FOE_IB1_BIND_PPPOE		BIT(19)
- #define MTK_FOE_IB1_BIND_VLAN_TAG	BIT(20)
- #define MTK_FOE_IB1_BIND_PKT_SAMPLE	BIT(21)
- #define MTK_FOE_IB1_BIND_CACHE		BIT(22)
- #define MTK_FOE_IB1_BIND_TUNNEL_DECAP	BIT(23)
+@@ -30,6 +52,8 @@
  #define MTK_FOE_IB1_BIND_TTL		BIT(24)
  
  #define MTK_FOE_IB1_PACKET_TYPE		GENMASK(27, 25)
@@ -232,7 +217,7 @@
  #define MTK_FOE_IB1_STATE		GENMASK(29, 28)
  #define MTK_FOE_IB1_UDP			BIT(30)
  #define MTK_FOE_IB1_STATIC		BIT(31)
-@@ -44,24 +47,42 @@ enum {
+@@ -44,24 +68,42 @@ enum {
  	MTK_PPE_PKT_TYPE_IPV6_6RD = 7,
  };
  
@@ -275,7 +260,7 @@
  
  enum {
  	MTK_FOE_STATE_INVALID,
-@@ -83,6 +81,11 @@ struct mtk_foe_mac_info {
+@@ -83,6 +125,11 @@ struct mtk_foe_mac_info {
  
  	u16 pppoe_id;
  	u16 src_mac_lo;
@@ -287,7 +272,7 @@
  };
  
  /* software-only entry type */
-@@ -200,7 +205,11 @@ struct mtk_foe_entry {
+@@ -200,7 +247,11 @@ struct mtk_foe_entry {
  		struct mtk_foe_ipv4_dslite dslite;
  		struct mtk_foe_ipv6 ipv6;
  		struct mtk_foe_ipv6_6rd ipv6_6rd;
@@ -300,11 +285,10 @@
  };
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-index d4a012608..5a4201447 100644
+index 8a28572..77594f3 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-@@ -192,7 +192,15 @@ mtk_flow_set_output_device(struct mtk_eth *eth, struct mtk_foe_entry *foe,
- 	if (mtk_flow_get_wdma_info(dev, dest_mac, &info) == 0) {
+@@ -193,6 +193,14 @@ mtk_flow_set_output_device(struct mtk_eth *eth, struct mtk_foe_entry *foe,
  		mtk_foe_entry_set_wdma(foe, info.wdma_idx, info.queue, info.bss,
  				       info.wcid);
  		pse_port = PSE_PPE0_PORT;
@@ -320,7 +304,7 @@
  		goto out;
  	}
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_regs.h b/drivers/net/ethernet/mediatek/mtk_ppe_regs.h
-index 0c45ea090..d319f1861 100644
+index 0c45ea0..d319f18 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_regs.h
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_regs.h
 @@ -21,6 +21,9 @@
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3007-flow-offload-add-mkhnat-dual-ppe-new-v2.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3005-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
old mode 100755
new mode 100644
similarity index 95%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3007-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3005-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
index 9957670..407cea0
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3007-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3005-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
@@ -1,7 +1,7 @@
-From 8341e1b35ca14f303f828f96f5e63719f80be88e Mon Sep 17 00:00:00 2001
+From 9f734703a4a6870a34ea015ba27f01b986e80c4c Mon Sep 17 00:00:00 2001
 From: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
-Date: Wed, 23 Aug 2023 11:36:05 +0800
-Subject: [PATCH] 999-3007-flow-offload-add-mkhnat-dual-ppe-new-v2
+Date: Mon, 18 Sep 2023 10:59:56 +0800
+Subject: [PATCH 06/22] flow-offload-add-mkhnat-dual-ppe-new-v2
 
 ---
  arch/arm64/boot/dts/mediatek/mt7986a.dtsi     |  1 +
@@ -28,10 +28,10 @@
                  #address-cells = <1>;
                  #size-cells = <0>;
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-index f019c56..81b68d6 100644
+index bfda873..ee5e0c6 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -2097,6 +2097,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
+@@ -2185,6 +2185,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
  	u8 *data, *new_data;
  	struct mtk_rx_dma_v2 *rxd, trxd;
  	int done = 0;
@@ -39,7 +39,7 @@
  
  	if (unlikely(!ring))
  		goto rx_done;
-@@ -2209,14 +2210,20 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
+@@ -2297,14 +2298,20 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
  
  #if defined(CONFIG_MEDIATEK_NETSYS_RX_V2)
  		reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON_V2, trxd.rxd5);
@@ -66,7 +66,7 @@
  #endif
  
  		if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
-@@ -3588,8 +3595,12 @@ static int mtk_open(struct net_device *dev)
+@@ -3676,8 +3683,12 @@ static int mtk_open(struct net_device *dev)
  		regmap_write(eth->sgmii->pcs[id].regmap,
  			     SGMSYS_QPHY_PWR_STATE_CTRL, 0);
  
@@ -81,7 +81,7 @@
  
  	mtk_gdm_config(eth, mac->id, gdm_config);
  
-@@ -3671,8 +3682,10 @@ static int mtk_stop(struct net_device *dev)
+@@ -3759,8 +3770,10 @@ static int mtk_stop(struct net_device *dev)
  
  	mtk_dma_free(eth);
  
@@ -94,7 +94,7 @@
  
  	return 0;
  }
-@@ -4958,15 +4971,35 @@ static int mtk_probe(struct platform_device *pdev)
+@@ -5211,15 +5224,35 @@ static int mtk_probe(struct platform_device *pdev)
  	}
  
  	if (eth->soc->offload_version) {
@@ -138,7 +138,7 @@
  
  	for (i = 0; i < MTK_MAX_DEVS; i++) {
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-index 8675c86..fad3e73 100644
+index a385df5..783166d 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 @@ -130,7 +130,12 @@
@@ -155,7 +155,7 @@
  #define MTK_GDMA_DROP_ALL	0x7777
  
  /* GDM Egress Control Register */
-@@ -1856,7 +1861,8 @@ struct mtk_eth {
+@@ -1867,7 +1872,8 @@ struct mtk_eth {
  	spinlock_t			syscfg0_lock;
  	struct timer_list		mtk_dma_monitor_timer;
  
@@ -165,9 +165,9 @@
  	struct rhashtable		flow_table;
  };
  
-@@ -1918,9 +1924,11 @@ int mtk_usxgmii_init(struct mtk_eth *eth, struct device_node *r);
- int mtk_toprgu_init(struct mtk_eth *eth, struct device_node *r);
+@@ -1949,9 +1955,11 @@ int mtk_toprgu_init(struct mtk_eth *eth, struct device_node *r);
  int mtk_dump_usxgmii(struct regmap *pmap, char *name, u32 offset, u32 range);
+ void mtk_usxgmii_link_poll(struct work_struct *work);
  
 -int mtk_eth_offload_init(struct mtk_eth *eth);
 +int mtk_eth_offload_init(struct mtk_eth *eth, int id);
@@ -179,7 +179,7 @@
 +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 7506670..0ff1fef 100755
+index ef8acbc..96c15b3 100755
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
 @@ -696,7 +696,7 @@ int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
@@ -330,7 +330,7 @@
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 old mode 100644
 new mode 100755
-index 77594f3..18f6333
+index 77594f3..f256607
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 @@ -229,9 +229,12 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3008-add-wed-tx-support-for-mt7986.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3006-add-wed-tx-support-for-netsys2.patch
similarity index 96%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3008-add-wed-tx-support-for-mt7986.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3006-add-wed-tx-support-for-netsys2.patch
index f6fcae3..1cfa774 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3008-add-wed-tx-support-for-mt7986.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3006-add-wed-tx-support-for-netsys2.patch
@@ -1,7 +1,7 @@
-From c6b43d63c3d4229b5f15cb7391192494b07e0fa7 Mon Sep 17 00:00:00 2001
+From a0b64514c2bfe883d0128ce5bb26559c34185d90 Mon Sep 17 00:00:00 2001
 From: Bo Jiao <Bo.Jiao@mediatek.com>
-Date: Mon, 27 Jun 2022 14:53:54 +0800
-Subject: [PATCH 7/8] 9996-add-wed-tx-support-for-mt7986
+Date: Mon, 18 Sep 2023 11:01:55 +0800
+Subject: [PATCH 07/22] add-wed-tx-support-for-mt7986
 
 ---
  arch/arm64/boot/dts/mediatek/mt7986a.dtsi     |   2 +
@@ -12,11 +12,11 @@
  drivers/net/ethernet/mediatek/mtk_wed.h       |  18 +-
  .../net/ethernet/mediatek/mtk_wed_debugfs.c   |   3 +
  drivers/net/ethernet/mediatek/mtk_wed_regs.h  | 130 ++++-
- include/linux/soc/mediatek/mtk_wed.h          |  29 +-
- 9 files changed, 546 insertions(+), 150 deletions(-)
+ include/linux/soc/mediatek/mtk_wed.h          |  23 +
+ 9 files changed, 547 insertions(+), 149 deletions(-)
 
 diff --git a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
-index 381136c21..644255b35 100644
+index 0c54e12..3ff8994 100644
 --- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
 +++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
 @@ -64,6 +64,7 @@
@@ -36,7 +36,7 @@
  
  	ap2woccif: ap2woccif@151A5000 {
 diff --git a/arch/arm64/boot/dts/mediatek/mt7986b.dtsi b/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
-index 0e5f116a2..67bf86f6a 100644
+index 2d2207f..043e509 100644
 --- a/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
 +++ b/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
 @@ -64,6 +64,7 @@
@@ -55,19 +55,31 @@
  	};
  
  	ap2woccif: ap2woccif@151A5000 {
+diff --git a/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/arch/arm64/boot/dts/mediatek/mt7981.dtsi
+index b2f53b13..d34943e7 100644
+--- a/arch/arm64/boot/dts/mediatek/mt7981.dtsi
++++ b/arch/arm64/boot/dts/mediatek/mt7981.dtsi
+@@ -96,6 +96,7 @@
+ 		reg = <0 0x15010000 0 0x1000>;
+ 		interrupt-parent = <&gic>;
+ 		interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
++		mediatek,wed_pcie = <&wed_pcie>;
+ 	};
+ 
+ 	ap2woccif: ap2woccif@151A5000 {
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-index 3f67bebfe..ac021e2ed 100644
+index ee5e0c6..2cab49a 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -4807,6 +4807,7 @@ static int mtk_probe(struct platform_device *pdev)
+@@ -4968,6 +4968,7 @@ static int mtk_probe(struct platform_device *pdev)
  {
- 	struct device_node *mac_np;
+ 	struct device_node *mac_np, *mux_np;
  	struct mtk_eth *eth;
 +	struct resource *res = NULL;
  	int err, i;
  
  	eth = devm_kzalloc(&pdev->dev, sizeof(*eth), GFP_KERNEL);
-@@ -4827,13 +4828,12 @@ static int mtk_probe(struct platform_device *pdev)
+@@ -4988,13 +4989,12 @@ static int mtk_probe(struct platform_device *pdev)
  			return PTR_ERR(eth->sram_base);
  	}
  
@@ -86,7 +98,7 @@
  
  	mtk_get_hwver(eth);
  
-@@ -4929,12 +4929,15 @@ static int mtk_probe(struct platform_device *pdev)
+@@ -5090,12 +5090,15 @@ static int mtk_probe(struct platform_device *pdev)
  			MTK_WDMA1_BASE
  		};
  		void __iomem *wdma;
@@ -102,14 +114,14 @@
 +		mtk_wed_add_hw(np, eth, wdma, wdma_phy, i);
  	}
  
- 	for (i = 0; i < MTK_MAX_IRQ_NUM; i++) {
+ 	for (i = 0; i < MTK_PDMA_IRQ_NUM; i++)
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-index b4de7c0c6..4a69bd0cf 100644
+index 783166d..960b979 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -518,8 +518,13 @@
+@@ -583,8 +583,13 @@
  #define RX_DMA_SPORT_MASK       0x7
- #endif
+ #define RX_DMA_SPORT_MASK_V2    0xf
  
 +#if defined(CONFIG_MEDIATEK_NETSYS_V2)
 +#define MTK_WDMA0_BASE		0x4800
@@ -122,7 +134,7 @@
  /* QDMA descriptor txd4 */
  #define TX_DMA_CHKSUM		(0x7 << 29)
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
-index ea1cbdf1a..48b0353bb 100644
+index ea1cbdf..0588e32 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
 @@ -18,15 +18,6 @@
@@ -209,7 +221,7 @@
  			desc->info = 0;
  			desc++;
  
-@@ -202,12 +206,12 @@ free_pagelist:
+@@ -202,12 +206,12 @@ mtk_wed_free_buffer(struct mtk_wed_device *dev)
  }
  
  static void
@@ -701,12 +713,12 @@
 -		MTK_WED_CTRL_WED_TX_FREE_AGENT_EN);
 -
 -	wed_w32(dev, MTK_WED_PCIE_INT_TRIGGER, MTK_WED_PCIE_INT_TRIGGER_STATUS);
-+	mtk_wed_set_int(dev, irq_mask);
- 
+-
 -	wed_w32(dev, MTK_WED_WPDMA_INT_TRIGGER,
 -		MTK_WED_WPDMA_INT_TRIGGER_RX_DONE |
 -		MTK_WED_WPDMA_INT_TRIGGER_TX_DONE);
--
++	mtk_wed_set_int(dev, irq_mask);
+ 
 -	wed_set(dev, MTK_WED_WPDMA_INT_CTRL,
 -		MTK_WED_WPDMA_INT_CTRL_SUBRT_ADV);
 -
@@ -842,7 +854,7 @@
  	}
  
  	return 0;
-@@ -780,7 +1009,8 @@ out:
+@@ -780,7 +1009,8 @@ void mtk_wed_flow_remove(int index)
  }
  
  void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
@@ -892,7 +904,7 @@
  
  	hw_list[index] = hw;
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.h b/drivers/net/ethernet/mediatek/mtk_wed.h
-index 981ec613f..9b17b7405 100644
+index 981ec61..9b17b74 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed.h
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.h
 @@ -8,6 +8,19 @@
@@ -941,7 +953,7 @@
  }
  static inline void
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
-index a81d3fd1a..f420f187e 100644
+index a81d3fd..f420f18 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
 @@ -116,6 +116,9 @@ wed_txinfo_show(struct seq_file *s, void *data)
@@ -955,7 +967,7 @@
  	struct mtk_wed_hw *hw = s->private;
  	struct mtk_wed_device *dev = hw->wed_dev;
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_regs.h b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
-index 0a0465ea5..69f136ed4 100644
+index 0a0465e..a9b9e2a 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 @@ -4,9 +4,15 @@
@@ -1217,7 +1229,7 @@
  #define MTK_WDMA_INT_MASK				0x228
  #define MTK_WDMA_INT_MASK_TX_DONE			GENMASK(3, 0)
 diff --git a/include/linux/soc/mediatek/mtk_wed.h b/include/linux/soc/mediatek/mtk_wed.h
-index 7e00cca06..24742604b 100644
+index 7e00cca..ffd547a 100644
 --- a/include/linux/soc/mediatek/mtk_wed.h
 +++ b/include/linux/soc/mediatek/mtk_wed.h
 @@ -8,6 +8,19 @@
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3009-add-wed-tx-wds-support-for-mt7986.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3007-add-wed-tx-wds-support-for-netsys2.patch
old mode 100755
new mode 100644
similarity index 89%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3009-add-wed-tx-wds-support-for-mt7986.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3007-add-wed-tx-wds-support-for-netsys2.patch
index d17f43d..aaa6c48
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3009-add-wed-tx-wds-support-for-mt7986.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3007-add-wed-tx-wds-support-for-netsys2.patch
@@ -1,9 +1,8 @@
-From 3bddc232ca043699e893d279a3ec1f72ff6b9fae Mon Sep 17 00:00:00 2001
+From 396ce749479219467ea3f1123d5e9a303e5051ec Mon Sep 17 00:00:00 2001
 From: Sujuan Chen <sujuan.chen@mediatek.com>
-Date: Sat, 10 Sep 2022 15:42:32 +0800
-Subject: [PATCH] 9996-add-wed-tx-wds-support-on-panther
+Date: Mon, 18 Sep 2023 11:03:33 +0800
+Subject: [PATCH 08/22] add-wed-tx-wds-support-for-mt7986
 
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
 ---
  drivers/net/ethernet/mediatek/mtk_wed.c      | 8 +++++++-
  drivers/net/ethernet/mediatek/mtk_wed_regs.h | 1 +
@@ -11,7 +10,7 @@
  3 files changed, 11 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
-index 48b0353..472726e 100644
+index 0588e32..23e3dc5 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
 @@ -797,7 +797,7 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
@@ -44,7 +43,7 @@
  	ret = mtk_wed_buffer_alloc(dev);
  	if (ret) {
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_regs.h b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
-index e107de7..b189761 100644
+index a9b9e2a..14e0e21 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 @@ -31,6 +31,7 @@ struct mtk_wdma_desc {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3010-add-wed-rx-support-for-mt7896.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3008-add-wed-rx-support-for-netsys2.patch
old mode 100755
new mode 100644
similarity index 96%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3010-add-wed-rx-support-for-mt7896.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3008-add-wed-rx-support-for-netsys2.patch
index 053a4da..7efa9df
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3010-add-wed-rx-support-for-mt7896.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3008-add-wed-rx-support-for-netsys2.patch
@@ -1,9 +1,8 @@
-From 7c81104d65728fb1c0f156c46e3cfc5dec24b119 Mon Sep 17 00:00:00 2001
+From d35f304a7d0ec9612064a41b98338d9f712fbb48 Mon Sep 17 00:00:00 2001
 From: Sujuan Chen <sujuan.chen@mediatek.com>
-Date: Wed, 15 Jun 2022 14:38:54 +0800
-Subject: [PATCH 8/8] 9997-add-wed-rx-support-for-mt7896
+Date: Mon, 18 Sep 2023 11:04:53 +0800
+Subject: [PATCH 09/22] add-wed-rx-support-for-mt7896
 
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
 ---
  arch/arm64/boot/dts/mediatek/mt7986a.dtsi     |  42 +-
  arch/arm64/boot/dts/mediatek/mt7986b.dtsi     |  42 +-
@@ -19,7 +18,7 @@
  drivers/net/ethernet/mediatek/mtk_wed_wo.c    | 564 ++++++++++++++++
  drivers/net/ethernet/mediatek/mtk_wed_wo.h    | 324 +++++++++
  include/linux/soc/mediatek/mtk_wed.h          | 126 +++-
- 14 files changed, 2796 insertions(+), 75 deletions(-)
+ 14 files changed, 2801 insertions(+), 83 deletions(-)
  create mode 100644 drivers/net/ethernet/mediatek/mtk_wed_ccif.c
  create mode 100644 drivers/net/ethernet/mediatek/mtk_wed_ccif.h
  create mode 100644 drivers/net/ethernet/mediatek/mtk_wed_mcu.c
@@ -28,7 +27,7 @@
  create mode 100644 drivers/net/ethernet/mediatek/mtk_wed_wo.h
 
 diff --git a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
-index 87d2b11a9..6abc06db8 100644
+index 3ff8994..c5dc5e8 100644
 --- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
 +++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
 @@ -65,6 +65,12 @@
@@ -99,7 +98,7 @@
  		resets = <&ethsysrst 0>;
  		reset-names = "wocpu_rst";
 diff --git a/arch/arm64/boot/dts/mediatek/mt7986b.dtsi b/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
-index 67bf86f6a..6710b388b 100644
+index 043e509..bfd2a02 100644
 --- a/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
 +++ b/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
 @@ -65,6 +65,12 @@
@@ -169,8 +168,52 @@
  
  		resets = <&ethsysrst 0>;
  		reset-names = "wocpu_rst";
+diff --git a/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/arch/arm64/boot/dts/mediatek/mt7981.dtsi
+index d34943e7..512fb5d6 100644
+--- a/arch/arm64/boot/dts/mediatek/mt7981.dtsi
++++ b/arch/arm64/boot/dts/mediatek/mt7981.dtsi
+@@ -97,26 +97,29 @@
+ 		interrupt-parent = <&gic>;
+ 		interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
+ 		mediatek,wed_pcie = <&wed_pcie>;
++		mediatek,ap2woccif = <&ap2woccif0>;
++		mediatek,wocpu_ilm = <&wocpu0_ilm>;
++		mediatek,wocpu_dlm = <&wocpu0_dlm>;
++		mediatek,wocpu_boot = <&cpu_boot>;
++		mediatek,wocpu_emi = <&wocpu0_emi>;
++		mediatek,wocpu_data = <&wocpu_data>;
+ 	};
+ 
+-	ap2woccif: ap2woccif@151A5000 {
+-		compatible = "mediatek,ap2woccif";
+-		reg = <0 0x151A5000 0 0x1000>,
+-		      <0 0x151AD000 0 0x1000>;
++	ap2woccif0: ap2woccif@151A5000 {
++		compatible = "mediatek,ap2woccif", "syscon";
++		reg = <0 0x151A5000 0 0x1000>;
+ 		interrupt-parent = <&gic>;
+-		interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>,
+-			     <GIC_SPI 212 IRQ_TYPE_LEVEL_HIGH>;
+-        };
++		interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>;
++	};
+ 
+ 	wocpu0_ilm: wocpu0_ilm@151E0000 {
+ 		compatible = "mediatek,wocpu0_ilm";
+ 		reg = <0 0x151E0000 0 0x8000>;
+ 	};
+ 
+-	wocpu_dlm: wocpu_dlm@151E8000 {
++	wocpu0_dlm: wocpu_dlm@151E8000 {
+ 		compatible = "mediatek,wocpu_dlm";
+-		reg = <0 0x151E8000 0 0x2000>,
+-		      <0 0x151F8000 0 0x2000>;
++		reg = <0 0x151E8000 0 0x2000>;
+ 
+ 		resets = <&ethsysrst 0>;
+ 		reset-names = "wocpu_rst";
 diff --git a/drivers/net/ethernet/mediatek/Makefile b/drivers/net/ethernet/mediatek/Makefile
-index 3528f1b..0c724a5 100644
+index 4090132..fdbb90f 100644
 --- a/drivers/net/ethernet/mediatek/Makefile
 +++ b/drivers/net/ethernet/mediatek/Makefile
 @@ -10,5 +10,5 @@ mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed.o
@@ -181,7 +224,7 @@
 +obj-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed_ops.o mtk_wed_wo.o mtk_wed_mcu.o mtk_wed_ccif.o
  obj-$(CONFIG_NET_MEDIATEK_HNAT)			+= mtk_hnat/
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
-index 2700176..b037d00 100644
+index 23e3dc5..4b2f1a2 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
 @@ -13,11 +13,19 @@
@@ -1139,7 +1182,7 @@
  static u32
  mtk_wed_irq_get(struct mtk_wed_device *dev, u32 mask)
  {
-@@ -1020,6 +1558,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1022,6 +1560,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
  		.attach = mtk_wed_attach,
  		.tx_ring_setup = mtk_wed_tx_ring_setup,
  		.txfree_ring_setup = mtk_wed_txfree_ring_setup,
@@ -1148,7 +1191,7 @@
  		.start = mtk_wed_start,
  		.stop = mtk_wed_stop,
  		.reset_dma = mtk_wed_reset_dma,
-@@ -1028,6 +1568,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1030,6 +1570,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
  		.irq_get = mtk_wed_irq_get,
  		.irq_set_mask = mtk_wed_irq_set_mask,
  		.detach = mtk_wed_detach,
@@ -1156,7 +1199,7 @@
  	};
  	struct device_node *eth_np = eth->dev->of_node;
  	struct platform_device *pdev;
-@@ -1067,6 +1608,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1069,6 +1610,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
  	hw->wdma_phy = wdma_phy;
  	hw->index = index;
  	hw->irq = irq;
@@ -1164,7 +1207,7 @@
  
  	if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
  		hw->mirror = syscon_regmap_lookup_by_phandle(eth_np,
-@@ -1083,6 +1625,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1085,6 +1627,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
  			regmap_write(hw->mirror, 0, 0);
  			regmap_write(hw->mirror, 4, 0);
  		}
@@ -1611,7 +1654,7 @@
 index 0000000..96e30a3
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
-@@ -0,0 +1,586 @@
+@@ -0,0 +1,590 @@
 +// SPDX-License-Identifier: GPL-2.0-only
 +
 +#include <linux/skbuff.h>
@@ -1856,7 +1899,11 @@
 +	u32 ofs = 0;
 +	u32 boot_cr, val;
 +
-+	mcu = wo->hw->index ? MT7986_FIRMWARE_WO_2 : MT7986_FIRMWARE_WO_1;
++	if (of_device_is_compatible(wo->hw->node, "mediatek,mt7981-wed"))
++		mcu = MT7981_FIRMWARE_WO;
++	else
++		mcu = wo->hw->index ? MT7986_FIRMWARE_WO_2 :
++				      MT7986_FIRMWARE_WO_1;
 +
 +	ret = request_firmware(&fw, mcu, wo->hw->dev);
 +	if (ret)
@@ -2203,7 +2250,7 @@
 index 0000000..19e1199
 --- /dev/null
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.h
-@@ -0,0 +1,96 @@
+@@ -0,0 +1,97 @@
 +// SPDX-License-Identifier: GPL-2.0-only
 +
 +#ifndef __MTK_WED_MCU_H
@@ -2222,6 +2269,7 @@
 +#define WARP_OK_STATUS (0)
 +#define WARP_ALREADY_DONE_STATUS (1)
 +
++#define MT7981_FIRMWARE_WO		"mediatek/mt7981_wo.bin"
 +#define MT7986_FIRMWARE_WO_1		"mediatek/mt7986_wo_0.bin"
 +#define MT7986_FIRMWARE_WO_2		"mediatek/mt7986_wo_1.bin"
 +
@@ -2301,7 +2349,7 @@
 +
 +#endif
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_regs.h b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
-index b189761..9d021e2 100644
+index 14e0e21..31871f7 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 @@ -4,6 +4,8 @@
@@ -2366,8 +2414,8 @@
 +							 MTK_WED_EXT_INT_STATUS_RX_FBUF_DMAD_ER | \
  							 MTK_WED_EXT_INT_STATUS_RX_DRV_R_RESP_ERR | \
  							 MTK_WED_EXT_INT_STATUS_RX_DRV_W_RESP_ERR | \
- 							 MTK_WED_EXT_INT_STATUS_RX_DRV_COHERENT | \
-@@ -97,6 +106,8 @@ struct mtk_wdma_desc {
+ 							 MTK_WED_EXT_INT_STATUS_RX_DRV_INIT_WDMA_EN | \
+@@ -96,6 +105,8 @@ struct mtk_wdma_desc {
  							 MTK_WED_EXT_INT_STATUS_TX_DMA_W_RESP_ERR)
  
  #define MTK_WED_EXT_INT_MASK				0x028
@@ -2376,7 +2424,7 @@
  
  #define MTK_WED_STATUS					0x060
  #define MTK_WED_STATUS_TX				GENMASK(15, 8)
-@@ -184,6 +195,9 @@ struct mtk_wdma_desc {
+@@ -183,6 +194,9 @@ struct mtk_wdma_desc {
  
  #define MTK_WED_RING_RX(_n)				(0x400 + (_n) * 0x10)
  
@@ -2386,7 +2434,7 @@
  #define MTK_WED_WPDMA_INT_TRIGGER			0x504
  #define MTK_WED_WPDMA_INT_TRIGGER_RX_DONE		BIT(1)
  #define MTK_WED_WPDMA_INT_TRIGGER_TX_DONE		GENMASK(5, 4)
-@@ -240,13 +254,19 @@ struct mtk_wdma_desc {
+@@ -239,13 +253,19 @@ struct mtk_wdma_desc {
  
  #define MTK_WED_WPDMA_INT_CTRL_TX			0x530
  #define MTK_WED_WPDMA_INT_CTRL_TX0_DONE_EN 		BIT(0)
@@ -2407,7 +2455,7 @@
  
  #define MTK_WED_WPDMA_INT_CTRL_TX_FREE			0x538
  #define MTK_WED_WPDMA_INT_CTRL_TX_FREE_DONE_EN		BIT(0)
-@@ -271,13 +291,40 @@ struct mtk_wdma_desc {
+@@ -270,13 +290,40 @@ struct mtk_wdma_desc {
  #define MTK_WED_WPDMA_TX_MIB(_n)			(0x5a0 + (_n) * 4)
  #define MTK_WED_WPDMA_TX_COHERENT_MIB(_n)		(0x5d0 + (_n) * 4)
  
@@ -2448,7 +2496,7 @@
  #define MTK_WED_WDMA_GLO_CFG_RX_DRV_EN			BIT(2)
  #define MTK_WED_WDMA_GLO_CFG_RX_DRV_BUSY		BIT(3)
  #define MTK_WED_WDMA_GLO_CFG_BT_SIZE			GENMASK(5, 4)
-@@ -321,6 +368,20 @@ struct mtk_wdma_desc {
+@@ -320,6 +367,20 @@ struct mtk_wdma_desc {
  #define MTK_WED_WDMA_RX_RECYCLE_MIB(_n)			(0xae8 + (_n) * 4)
  #define MTK_WED_WDMA_RX_PROCESSED_MIB(_n)		(0xaf0 + (_n) * 4)
  
@@ -2469,7 +2517,7 @@
  #define MTK_WED_RING_OFS_BASE				0x00
  #define MTK_WED_RING_OFS_COUNT				0x04
  #define MTK_WED_RING_OFS_CPU_IDX			0x08
-@@ -331,12 +392,13 @@ struct mtk_wdma_desc {
+@@ -330,12 +391,13 @@ struct mtk_wdma_desc {
  
  #define MTK_WDMA_GLO_CFG				0x204
  #define MTK_WDMA_GLO_CFG_TX_DMA_EN			BIT(0)
@@ -2484,7 +2532,7 @@
  #define MTK_WDMA_RESET_IDX				0x208
  #define MTK_WDMA_RESET_IDX_TX				GENMASK(3, 0)
  #define MTK_WDMA_RESET_IDX_RX				GENMASK(17, 16)
-@@ -360,4 +422,70 @@ struct mtk_wdma_desc {
+@@ -359,4 +421,70 @@ struct mtk_wdma_desc {
  /* DMA channel mapping */
  #define HIFSYS_DMA_AG_MAP				0x008
  
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3011-add-wed-ser-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3009-add-wed-ser-support.patch
old mode 100755
new mode 100644
similarity index 97%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3011-add-wed-ser-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3009-add-wed-ser-support.patch
index 0d6a50f..c53746f
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3011-add-wed-ser-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3009-add-wed-ser-support.patch
@@ -1,9 +1,8 @@
-From f70e83ccdca85840c3bf9e7a31fb871a12724dc2 Mon Sep 17 00:00:00 2001
+From de9cc10d4e2d5aad4801dc92fb37c42478a4ab68 Mon Sep 17 00:00:00 2001
 From: Sujuan Chen <sujuan.chen@mediatek.com>
-Date: Thu, 28 Jul 2022 14:49:16 +0800
-Subject: [PATCH 3/3] add wed ser support
+Date: Mon, 18 Sep 2023 11:05:45 +0800
+Subject: [PATCH 10/22] add-wed-ser-support
 
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
 ---
  drivers/net/ethernet/mediatek/mtk_eth_soc.c  |   8 +
  drivers/net/ethernet/mediatek/mtk_wed.c      | 361 ++++++++++++++-----
@@ -13,10 +12,10 @@
  5 files changed, 320 insertions(+), 99 deletions(-)
 
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-index 2b52fa0..2f98525 100644
+index 2cab49a..c1399c5 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -3680,6 +3680,9 @@ static void mtk_pending_work(struct work_struct *work)
+@@ -4158,6 +4158,9 @@ static void mtk_pending_work(struct work_struct *work)
  	for (i = 0; i < MTK_MAC_COUNT; i++) {
  		if (!eth->netdev[i])
  			continue;
@@ -26,15 +25,15 @@
  		if (mtk_reset_flag == MTK_FE_STOP_TRAFFIC) {
  			pr_info("send MTK_FE_STOP_TRAFFIC event\n");
  			call_netdevice_notifiers(MTK_FE_STOP_TRAFFIC,
-@@ -3693,6 +3696,7 @@ static void mtk_pending_work(struct work_struct *work)
- 		if (!wait_for_completion_timeout(&wait_ser_done, 3000))
+@@ -4183,6 +4186,7 @@ static void mtk_pending_work(struct work_struct *work)
  			pr_warn("wait for MTK_FE_START_RESET\n");
+ 		}
  		rtnl_lock();
 +#endif
  		break;
  	}
  
-@@ -3731,6 +3735,9 @@ static void mtk_pending_work(struct work_struct *work)
+@@ -4221,6 +4225,9 @@ static void mtk_pending_work(struct work_struct *work)
  	for (i = 0; i < MTK_MAC_COUNT; i++) {
  		if (!eth->netdev[i])
  			continue;
@@ -44,7 +43,7 @@
  		if (mtk_reset_flag == MTK_FE_STOP_TRAFFIC) {
  			pr_info("send MTK_FE_START_TRAFFIC event\n");
  			call_netdevice_notifiers(MTK_FE_START_TRAFFIC,
-@@ -3740,6 +3747,7 @@ static void mtk_pending_work(struct work_struct *work)
+@@ -4230,6 +4237,7 @@ static void mtk_pending_work(struct work_struct *work)
  			call_netdevice_notifiers(MTK_FE_RESET_DONE,
  				eth->netdev[i]);
  		}
@@ -53,7 +52,7 @@
  			eth->netdev[i]);
  		break;
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
-index ff8f658..0917a5a 100644
+index 4b2f1a2..ae31412 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
 @@ -13,8 +13,10 @@
@@ -613,7 +612,7 @@
  	if (dev->ver == MTK_WED_V1)
  		regmap_update_bits(hw->hifsys, HIFSYS_DMA_AG_MAP,
  				   BIT(hw->index), 0);
-@@ -1374,7 +1549,8 @@ out:
+@@ -1374,7 +1549,8 @@ mtk_wed_attach(struct mtk_wed_device *dev)
  }
  
  static int
@@ -706,7 +705,7 @@
  
  #ifdef CONFIG_DEBUG_FS
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_regs.h b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
-index 9d021e2..cfcd94f 100644
+index 31871f7..403a36b 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 @@ -38,11 +38,15 @@ struct mtk_wdma_desc {
@@ -725,7 +724,7 @@
  #define MTK_WED_RESET_WDMA_RX_DRV			BIT(17)
  #define MTK_WED_RESET_WDMA_INT_AGENT			BIT(19)
  #define MTK_WED_RESET_RX_RRO_QM				BIT(20)
-@@ -186,7 +190,12 @@ struct mtk_wdma_desc {
+@@ -185,7 +189,12 @@ struct mtk_wdma_desc {
  
  #define MTK_WED_RESET_IDX				0x20c
  #define MTK_WED_RESET_IDX_TX				GENMASK(3, 0)
@@ -738,7 +737,7 @@
  
  #define MTK_WED_TX_MIB(_n)				(0x2a0 + (_n) * 4)
  #define MTK_WED_RX_MIB(_n)				(0x2e0 + (_n) * 4)
-@@ -300,6 +309,9 @@ struct mtk_wdma_desc {
+@@ -299,6 +308,9 @@ struct mtk_wdma_desc {
  
  #define MTK_WED_WPDMA_RX_D_GLO_CFG			0x75c
  #define MTK_WED_WPDMA_RX_D_RX_DRV_EN			BIT(0)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3012-ethernet-update-ppe-backward-compatible-two-way-hash.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3010-ethernet-update-ppe-backward-compatible-two-way-hash.patch
old mode 100755
new mode 100644
similarity index 74%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3012-ethernet-update-ppe-backward-compatible-two-way-hash.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3010-ethernet-update-ppe-backward-compatible-two-way-hash.patch
index 554a0ee..b547328
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3012-ethernet-update-ppe-backward-compatible-two-way-hash.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3010-ethernet-update-ppe-backward-compatible-two-way-hash.patch
@@ -1,8 +1,20 @@
+From 84fd451dd7379943e6957e9ceb749be4d6c41540 Mon Sep 17 00:00:00 2001
+From: Bc-bocun Chen <bc-bocun.chen@mediatek.com>
+Date: Mon, 18 Sep 2023 11:07:14 +0800
+Subject: [PATCH 11/22] ethernet-update-ppe-backward-compatible-two-way-hash
+
+---
+ drivers/net/ethernet/mediatek/mtk_eth_soc.c | 10 ++++++++-
+ drivers/net/ethernet/mediatek/mtk_eth_soc.h |  1 +
+ drivers/net/ethernet/mediatek/mtk_ppe.c     | 24 ++++++++++++++-------
+ drivers/net/ethernet/mediatek/mtk_ppe.h     |  5 +++--
+ 4 files changed, 29 insertions(+), 11 deletions(-)
+
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-index 2c54c9c..d3ba9eb 100644
+index c1399c5..bd622d3 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -4442,7 +4442,8 @@ static int mtk_probe(struct platform_dev
+@@ -5252,7 +5252,8 @@ static int mtk_probe(struct platform_device *pdev)
  
  		for (i = 0; i < eth->ppe_num; i++) {
  			eth->ppe[i] = mtk_ppe_init(eth,
@@ -12,69 +24,69 @@
  			if (!eth->ppe[i]) {
  				err = -ENOMEM;
  				goto err_free_dev;
-@@ -4558,6 +4559,7 @@ static const struct mtk_soc_data mt2701_
+@@ -5359,6 +5360,7 @@ static const struct mtk_soc_data mt2701_data = {
  	.required_clks = MT7623_CLKS_BITMAP,
  	.required_pctl = true,
  	.has_sram = false,
 +	.hash_way = 2,
  	.offload_version = 2,
-	.rss_num = 0,
+ 	.rss_num = 0,
  	.txrx = {
-@@ -4573,6 +4575,7 @@ static const struct mtk_soc_data mt7621_
+@@ -5377,6 +5379,7 @@ static const struct mtk_soc_data mt7621_data = {
  	.required_clks = MT7621_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.hash_way = 2,
  	.offload_version = 2,
-	.rss_num = 0,
+ 	.rss_num = 0,
  	.txrx = {
-@@ -4589,6 +4592,7 @@ static const struct mtk_soc_data mt7622_
+@@ -5396,6 +5399,7 @@ static const struct mtk_soc_data mt7622_data = {
  	.required_clks = MT7622_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.hash_way = 2,
  	.offload_version = 2,
-	.rss_num = 0,
+ 	.rss_num = 0,
  	.txrx = {
-@@ -4604,6 +4608,7 @@ static const struct mtk_soc_data mt7623_
+@@ -5414,6 +5418,7 @@ static const struct mtk_soc_data mt7623_data = {
  	.required_clks = MT7623_CLKS_BITMAP,
  	.required_pctl = true,
  	.has_sram = false,
 +	.hash_way = 2,
  	.offload_version = 2,
-	.rss_num = 0,
+ 	.rss_num = 0,
  	.txrx = {
-@@ -4635,6 +4640,7 @@ static const struct mtk_soc_data mt7986_
+@@ -5451,6 +5456,7 @@ static const struct mtk_soc_data mt7986_data = {
  	.required_clks = MT7986_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.hash_way = 4,
  	.offload_version = 2,
-	.rss_num = 0,
+ 	.rss_num = 4,
  	.txrx = {
-@@ -4651,6 +4657,8 @@ static const struct mtk_soc_data mt7981_
+@@ -5470,6 +5476,8 @@ static const struct mtk_soc_data mt7981_data = {
  	.required_clks = MT7981_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.hash_way = 4,
 +	.offload_version = 2,
-	.rss_num = 0,
+ 	.rss_num = 4,
  	.txrx = {
  		.txd_size = sizeof(struct mtk_tx_dma_v2),
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-index 4a69bd0..35a7543 100644
+index 960b979..68b8ab1 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -1472,6 +1472,7 @@ struct mtk_soc_data {
+@@ -1679,6 +1679,7 @@ struct mtk_soc_data {
  	u64		caps;
- 	u32		required_clks;
+ 	u64		required_clks;
  	bool		required_pctl;
 +	u8		hash_way;
  	u8		offload_version;
  	netdev_features_t hw_features;
  	bool		has_sram;
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
-index e4d50eb..918aa22 100755
+index 96c15b3..4da7e7a 100755
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
 @@ -88,7 +88,7 @@ static void mtk_ppe_cache_enable(struct mtk_ppe *ppe, bool enable)
@@ -95,7 +107,7 @@
  	hash &= MTK_PPE_ENTRIES - 1;
  
  	return hash;
-@@ -542,10 +542,10 @@ int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
+@@ -557,10 +557,10 @@ int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
  	if (type == MTK_PPE_PKT_TYPE_BRIDGE)
  		return mtk_foe_entry_commit_l2(ppe, entry);
  
@@ -108,7 +120,7 @@
  	spin_unlock_bh(&ppe_lock);
  
  	return 0;
-@@ -569,7 +569,7 @@ mtk_foe_entry_commit_subflow(struct mtk_ppe *ppe, struct mtk_flow_entry *entry,
+@@ -584,7 +584,7 @@ mtk_foe_entry_commit_subflow(struct mtk_ppe *ppe, struct mtk_flow_entry *entry,
  	flow_info->l2_data.base_flow = entry;
  	flow_info->type = MTK_FLOW_TYPE_L2_SUBFLOW;
  	flow_info->hash = hash;
@@ -117,7 +129,7 @@
  	hlist_add_head(&flow_info->l2_data.list, &entry->l2_flows);
  
  	hwe = &ppe->foe_table[hash];
-@@ -593,7 +593,7 @@ mtk_foe_entry_commit_subflow(struct mtk_ppe *ppe, struct mtk_flow_entry *entry,
+@@ -608,7 +608,7 @@ mtk_foe_entry_commit_subflow(struct mtk_ppe *ppe, struct mtk_flow_entry *entry,
  
  void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
  {
@@ -126,7 +138,7 @@
  	struct mtk_foe_entry *hwe = &ppe->foe_table[hash];
  	struct mtk_flow_entry *entry;
  	struct mtk_foe_bridge key = {};
-@@ -676,12 +676,12 @@ int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
+@@ -695,12 +695,12 @@ int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
  	return __mtk_foe_entry_idle_time(ppe, entry->data.ib1);
  }
  
@@ -141,7 +153,7 @@
  
  	ppe = devm_kzalloc(dev, sizeof(*ppe), GFP_KERNEL);
  	if (!ppe)
-@@ -695,6 +696,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int versio
+@@ -715,6 +715,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base,
  	ppe->eth = eth;
  	ppe->dev = dev;
  	ppe->version = version;
@@ -149,7 +161,7 @@
  	ppe->id = id;
  
  	foe = dmam_alloc_coherent(ppe->dev, MTK_PPE_ENTRIES * sizeof(*foe),
-@@ -704,6 +706,13 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int versio
+@@ -724,6 +725,13 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base,
  
  	ppe->foe_table = foe;
  
@@ -164,10 +176,10 @@
  }
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.h b/drivers/net/ethernet/mediatek/mtk_ppe.h
-index 21cc551..3d6928c 100644
+index 86bbac8..feb1a4a 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.h
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
-@@ -276,19 +276,20 @@ struct mtk_ppe {
+@@ -322,19 +322,20 @@ struct mtk_ppe {
  	void __iomem *base;
  	int version;
  	int id;
@@ -190,3 +202,6 @@
  int mtk_ppe_start(struct mtk_ppe *ppe);
  int mtk_ppe_stop(struct mtk_ppe *ppe);
  
+-- 
+2.18.0
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3013-flow-offload-add-mtkhnat-flow-accounting.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3011-flow-offload-add-mtkhnat-flow-accounting.patch
old mode 100755
new mode 100644
similarity index 82%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3013-flow-offload-add-mtkhnat-flow-accounting.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3011-flow-offload-add-mtkhnat-flow-accounting.patch
index b29a907..3699263
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3013-flow-offload-add-mtkhnat-flow-accounting.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3011-flow-offload-add-mtkhnat-flow-accounting.patch
@@ -1,8 +1,24 @@
+From 77bdae190ded4dfafa80dfaf04a77018e33e233c Mon Sep 17 00:00:00 2001
+From: Bc-bocun Chen <bc-bocun.chen@mediatek.com>
+Date: Mon, 18 Sep 2023 11:09:23 +0800
+Subject: [PATCH 12/22] flow-offload-add-mtkhnat-flow-accounting
+
+---
+ drivers/net/ethernet/mediatek/mtk_eth_soc.c   |  11 +-
+ drivers/net/ethernet/mediatek/mtk_eth_soc.h   |   1 +
+ drivers/net/ethernet/mediatek/mtk_ppe.c       | 131 +++++++++++++++++-
+ drivers/net/ethernet/mediatek/mtk_ppe.h       |  23 ++-
+ .../net/ethernet/mediatek/mtk_ppe_debugfs.c   |  10 +-
+ .../net/ethernet/mediatek/mtk_ppe_offload.c   |   7 +
+ drivers/net/ethernet/mediatek/mtk_ppe_regs.h  |  14 ++
+ net/netfilter/xt_FLOWOFFLOAD.c                |   2 +-
+ 8 files changed, 191 insertions(+), 8 deletions(-)
+
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-index 4f53794..dc5d050 100644
+index bd622d3..9d8ce07 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -3944,7 +3944,8 @@ static int mtk_probe(struct platform_device *pdev)
+@@ -5253,7 +5253,8 @@ static int mtk_probe(struct platform_device *pdev)
  		for (i = 0; i < eth->ppe_num; i++) {
  			eth->ppe[i] = mtk_ppe_init(eth,
  						   eth->base + MTK_ETH_PPE_BASE + i * 0x400,
@@ -12,75 +28,75 @@
  			if (!eth->ppe[i]) {
  				err = -ENOMEM;
  				goto err_free_dev;
-@@ -4057,6 +4058,7 @@ static const struct mtk_soc_data mt2701_data = {
+@@ -5360,6 +5361,7 @@ static const struct mtk_soc_data mt2701_data = {
  	.required_clks = MT7623_CLKS_BITMAP,
  	.required_pctl = true,
  	.has_sram = false,
 +	.has_accounting = false,
  	.hash_way = 2,
  	.offload_version = 2,
-	.rss_num = 0,
-@@ -4073,6 +4075,7 @@ static const struct mtk_soc_data mt7621_data = {
+ 	.rss_num = 0,
+@@ -5379,6 +5381,7 @@ static const struct mtk_soc_data mt7621_data = {
  	.required_clks = MT7621_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.has_accounting = false,
  	.hash_way = 2,
  	.offload_version = 2,
-	.rss_num = 0,
-@@ -4090,6 +4093,7 @@ static const struct mtk_soc_data mt7622_data = {
+ 	.rss_num = 0,
+@@ -5399,6 +5402,7 @@ static const struct mtk_soc_data mt7622_data = {
  	.required_clks = MT7622_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.has_accounting = true,
  	.hash_way = 2,
  	.offload_version = 2,
-	.rss_num = 0,
-@@ -4106,6 +4110,7 @@ static const struct mtk_soc_data mt7623_data = {
+ 	.rss_num = 0,
+@@ -5418,6 +5422,7 @@ static const struct mtk_soc_data mt7623_data = {
  	.required_clks = MT7623_CLKS_BITMAP,
  	.required_pctl = true,
  	.has_sram = false,
 +	.has_accounting = false,
  	.hash_way = 2,
  	.offload_version = 2,
-	.rss_num = 0,
-@@ -4123,6 +4128,7 @@ static const struct mtk_soc_data mt7629_data = {
+ 	.rss_num = 0,
+@@ -5438,6 +5443,7 @@ static const struct mtk_soc_data mt7629_data = {
  	.required_clks = MT7629_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.has_accounting = true,
-	.rss_num = 0,
+ 	.rss_num = 0,
  	.txrx = {
  		.txd_size = sizeof(struct mtk_tx_dma),
-@@ -4138,6 +4144,7 @@ static const struct mtk_soc_data mt7986_data = {
+@@ -5456,6 +5462,7 @@ static const struct mtk_soc_data mt7986_data = {
  	.required_clks = MT7986_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.has_accounting = true,
  	.hash_way = 4,
  	.offload_version = 2,
-	.rss_num = 0,
-@@ -4155,6 +4162,7 @@ static const struct mtk_soc_data mt7981_data = {
+ 	.rss_num = 4,
+@@ -5476,6 +5483,7 @@ static const struct mtk_soc_data mt7981_data = {
  	.required_clks = MT7981_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.has_accounting = true,
  	.hash_way = 4,
  	.offload_version = 2,
-	.rss_num = 0,
-@@ -4171,6 +4179,7 @@ static const struct mtk_soc_data rt5350_data = {
+ 	.rss_num = 4,
+@@ -5513,6 +5521,7 @@ static const struct mtk_soc_data rt5350_data = {
  	.required_clks = MT7628_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = false,
 +	.has_accounting = false,
-	.rss_num = 0,
+ 	.rss_num = 0,
  	.txrx = {
  		.txd_size = sizeof(struct mtk_tx_dma),
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-index f659633..5e16fa8 100644
+index 68b8ab1..101c233 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -1213,6 +1213,7 @@ struct mtk_soc_data {
+@@ -1683,6 +1683,7 @@ struct mtk_soc_data {
  	u8		offload_version;
  	netdev_features_t hw_features;
  	bool		has_sram;
@@ -89,7 +105,7 @@
  		u32	txd_size;
  		u32	rxd_size;
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
-index 918aa22..8c036cd 100755
+index 4da7e7a..f55a95c 100755
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
 @@ -74,6 +74,46 @@ static int mtk_ppe_wait_busy(struct mtk_ppe *ppe)
@@ -139,7 +155,7 @@
  static void mtk_ppe_cache_clear(struct mtk_ppe *ppe)
  {
  	ppe_set(ppe, MTK_PPE_CACHE_CTL, MTK_PPE_CACHE_CTL_CLEAR);
-@@ -412,7 +452,19 @@ __mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
+@@ -426,6 +466,18 @@ __mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
  							      MTK_FOE_STATE_INVALID);
  		dma_wmb();
  		mtk_ppe_cache_clear(ppe);
@@ -155,11 +171,10 @@
 +			acct_updated->packets = 0;
 +			acct_updated->bytes = 0;
 +		}
-	}
+ 	}
  	entry->hash = 0xffff;
  
- 	if (entry->type != MTK_FLOW_TYPE_L2_SUBFLOW)
-@@ -513,6 +560,16 @@ __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry,
+@@ -528,6 +580,16 @@ __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry,
  	wmb();
  	hwe->ib1 = entry->ib1;
  
@@ -176,7 +191,7 @@
  	dma_wmb();
  
  	mtk_ppe_cache_clear(ppe);
-@@ -618,8 +675,6 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
+@@ -637,8 +699,6 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
  		}
  
  		if (found || !mtk_flow_entry_match(entry, hwe)) {
@@ -185,7 +200,7 @@
  			continue;
  		}
  
-@@ -676,12 +731,44 @@ int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
+@@ -695,12 +755,44 @@ int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
  	return __mtk_foe_entry_idle_time(ppe, entry->data.ib1);
  }
  
@@ -231,7 +246,7 @@
  
  	ppe = devm_kzalloc(dev, sizeof(*ppe), GFP_KERNEL);
  	if (!ppe)
-@@ -698,6 +781,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int versio
+@@ -717,6 +809,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int versio
  	ppe->version = version;
  	ppe->way = way;
  	ppe->id = id;
@@ -239,7 +254,7 @@
  
  	foe = dmam_alloc_coherent(ppe->dev, MTK_PPE_ENTRIES * sizeof(*foe),
  				  &ppe->foe_phys, GFP_KERNEL);
-@@ -713,6 +797,31 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int versio
+@@ -732,6 +825,31 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int versio
  
  	ppe->foe_flow = flow;
  
@@ -271,9 +286,9 @@
  	return ppe;
  }
  
-@@ -811,6 +949,13 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
- 	ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT1, 0xcb777);
+@@ -834,6 +952,13 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
  	ppe_w32(ppe, MTK_PPE_SBW_CTRL, 0x7f);
+ #endif
  
 +	if (ppe->accounting && ppe->mib_phys) {
 +		ppe_w32(ppe, MTK_PPE_MIB_TB_BASE, ppe->mib_phys);
@@ -286,10 +301,10 @@
  }
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.h b/drivers/net/ethernet/mediatek/mtk_ppe.h
-index 3d6928c..8076e5d 100644
+index feb1a4a..86288b0 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.h
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
-@@ -270,6 +270,20 @@ struct mtk_flow_entry {
+@@ -316,6 +316,20 @@ struct mtk_flow_entry {
  	unsigned long cookie;
  };
  
@@ -310,7 +325,7 @@
  struct mtk_ppe {
  	struct mtk_eth *eth;
  	struct device *dev;
-@@ -277,10 +291,14 @@ struct mtk_ppe {
+@@ -323,19 +337,25 @@ struct mtk_ppe {
  	int version;
  	int id;
  	int way;
@@ -325,7 +340,8 @@
  	u16 foe_check_time[MTK_PPE_ENTRIES];
  	struct hlist_head *foe_flow;
  
+ 	struct rhashtable l2_flows;
+ 
-@@ -289,7 +307,9 @@ struct mtk_ppe {
  	void *acct_table;
 +	void *acct_updated_table;
  };
@@ -336,7 +352,7 @@
  int mtk_ppe_start(struct mtk_ppe *ppe);
  int mtk_ppe_stop(struct mtk_ppe *ppe);
  
-@@ -340,5 +359,6 @@ int mtk_foe_entry_set_wdma(struct mtk_foe_entry *entry, int wdma_idx, int txq,
+@@ -386,5 +406,6 @@ int mtk_foe_entry_set_wdma(struct mtk_foe_entry *entry, int wdma_idx, int txq,
  int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
  void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
  int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
@@ -380,10 +396,10 @@
  
  	return 0;
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-index 2f7d76d..f258539 100755
+index f256607..b80f72d 100755
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-@@ -504,6 +504,7 @@ static int
+@@ -509,6 +509,7 @@ static int
  mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f)
  {
  	struct mtk_flow_entry *entry;
@@ -391,7 +407,7 @@
  	u32 idle;
  	int i;
  
-@@ -516,6 +517,12 @@ mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f)
+@@ -521,6 +522,12 @@ mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f)
  	idle = mtk_foe_entry_idle_time(eth->ppe[i], entry);
  	f->stats.lastused = jiffies - idle * HZ;
  
@@ -405,10 +421,10 @@
  }
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_regs.h b/drivers/net/ethernet/mediatek/mtk_ppe_regs.h
-index d319f18..9eb7a0d 100644
+index d319f18..8d3ebe1 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_regs.h
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_regs.h
-@@ -145,6 +146,20 @@ enum {
+@@ -145,6 +145,20 @@ enum {
  
  #define MTK_PPE_MIB_TB_BASE			0x338
  
@@ -430,10 +446,10 @@
  #define MTK_PPE_MIB_CACHE_CTL_EN		BIT(0)
  #define MTK_PPE_MIB_CACHE_CTL_FLUSH		BIT(2)
 diff --git a/net/netfilter/xt_FLOWOFFLOAD.c b/net/netfilter/xt_FLOWOFFLOAD.c
-index 8547f4a..c175e4d 100644
+index 2cab008..1defb15 100644
 --- a/net/netfilter/xt_FLOWOFFLOAD.c
 +++ b/net/netfilter/xt_FLOWOFFLOAD.c
-@@ -700,12 +781,12 @@ static int __init xt_flowoffload_tg_init(void)
+@@ -766,7 +766,7 @@ static int __init xt_flowoffload_tg_init(void)
  	if (ret)
  		goto cleanup;
  
@@ -442,8 +458,6 @@
  
  	ret = xt_register_target(&offload_tg_reg);
  	if (ret)
- 		goto cleanup2;
- 
- 	return 0;
- 
- cleanup2:
+-- 
+2.18.0
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-flow-offload-add-mtkhnat-qdma-qos.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3012-flow-offload-add-mtkhnat-qdma-qos.patch
similarity index 95%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-flow-offload-add-mtkhnat-qdma-qos.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3012-flow-offload-add-mtkhnat-qdma-qos.patch
index 74a937e..062dace 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-flow-offload-add-mtkhnat-qdma-qos.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3012-flow-offload-add-mtkhnat-qdma-qos.patch
@@ -1,7 +1,7 @@
-From e2277f2ea6c9657b727b082f7baa967ef94861dc Mon Sep 17 00:00:00 2001
-From: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
-Date: Sat, 26 Aug 2023 00:38:09 +0800
-Subject: [PATCH] 999-3014-flow-offload-add-mtkhnat-qdma-qos
+From 9e21d6fa97e93cb2ba9b923810666ddaf7a981ee Mon Sep 17 00:00:00 2001
+From: Bc-bocun Chen <bc-bocun.chen@mediatek.com>
+Date: Mon, 18 Sep 2023 11:11:03 +0800
+Subject: [PATCH 13/22] flow-offload-add-mtkhnat-qdma-qos
 
 ---
  drivers/net/ethernet/mediatek/Makefile        |   2 +-
@@ -30,10 +30,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 9102144..a370547 100644
+index 9d8ce07..0f6613b 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -5085,6 +5085,8 @@ static int mtk_probe(struct platform_device *pdev)
+@@ -5266,6 +5266,8 @@ static int mtk_probe(struct platform_device *pdev)
  		}
  
  		mtk_ppe_debugfs_init(eth);
@@ -42,7 +42,7 @@
  	}
  
  	for (i = 0; i < MTK_MAX_DEVS; i++) {
-@@ -5197,6 +5199,7 @@ static const struct mtk_soc_data mt2701_data = {
+@@ -5371,6 +5373,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,
@@ -50,7 +50,7 @@
  	},
  };
  
-@@ -5217,6 +5220,7 @@ static const struct mtk_soc_data mt7621_data = {
+@@ -5391,6 +5394,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,
@@ -58,7 +58,7 @@
  	},
  };
  
-@@ -5238,6 +5242,7 @@ static const struct mtk_soc_data mt7622_data = {
+@@ -5412,6 +5416,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,
@@ -66,7 +66,7 @@
  	},
  };
  
-@@ -5258,6 +5263,7 @@ static const struct mtk_soc_data mt7623_data = {
+@@ -5432,6 +5437,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,
@@ -74,7 +74,7 @@
  	},
  };
  
-@@ -5298,6 +5304,7 @@ static const struct mtk_soc_data mt7986_data = {
+@@ -5472,6 +5478,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,
@@ -82,7 +82,7 @@
  	},
  };
  
-@@ -5319,6 +5326,7 @@ static const struct mtk_soc_data mt7981_data = {
+@@ -5493,6 +5500,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,
@@ -90,7 +90,7 @@
  	},
  };
  
-@@ -5337,6 +5345,7 @@ static const struct mtk_soc_data mt7988_data = {
+@@ -5511,6 +5519,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,
@@ -98,7 +98,7 @@
  	},
  };
  
-@@ -5355,6 +5364,7 @@ static const struct mtk_soc_data rt5350_data = {
+@@ -5529,6 +5538,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,
@@ -107,10 +107,10 @@
  };
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-index db139a1..a7892e2 100644
+index 101c233..7ea380e 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -398,10 +398,21 @@
+@@ -400,10 +400,21 @@
  
  /* QDMA TX Queue Configuration Registers */
  #define MTK_QTX_CFG(x)		(QDMA_BASE + (x * 0x10))
@@ -132,7 +132,7 @@
  
  /* QDMA RX Base Pointer Register */
  #define MTK_QRX_BASE_PTR0	(QDMA_BASE + 0x100)
-@@ -419,7 +430,9 @@
+@@ -421,7 +432,9 @@
  #define MTK_QRX_DRX_IDX0	(QDMA_BASE + 0x10c)
  
  /* QDMA Page Configuration Register */
@@ -143,7 +143,7 @@
  
  /* QDMA Global Configuration Register */
  #define MTK_QDMA_GLO_CFG	(QDMA_BASE + 0x204)
-@@ -456,6 +469,9 @@
+@@ -458,6 +471,9 @@
  #define FC_THRES_DROP_EN	(7 << 16)
  #define FC_THRES_MIN		0x4444
  
@@ -153,7 +153,7 @@
  /* QDMA Interrupt Status Register */
  #define MTK_QDMA_INT_STATUS	(QDMA_BASE + 0x218)
  #if defined(CONFIG_MEDIATEK_NETSYS_RX_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3)
-@@ -492,6 +508,11 @@
+@@ -494,6 +510,11 @@
  /* QDMA Interrupt Mask Register */
  #define MTK_QDMA_HRED2		(QDMA_BASE + 0x244)
  
@@ -165,7 +165,7 @@
  /* QDMA TX Forward CPU Pointer Register */
  #define MTK_QTX_CTX_PTR		(QDMA_BASE +0x300)
  
-@@ -519,6 +540,14 @@
+@@ -521,6 +542,14 @@
  /* QDMA FQ Free Page Buffer Length Register */
  #define MTK_QDMA_FQ_BLEN	(QDMA_BASE +0x32c)
  
@@ -180,7 +180,7 @@
  /* WDMA Registers */
  #define MTK_WDMA_CTX_PTR(x)	(WDMA_BASE(x) + 0x8)
  #define MTK_WDMA_DTX_PTR(x)	(WDMA_BASE(x) + 0xC)
-@@ -1682,6 +1711,7 @@ struct mtk_soc_data {
+@@ -1690,6 +1719,7 @@ struct mtk_soc_data {
  		u32	rx_dma_l4_valid;
  		u32	dma_max_len;
  		u32	dma_len_offset;
@@ -188,7 +188,7 @@
  	} txrx;
  };
  
-@@ -1868,6 +1898,7 @@ struct mtk_eth {
+@@ -1879,6 +1909,7 @@ struct mtk_eth {
  	spinlock_t			syscfg0_lock;
  	struct timer_list		mtk_dma_monitor_timer;
  
@@ -196,7 +196,7 @@
  	u8				ppe_num;
  	struct mtk_ppe			*ppe[MTK_MAX_PPE_NUM];
  	struct rhashtable		flow_table;
-@@ -1906,6 +1937,34 @@ extern const struct of_device_id of_mtk_match[];
+@@ -1936,6 +1967,34 @@ extern const struct of_device_id of_mtk_match[];
  extern u32 mtk_hwlro_stats_ebl;
  extern u32 dbg_show_level;
  
@@ -231,7 +231,7 @@
  /* read the hardware status register */
  void mtk_stats_update_mac(struct mtk_mac *mac);
  
-@@ -1938,4 +1997,6 @@ void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev);
+@@ -1969,4 +2028,6 @@ void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev);
  u32 mtk_rss_indr_table(struct mtk_rss_params *rss_params, int index);
  
  int mtk_ppe_debugfs_init(struct mtk_eth *eth);
@@ -239,7 +239,7 @@
 +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 107f5a1..0d4ae28 100755
+index f55a95c..6d6c1e4 100755
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
 @@ -128,7 +128,7 @@ static void mtk_ppe_cache_enable(struct mtk_ppe *ppe, bool enable)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3015-flow-offload-ovs-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3013-flow-offload-ovs-support.patch
old mode 100755
new mode 100644
similarity index 75%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3015-flow-offload-ovs-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3013-flow-offload-ovs-support.patch
index 04e22a4..a164d1a
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3015-flow-offload-ovs-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3013-flow-offload-ovs-support.patch
@@ -1,11 +1,20 @@
-Index: net/openvswitch/vport-internal_dev.c
-===================================================================
+From 842a435bd21807447504a387e5ebb8071b0db93f Mon Sep 17 00:00:00 2001
+From: Evelyn Tsai <evelyn.tsai@mediatek.com>
+Date: Mon, 18 Sep 2023 11:11:41 +0800
+Subject: [PATCH 14/22] flow-offload-ovs-support
+
+---
+ net/openvswitch/vport-internal_dev.c | 46 ++++++++++++++++++++++++++++
+ 1 file changed, 46 insertions(+)
+
+diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
+index 58a7b83..8475727 100644
 --- a/net/openvswitch/vport-internal_dev.c
 +++ b/net/openvswitch/vport-internal_dev.c
-@@ -113,12 +113,58 @@ internal_get_stats(struct net_device *de
+@@ -113,12 +113,58 @@ internal_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
  	}
  }
-
+ 
 +static int internal_dev_fill_forward_path(struct net_device_path_ctx *ctx, struct net_device_path *path)
 +{
 +	struct vport *vport;
@@ -59,5 +68,8 @@
  	.ndo_get_stats64 = internal_get_stats,
 +	.ndo_fill_forward_path	 = internal_dev_fill_forward_path,
  };
-
+ 
  static struct rtnl_link_ops internal_dev_link_ops __read_mostly = {
+-- 
+2.18.0
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3016-update-net-bridge-for-bridger.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-update-net-bridge-for-bridger.patch
old mode 100755
new mode 100644
similarity index 98%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3016-update-net-bridge-for-bridger.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-update-net-bridge-for-bridger.patch
index 6fe3733..b01d689
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3016-update-net-bridge-for-bridger.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-update-net-bridge-for-bridger.patch
@@ -1,3 +1,23 @@
+From 120baca4e8b019d03c8d1a29012cea911629247a Mon Sep 17 00:00:00 2001
+From: Bc-bocun Chen <bc-bocun.chen@mediatek.com>
+Date: Mon, 18 Sep 2023 11:13:51 +0800
+Subject: [PATCH 15/22] update-net-bridge-for-bridger
+
+---
+ include/net/switchdev.h        |   2 +
+ net/bridge/Makefile            |   2 +-
+ net/bridge/br_mdb.c            |  32 +-
+ net/bridge/br_netlink.c        |   6 +-
+ net/bridge/br_netlink_tunnel.c |   4 +-
+ net/bridge/br_private.h        | 293 +++++++++++++-
+ net/bridge/br_private_tunnel.h |   4 +
+ net/bridge/br_vlan.c           | 698 +++++++++++++++++++++++++++++++--
+ net/bridge/br_vlan_options.c   | 346 ++++++++++++++++
+ net/core/rtnetlink.c           |   1 +
+ net/dsa/slave.c                |  11 +
+ 11 files changed, 1365 insertions(+), 34 deletions(-)
+ create mode 100644 net/bridge/br_vlan_options.c
+
 diff --git a/include/net/switchdev.h b/include/net/switchdev.h
 index 191dc34..d4d71d9 100644
 --- a/include/net/switchdev.h
@@ -1786,10 +1806,10 @@
 +	return false;
 +}
 diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
-index dbc9b2f..706b207 100644
+index da1ef00..b896f71 100644
 --- a/net/core/rtnetlink.c
 +++ b/net/core/rtnetlink.c
-@@ -1996,6 +1996,7 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
+@@ -1998,6 +1998,7 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
  				goto cont;
  			if (idx < s_idx)
  				goto cont;
@@ -1821,3 +1841,6 @@
  out_phy:
  	rtnl_lock();
  	phylink_disconnect_phy(p->dp->pl);
+-- 
+2.18.0
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3017-ethernet-update-ppe-from-mt7986-to-mt7988.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3015-ethernet-update-ppe-from-netsys2-to-netsys3.patch
old mode 100755
new mode 100644
similarity index 93%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3017-ethernet-update-ppe-from-mt7986-to-mt7988.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3015-ethernet-update-ppe-from-netsys2-to-netsys3.patch
index 872a279..036f531
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3017-ethernet-update-ppe-from-mt7986-to-mt7988.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3015-ethernet-update-ppe-from-netsys2-to-netsys3.patch
@@ -1,7 +1,7 @@
-From 06c3b8d434290affb720808a38315a78e94c9923 Mon Sep 17 00:00:00 2001
-From: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
-Date: Sat, 26 Aug 2023 00:45:40 +0800
-Subject: [PATCH] 999-3017-ethernet-update-ppe-from-mt7986-to-mt7988
+From 6a91e5e7304b98d06b589de7f9f09cc34cb9c231 Mon Sep 17 00:00:00 2001
+From: Bc-bocun Chen <bc-bocun.chen@mediatek.com>
+Date: Mon, 18 Sep 2023 11:15:14 +0800
+Subject: [PATCH 16/22] ethernet-update-ppe-from-mt7986-to-mt7988
 
 ---
  drivers/net/ethernet/mediatek/mtk_eth_soc.c   | 14 ++++---
@@ -12,10 +12,10 @@
  5 files changed, 64 insertions(+), 21 deletions(-)
 
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-index a370547..239c25d 100644
+index 0f6613b..8bd526a 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -2272,17 +2272,17 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
+@@ -2286,17 +2286,17 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
  			skb_checksum_none_assert(skb);
  		skb->protocol = eth_type_trans(skb, netdev);
  
@@ -37,7 +37,7 @@
  		reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON_V2, trxd.rxd5);
  		if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED) {
  			for (i = 0; i < eth->ppe_num; i++) {
-@@ -5071,7 +5071,8 @@ static int mtk_probe(struct platform_device *pdev)
+@@ -5252,7 +5252,8 @@ static int mtk_probe(struct platform_device *pdev)
  
  		for (i = 0; i < eth->ppe_num; i++) {
  			eth->ppe[i] = mtk_ppe_init(eth,
@@ -47,7 +47,7 @@
  						   2, eth->soc->hash_way, i,
  						   eth->soc->has_accounting);
  			if (!eth->ppe[i]) {
-@@ -5338,6 +5339,9 @@ static const struct mtk_soc_data mt7988_data = {
+@@ -5512,6 +5513,9 @@ static const struct mtk_soc_data mt7988_data = {
  	.required_clks = MT7988_CLKS_BITMAP,
  	.required_pctl = false,
  	.has_sram = true,
@@ -58,7 +58,7 @@
  	.txrx = {
  		.txd_size = sizeof(struct mtk_tx_dma_v2),
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-index a7892e2..cd19c8d 100644
+index 7ea380e..23c5f49 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 @@ -130,9 +130,10 @@
@@ -73,7 +73,7 @@
  #else
  #define MTK_GDMA_TO_PPE0	0x4444
  #endif
-@@ -1939,13 +1940,15 @@ extern u32 dbg_show_level;
+@@ -1969,13 +1970,15 @@ extern u32 dbg_show_level;
  
  static inline void mtk_set_ib1_sp(struct mtk_eth *eth, struct mtk_foe_entry *foe, u32 val)
  {
@@ -92,7 +92,7 @@
  
  	return 0;
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
-index 0d4ae28..308d5a1 100755
+index 6d6c1e4..446acca 100755
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
 @@ -211,7 +211,7 @@ int mtk_foe_entry_prepare(struct mtk_foe_entry *entry, int type, int l4proto,
@@ -149,7 +149,7 @@
  	      MTK_PPE_TB_CFG_INFO_SEL |
  #endif
  	      FIELD_PREP(MTK_PPE_TB_CFG_SEARCH_MISS,
-@@ -992,7 +1000,7 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
+@@ -993,7 +1001,7 @@ int mtk_ppe_start(struct mtk_ppe *ppe)
  
  	ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT, 0);
  
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3018-mediatek-ethernet-add-wifi2wifi-offload-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3016-mediatek-ethernet-add-wifi2wifi-offload-support.patch
old mode 100755
new mode 100644
similarity index 86%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3018-mediatek-ethernet-add-wifi2wifi-offload-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3016-mediatek-ethernet-add-wifi2wifi-offload-support.patch
index c810ff1..121db94
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3018-mediatek-ethernet-add-wifi2wifi-offload-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3016-mediatek-ethernet-add-wifi2wifi-offload-support.patch
@@ -1,9 +1,8 @@
-From 4c8f0a38d9c2df3815ace32133bb63d8a4345856 Mon Sep 17 00:00:00 2001
+From d3183ad9ed0a8a35047a37f30d85f920a729897c Mon Sep 17 00:00:00 2001
 From: Sujuan Chen <sujuan.chen@mediatek.com>
-Date: Tue, 27 Dec 2022 10:14:35 +0800
-Subject: [PATCH] mediatek: ethernet: add wifi2wifi offload support
+Date: Mon, 18 Sep 2023 11:16:18 +0800
+Subject: [PATCH 17/22] mediatek-ethernet-add-wifi2wifi-offload-support
 
-Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
 ---
  drivers/net/ethernet/mediatek/mtk_eth_soc.h   |  2 ++
  .../net/ethernet/mediatek/mtk_ppe_offload.c   | 35 +++++++++++++------
@@ -13,25 +12,25 @@
  mode change 100755 => 100644 drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-index b935de6..acefa48 100644
+index 23c5f49..ee89b4c 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -1767,6 +1767,8 @@ void ethsys_reset(struct mtk_eth *eth, u32 reset_bits);
+@@ -2027,6 +2027,8 @@ void mtk_usxgmii_link_poll(struct work_struct *work);
  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);
 +int mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f,
 +			   struct mtk_eth *eth);
  void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev);
+ u32 mtk_rss_indr_table(struct mtk_rss_params *rss_params, int index);
  
- int mtk_ppe_debugfs_init(struct mtk_eth *eth);
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 old mode 100755
 new mode 100644
-index 2787a97..23d2048
+index f0c63da..c1cce76
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-@@ -546,10 +546,20 @@ static int
+@@ -563,10 +563,20 @@ static int
  mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv)
  {
  	struct flow_cls_offload *cls = type_data;
@@ -56,7 +55,7 @@
  
  	if (!tc_can_offload(dev))
  		return -EOPNOTSUPP;
-@@ -577,14 +587,19 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_pri
+@@ -594,16 +604,21 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_pri
  	return err;
  }
  
@@ -80,7 +79,9 @@
 +	}
 +
  	for (i = 0; i < eth->ppe_num; i++) {
-@@ -610,7 +625,7 @@ mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
+ 		if (!eth->ppe[i] || !eth->ppe[i]->foe_table)
+ 			return -EOPNOTSUPP;
+@@ -622,7 +637,7 @@ mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
  			flow_block_cb_incref(block_cb);
  			goto unlock;
  		}
@@ -89,7 +90,7 @@
  		if (IS_ERR(block_cb)) {
  			err = PTR_ERR(block_cb);
  			goto unlock;
-@@ -647,7 +662,7 @@ int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type,
+@@ -658,7 +673,7 @@ int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type,
  	switch (type) {
  	case TC_SETUP_BLOCK:
  	case TC_SETUP_FT:
@@ -99,10 +100,10 @@
  		return -EOPNOTSUPP;
  	}
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
-index 1a615f2..37a86c3 100644
+index ae31412..3e760f7 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
-@@ -1731,6 +1731,18 @@ out:
+@@ -1733,6 +1733,18 @@ void mtk_wed_flow_remove(int index)
  	mutex_unlock(&hw_lock);
  }
  
@@ -121,7 +122,7 @@
  void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
  			void __iomem *wdma, u32 wdma_phy, int index)
  
-@@ -1749,6 +1761,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1751,6 +1763,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
  		.irq_get = mtk_wed_irq_get,
  		.irq_set_mask = mtk_wed_irq_set_mask,
  		.detach = mtk_wed_detach,
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3019-flow-offload-add-mtkhnat-dscp.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3017-flow-offload-add-mtkhnat-dscp.patch
old mode 100755
new mode 100644
similarity index 94%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3019-flow-offload-add-mtkhnat-dscp.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3017-flow-offload-add-mtkhnat-dscp.patch
index a43261a..478a7a9
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3019-flow-offload-add-mtkhnat-dscp.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3017-flow-offload-add-mtkhnat-dscp.patch
@@ -1,7 +1,7 @@
-From 72dd3b798e3a08122e9a769d6f0197b0f357478e Mon Sep 17 00:00:00 2001
-From: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
-Date: Wed, 23 Aug 2023 14:03:52 +0800
-Subject: [PATCH] 999-3019-flow-offload-add-mtkhnat-dscp
+From 3e4d44d8da90b9ba20abc5cec255d92b67e3fb00 Mon Sep 17 00:00:00 2001
+From: Bc-bocun Chen <bc-bocun.chen@mediatek.com>
+Date: Mon, 18 Sep 2023 11:17:24 +0800
+Subject: [PATCH 18/22] flow-offload-add-mtkhnat-dscp
 
 ---
  drivers/net/ethernet/mediatek/mtk_ppe.c       | 11 +++++++
@@ -13,7 +13,7 @@
  6 files changed, 64 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
-index 4c17a4e..2860e99 100755
+index 446acca..384e811 100755
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
 @@ -435,6 +435,17 @@ int mtk_foe_entry_set_qid(struct mtk_foe_entry *entry, int qid)
@@ -35,7 +35,7 @@
  {
  	return !(entry->ib1 & MTK_FOE_IB1_STATIC) &&
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.h b/drivers/net/ethernet/mediatek/mtk_ppe.h
-index 4abed85..57251d3 100644
+index 5529d64..2a8b6ef 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.h
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
 @@ -430,6 +430,7 @@ int mtk_foe_entry_set_pppoe(struct mtk_foe_entry *entry, int sid);
@@ -44,10 +44,10 @@
  int mtk_foe_entry_set_qid(struct mtk_foe_entry *entry, int qid);
 +int mtk_foe_entry_set_dscp(struct mtk_foe_entry *entry, int dscp);
  bool mtk_foe_entry_match(struct mtk_foe_entry *entry, struct mtk_foe_entry *data);
+ int mtk_foe_entry_set_sp(struct mtk_ppe *ppe, struct mtk_foe_entry *entry);
  int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
- void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-index 989b412..f89875d 100644
+index c1cce76..95174b7 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 @@ -262,6 +262,7 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3020-flow-offload-add-mtkhnat-netlink.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3018-flow-offload-add-mtkhnat-netlink.patch
old mode 100755
new mode 100644
similarity index 91%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3020-flow-offload-add-mtkhnat-netlink.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3018-flow-offload-add-mtkhnat-netlink.patch
index 3b9e863..3bb7e7a
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3020-flow-offload-add-mtkhnat-netlink.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3018-flow-offload-add-mtkhnat-netlink.patch
@@ -1,8 +1,23 @@
+From 6bda18f107acbf04f01c18ad5964be6f7404d3cf Mon Sep 17 00:00:00 2001
+From: Bc-bocun Chen <bc-bocun.chen@mediatek.com>
+Date: Mon, 18 Sep 2023 13:14:08 +0800
+Subject: [PATCH 19/22] flow-offload-add-mtkhnat-netlink
+
+---
+ include/net/netfilter/nf_flow_table.h    |   1 +
+ include/uapi/linux/netfilter/nfnetlink.h |   3 +-
+ net/netfilter/Kconfig                    |   9 +
+ net/netfilter/Makefile                   |   1 +
+ net/netfilter/nf_flow_table_core.c       |  23 +++
+ net/netfilter/nf_flow_table_netlink.c    | 239 +++++++++++++++++++++++
+ 6 files changed, 275 insertions(+), 1 deletion(-)
+ create mode 100644 net/netfilter/nf_flow_table_netlink.c
+
 diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
-index 8a84de3..1a23c03 100644
+index 97a277d..3490d90 100644
 --- a/include/net/netfilter/nf_flow_table.h
 +++ b/include/net/netfilter/nf_flow_table.h
-@@ -276,6 +276,7 @@ int nf_flow_table_init(struct nf_flowtable *flow_table);
+@@ -277,6 +277,7 @@ int nf_flow_table_init(struct nf_flowtable *flow_table);
  void nf_flow_table_free(struct nf_flowtable *flow_table);
  
  void flow_offload_teardown(struct flow_offload *flow);
@@ -57,7 +72,7 @@
  # generic X tables
  obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o
 diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
-index 1036558..a0f52f6 100644
+index c3054af..fb06755 100644
 --- a/net/netfilter/nf_flow_table_core.c
 +++ b/net/netfilter/nf_flow_table_core.c
 @@ -373,6 +373,29 @@ void flow_offload_teardown(struct flow_offload *flow)
@@ -335,3 +350,6 @@
 +MODULE_LICENSE("GPL");
 +module_init(ftnetlink_init);
 +module_exit(ftnetlink_exit);
+-- 
+2.18.0
+
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 830294f..53b5f30 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986.cfg
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986.cfg
@@ -1,7 +1,7 @@
 CONFIG_64BIT=y
 CONFIG_AHCI_MTK=y
 CONFIG_AIROHA_EN8801SC_PHY=y
-CONFIG_AIROHA_EN8811H_PHY=y
+# CONFIG_AIROHA_EN8811H_PHY is not set
 CONFIG_ARCH_CLOCKSOURCE_DATA=y
 CONFIG_ARCH_DMA_ADDR_T_64BIT=y
 CONFIG_ARCH_KEEP_MEMBLOCK=y
@@ -449,6 +449,7 @@
 CONFIG_RESET_CONTROLLER=y
 CONFIG_RESET_TI_SYSCON=y
 CONFIG_RFS_ACCEL=y
+# CONFIG_RICHTEK_RTQ6056 is not set
 CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
 CONFIG_RPS=y
 CONFIG_RTC_CLASS=y
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/nf_hnat/999-4100-mtk-tunnel-offload-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/nf_hnat/999-4100-mtk-tunnel-offload-support.patch
index 57a1dde..299c7b4 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/nf_hnat/999-4100-mtk-tunnel-offload-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/nf_hnat/999-4100-mtk-tunnel-offload-support.patch
@@ -1,497 +1,489 @@
---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -245,6 +245,9 @@ static const char * const mtk_clks_sourc
- 	"top_netsys_warp_sel",
- };
- 
-+struct net_device *(*mtk_get_tnl_dev)(int tnl_idx) = NULL;
-+EXPORT_SYMBOL(mtk_get_tnl_dev);
-+
- void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg)
- {
- 	__raw_writel(val, eth->base + reg);
-@@ -2171,6 +2174,7 @@ static int mtk_poll_rx(struct napi_struc
- 	u64 addr64 = 0;
- 	u8 *data, *new_data;
- 	struct mtk_rx_dma_v2 *rxd, trxd;
-+	int tnl_idx = 0;
- 	int done = 0;
- 
- 	if (unlikely(!ring))
-@@ -2214,11 +2218,20 @@ static int mtk_poll_rx(struct napi_struc
- 				      0 : RX_DMA_GET_SPORT(trxd.rxd4) - 1;
- 		}
- 
--		if (unlikely(mac < 0 || mac >= MTK_MAC_COUNT ||
--			     !eth->netdev[mac]))
--			goto release_desc;
-+		tnl_idx = RX_DMA_GET_TOPS_CRSN(trxd.rxd6);
-+		if (mtk_get_tnl_dev && tnl_idx) {
-+			netdev = mtk_get_tnl_dev(tnl_idx);
-+			if (unlikely(IS_ERR(netdev)))
-+				netdev = NULL;
-+		}
- 
--		netdev = eth->netdev[mac];
-+		if (!netdev) {
-+			if (unlikely(mac < 0 || mac >= MTK_MAC_COUNT ||
-+				     !eth->netdev[mac]))
-+				goto release_desc;
-+
-+			netdev = eth->netdev[mac];
-+		}
- 
- 		if (unlikely(test_bit(MTK_RESETTING, &eth->state)))
- 			goto release_desc;
-@@ -2303,6 +2316,8 @@ static int mtk_poll_rx(struct napi_struc
- 		skb_hnat_alg(skb) = 0;
- 		skb_hnat_filled(skb) = 0;
- 		skb_hnat_magic_tag(skb) = HNAT_MAGIC_TAG;
-+		skb_hnat_set_tops(skb, 0);
-+		skb_hnat_set_is_decap(skb, 0);
- 
- 		if (skb_hnat_reason(skb) == HIT_BIND_FORCE_TO_CPU) {
- 			trace_printk("[%s] reason=0x%x(force to CPU) from WAN to Ext\n",
---- a/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
-+++ b/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
-@@ -43,6 +43,12 @@ void (*ppe_dev_register_hook)(struct net
- EXPORT_SYMBOL(ppe_dev_register_hook);
- void (*ppe_dev_unregister_hook)(struct net_device *dev) = NULL;
- EXPORT_SYMBOL(ppe_dev_unregister_hook);
-+int (*mtk_tnl_encap_offload)(struct sk_buff *skb) = NULL;
-+EXPORT_SYMBOL(mtk_tnl_encap_offload);
-+int (*mtk_tnl_decap_offload)(struct sk_buff *skb) = NULL;
-+EXPORT_SYMBOL(mtk_tnl_decap_offload);
-+bool (*mtk_tnl_decap_offloadable)(struct sk_buff *skb) = NULL;
-+EXPORT_SYMBOL(mtk_tnl_decap_offloadable);
- 
- static void hnat_sma_build_entry(struct timer_list *t)
- {
-@@ -53,6 +59,16 @@ static void hnat_sma_build_entry(struct
- 			     SMA, SMA_FWD_CPU_BUILD_ENTRY);
- }
- 
-+struct foe_entry *hnat_get_foe_entry(u32 ppe_id, u32 index)
-+{
-+	if (index == 0x7fff || index >= hnat_priv->foe_etry_num
-+	    || ppe_id >= CFG_PPE_NUM)
-+		return ERR_PTR(-EINVAL);
-+
-+	return &hnat_priv->foe_table_cpu[ppe_id][index];
-+}
-+EXPORT_SYMBOL(hnat_get_foe_entry);
-+
- void hnat_cache_ebl(int enable)
- {
- 	int i;
-@@ -63,6 +79,7 @@ void hnat_cache_ebl(int enable)
- 		cr_set_field(hnat_priv->ppe_base[i] + PPE_CAH_CTRL, CAH_EN, enable);
- 	}
- }
-+EXPORT_SYMBOL(hnat_cache_ebl);
- 
- static void hnat_reset_timestamp(struct timer_list *t)
- {
---- a/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
-+++ b/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
-@@ -1087,6 +1087,8 @@ enum FoeIpAct {
- #define NR_WDMA1_PORT 9
- #define NR_WDMA2_PORT 13
- #define NR_GMAC3_PORT 15
-+#define NR_TDMA_TPORT 4
-+#define NR_TDMA_QDMA_TPORT 5
- #define LAN_DEV_NAME hnat_priv->lan
- #define LAN2_DEV_NAME hnat_priv->lan2
- #define IS_WAN(dev)                                                            \
-@@ -1210,6 +1212,8 @@ static inline bool hnat_dsa_is_enable(st
- }
- #endif
- 
-+struct foe_entry *hnat_get_foe_entry(u32 ppe_id, u32 index);
-+
- void hnat_deinit_debugfs(struct mtk_hnat *h);
- int hnat_init_debugfs(struct mtk_hnat *h);
- int hnat_register_nf_hooks(void);
-@@ -1226,6 +1230,9 @@ extern int qos_ul_toggle;
- extern int hook_toggle;
- extern int mape_toggle;
- extern int qos_toggle;
-+extern int (*mtk_tnl_encap_offload)(struct sk_buff *skb);
-+extern int (*mtk_tnl_decap_offload)(struct sk_buff *skb);
-+extern bool (*mtk_tnl_decap_offloadable)(struct sk_buff *skb);
- 
- int ext_if_add(struct extdev_entry *ext_entry);
- int ext_if_del(struct extdev_entry *ext_entry);
---- a/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
-+++ b/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
-@@ -726,10 +726,14 @@ static unsigned int is_ppe_support_type(
- 	case ETH_P_IP:
- 		iph = ip_hdr(skb);
- 
--		/* do not accelerate non tcp/udp traffic */
--		if ((iph->protocol == IPPROTO_TCP) ||
-+		if (mtk_tnl_decap_offloadable && mtk_tnl_decap_offloadable(skb)) {
-+			/* tunnel protocol is offloadable */
-+			skb_hnat_set_is_decap(skb, 1);
-+			return 1;
-+		} else if ((iph->protocol == IPPROTO_TCP) ||
- 		    (iph->protocol == IPPROTO_UDP) ||
- 		    (iph->protocol == IPPROTO_IPV6)) {
-+			/* do not accelerate non tcp/udp traffic */
- 			return 1;
- 		}
- 
-@@ -846,6 +850,13 @@ mtk_hnat_ipv4_nf_pre_routing(void *priv,
- 
- 	hnat_set_head_frags(state, skb, -1, hnat_set_iif);
- 
-+	if (skb_hnat_tops(skb) && skb_hnat_is_decap(skb)
-+	    && is_magic_tag_valid(skb)
-+	    && skb_hnat_iface(skb) == FOE_MAGIC_GE_VIRTUAL
-+	    && mtk_tnl_decap_offload && mtk_tnl_decap_offload(skb)) {
-+		return NF_ACCEPT;
-+	}
-+
- 	/*
- 	 * Avoid mistakenly binding of outer IP, ports in SW L2TP decap flow.
- 	 * In pre-routing, if dev is virtual iface, TOPS module is not loaded,
-@@ -922,6 +933,13 @@ mtk_hnat_br_nf_local_in(void *priv, stru
- 
- 	hnat_set_head_frags(state, skb, -1, hnat_set_iif);
- 
-+	if (skb_hnat_tops(skb) && skb_hnat_is_decap(skb)
-+	    && is_magic_tag_valid(skb)
-+	    && skb_hnat_iface(skb) == FOE_MAGIC_GE_VIRTUAL
-+	    && mtk_tnl_decap_offload && mtk_tnl_decap_offload(skb)) {
-+		return NF_ACCEPT;
-+	}
-+
- 	pre_routing_print(skb, state->in, state->out, __func__);
- 
- 	if (unlikely(debug_level >= 7)) {
-@@ -1074,9 +1092,22 @@ static unsigned int hnat_ipv4_get_nextho
- 		return -1;
- 	}
- 
-+	/*
-+	 * if this packet is a tunnel packet and is about to construct
-+	 * outer header, we must update its outer mac header pointer
-+	 * before filling outer mac or it may screw up inner mac
-+	 */
-+	if (skb_hnat_tops(skb) && skb_hnat_is_encap(skb)) {
-+		skb_push(skb, sizeof(struct ethhdr));
-+		skb_reset_mac_header(skb);
-+	}
-+
- 	memcpy(eth_hdr(skb)->h_dest, neigh->ha, ETH_ALEN);
- 	memcpy(eth_hdr(skb)->h_source, out->dev_addr, ETH_ALEN);
- 
-+	if (skb_hnat_tops(skb) && skb_hnat_is_encap(skb))
-+		skb_pull(skb, sizeof(struct ethhdr));
-+
- 	rcu_read_unlock_bh();
- 
- 	return 0;
-@@ -1202,6 +1233,81 @@ static struct ethhdr *get_ipv6_ipip_ethh
- 	return eth;
- }
- 
-+static inline void hnat_get_filled_unbind_entry(struct sk_buff *skb,
-+						struct foe_entry *entry)
-+{
-+	if (unlikely(!skb || !entry))
-+		return;
-+
-+	memcpy(entry,
-+	       &hnat_priv->foe_table_cpu[skb_hnat_ppe(skb)][skb_hnat_entry(skb)],
-+	       sizeof(*entry));
-+
-+#if defined(CONFIG_MEDIATEK_NETSYS_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3)
-+	entry->bfib1.mc = 0;
-+#endif /* defined(CONFIG_MEDIATEK_NETSYS_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3) */
-+	entry->bfib1.ka = 0;
-+	entry->bfib1.vlan_layer = 0;
-+	entry->bfib1.psn = 0;
-+	entry->bfib1.vpm = 0;
-+	entry->bfib1.ps = 0;
-+}
-+
-+static inline void hnat_qos_tnl(u32 id, const struct net_device *dev)
-+{
-+	u32 cfg;
-+	u32 max_man = 0;
-+	u32 max_exp = 0;
-+	const struct mtk_mac *mac;
-+
-+	if (!dev)
-+		return;
-+	mac = netdev_priv(dev);
-+
-+	switch (mac->speed) {
-+	case SPEED_100:
-+	case SPEED_1000:
-+	case SPEED_2500:
-+	case SPEED_5000:
-+	case SPEED_10000:
-+		max_man = mac->speed / SPEED_100;
-+		max_exp = 5;
-+		break;
-+	default:
-+		return;
-+	}
-+
-+	cfg = QTX_SCH_MIN_RATE_EN | QTX_SCH_MAX_RATE_EN;
-+	cfg |= (1 << QTX_SCH_MIN_RATE_MAN_OFFSET) |
-+	       (4 << QTX_SCH_MIN_RATE_EXP_OFFSET) |
-+	       (max_man << QTX_SCH_MAX_RATE_MAN_OFFSET) |
-+	       (max_exp << QTX_SCH_MAX_RATE_EXP_OFFSET) |
-+	       (4 << QTX_SCH_MAX_RATE_WGHT_OFFSET);
-+	writel(cfg, hnat_priv->fe_base + QTX_SCH(id % NUM_OF_Q_PER_PAGE));
-+}
-+
-+static inline void hnat_fill_offload_engine_entry(struct sk_buff *skb,
-+						  struct foe_entry *entry,
-+						  const struct net_device *dev)
-+{
-+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
-+	if (skb_hnat_tops(skb) && skb_hnat_is_encap(skb)) {
-+		/*
-+		 * if skb_hnat_tops(skb) is setup for encapsulation,
-+		 * we fill in hnat tport and tops_entry for tunnel encapsulation
-+		 * offloading
-+		 */
-+		entry->ipv4_hnapt.tport_id = NR_TDMA_QDMA_TPORT;
-+		entry->ipv4_hnapt.tops_entry = skb_hnat_tops(skb);
-+	} else {
-+		return;
-+	}
-+
-+	entry->ipv4_hnapt.iblk2.qid = 12; /* offload engine use QID 12 */
-+	hnat_qos_tnl(12, dev); /* set rate limit to line rate */
-+#endif /* defined(CONFIG_MEDIATEK_NETSYS_V3) */
-+}
-+
- static unsigned int skb_to_hnat_info(struct sk_buff *skb,
- 				     const struct net_device *dev,
- 				     struct foe_entry *foe,
-@@ -1238,6 +1344,11 @@ static unsigned int skb_to_hnat_info(str
- 	if (whnat && is_hnat_pre_filled(foe))
- 		return 0;
- 
-+	if (skb_hnat_tops(skb) && !(hw_path->flags & FLOW_OFFLOAD_PATH_TNL)) {
-+		hnat_get_filled_unbind_entry(skb, &entry);
-+		goto hnat_entry_bind;
-+	}
-+
- 	entry.bfib1.pkt_type = foe->udib1.pkt_type; /* Get packte type state*/
- 	entry.bfib1.state = foe->udib1.state;
- 
-@@ -1633,6 +1744,10 @@ static unsigned int skb_to_hnat_info(str
- 	/* Fill Layer2 Info.*/
- 	entry = ppe_fill_L2_info(eth, entry, hw_path);
- 
-+	if (skb_hnat_tops(skb) && hw_path->flags & FLOW_OFFLOAD_PATH_TNL)
-+		goto hnat_entry_skip_bind;
-+
-+hnat_entry_bind:
- 	/* Fill Info Blk*/
- 	entry = ppe_fill_info_blk(eth, entry, hw_path);
- 
-@@ -1833,7 +1948,20 @@ static unsigned int skb_to_hnat_info(str
- 			entry.ipv6_5t_route.act_dp |= UDF_HNAT_PRE_FILLED;
- 	}
- 
-+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
-+	hnat_fill_offload_engine_entry(skb, &entry, dev);
-+#endif
-+
-+hnat_entry_skip_bind:
- 	wmb();
-+
-+	/*
-+	 * final check before we write BIND info.
-+	 * If this entry is already bound, we should not modify it right now
-+	 */
-+	if (entry_hnat_is_bound(foe))
-+		return 0;
-+
- 	memcpy(foe, &entry, sizeof(entry));
- 	/*reset statistic for this entry*/
- 	if (hnat_priv->data->per_flow_accounting &&
-@@ -1886,6 +2014,7 @@ int mtk_sw_nat_hook_tx(struct sk_buff *s
- 		return NF_ACCEPT;
- 
- 	eth = eth_hdr(skb);
-+
- 	memcpy(&bfib1_tx, &entry->bfib1, sizeof(entry->bfib1));
- 
- 	/*not bind multicast if PPE mcast not enable*/
-@@ -1905,6 +2034,12 @@ int mtk_sw_nat_hook_tx(struct sk_buff *s
- 	switch ((int)bfib1_tx.pkt_type) {
- 	case IPV4_HNAPT:
- 	case IPV4_HNAT:
-+		/*
-+		 * skip if packet is an encap tnl packet or it may
-+		 * screw up inner mac header
-+		 */
-+		if (skb_hnat_tops(skb) && skb_hnat_is_encap(skb))
-+			break;
- 		entry->ipv4_hnapt.smac_hi = swab32(*((u32 *)eth->h_source));
- 		entry->ipv4_hnapt.smac_lo = swab16(*((u16 *)&eth->h_source[4]));
- 		break;
-@@ -2066,6 +2201,10 @@ int mtk_sw_nat_hook_tx(struct sk_buff *s
- 		entry->ipv6_5t_route.iblk2.dp = gmac_no;
- 	}
- 
-+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
-+	hnat_fill_offload_engine_entry(skb, entry, NULL);
-+#endif
-+
- 	bfib1_tx.ttl = 1;
- 	bfib1_tx.state = BIND;
- 	wmb();
-@@ -2087,6 +2226,7 @@ int mtk_sw_nat_hook_rx(struct sk_buff *s
- 	}
- 
- 	skb_hnat_alg(skb) = 0;
-+	skb_hnat_set_tops(skb, 0);
- 	skb_hnat_magic_tag(skb) = HNAT_MAGIC_TAG;
- 
- 	if (skb_hnat_iface(skb) == FOE_MAGIC_WED0)
-@@ -2535,6 +2675,7 @@ static unsigned int mtk_hnat_nf_post_rou
- 	struct flow_offload_hw_path hw_path = { .dev = (struct net_device*)out,
- 						.virt_dev = (struct net_device*)out };
- 	const struct net_device *arp_dev = out;
-+	bool is_virt_dev = false;
- 
- 	if (xlat_toggle && !mtk_464xlat_post_process(skb, out))
- 		return 0;
-@@ -2551,10 +2692,29 @@ static unsigned int mtk_hnat_nf_post_rou
- 
- 	if (out->netdev_ops->ndo_flow_offload_check) {
- 		out->netdev_ops->ndo_flow_offload_check(&hw_path);
-+
- 		out = (IS_GMAC1_MODE) ? hw_path.virt_dev : hw_path.dev;
-+		if (hw_path.flags & FLOW_OFFLOAD_PATH_TNL && mtk_tnl_encap_offload) {
-+			if (ntohs(skb->protocol) == ETH_P_IP
-+			    && ip_hdr(skb)->protocol == IPPROTO_TCP) {
-+				skb_hnat_set_tops(skb, hw_path.tnl_type + 1);
-+			} else {
-+				/*
-+				 * we are not support protocols other than IPv4 TCP
-+				 * for tunnel protocol offload yet
-+				 */
-+				skb_hnat_alg(skb) = 1;
-+				return 0;
-+			}
-+		}
- 	}
- 
- 	if (!IS_LAN_GRP(out) && !IS_WAN(out) && !IS_EXT(out))
-+		is_virt_dev = true;
-+
-+	if (is_virt_dev
-+	    && !(skb_hnat_tops(skb) && skb_hnat_is_encap(skb)
-+		 && (hw_path.flags & FLOW_OFFLOAD_PATH_TNL)))
- 		return 0;
- 
- 	trace_printk("[%s] case hit, %x-->%s, reason=%x\n", __func__,
-@@ -2574,9 +2734,18 @@ static unsigned int mtk_hnat_nf_post_rou
- 		if (fn && !mtk_hnat_accel_type(skb))
- 			break;
- 
--		if (fn && fn(skb, arp_dev, &hw_path))
-+		if (!is_virt_dev && fn && fn(skb, arp_dev, &hw_path))
- 			break;
- 
-+		/* skb_hnat_tops(skb) is updated in mtk_tnl_offload() */
-+		if (skb_hnat_tops(skb)) {
-+			if (skb_hnat_is_encap(skb) && !is_virt_dev
-+			    && mtk_tnl_encap_offload && mtk_tnl_encap_offload(skb))
-+				break;
-+			if (skb_hnat_is_decap(skb))
-+				break;
-+		}
-+
- 		skb_to_hnat_info(skb, out, entry, &hw_path);
- 		break;
- 	case HIT_BIND_KEEPALIVE_DUP_OLD_HDR:
-@@ -2847,7 +3016,7 @@ mtk_hnat_ipv4_nf_local_out(void *priv, s
- 	if (iph->protocol == IPPROTO_IPV6) {
- 		entry->udib1.pkt_type = IPV6_6RD;
- 		hnat_set_head_frags(state, skb, 0, hnat_set_alg);
--	} else {
-+	} else if (!skb_hnat_tops(skb)) {
- 		hnat_set_head_frags(state, skb, 1, hnat_set_alg);
- 	}
- 
---- a/drivers/net/ethernet/mediatek/mtk_hnat/nf_hnat_mtk.h
-+++ b/drivers/net/ethernet/mediatek/mtk_hnat/nf_hnat_mtk.h
-@@ -44,7 +44,9 @@ struct hnat_desc {
- 	u32 is_sp : 1;
- 	u32 hf : 1;
- 	u32 amsdu : 1;
--	u32 resv3 : 19;
-+	u32 tops : 6;
-+	u32 is_decap : 1;
-+	u32 resv3 : 12;
- 	u32 magic_tag_protect : 16;
- } __packed;
- #elif defined(CONFIG_MEDIATEK_NETSYS_RX_V2)
-@@ -91,6 +93,19 @@ struct hnat_desc {
- 	((((skb_headroom(skb) >= FOE_INFO_LEN) ? 1 : 0)))
- 
- #define skb_hnat_info(skb) ((struct hnat_desc *)(skb->head))
-+#if defined(CONFIG_MEDIATEK_NETSYS_V3)
-+#define skb_hnat_tops(skb) (((struct hnat_desc *)((skb)->head))->tops)
-+#define skb_hnat_is_decap(skb) (((struct hnat_desc *)((skb)->head))->is_decap)
-+#define skb_hnat_is_encap(skb) (!skb_hnat_is_decap(skb))
-+#define skb_hnat_set_tops(skb, tops) ((skb_hnat_tops(skb)) = (tops))
-+#define skb_hnat_set_is_decap(skb, is_decap) ((skb_hnat_is_decap(skb)) = (is_decap))
-+#else /* !defined(CONFIG_MEDIATEK_NETSYS_V3) */
-+#define skb_hnat_tops(skb) (0)
-+#define skb_hnat_is_decap(skb) (0)
-+#define skb_hnat_is_encap(skb) (0)
-+#define skb_hnat_set_tops(skb, tops)
-+#define skb_hnat_set_is_decap(skb, is_decap)
-+#endif /* defined(CONFIG_MEDIATEK_NETSYS_V3) */
- #define skb_hnat_magic(skb) (((struct hnat_desc *)(skb->head))->magic)
- #define skb_hnat_reason(skb) (((struct hnat_desc *)(skb->head))->crsn)
- #define skb_hnat_entry(skb) (((struct hnat_desc *)(skb->head))->entry)
---- a/include/net/netfilter/nf_flow_table.h
-+++ b/include/net/netfilter/nf_flow_table.h
-@@ -98,10 +98,22 @@ struct flow_offload {
- #define FLOW_OFFLOAD_PATH_6RD		BIT(5)
- #define FLOW_OFFLOAD_PATH_TNL		BIT(6)
- 
-+enum flow_offload_tnl {
-+	FLOW_OFFLOAD_TNL_GRETAP,
-+	FLOW_OFFLOAD_TNL_PPTP,
-+	FLOW_OFFLOAD_TNL_IP_L2TP,
-+	FLOW_OFFLOAD_TNL_UDP_L2TP_CTRL,
-+	FLOW_OFFLOAD_TNL_UDP_L2TP_DATA,
-+	FLOW_OFFLOAD_VXLAN,
-+	FLOW_OFFLOAD_NATT,
-+	__FLOW_OFFLOAD_MAX,
-+};
-+
- struct flow_offload_hw_path {
- 	struct net_device *dev;
- 	struct net_device *virt_dev;
- 	u32 flags;
-+	u32 tnl_type;
- 
- 	u8 eth_src[ETH_ALEN];
- 	u8 eth_dest[ETH_ALEN];
---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -1874,6 +1874,9 @@ extern const struct of_device_id of_mtk_
- extern u32 mtk_hwlro_stats_ebl;
- extern u32 dbg_show_level;
- 
-+/* tunnel offload related */
-+extern struct net_device *(*mtk_get_tnl_dev)(int tnl_idx);
-+
- /* read the hardware status register */
- void mtk_stats_update_mac(struct mtk_mac *mac);
- 
+--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c

++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c

+@@ -245,6 +245,9 @@ static const char * const mtk_clks_source_name[] = {

+ 	"top_netsys_warp_sel",

+ };

+ 

++struct net_device *(*mtk_get_tnl_dev)(int tnl_idx) = NULL;

++EXPORT_SYMBOL(mtk_get_tnl_dev);

++

+ void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg)

+ {

+ 	__raw_writel(val, eth->base + reg);

+@@ -2186,6 +2189,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,

+ 	u64 addr64 = 0;

+ 	u8 *data, *new_data;

+ 	struct mtk_rx_dma_v2 *rxd, trxd;

++	int tnl_idx = 0;

+ 	int done = 0;

+ 

+ 	if (unlikely(!ring))

+@@ -2229,11 +2233,20 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,

+ 				      0 : RX_DMA_GET_SPORT(trxd.rxd4) - 1;

+ 		}

+ 

+-		if (unlikely(mac < 0 || mac >= MTK_MAC_COUNT ||

+-			     !eth->netdev[mac]))

+-			goto release_desc;

++		tnl_idx = RX_DMA_GET_TOPS_CRSN(trxd.rxd6);

++		if (mtk_get_tnl_dev && tnl_idx) {

++			netdev = mtk_get_tnl_dev(tnl_idx);

++			if (unlikely(IS_ERR(netdev)))

++				netdev = NULL;

++		}

+ 

+-		netdev = eth->netdev[mac];

++		if (!netdev) {

++			if (unlikely(mac < 0 || mac >= MTK_MAC_COUNT ||

++				     !eth->netdev[mac]))

++				goto release_desc;

++

++			netdev = eth->netdev[mac];

++		}

+ 

+ 		if (unlikely(test_bit(MTK_RESETTING, &eth->state)))

+ 			goto release_desc;

+@@ -2318,6 +2331,8 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,

+ 		skb_hnat_alg(skb) = 0;

+ 		skb_hnat_filled(skb) = 0;

+ 		skb_hnat_magic_tag(skb) = HNAT_MAGIC_TAG;

++		skb_hnat_set_tops(skb, 0);

++		skb_hnat_set_is_decap(skb, 0);

+ 

+ 		if (skb_hnat_reason(skb) == HIT_BIND_FORCE_TO_CPU) {

+ 			trace_printk("[%s] reason=0x%x(force to CPU) from WAN to Ext\n",

+--- a/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c

++++ b/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c

+@@ -43,6 +43,12 @@ void (*ppe_dev_register_hook)(struct net_device *dev) = NULL;

+ EXPORT_SYMBOL(ppe_dev_register_hook);

+ void (*ppe_dev_unregister_hook)(struct net_device *dev) = NULL;

+ EXPORT_SYMBOL(ppe_dev_unregister_hook);

++int (*mtk_tnl_encap_offload)(struct sk_buff *skb) = NULL;

++EXPORT_SYMBOL(mtk_tnl_encap_offload);

++int (*mtk_tnl_decap_offload)(struct sk_buff *skb) = NULL;

++EXPORT_SYMBOL(mtk_tnl_decap_offload);

++bool (*mtk_tnl_decap_offloadable)(struct sk_buff *skb) = NULL;

++EXPORT_SYMBOL(mtk_tnl_decap_offloadable);

+ 

+ static void hnat_sma_build_entry(struct timer_list *t)

+ {

+@@ -53,6 +59,16 @@ static void hnat_sma_build_entry(struct timer_list *t)

+ 			     SMA, SMA_FWD_CPU_BUILD_ENTRY);

+ }

+ 

++struct foe_entry *hnat_get_foe_entry(u32 ppe_id, u32 index)

++{

++	if (index == 0x7fff || index >= hnat_priv->foe_etry_num

++	    || ppe_id >= CFG_PPE_NUM)

++		return ERR_PTR(-EINVAL);

++

++	return &hnat_priv->foe_table_cpu[ppe_id][index];

++}

++EXPORT_SYMBOL(hnat_get_foe_entry);

++

+ void hnat_cache_ebl(int enable)

+ {

+ 	int i;

+@@ -63,6 +79,7 @@ void hnat_cache_ebl(int enable)

+ 		cr_set_field(hnat_priv->ppe_base[i] + PPE_CAH_CTRL, CAH_EN, enable);

+ 	}

+ }

++EXPORT_SYMBOL(hnat_cache_ebl);

+ 

+ static void hnat_reset_timestamp(struct timer_list *t)

+ {

+--- a/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h

++++ b/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h

+@@ -1133,6 +1133,8 @@ enum FoeIpAct {

+ #define NR_WDMA1_PORT 9

+ #define NR_WDMA2_PORT 13

+ #define NR_GMAC3_PORT 15

++#define NR_TDMA_TPORT 4

++#define NR_TDMA_QDMA_TPORT 5

+ #define LAN_DEV_NAME hnat_priv->lan

+ #define LAN2_DEV_NAME hnat_priv->lan2

+ #define IS_WAN(dev)                                                            \

+@@ -1256,6 +1258,8 @@ static inline bool hnat_dsa_is_enable(struct mtk_hnat *priv)

+ }

+ #endif

+ 

++struct foe_entry *hnat_get_foe_entry(u32 ppe_id, u32 index);

++

+ void hnat_deinit_debugfs(struct mtk_hnat *h);

+ int hnat_init_debugfs(struct mtk_hnat *h);

+ int hnat_register_nf_hooks(void);

+@@ -1272,6 +1276,9 @@ extern int qos_ul_toggle;

+ extern int hook_toggle;

+ extern int mape_toggle;

+ extern int qos_toggle;

++extern int (*mtk_tnl_encap_offload)(struct sk_buff *skb);

++extern int (*mtk_tnl_decap_offload)(struct sk_buff *skb);

++extern bool (*mtk_tnl_decap_offloadable)(struct sk_buff *skb);

+ 

+ int ext_if_add(struct extdev_entry *ext_entry);

+ int ext_if_del(struct extdev_entry *ext_entry);

+--- a/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c

++++ b/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c

+@@ -726,10 +726,14 @@ static unsigned int is_ppe_support_type(struct sk_buff *skb)

+ 	case ETH_P_IP:

+ 		iph = ip_hdr(skb);

+ 

+-		/* do not accelerate non tcp/udp traffic */

+-		if ((iph->protocol == IPPROTO_TCP) ||

++		if (mtk_tnl_decap_offloadable && mtk_tnl_decap_offloadable(skb)) {

++			/* tunnel protocol is offloadable */

++			skb_hnat_set_is_decap(skb, 1);

++			return 1;

++		} else if ((iph->protocol == IPPROTO_TCP) ||

+ 		    (iph->protocol == IPPROTO_UDP) ||

+ 		    (iph->protocol == IPPROTO_IPV6)) {

++			/* do not accelerate non tcp/udp traffic */

+ 			return 1;

+ 		}

+ 

+@@ -846,6 +850,13 @@ mtk_hnat_ipv4_nf_pre_routing(void *priv, struct sk_buff *skb,

+ 

+ 	hnat_set_head_frags(state, skb, -1, hnat_set_iif);

+ 

++	if (skb_hnat_tops(skb) && skb_hnat_is_decap(skb)

++	    && is_magic_tag_valid(skb)

++	    && skb_hnat_iface(skb) == FOE_MAGIC_GE_VIRTUAL

++	    && mtk_tnl_decap_offload && mtk_tnl_decap_offload(skb)) {

++		return NF_ACCEPT;

++	}

++

+ 	/*

+ 	 * Avoid mistakenly binding of outer IP, ports in SW L2TP decap flow.

+ 	 * In pre-routing, if dev is virtual iface, TOPS module is not loaded,

+@@ -921,6 +932,13 @@ mtk_hnat_br_nf_local_in(void *priv, struct sk_buff *skb,

+ 

+ 	hnat_set_head_frags(state, skb, -1, hnat_set_iif);

+ 

++	if (skb_hnat_tops(skb) && skb_hnat_is_decap(skb)

++	    && is_magic_tag_valid(skb)

++	    && skb_hnat_iface(skb) == FOE_MAGIC_GE_VIRTUAL

++	    && mtk_tnl_decap_offload && mtk_tnl_decap_offload(skb)) {

++		return NF_ACCEPT;

++	}

++

+ 	pre_routing_print(skb, state->in, state->out, __func__);

+ 

+ 	if (unlikely(debug_level >= 7)) {

+@@ -1073,9 +1091,22 @@ static unsigned int hnat_ipv4_get_nexthop(struct sk_buff *skb,

+ 		return -1;

+ 	}

+ 

++	/*

++	 * if this packet is a tunnel packet and is about to construct

++	 * outer header, we must update its outer mac header pointer

++	 * before filling outer mac or it may screw up inner mac

++	 */

++	if (skb_hnat_tops(skb) && skb_hnat_is_encap(skb)) {

++		skb_push(skb, sizeof(struct ethhdr));

++		skb_reset_mac_header(skb);

++	}

++

+ 	memcpy(eth_hdr(skb)->h_dest, neigh->ha, ETH_ALEN);

+ 	memcpy(eth_hdr(skb)->h_source, out->dev_addr, ETH_ALEN);

+ 

++	if (skb_hnat_tops(skb) && skb_hnat_is_encap(skb))

++		skb_pull(skb, sizeof(struct ethhdr));

++

+ 	rcu_read_unlock_bh();

+ 

+ 	return 0;

+@@ -1201,6 +1232,81 @@ static struct ethhdr *get_ipv6_ipip_ethhdr(struct sk_buff *skb,

+ 	return eth;

+ }

+ 

++static inline void hnat_get_filled_unbind_entry(struct sk_buff *skb,

++						struct foe_entry *entry)

++{

++	if (unlikely(!skb || !entry))

++		return;

++

++	memcpy(entry,

++	       &hnat_priv->foe_table_cpu[skb_hnat_ppe(skb)][skb_hnat_entry(skb)],

++	       sizeof(*entry));

++

++#if defined(CONFIG_MEDIATEK_NETSYS_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3)

++	entry->bfib1.mc = 0;

++#endif /* defined(CONFIG_MEDIATEK_NETSYS_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3) */

++	entry->bfib1.ka = 0;

++	entry->bfib1.vlan_layer = 0;

++	entry->bfib1.psn = 0;

++	entry->bfib1.vpm = 0;

++	entry->bfib1.ps = 0;

++}

++

++static inline void hnat_qos_tnl(u32 id, const struct net_device *dev)

++{

++	u32 cfg;

++	u32 max_man = 0;

++	u32 max_exp = 0;

++	const struct mtk_mac *mac;

++

++	if (!dev)

++		return;

++	mac = netdev_priv(dev);

++

++	switch (mac->speed) {

++	case SPEED_100:

++	case SPEED_1000:

++	case SPEED_2500:

++	case SPEED_5000:

++	case SPEED_10000:

++		max_man = mac->speed / SPEED_100;

++		max_exp = 5;

++		break;

++	default:

++		return;

++	}

++

++	cfg = QTX_SCH_MIN_RATE_EN | QTX_SCH_MAX_RATE_EN;

++	cfg |= (1 << QTX_SCH_MIN_RATE_MAN_OFFSET) |

++	       (4 << QTX_SCH_MIN_RATE_EXP_OFFSET) |

++	       (max_man << QTX_SCH_MAX_RATE_MAN_OFFSET) |

++	       (max_exp << QTX_SCH_MAX_RATE_EXP_OFFSET) |

++	       (4 << QTX_SCH_MAX_RATE_WGHT_OFFSET);

++	writel(cfg, hnat_priv->fe_base + QTX_SCH(id % NUM_OF_Q_PER_PAGE));

++}

++

++static inline void hnat_fill_offload_engine_entry(struct sk_buff *skb,

++						  struct foe_entry *entry,

++						  const struct net_device *dev)

++{

++#if defined(CONFIG_MEDIATEK_NETSYS_V3)

++	if (skb_hnat_tops(skb) && skb_hnat_is_encap(skb)) {

++		/*

++		 * if skb_hnat_tops(skb) is setup for encapsulation,

++		 * we fill in hnat tport and tops_entry for tunnel encapsulation

++		 * offloading

++		 */

++		entry->ipv4_hnapt.tport_id = NR_TDMA_QDMA_TPORT;

++		entry->ipv4_hnapt.tops_entry = skb_hnat_tops(skb);

++	} else {

++		return;

++	}

++

++	entry->ipv4_hnapt.iblk2.qid = 12; /* offload engine use QID 12 */

++	hnat_qos_tnl(12, dev); /* set rate limit to line rate */

++#endif /* defined(CONFIG_MEDIATEK_NETSYS_V3) */

++}

++

+ static unsigned int skb_to_hnat_info(struct sk_buff *skb,

+ 				     const struct net_device *dev,

+ 				     struct foe_entry *foe,

+@@ -1237,6 +1343,11 @@ static unsigned int skb_to_hnat_info(struct sk_buff *skb,

+ 	if (whnat && is_hnat_pre_filled(foe))

+ 		return 0;

+ 

++	if (skb_hnat_tops(skb) && !(hw_path->flags & FLOW_OFFLOAD_PATH_TNL)) {

++		hnat_get_filled_unbind_entry(skb, &entry);

++		goto hnat_entry_bind;

++	}

++

+ 	entry.bfib1.pkt_type = foe->udib1.pkt_type; /* Get packte type state*/

+ 	entry.bfib1.state = foe->udib1.state;

+ 

+@@ -1679,6 +1790,10 @@ static unsigned int skb_to_hnat_info(struct sk_buff *skb,

+ 	/* Fill Layer2 Info.*/

+ 	entry = ppe_fill_L2_info(eth, entry, hw_path);

+ 

++	if (skb_hnat_tops(skb) && hw_path->flags & FLOW_OFFLOAD_PATH_TNL)

++		goto hnat_entry_skip_bind;

++

++hnat_entry_bind:

+ 	/* Fill Info Blk*/

+ 	entry = ppe_fill_info_blk(eth, entry, hw_path);

+ 

+@@ -1879,7 +1994,20 @@ static unsigned int skb_to_hnat_info(struct sk_buff *skb,

+ 			entry.ipv6_5t_route.act_dp |= UDF_HNAT_PRE_FILLED;

+ 	}

+ 

++#if defined(CONFIG_MEDIATEK_NETSYS_V3)

++	hnat_fill_offload_engine_entry(skb, &entry, dev);

++#endif

++

++hnat_entry_skip_bind:

+ 	wmb();

++

++	/*

++	 * final check before we write BIND info.

++	 * If this entry is already bound, we should not modify it right now

++	 */

++	if (entry_hnat_is_bound(foe))

++		return 0;

++

+ 	memcpy(foe, &entry, sizeof(entry));

+ 	/*reset statistic for this entry*/

+ 	if (hnat_priv->data->per_flow_accounting &&

+@@ -1951,6 +2079,12 @@ int mtk_sw_nat_hook_tx(struct sk_buff *skb, int gmac_no)

+ 	switch ((int)entry.bfib1.pkt_type) {

+ 	case IPV4_HNAPT:

+ 	case IPV4_HNAT:

++		/*

++		 * skip if packet is an encap tnl packet or it may

++		 * screw up inner mac header

++		 */

++		if (skb_hnat_tops(skb) && skb_hnat_is_encap(skb))

++			break;

+ 		entry.ipv4_hnapt.smac_hi = swab32(*((u32 *)eth->h_source));

+ 		entry.ipv4_hnapt.smac_lo = swab16(*((u16 *)&eth->h_source[4]));

+ 		break;

+@@ -2112,6 +2246,10 @@ int mtk_sw_nat_hook_tx(struct sk_buff *skb, int gmac_no)

+ 		entry.ipv6_5t_route.iblk2.dp = gmac_no;

+ 	}

+ 

++#if defined(CONFIG_MEDIATEK_NETSYS_V3)

++	hnat_fill_offload_engine_entry(skb, &entry, NULL);

++#endif

++

+ 	entry.bfib1.ttl = 1;

+ 	entry.bfib1.state = BIND;

+ 

+@@ -2187,6 +2325,7 @@ int mtk_sw_nat_hook_rx(struct sk_buff *skb)

+ 	}

+ 

+ 	skb_hnat_alg(skb) = 0;

++	skb_hnat_set_tops(skb, 0);

+ 	skb_hnat_magic_tag(skb) = HNAT_MAGIC_TAG;

+ 

+ 	if (skb_hnat_iface(skb) == FOE_MAGIC_WED0)

+@@ -2636,6 +2775,7 @@ static unsigned int mtk_hnat_nf_post_routing(

+ 	struct flow_offload_hw_path hw_path = { .dev = (struct net_device*)out,

+ 						.virt_dev = (struct net_device*)out };

+ 	const struct net_device *arp_dev = out;

++	bool is_virt_dev = false;

+ 

+ 	if (xlat_toggle && !mtk_464xlat_post_process(skb, out))

+ 		return 0;

+@@ -2652,10 +2792,29 @@ static unsigned int mtk_hnat_nf_post_routing(

+ 

+ 	if (out->netdev_ops->ndo_flow_offload_check) {

+ 		out->netdev_ops->ndo_flow_offload_check(&hw_path);

++

+ 		out = (IS_GMAC1_MODE) ? hw_path.virt_dev : hw_path.dev;

++		if (hw_path.flags & FLOW_OFFLOAD_PATH_TNL && mtk_tnl_encap_offload) {

++			if (ntohs(skb->protocol) == ETH_P_IP

++			    && ip_hdr(skb)->protocol == IPPROTO_TCP) {

++				skb_hnat_set_tops(skb, hw_path.tnl_type + 1);

++			} else {

++				/*

++				 * we are not support protocols other than IPv4 TCP

++				 * for tunnel protocol offload yet

++				 */

++				skb_hnat_alg(skb) = 1;

++				return 0;

++			}

++		}

+ 	}

+ 

+ 	if (!IS_LAN_GRP(out) && !IS_WAN(out) && !IS_EXT(out))

++		is_virt_dev = true;

++

++	if (is_virt_dev

++	    && !(skb_hnat_tops(skb) && skb_hnat_is_encap(skb)

++		 && (hw_path.flags & FLOW_OFFLOAD_PATH_TNL)))

+ 		return 0;

+ 

+ 	trace_printk("[%s] case hit, %x-->%s, reason=%x\n", __func__,

+@@ -2675,9 +2834,18 @@ static unsigned int mtk_hnat_nf_post_routing(

+ 		if (fn && !mtk_hnat_accel_type(skb))

+ 			break;

+ 

+-		if (fn && fn(skb, arp_dev, &hw_path))

++		if (!is_virt_dev && fn && fn(skb, arp_dev, &hw_path))

+ 			break;

+ 

++		/* skb_hnat_tops(skb) is updated in mtk_tnl_offload() */

++		if (skb_hnat_tops(skb)) {

++			if (skb_hnat_is_encap(skb) && !is_virt_dev

++			    && mtk_tnl_encap_offload && mtk_tnl_encap_offload(skb))

++				break;

++			if (skb_hnat_is_decap(skb))

++				break;

++		}

++

+ 		spin_lock(&hnat_priv->entry_lock);

+ 		skb_to_hnat_info(skb, out, entry, &hw_path);

+ 		spin_unlock(&hnat_priv->entry_lock);

+@@ -2951,7 +3119,7 @@ mtk_hnat_ipv4_nf_local_out(void *priv, struct sk_buff *skb,

+ 	if (iph->protocol == IPPROTO_IPV6) {

+ 		entry->udib1.pkt_type = IPV6_6RD;

+ 		hnat_set_head_frags(state, skb, 0, hnat_set_alg);

+-	} else {

++	} else if (!skb_hnat_tops(skb)) {

+ 		hnat_set_head_frags(state, skb, 1, hnat_set_alg);

+ 	}

+ 

+--- a/drivers/net/ethernet/mediatek/mtk_hnat/nf_hnat_mtk.h

++++ b/drivers/net/ethernet/mediatek/mtk_hnat/nf_hnat_mtk.h

+@@ -44,7 +44,9 @@ struct hnat_desc {

+ 	u32 is_sp : 1;

+ 	u32 hf : 1;

+ 	u32 amsdu : 1;

+-	u32 resv3 : 19;

++	u32 tops : 6;

++	u32 is_decap : 1;

++	u32 resv3 : 12;

+ 	u32 magic_tag_protect : 16;

+ } __packed;

+ #elif defined(CONFIG_MEDIATEK_NETSYS_RX_V2)

+@@ -91,6 +93,19 @@ struct hnat_desc {

+ 	((((skb_headroom(skb) >= FOE_INFO_LEN) ? 1 : 0)))

+ 

+ #define skb_hnat_info(skb) ((struct hnat_desc *)(skb->head))

++#if defined(CONFIG_MEDIATEK_NETSYS_V3)

++#define skb_hnat_tops(skb) (((struct hnat_desc *)((skb)->head))->tops)

++#define skb_hnat_is_decap(skb) (((struct hnat_desc *)((skb)->head))->is_decap)

++#define skb_hnat_is_encap(skb) (!skb_hnat_is_decap(skb))

++#define skb_hnat_set_tops(skb, tops) ((skb_hnat_tops(skb)) = (tops))

++#define skb_hnat_set_is_decap(skb, is_decap) ((skb_hnat_is_decap(skb)) = (is_decap))

++#else /* !defined(CONFIG_MEDIATEK_NETSYS_V3) */

++#define skb_hnat_tops(skb) (0)

++#define skb_hnat_is_decap(skb) (0)

++#define skb_hnat_is_encap(skb) (0)

++#define skb_hnat_set_tops(skb, tops)

++#define skb_hnat_set_is_decap(skb, is_decap)

++#endif /* defined(CONFIG_MEDIATEK_NETSYS_V3) */

+ #define skb_hnat_magic(skb) (((struct hnat_desc *)(skb->head))->magic)

+ #define skb_hnat_reason(skb) (((struct hnat_desc *)(skb->head))->crsn)

+ #define skb_hnat_entry(skb) (((struct hnat_desc *)(skb->head))->entry)

+--- a/include/net/netfilter/nf_flow_table.h

++++ b/include/net/netfilter/nf_flow_table.h

+@@ -98,10 +98,22 @@ struct flow_offload {

+ #define FLOW_OFFLOAD_PATH_6RD		BIT(5)

+ #define FLOW_OFFLOAD_PATH_TNL		BIT(6)

+ 

++enum flow_offload_tnl {

++	FLOW_OFFLOAD_TNL_GRETAP,

++	FLOW_OFFLOAD_TNL_PPTP,

++	FLOW_OFFLOAD_TNL_IP_L2TP,

++	FLOW_OFFLOAD_TNL_UDP_L2TP_CTRL,

++	FLOW_OFFLOAD_TNL_UDP_L2TP_DATA,

++	FLOW_OFFLOAD_VXLAN,

++	FLOW_OFFLOAD_NATT,

++	__FLOW_OFFLOAD_MAX,

++};

++

+ struct flow_offload_hw_path {

+ 	struct net_device *dev;

+ 	struct net_device *virt_dev;

+ 	u32 flags;

++	u32 tnl_type;

+ 

+ 	u8 eth_src[ETH_ALEN];

+ 	u8 eth_dest[ETH_ALEN];

+--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h

++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h

+@@ -1904,6 +1904,9 @@ extern const struct of_device_id of_mtk_match[];

+ extern u32 mtk_hwlro_stats_ebl;

+ extern u32 dbg_show_level;

+ 

++/* tunnel offload related */

++extern struct net_device *(*mtk_get_tnl_dev)(int tnl_idx);

++

+ /* read the hardware status register */

+ void mtk_stats_update_mac(struct mtk_mac *mac);

+ 

diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3021-mtk-wed-add-wed3-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3019-mtk-wed-add-wed3-support.patch
similarity index 95%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3021-mtk-wed-add-wed3-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3019-mtk-wed-add-wed3-support.patch
index cda6afa..1edbab9 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3021-mtk-wed-add-wed3-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3019-mtk-wed-add-wed3-support.patch
@@ -1,6 +1,6 @@
-From e8b3ef23ae83316d6b1d7d544708cc2a076ba571 Mon Sep 17 00:00:00 2001
-From: mtk27745 <rex.lu@mediatek.com>
-Date: Mon, 11 Sep 2023 11:25:07 +0800
+From b54ca484993804cec5941bd12c6cafc9ce51e4dc Mon Sep 17 00:00:00 2001
+From: Sujuan Chen <sujuan.chen@mediatek.com>
+Date: Mon, 18 Sep 2023 13:21:15 +0800
 Subject: [PATCH] mtk:wed:add wed3 support
 
 ---
@@ -12,19 +12,19 @@
  drivers/net/ethernet/mediatek/mtk_ppe.c       |   17 +-
  drivers/net/ethernet/mediatek/mtk_ppe.h       |    2 +-
  .../net/ethernet/mediatek/mtk_ppe_offload.c   |   13 +-
- drivers/net/ethernet/mediatek/mtk_wed.c       | 1155 +++++++++++++----
+ drivers/net/ethernet/mediatek/mtk_wed.c       | 1178 +++++++++++++----
  drivers/net/ethernet/mediatek/mtk_wed.h       |   25 +-
- .../net/ethernet/mediatek/mtk_wed_debugfs.c   |  584 ++++++++-
+ .../net/ethernet/mediatek/mtk_wed_debugfs.c   |  584 +++++++-
  drivers/net/ethernet/mediatek/mtk_wed_mcu.c   |   13 +-
  drivers/net/ethernet/mediatek/mtk_wed_mcu.h   |    5 +-
  drivers/net/ethernet/mediatek/mtk_wed_regs.h  |  338 ++++-
  include/linux/netdevice.h                     |    7 +
- include/linux/soc/mediatek/mtk_wed.h          |   81 +-
- 16 files changed, 2045 insertions(+), 387 deletions(-)
+ include/linux/soc/mediatek/mtk_wed.h          |   83 +-
+ 16 files changed, 2069 insertions(+), 388 deletions(-)
  mode change 100755 => 100644 drivers/net/ethernet/mediatek/mtk_ppe.c
 
 diff --git a/arch/arm64/boot/dts/mediatek/mt7988.dtsi b/arch/arm64/boot/dts/mediatek/mt7988.dtsi
-index 561450e9ba48..8995ea30d4f7 100644
+index 561450e..8995ea3 100644
 --- a/arch/arm64/boot/dts/mediatek/mt7988.dtsi
 +++ b/arch/arm64/boot/dts/mediatek/mt7988.dtsi
 @@ -205,44 +205,49 @@
@@ -223,7 +223,7 @@
  		mediatek,xfi_pextp = <&xfi_pextp0>, <&xfi_pextp1>;
  		mediatek,xfi_pll = <&xfi_pll>;
 diff --git a/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts b/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
-index 70a7554473f6..bed27b4b3488 100644
+index 70a7554..bed27b4 100644
 --- a/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
 +++ b/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
 @@ -369,9 +369,23 @@
@@ -253,7 +253,7 @@
 +};
 \ No newline at end of file
 diff --git a/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts b/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
-index e8e3a69290c8..5dd481b72ea8 100644
+index e8e3a69..5dd481b 100644
 --- a/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
 +++ b/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
 @@ -379,9 +379,23 @@
@@ -283,10 +283,10 @@
 +};
 \ No newline at end of file
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-index 6fabc5758fb6..655928cc7462 100644
+index 8bd526a..dea66d7 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -5094,7 +5094,8 @@ static int mtk_probe(struct platform_device *pdev)
+@@ -5095,7 +5095,8 @@ static int mtk_probe(struct platform_device *pdev)
  							  "mediatek,wed", i);
  		static const u32 wdma_regs[] = {
  			MTK_WDMA0_BASE,
@@ -297,10 +297,10 @@
  		void __iomem *wdma;
  		u32 wdma_phy;
 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-index 80f4c4b32a30..06f2b5d98b81 100644
+index ee89b4c..8656b5f 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
-@@ -611,9 +611,12 @@
+@@ -613,9 +613,12 @@
  #define RX_DMA_SPORT_MASK       0x7
  #define RX_DMA_SPORT_MASK_V2    0xf
  
@@ -317,7 +317,7 @@
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
 old mode 100755
 new mode 100644
-index 384e811d6946..eda23c2afbbf
+index 384e811..eda23c2
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
 @@ -9,6 +9,7 @@
@@ -366,7 +366,7 @@
  }
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.h b/drivers/net/ethernet/mediatek/mtk_ppe.h
-index 2a8b6ef225a2..66c7f10170d2 100644
+index 2a8b6ef..66c7f10 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.h
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
 @@ -428,7 +428,7 @@ int mtk_foe_entry_set_dsa(struct mtk_foe_entry *entry, int port);
@@ -379,7 +379,7 @@
  int mtk_foe_entry_set_dscp(struct mtk_foe_entry *entry, int dscp);
  bool mtk_foe_entry_match(struct mtk_foe_entry *entry, struct mtk_foe_entry *data);
 diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-index 95174b795cf0..eab9e9de7193 100644
+index 95174b7..eab9e9d 100644
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 @@ -112,6 +112,7 @@ mtk_flow_get_wdma_info(struct net_device *dev, const u8 *addr, struct mtk_wdma_i
@@ -430,7 +430,7 @@
  }
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
-index 3e760f7c5f3d..6ac4aa8d4e3c 100644
+index 3e760f7..7b2e199 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
 @@ -28,7 +28,7 @@ struct wo_cmd_ring {
@@ -838,7 +838,7 @@
  static void
  mtk_wed_free_ring(struct mtk_wed_device *dev, struct mtk_wed_ring *ring, int scale)
  {
-@@ -416,19 +618,25 @@ mtk_wed_free_ring(struct mtk_wed_device *dev, struct mtk_wed_ring *ring, int sca
+@@ -416,19 +618,35 @@ mtk_wed_free_ring(struct mtk_wed_device *dev, struct mtk_wed_ring *ring, int sca
  static void
  mtk_wed_free_tx_rings(struct mtk_wed_device *dev)
  {
@@ -847,12 +847,12 @@
  
  	for (i = 0; i < ARRAY_SIZE(dev->tx_ring); i++)
 -		mtk_wed_free_ring(dev, &dev->tx_ring[i], 1);
-+		if (!(dev->rx_ring[i].flags & MTK_WED_RING_CONFIGURED))
++		if ((dev->tx_ring[i].flags & MTK_WED_RING_CONFIGURED))
 +			mtk_wed_free_ring(dev, &dev->tx_ring[i], 1);
 +
  	for (i = 0; i < ARRAY_SIZE(dev->tx_wdma); i++)
 -		mtk_wed_free_ring(dev, &dev->tx_wdma[i], dev->ver);
-+		if ((dev->rx_ring[i].flags & MTK_WED_RING_CONFIGURED))
++		if ((dev->tx_wdma[i].flags & MTK_WED_RING_CONFIGURED))
 +			mtk_wed_free_ring(dev, &dev->tx_wdma[i], scale);
  }
  
@@ -860,6 +860,16 @@
  mtk_wed_free_rx_rings(struct mtk_wed_device *dev)
  {
 -	mtk_wed_free_rx_bm(dev);
++	int i, scale = dev->hw->version > 1 ? 2 : 1;
++
++	for (i = 0; i < ARRAY_SIZE(dev->rx_ring); i++)
++		if ((dev->rx_ring[i].flags & MTK_WED_RING_CONFIGURED))
++			mtk_wed_free_ring(dev, &dev->rx_ring[i], 1);
++
++	for (i = 0; i < ARRAY_SIZE(dev->rx_wdma); i++)
++		if ((dev->rx_wdma[i].flags & MTK_WED_RING_CONFIGURED))
++			mtk_wed_free_ring(dev, &dev->rx_wdma[i], scale);
++
 +	mtk_wed_free_rx_buffer(dev);
  	mtk_wed_free_ring(dev, &dev->rro.rro_ring, 1);
 +
@@ -868,7 +878,7 @@
  }
  
  static void
-@@ -437,7 +645,7 @@ mtk_wed_set_int(struct mtk_wed_device *dev, u32 irq_mask)
+@@ -437,7 +655,7 @@ mtk_wed_set_int(struct mtk_wed_device *dev, u32 irq_mask)
  	u32 wdma_mask;
  
  	wdma_mask = FIELD_PREP(MTK_WDMA_INT_MASK_RX_DONE, GENMASK(1, 0));
@@ -877,7 +887,7 @@
  		wdma_mask |= FIELD_PREP(MTK_WDMA_INT_MASK_TX_DONE,
  					GENMASK(1, 0));
  	/* wed control cr set */
-@@ -447,7 +655,7 @@ mtk_wed_set_int(struct mtk_wed_device *dev, u32 irq_mask)
+@@ -447,7 +665,7 @@ mtk_wed_set_int(struct mtk_wed_device *dev, u32 irq_mask)
  		MTK_WED_CTRL_WED_TX_BM_EN |
  		MTK_WED_CTRL_WED_TX_FREE_AGENT_EN);
  
@@ -886,7 +896,7 @@
  		wed_w32(dev, MTK_WED_PCIE_INT_TRIGGER,
  			MTK_WED_PCIE_INT_TRIGGER_STATUS);
  
-@@ -458,6 +666,8 @@ mtk_wed_set_int(struct mtk_wed_device *dev, u32 irq_mask)
+@@ -458,6 +676,8 @@ mtk_wed_set_int(struct mtk_wed_device *dev, u32 irq_mask)
  		wed_set(dev, MTK_WED_WPDMA_INT_CTRL,
  			MTK_WED_WPDMA_INT_CTRL_SUBRT_ADV);
  	} else {
@@ -895,7 +905,7 @@
  
  		wed_w32(dev, MTK_WED_WPDMA_INT_CTRL_TX,
  			MTK_WED_WPDMA_INT_CTRL_TX0_DONE_EN |
-@@ -475,18 +685,20 @@ mtk_wed_set_int(struct mtk_wed_device *dev, u32 irq_mask)
+@@ -475,18 +695,20 @@ mtk_wed_set_int(struct mtk_wed_device *dev, u32 irq_mask)
  			FIELD_PREP(MTK_WED_WPDMA_INT_CTRL_TX_FREE_DONE_TRIG,
  				    dev->wlan.txfree_tbit));
  
@@ -926,7 +936,7 @@
  		wed_clr(dev, MTK_WED_WDMA_INT_CTRL, wdma_mask);
  	} else {
  		wed_w32(dev, MTK_WED_WDMA_INT_CLR, wdma_mask);
-@@ -506,6 +718,21 @@ mtk_wed_set_ext_int(struct mtk_wed_device *dev, bool en)
+@@ -506,6 +728,21 @@ mtk_wed_set_ext_int(struct mtk_wed_device *dev, bool en)
  {
  	u32 mask = MTK_WED_EXT_INT_STATUS_ERROR_MASK;
  
@@ -948,7 +958,7 @@
  	if (!dev->hw->num_flows)
  		mask &= ~MTK_WED_EXT_INT_STATUS_TKID_WO_PYLD;
  
-@@ -514,31 +741,86 @@ mtk_wed_set_ext_int(struct mtk_wed_device *dev, bool en)
+@@ -514,31 +751,86 @@ mtk_wed_set_ext_int(struct mtk_wed_device *dev, bool en)
  }
  
  static void
@@ -1017,10 +1027,10 @@
 -#define MTK_WFMDA_RX_DMA_EN 	BIT(2)
 +	if (!mtk_wed_get_rx_capa(dev))
 +		return 0;
-+
+ 
 +	wed_set(dev, MTK_WED_RRO_PG_BM_RX_DMAM,
 +		FIELD_PREP(MTK_WED_RRO_PG_BM_RX_SDL0, 128));
- 
++
 +	wed_w32(dev, MTK_WED_RRO_PG_BM_BASE,
 +		dev->rx_page_buf_ring.desc_phys);
 +
@@ -1051,7 +1061,7 @@
  		if (cur_idx == MTK_WED_RX_RING_SIZE - 1)
  			break;
  
-@@ -546,70 +828,133 @@ mtk_wed_check_wfdma_rx_fill(struct mtk_wed_device *dev, int idx)
+@@ -546,70 +838,133 @@ mtk_wed_check_wfdma_rx_fill(struct mtk_wed_device *dev, int idx)
  		timeout--;
  	} while (timeout > 0);
  
@@ -1208,7 +1218,7 @@
  	}
  }
  
-@@ -644,15 +989,20 @@ mtk_wed_dma_disable(struct mtk_wed_device *dev)
+@@ -644,15 +999,20 @@ mtk_wed_dma_disable(struct mtk_wed_device *dev)
  			MTK_WED_WPDMA_RX_D_RX_DRV_EN);
  		wed_clr(dev, MTK_WED_WDMA_GLO_CFG,
  			MTK_WED_WDMA_GLO_CFG_TX_DDONE_CHK);
@@ -1232,7 +1242,7 @@
  		wed_w32(dev, MTK_WED_EXT_INT_MASK1, 0);
  		wed_w32(dev, MTK_WED_EXT_INT_MASK2, 0);
  	}
-@@ -677,13 +1027,21 @@ mtk_wed_deinit(struct mtk_wed_device *dev)
+@@ -677,13 +1037,21 @@ mtk_wed_deinit(struct mtk_wed_device *dev)
  		MTK_WED_CTRL_WED_TX_BM_EN |
  		MTK_WED_CTRL_WED_TX_FREE_AGENT_EN);
  
@@ -1255,7 +1265,7 @@
  }
  
  static void
-@@ -702,9 +1060,9 @@ mtk_wed_detach(struct mtk_wed_device *dev)
+@@ -702,9 +1070,9 @@ mtk_wed_detach(struct mtk_wed_device *dev)
  
  	mtk_wdma_tx_reset(dev);
  
@@ -1267,7 +1277,7 @@
  		mtk_wed_wo_reset(dev);
  		mtk_wed_free_rx_rings(dev);
  		mtk_wed_wo_exit(hw);
-@@ -731,24 +1089,29 @@ mtk_wed_detach(struct mtk_wed_device *dev)
+@@ -731,24 +1099,29 @@ mtk_wed_detach(struct mtk_wed_device *dev)
  static void
  mtk_wed_bus_init(struct mtk_wed_device *dev)
  {
@@ -1311,7 +1321,7 @@
  
  		wed_w32(dev, MTK_WED_PCIE_INT_CTRL,
  			FIELD_PREP(MTK_WED_PCIE_INT_CTRL_POLL_EN, 2));
-@@ -756,45 +1119,51 @@ mtk_wed_bus_init(struct mtk_wed_device *dev)
+@@ -756,45 +1129,53 @@ mtk_wed_bus_init(struct mtk_wed_device *dev)
  		/* pcie interrupt control: pola/source selection */
  		wed_set(dev, MTK_WED_PCIE_INT_CTRL,
  			MTK_WED_PCIE_INT_CTRL_MSK_EN_POLA |
@@ -1373,21 +1383,23 @@
 +			int i;
 +
 +			wed_w32(dev, MTK_WED_WPDMA_RX_GLO_CFG,  dev->wlan.wpdma_rx_glo);
-+			wed_w32(dev, MTK_WED_WPDMA_RX_RING0,  dev->wlan.wpdma_rx);
++			wed_w32(dev, MTK_WED_WPDMA_RX_RING0,  dev->wlan.wpdma_rx[0]);
++			if (dev->wlan.wpdma_rx[1])
++				wed_w32(dev, MTK_WED_WPDMA_RX_RING1,  dev->wlan.wpdma_rx[1]);
 +
 +			if (dev->wlan.hwrro) {
-+	                       wed_w32(dev, MTK_WED_RRO_RX_D_CFG(0), dev->wlan.wpdma_rx_rro[0]);
-+	                       wed_w32(dev, MTK_WED_RRO_RX_D_CFG(1), dev->wlan.wpdma_rx_rro[1]);
-+	                       for (i = 0; i < MTK_WED_RX_PAGE_QUEUES; i++) {
-+	                               wed_w32(dev, MTK_WED_RRO_MSDU_PG_RING_CFG(i),
-+	                                       dev->wlan.wpdma_rx_pg + i * 0x10);
++				wed_w32(dev, MTK_WED_RRO_RX_D_CFG(0), dev->wlan.wpdma_rx_rro[0]);
++				wed_w32(dev, MTK_WED_RRO_RX_D_CFG(1), dev->wlan.wpdma_rx_rro[1]);
++				for (i = 0; i < MTK_WED_RX_PAGE_QUEUES; i++) {
++					wed_w32(dev, MTK_WED_RRO_MSDU_PG_RING_CFG(i),
++						dev->wlan.wpdma_rx_pg + i * 0x10);
 +			       }
 +			}
 +		}
  	}
  }
  
-@@ -806,21 +1175,25 @@ mtk_wed_hw_init_early(struct mtk_wed_device *dev)
+@@ -806,21 +1187,25 @@ mtk_wed_hw_init_early(struct mtk_wed_device *dev)
  	mtk_wed_deinit(dev);
  	mtk_wed_reset(dev, MTK_WED_RESET_WED);
  
@@ -1423,7 +1435,7 @@
  		offset = dev->hw->index ? 0x04000400 : 0;
  		wed_w32(dev, MTK_WED_WDMA_OFFSET0, 0x2a042a20 + offset);
  		wed_w32(dev, MTK_WED_WDMA_OFFSET1, 0x29002800 + offset);
-@@ -907,11 +1280,16 @@ mtk_wed_route_qm_hw_init(struct mtk_wed_device *dev)
+@@ -907,11 +1292,16 @@ mtk_wed_route_qm_hw_init(struct mtk_wed_device *dev)
  	} while (1);
  
  	/* configure RX_ROUTE_QM */
@@ -1445,7 +1457,7 @@
  
  	/* enable RX_ROUTE_QM */
  	wed_set(dev, MTK_WED_CTRL, MTK_WED_CTRL_RX_ROUTE_QM_EN);
-@@ -920,23 +1298,45 @@ mtk_wed_route_qm_hw_init(struct mtk_wed_device *dev)
+@@ -920,23 +1310,45 @@ mtk_wed_route_qm_hw_init(struct mtk_wed_device *dev)
  static void
  mtk_wed_tx_hw_init(struct mtk_wed_device *dev)
  {
@@ -1501,7 +1513,7 @@
  
  	wed_w32(dev, MTK_WED_TX_BM_TKID,
  		FIELD_PREP(MTK_WED_TX_BM_TKID_START,
-@@ -946,25 +1346,44 @@ mtk_wed_tx_hw_init(struct mtk_wed_device *dev)
+@@ -946,25 +1358,44 @@ mtk_wed_tx_hw_init(struct mtk_wed_device *dev)
  
  	wed_w32(dev, MTK_WED_TX_BM_BUF_LEN, MTK_WED_PKT_SIZE);
  
@@ -1515,7 +1527,7 @@
 +	else {
 +		/* change to new bm */
 +		wed_w32(dev, MTK_WED_TX_BM_INIT_PTR, dev->tx_buf_ring.pkt_nums |
-+				MTK_WED_TX_BM_INIT_SW_TAIL_IDX);
++			MTK_WED_TX_BM_INIT_SW_TAIL_IDX);
 +		wed_clr(dev, MTK_WED_TX_BM_CTRL, MTK_WED_TX_BM_CTRL_LEGACY_EN);
 +	}
  
@@ -1557,7 +1569,7 @@
  		wed_clr(dev, MTK_WED_TX_TKID_CTRL, MTK_WED_TX_TKID_CTRL_PAUSE);
  }
  
-@@ -977,7 +1396,26 @@ mtk_wed_rx_hw_init(struct mtk_wed_device *dev)
+@@ -977,7 +1408,26 @@ mtk_wed_rx_hw_init(struct mtk_wed_device *dev)
  
  	wed_w32(dev, MTK_WED_WPDMA_RX_D_RST_IDX, 0);
  
@@ -1584,7 +1596,7 @@
  	mtk_wed_rro_hw_init(dev);
  	mtk_wed_route_qm_hw_init(dev);
  }
-@@ -991,7 +1429,7 @@ mtk_wed_hw_init(struct mtk_wed_device *dev)
+@@ -991,7 +1441,7 @@ mtk_wed_hw_init(struct mtk_wed_device *dev)
  	dev->init_done = true;
  	mtk_wed_set_ext_int(dev, false);
  	mtk_wed_tx_hw_init(dev);
@@ -1593,7 +1605,7 @@
  		mtk_wed_rx_hw_init(dev);
  }
  
-@@ -1015,26 +1453,6 @@ mtk_wed_ring_reset(struct mtk_wdma_desc *desc, int size, int scale, bool tx)
+@@ -1015,26 +1465,6 @@ mtk_wed_ring_reset(struct mtk_wdma_desc *desc, int size, int scale, bool tx)
  	}
  }
  
@@ -1620,7 +1632,7 @@
  static void
  mtk_wed_rx_reset(struct mtk_wed_device *dev)
  {
-@@ -1133,7 +1551,7 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1133,7 +1563,7 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
  		mtk_wed_ring_reset(desc, MTK_WED_RX_RING_SIZE, 1, false);
  	}
  
@@ -1629,7 +1641,7 @@
  }
  
  
-@@ -1271,12 +1689,15 @@ mtk_wed_wdma_rx_ring_setup(struct mtk_wed_device *dev,
+@@ -1271,12 +1701,15 @@ mtk_wed_wdma_rx_ring_setup(struct mtk_wed_device *dev,
  		int idx, int size, bool reset)
  {
  	struct mtk_wed_ring *wdma = &dev->tx_wdma[idx];
@@ -1646,7 +1658,7 @@
  	wdma_w32(dev, MTK_WDMA_RING_RX(idx) + MTK_WED_RING_OFS_BASE,
  		 wdma->desc_phys);
  	wdma_w32(dev, MTK_WDMA_RING_RX(idx) + MTK_WED_RING_OFS_COUNT,
-@@ -1296,12 +1717,31 @@ mtk_wed_wdma_tx_ring_setup(struct mtk_wed_device *dev,
+@@ -1296,12 +1729,33 @@ mtk_wed_wdma_tx_ring_setup(struct mtk_wed_device *dev,
  	int idx, int size, bool reset)
  {
  	struct mtk_wed_ring *wdma = &dev->rx_wdma[idx];
@@ -1676,10 +1688,12 @@
 +		}
 +	}
 +
++	wdma->flags |= MTK_WED_RING_CONFIGURED;
++
  	wdma_w32(dev, MTK_WDMA_RING_TX(idx) + MTK_WED_RING_OFS_BASE,
  		 wdma->desc_phys);
  	wdma_w32(dev, MTK_WDMA_RING_TX(idx) + MTK_WED_RING_OFS_COUNT,
-@@ -1312,7 +1752,7 @@ mtk_wed_wdma_tx_ring_setup(struct mtk_wed_device *dev,
+@@ -1312,7 +1766,7 @@ mtk_wed_wdma_tx_ring_setup(struct mtk_wed_device *dev,
  		 MTK_WDMA_RING_TX(idx) + MTK_WED_RING_OFS_DMA_IDX, 0);
  	if (reset)
  		mtk_wed_ring_reset(wdma->desc, MTK_WED_WDMA_RING_SIZE,
@@ -1688,7 +1702,7 @@
  	if (idx == 0)  {
  		wed_w32(dev, MTK_WED_WDMA_RING_TX
  			+ MTK_WED_RING_OFS_BASE, wdma->desc_phys);
-@@ -1395,7 +1835,7 @@ mtk_wed_send_msg(struct mtk_wed_device *dev, int cmd_id, void *data, int len)
+@@ -1395,7 +1849,7 @@ mtk_wed_send_msg(struct mtk_wed_device *dev, int cmd_id, void *data, int len)
  {
  	struct mtk_wed_wo *wo = dev->hw->wed_wo;
  
@@ -1697,7 +1711,7 @@
  		return 0;
  
  	return mtk_wed_mcu_send_msg(wo, MODULE_ID_WO, cmd_id, data, len, true);
-@@ -1420,13 +1860,87 @@ mtk_wed_ppe_check(struct mtk_wed_device *dev, struct sk_buff *skb,
+@@ -1420,24 +1874,106 @@ mtk_wed_ppe_check(struct mtk_wed_device *dev, struct sk_buff *skb,
  	}
  }
  
@@ -1787,7 +1801,18 @@
  
  	for (i = 0; i < ARRAY_SIZE(dev->tx_wdma); i++)
  		if (!dev->tx_wdma[i].desc)
-@@ -1437,7 +1951,7 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
+ 			mtk_wed_wdma_rx_ring_setup(dev, i, 16, false);
+ 
++	for (i = 0; i < ARRAY_SIZE(dev->rx_page_ring); i++) {
++		u32 count = MTK_WED_RRO_MSDU_PG_CTRL0(i) +
++			    MTK_WED_RING_OFS_COUNT;
++
++		if (!wed_r32(dev, count))
++			wed_w32(dev, count, 1);
++	}
++
+ 	mtk_wed_hw_init(dev);
+ 
  	mtk_wed_set_int(dev, irq_mask);
  	mtk_wed_set_ext_int(dev, true);
  
@@ -1796,7 +1821,7 @@
  		u32 val;
  
  		val = dev->wlan.wpdma_phys |
-@@ -1448,33 +1962,52 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
+@@ -1448,33 +1984,52 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
  			val |= BIT(1);
  		val |= BIT(0);
  		regmap_write(dev->hw->mirror, dev->hw->index * 4, val);
@@ -1852,7 +1877,7 @@
  	int ret = 0;
  
  	RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
-@@ -1494,34 +2027,30 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+@@ -1494,34 +2049,30 @@ mtk_wed_attach(struct mtk_wed_device *dev)
  		goto out;
  	}
  
@@ -1897,7 +1922,7 @@
  		ret = mtk_wed_rro_alloc(dev);
  		if (ret)
  			goto error;
-@@ -1533,15 +2062,20 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+@@ -1533,15 +2084,20 @@ mtk_wed_attach(struct mtk_wed_device *dev)
  	init_completion(&dev->wlan_reset_done);
  	atomic_set(&dev->fe_reset, 0);
  
@@ -1921,7 +1946,7 @@
  out:
  	mutex_unlock(&hw_lock);
  
-@@ -1576,8 +2110,26 @@ mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx,
+@@ -1576,8 +2132,26 @@ mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx,
  	if (mtk_wed_wdma_rx_ring_setup(dev, idx, MTK_WED_WDMA_RING_SIZE, reset))
  		return -ENOMEM;
  
@@ -1948,7 +1973,7 @@
  
  	/* WED -> WPDMA */
  	wpdma_tx_w32(dev, idx, MTK_WED_RING_OFS_BASE, ring->desc_phys);
-@@ -1599,7 +2151,7 @@ mtk_wed_txfree_ring_setup(struct mtk_wed_device *dev, void __iomem *regs)
+@@ -1599,7 +2173,7 @@ mtk_wed_txfree_ring_setup(struct mtk_wed_device *dev, void __iomem *regs)
  	struct mtk_wed_ring *ring = &dev->txfree_ring;
  	int i, idx = 1;
  
@@ -1957,7 +1982,15 @@
  		idx = 0;
  
  	/*
-@@ -1652,6 +2204,129 @@ mtk_wed_rx_ring_setup(struct mtk_wed_device *dev,
+@@ -1638,6 +2212,7 @@ mtk_wed_rx_ring_setup(struct mtk_wed_device *dev,
+ 
+ 	ring->reg_base = MTK_WED_RING_RX_DATA(idx);
+ 	ring->wpdma = regs;
++	ring->flags |= MTK_WED_RING_CONFIGURED;
+ 	dev->hw->ring_num = idx + 1;
+ 
+ 	/* WPDMA ->  WED */
+@@ -1652,6 +2227,129 @@ mtk_wed_rx_ring_setup(struct mtk_wed_device *dev,
  	return 0;
  }
  
@@ -2087,7 +2120,7 @@
  static u32
  mtk_wed_irq_get(struct mtk_wed_device *dev, u32 mask)
  {
-@@ -1659,9 +2334,13 @@ mtk_wed_irq_get(struct mtk_wed_device *dev, u32 mask)
+@@ -1659,9 +2357,13 @@ mtk_wed_irq_get(struct mtk_wed_device *dev, u32 mask)
  
  	val = wed_r32(dev, MTK_WED_EXT_INT_STATUS);
  	wed_w32(dev, MTK_WED_EXT_INT_STATUS, val);
@@ -2104,7 +2137,7 @@
  	if (val && net_ratelimit())
  		pr_err("mtk_wed%d: error status=%08x\n", dev->hw->index, val);
  
-@@ -1754,6 +2433,9 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1754,6 +2456,9 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
  		.tx_ring_setup = mtk_wed_tx_ring_setup,
  		.txfree_ring_setup = mtk_wed_txfree_ring_setup,
  		.rx_ring_setup = mtk_wed_rx_ring_setup,
@@ -2114,7 +2147,7 @@
  		.msg_update = mtk_wed_send_msg,
  		.start = mtk_wed_start,
  		.stop = mtk_wed_stop,
-@@ -1765,6 +2447,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1765,6 +2470,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
  		.detach = mtk_wed_detach,
  		.setup_tc = mtk_wed_eth_setup_tc,
  		.ppe_check = mtk_wed_ppe_check,
@@ -2122,7 +2155,7 @@
  	};
  	struct device_node *eth_np = eth->dev->of_node;
  	struct platform_device *pdev;
-@@ -1804,9 +2487,10 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1804,9 +2510,10 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
  	hw->wdma_phy = wdma_phy;
  	hw->index = index;
  	hw->irq = irq;
@@ -2135,7 +2168,7 @@
  		hw->mirror = syscon_regmap_lookup_by_phandle(eth_np,
  							     "mediatek,pcie-mirror");
  		hw->hifsys = syscon_regmap_lookup_by_phandle(eth_np,
-@@ -1821,7 +2505,6 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1821,7 +2528,6 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
  			regmap_write(hw->mirror, 0, 0);
  			regmap_write(hw->mirror, 4, 0);
  		}
@@ -2144,7 +2177,7 @@
  
  	mtk_wed_hw_add_debugfs(hw);
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.h b/drivers/net/ethernet/mediatek/mtk_wed.h
-index 490873cc58ac..fcf7bd0a6f66 100644
+index 490873c..fcf7bd0 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed.h
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.h
 @@ -10,10 +10,13 @@
@@ -2211,7 +2244,7 @@
  
  #ifdef CONFIG_NET_MEDIATEK_SOC_WED
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
-index 4a9e684edbdb..51e3d7c94d86 100644
+index 4a9e684..51e3d7c 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
 @@ -11,9 +11,11 @@ struct reg_dump {
@@ -2908,15 +2941,16 @@
  	}
  }
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
-index 96e30a320ed7..055594de1c98 100644
+index 96e30a3..055594d 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
-@@ -242,7 +242,7 @@ mtk_wed_load_firmware(struct mtk_wed_wo *wo)
- 	u32 ofs = 0;
- 	u32 boot_cr, val;
- 
--	mcu = wo->hw->index ? MT7986_FIRMWARE_WO_2 : MT7986_FIRMWARE_WO_1;
-+	mcu = wo->hw->index ? MTK_FIRMWARE_WO_1 : MTK_FIRMWARE_WO_0;
+@@ -245,8 +245,7 @@ mtk_wed_load_firmware(struct mtk_wed_wo *wo)
+ 	if (of_device_is_compatible(wo->hw->node, "mediatek,mt7981-wed"))
+ 		mcu = MT7981_FIRMWARE_WO;
+ 	else
+-		mcu = wo->hw->index ? MT7986_FIRMWARE_WO_2 :
+-				      MT7986_FIRMWARE_WO_1;
++		mcu = wo->hw->index ? MTK_FIRMWARE_WO_1 : MTK_FIRMWARE_WO_0;
  
  	ret = request_firmware(&fw, mcu, wo->hw->dev);
  	if (ret)
@@ -2946,13 +2980,13 @@
  	wo_w32(wo, WOX_MCU_CFG_LS_WF_MCU_CFG_WM_WA_ADDR, val);
  
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_mcu.h b/drivers/net/ethernet/mediatek/mtk_wed_mcu.h
-index 19e1199783f4..c07bdb6ca153 100644
+index 19e1199..c07bdb6 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.h
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.h
-@@ -16,8 +16,9 @@
- #define WARP_OK_STATUS (0)
+@@ -17,8 +17,9 @@
  #define WARP_ALREADY_DONE_STATUS (1)
  
+ #define MT7981_FIRMWARE_WO		"mediatek/mt7981_wo.bin"
 -#define MT7986_FIRMWARE_WO_1		"mediatek/mt7986_wo_0.bin"
 -#define MT7986_FIRMWARE_WO_2		"mediatek/mt7986_wo_1.bin"
 +#define MTK_FIRMWARE_WO_0		"mediatek/mtk_wo_0.bin"
@@ -2962,7 +2996,7 @@
  #define WOCPU_EMI_DEV_NODE		"mediatek,wocpu_emi"
  #define WOCPU_ILM_DEV_NODE		"mediatek,wocpu_ilm"
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed_regs.h b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
-index 403a36bb9d5e..25be547b98fa 100644
+index 403a36b..25be547 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 +++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
 @@ -20,6 +20,9 @@
@@ -3465,7 +3499,7 @@
 +#define MTK_WED_PCIE_BASE2			0x11290000
  #endif
 diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
-index 0967dc24060f..3211f344847e 100644
+index 0967dc2..3211f34 100644
 --- a/include/linux/netdevice.h
 +++ b/include/linux/netdevice.h
 @@ -875,6 +875,13 @@ struct net_device_path {
@@ -3483,7 +3517,7 @@
  	};
  };
 diff --git a/include/linux/soc/mediatek/mtk_wed.h b/include/linux/soc/mediatek/mtk_wed.h
-index 27cf284b4af3..2b389e8a813c 100644
+index 27cf284..92df4ba 100644
 --- a/include/linux/soc/mediatek/mtk_wed.h
 +++ b/include/linux/soc/mediatek/mtk_wed.h
 @@ -5,11 +5,14 @@
@@ -3577,10 +3611,12 @@
  		u32 phy_base;
  
  		u32 wpdma_phys;
-@@ -142,9 +163,13 @@ struct mtk_wed_device {
+@@ -141,10 +162,14 @@ struct mtk_wed_device {
+ 		u32 wpdma_tx;
  		u32 wpdma_txfree;
  		u32 wpdma_rx_glo;
- 		u32 wpdma_rx;
+-		u32 wpdma_rx;
++		u32 wpdma_rx[MTK_WED_RX_QUEUES];
 +		u32 wpdma_rx_rro[MTK_WED_RX_QUEUES];
 +		u32 wpdma_rx_pg;
  
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3022-mtk-wed-add-wed3-ser-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3020-mtk-wed-add-wed3-ser-support.patch
similarity index 95%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3022-mtk-wed-add-wed3-ser-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3020-mtk-wed-add-wed3-ser-support.patch
index 36ed532..ea0daa2 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3022-mtk-wed-add-wed3-ser-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3020-mtk-wed-add-wed3-ser-support.patch
@@ -1,7 +1,7 @@
-From 7304ce8edabcbc34433307b02de429c2d118abaa Mon Sep 17 00:00:00 2001
+From a77480d9f1e1f2de7d27365a9668daf98184b0e2 Mon Sep 17 00:00:00 2001
 From: mtk27745 <rex.lu@mediatek.com>
-Date: Tue, 23 May 2023 11:19:30 +0800
-Subject: [PATCH] mtk-wed-add-wed3-ser-support
+Date: Mon, 18 Sep 2023 13:22:44 +0800
+Subject: [PATCH 21/22] mtk wed add wed3 ser support
 
 ---
  drivers/net/ethernet/mediatek/mtk_wed.c      | 236 +++++++++++++++++--
@@ -10,7 +10,7 @@
  3 files changed, 291 insertions(+), 24 deletions(-)
 
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
-index 6ed1c83..990888d 100644
+index 9047cb0..0d101d5 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
 @@ -99,11 +99,65 @@ mtk_wdma_rx_reset(struct mtk_wed_device *dev)
@@ -153,7 +153,7 @@
  			if (mtk_wed_get_rx_capa(dev)) {
  				wed_set(dev, MTK_WED_WPDMA_RX_D_PREF_CFG,
  					MTK_WED_WPDMA_RX_D_PREF_EN |
-@@ -1465,13 +1568,30 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1466,13 +1569,30 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
  	mtk_wed_mcu_send_msg(wo, MODULE_ID_WO, MTK_WED_WO_CMD_CHANGE_STATE,
  			     &state, sizeof(state), true);
  
@@ -184,7 +184,7 @@
  		wed_w32(dev, MTK_WED_WPDMA_RX_D_RST_IDX,
  			MTK_WED_WPDMA_RX_D_RST_CRX_IDX |
  			MTK_WED_WPDMA_RX_D_RST_DRV_IDX);
-@@ -1499,6 +1619,24 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1500,6 +1620,24 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
  		wed_w32(dev, MTK_WED_RROQM_RST_IDX, 0);
  	}
  
@@ -209,7 +209,7 @@
  	/* reset route qm */
  	wed_clr(dev, MTK_WED_CTRL, MTK_WED_CTRL_RX_ROUTE_QM_EN);
  	busy = mtk_wed_poll_busy(dev, MTK_WED_CTRL,
-@@ -1506,8 +1644,13 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1507,8 +1645,13 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
  	if (busy) {
  		mtk_wed_reset(dev, MTK_WED_RESET_RX_ROUTE_QM);
  	} else {
@@ -225,7 +225,7 @@
  	}
  
  	/* reset tx wdma */
-@@ -1515,8 +1658,13 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1516,8 +1659,13 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
  
  	/* reset tx wdma drv */
  	wed_clr(dev, MTK_WED_WDMA_GLO_CFG, MTK_WED_WDMA_GLO_CFG_TX_DRV_EN);
@@ -241,7 +241,7 @@
  	mtk_wed_reset(dev, MTK_WED_RESET_WDMA_TX_DRV);
  
  	/* reset wed rx dma */
-@@ -1534,9 +1682,17 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1535,9 +1683,17 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
  	/* reset rx bm */
  	wed_clr(dev, MTK_WED_CTRL, MTK_WED_CTRL_WED_RX_BM_EN);
  	mtk_wed_poll_busy(dev, MTK_WED_CTRL,
@@ -260,7 +260,7 @@
  	/* wo change to enable state */
  	state = WO_STATE_ENABLE;
  	mtk_wed_mcu_send_msg(wo, MODULE_ID_WO, MTK_WED_WO_CMD_CHANGE_STATE,
-@@ -1553,6 +1709,9 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
+@@ -1554,6 +1710,9 @@ mtk_wed_rx_reset(struct mtk_wed_device *dev)
  	}
  
  	mtk_wed_free_rx_buffer(dev);
@@ -270,7 +270,7 @@
  }
  
  
-@@ -1586,18 +1745,40 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -1587,18 +1746,40 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
  
  	/* 2. Reset WDMA Rx DMA/Driver_Engine */
  	busy = !!mtk_wdma_rx_reset(dev);
@@ -314,7 +314,7 @@
  		wed_w32(dev, MTK_WED_WDMA_RESET_IDX, 0);
  
  		wed_set(dev, MTK_WED_WDMA_GLO_CFG,
-@@ -1612,9 +1793,15 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -1613,9 +1794,15 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
  		MTK_WED_CTRL_WED_TX_FREE_AGENT_EN);
  
  	for (i = 0; i < 100; i++) {
@@ -333,7 +333,7 @@
  	}
  	mtk_wed_reset(dev, MTK_WED_RESET_TX_FREE_AGENT);
  
-@@ -1623,18 +1810,20 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -1624,18 +1811,20 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
  
  	/* 4. Reset WED WPDMA Tx Driver Engine */
  	busy = mtk_wed_poll_busy(dev, MTK_WED_WPDMA_GLO_CFG,
@@ -356,7 +356,7 @@
  	} else {
  		wed_w32(dev, MTK_WED_WPDMA_RESET_IDX,
  			MTK_WED_WPDMA_RESET_IDX_TX |
-@@ -1647,7 +1836,13 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
+@@ -1648,7 +1837,13 @@ mtk_wed_reset_dma(struct mtk_wed_device *dev)
  		}
  	}
  
@@ -371,7 +371,7 @@
  		dev->init_done = false;
  		mtk_wed_rx_reset(dev);
  	}
-@@ -1862,7 +2057,7 @@ mtk_wed_ppe_check(struct mtk_wed_device *dev, struct sk_buff *skb,
+@@ -1863,7 +2058,7 @@ mtk_wed_ppe_check(struct mtk_wed_device *dev, struct sk_buff *skb,
  }
  
  static void
@@ -380,7 +380,7 @@
  {
  	int idx, ret;
  
-@@ -1872,6 +2067,11 @@ mtk_wed_start_hwrro(struct mtk_wed_device *dev, u32 irq_mask)
+@@ -1873,6 +2068,11 @@ mtk_wed_start_hwrro(struct mtk_wed_device *dev, u32 irq_mask)
  	if (!mtk_wed_get_rx_capa(dev) || !dev->wlan.hwrro)
  		return;
  
@@ -583,7 +583,7 @@
  #define MTK_WED_RX_IND_CMD_DBG_CNT_EN			BIT(31)
  
 diff --git a/include/linux/soc/mediatek/mtk_wed.h b/include/linux/soc/mediatek/mtk_wed.h
-index 2b389e8..bb02ba5 100644
+index 92df4ba..1438692 100644
 --- a/include/linux/soc/mediatek/mtk_wed.h
 +++ b/include/linux/soc/mediatek/mtk_wed.h
 @@ -240,7 +240,7 @@ struct mtk_wed_ops {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3023-mtk-wed-add-dma-mask-limitation-and-GFP_DMA32-for-bo.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3021-mtk-wed-add-dma-mask-limitation-and-GFP_DMA32-for-bo.patch
similarity index 88%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3023-mtk-wed-add-dma-mask-limitation-and-GFP_DMA32-for-bo.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3021-mtk-wed-add-dma-mask-limitation-and-GFP_DMA32-for-bo.patch
index e27c903..af32459 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3023-mtk-wed-add-dma-mask-limitation-and-GFP_DMA32-for-bo.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/wed3/999-3021-mtk-wed-add-dma-mask-limitation-and-GFP_DMA32-for-bo.patch
@@ -1,10 +1,9 @@
-From 57294c4562d1f93ee2deaef67a2ad15fb925c288 Mon Sep 17 00:00:00 2001
-From: "sujuan.chen" <sujuan.chen@mediatek.com>
-Date: Wed, 19 Jul 2023 17:22:59 +0800
-Subject: [PATCH] mtk: wed: add dma mask limitation and GFP_DMA32 for board w/
- >= 4GB dram
+From 659d8d088ee856cbc7598a26a307fd3e20a70e8e Mon Sep 17 00:00:00 2001
+From: Sujuan Chen <sujuan.chen@mediatek.com>
+Date: Mon, 18 Sep 2023 13:23:56 +0800
+Subject: [PATCH 22/22] mtk: wed: add dma mask limitation and GFP_DMA32 for
+ board >= 4GB dram
 
-Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
 ---
  drivers/net/ethernet/mediatek/mtk_wed.c     | 8 ++++++--
  drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 4 ++--
@@ -13,7 +12,7 @@
  4 files changed, 11 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
-index 45dfa0c..d4d8658 100644
+index 0d101d5..2ec7148 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
 @@ -472,7 +472,7 @@ mtk_wed_tx_buffer_alloc(struct mtk_wed_device *dev)
@@ -34,7 +33,7 @@
  		if (!page)
  			return -ENOMEM;
  
-@@ -2239,6 +2239,10 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+@@ -2249,6 +2249,10 @@ mtk_wed_attach(struct mtk_wed_device *dev)
  	dev->wdma_idx = hw->index;
  	dev->ver = hw->version;