Merge "[Refactor and sync kernel/wifi from Openwrt]"
diff --git a/recipes-bsp/u-boot/files/fw_env.config b/recipes-bsp/u-boot/files/fw_env.config
new file mode 100644
index 0000000..0887e7a
--- /dev/null
+++ b/recipes-bsp/u-boot/files/fw_env.config
@@ -0,0 +1 @@
+/dev/ubi0_0 0 0x80000 0x80000 1
\ No newline at end of file
diff --git a/recipes-bsp/u-boot/libubootenv_%.bbappend b/recipes-bsp/u-boot/libubootenv_%.bbappend
new file mode 100644
index 0000000..c5d96ad
--- /dev/null
+++ b/recipes-bsp/u-boot/libubootenv_%.bbappend
@@ -0,0 +1,18 @@
+SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities"
+
+
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+SRC_URI += "file://fw_env.config"
+
+
+
+
+
+
+do_install_append () {
+	install -d ${D}${sysconfdir}
+	install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
+}
+
+
diff --git a/recipes-devtools/smp/files/smp-mt76.sh b/recipes-devtools/smp/files/smp-mt76.sh
index 819cf22..a03bd7c 100644
--- a/recipes-devtools/smp/files/smp-mt76.sh
+++ b/recipes-devtools/smp/files/smp-mt76.sh
@@ -12,6 +12,7 @@
 WIFI_RADIO1=0
 WIFI_RADIO2=0
 WIFI_RADIO3=0
+WED_ENABLE=0
 
 get_if_info()
 {
@@ -51,10 +52,19 @@
 		fi
 	done;
 
+	WED_ENABLE_LIST=`cat /sys/module/mt7915e/parameters/wed_enable`
+	for v in $WED_ENABLE_LIST;
+	do
+		dbg2 "wed enable ori info $v"
+		if [[ $v == "Y" ]]; then
+			WED_ENABLE=1
+		fi
+	done;
 	dbg2 "NUM_WIFI_CARD = $NUM_WIFI_CARD"
 	dbg2 "platform wifi enable = $WIFI_RADIO1"
 	dbg2 "pcie1 wifi enable = $WIFI_RADIO2"
 	dbg2 "pcie2 wifi enable = $WIFI_RADIO3"
+	dbg2 "WED enable = $WED_ENABLE"
 }
 
 # $1: CPU#
@@ -85,17 +95,46 @@
 	wifi1_irq=
 	wifi2_irq=
 	wifi3_irq=
-	#AX6000 AX7800
-	if [[ "$WIFI_RADIO1" -eq "1" ]]; then
-		wifi1_irq=245
-	fi
-	#AX7800
-	if [[ "$WIFI_RADIO2" -eq "1" ]]; then
-		wifi2_irq=246
-	fi
-	#AX7800
-	if [[ "$WIFI_RADIO3" -eq "1" ]]; then
-		wifi3_irq=247
+
+	if [[ "$WED_ENABLE" -eq "1" ]]; then
+		dbg2 "WED_ENABLE ON irq/iptable setting"
+		#TCP Binding
+		iptables -D FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw
+		iptables -I FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw
+		ip6tables -D FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw
+		ip6tables -I FORWARD -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j FLOWOFFLOAD --hw
+		#UDP Binding
+		iptables -D FORWARD -p udp -j FLOWOFFLOAD --hw
+		iptables -I FORWARD -p udp -j FLOWOFFLOAD --hw
+		ip6tables -D FORWARD -p udp -j FLOWOFFLOAD --hw
+		ip6tables -I FORWARD -p udp -j FLOWOFFLOAD --hw
+
+		#AX6000 AX7800 - SOC
+		if [[ "$WIFI_RADIO1" -eq "1" ]]; then
+			wifi1_irq=238
+		fi
+		#AX7800 - PCIE0
+		if [[ "$WIFI_RADIO2" -eq "1" ]]; then
+			wifi2_irq=237
+		fi
+		#AX7800 - PCIE1
+		#if [[ "$WIFI_RADIO3" -eq "1" ]]; then
+		#	wifi3_irq=239
+		#fi
+	else
+		dbg2 "WED_ENABLE OFF irq/iptable seting"
+		#AX6000 AX7800 - SOC
+		if [[ "$WIFI_RADIO1" -eq "1" ]]; then
+			wifi1_irq=245
+		fi
+		#AX7800 - PCIE0
+		if [[ "$WIFI_RADIO2" -eq "1" ]]; then
+			wifi2_irq=246
+		fi
+		#AX7800 - PCIE1
+		#if [[ "$WIFI_RADIO3" -eq "1" ]]; then
+		#	wifi3_irq=247
+		#fi
 	fi
 	# Please update the CPU binding in each cases.
 	# CPU#_AFFINITY="add binding irq number here"