[][MAC80211][app][Add MT7988 case in smp-mt76.sh]

[Description]
Add MT7988 case in smp-mt76.sh
With this patch, it would use the following setting
- wireless interface (wlan* and phy*)
  - rps = 0x7
  - smp_affinity = 0
- ethernet interface
  - rps = 0
  - smp_affinity = 4 and 8

[Release-log]
N/A

Change-Id: I2dbccbd883f90c9d13a8c6537868951fe03bb463
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7015710
diff --git a/target/linux/mediatek/base-files/sbin/smp-mt76.sh b/target/linux/mediatek/base-files/sbin/smp-mt76.sh
index 66e00d2..ea94f18 100755
--- a/target/linux/mediatek/base-files/sbin/smp-mt76.sh
+++ b/target/linux/mediatek/base-files/sbin/smp-mt76.sh
@@ -14,6 +14,7 @@
 WIFI_RADIO3=0
 WED_ENABLE=0
 
+module_param=/sys/module/mt7915e/parameters/wed_enable
 get_if_info()
 {
 	# try to get all wifi and eth net interface.
@@ -39,9 +40,10 @@
 		if [[ $v == *"wmac"* ]]; then
 			WIFI_RADIO1=1
 		fi
+
 		if [[ $v == *"wbsys"* ]]; then
-                        WIFI_RADIO1=1
-                fi
+			WIFI_RADIO1=1
+		fi
 
 		if [[ $v == *"pci0000"* ]]; then
 			WIFI_RADIO2=1
@@ -52,7 +54,10 @@
 		fi
 	done;
 
-	WED_ENABLE_LIST=`cat /sys/module/mt7915e/parameters/wed_enable`
+	WED_ENABLE_LIST=
+	if [[ -f "$module_param" ]]; then
+		WED_ENABLE_LIST=`cat $module_param`
+	fi
 	for v in $WED_ENABLE_LIST;
 	do
 		dbg2 "wed enable ori info $v"
@@ -84,6 +89,75 @@
 	dbg2 "CPU${1}_RPS=\"\$CPU${1}_RPS $2\""
 }
 
+MT7988()
+{
+	num_of_wifi=$1
+	DEFAULT_RPS=0
+
+	#Physical IRQ# setting
+	eth0_irq=229
+	eth1_irq=230
+	eth2_irq=231
+	wifi1_irq_pcie0=524288
+	wifi1_irq_pcie1=134742016
+	wifi2_irq_pcie0=
+	wifi2_irq_pcie1=
+
+	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
+
+	else
+		dbg2 "WED_ENABLE OFF irq/iptable seting"
+	fi
+
+	for vif in $NET_IF_LIST;
+	do
+		if [[ "$vif" == "wlan*" ]] || [[ "$vif" == "phy*" ]]; then
+			WIFI_IF_LIST="$WIFI_IF_LIST $vif"
+		fi
+	done;
+	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="$eth0_irq"
+		CPU1_AFFINITY="$eth1_irq"
+		CPU2_AFFINITY="$eth2_irq"
+		CPU3_AFFINITY=""
+
+		CPU0_RPS="$RPS_IF_LIST"
+		CPU1_RPS="$RPS_IF_LIST"
+		CPU2_RPS="$RPS_IF_LIST"
+		CPU3_RPS="$RPS_IF_LIST"
+	else
+		#we bound all wifi card to cpu0 and bound eth to cpu
+		CPU0_AFFINITY=""
+		CPU1_AFFINITY=""
+		CPU2_AFFINITY="$eth1_irq"
+		CPU3_AFFINITY="$eth0_irq $eth2_irq"
+
+		CPU0_RPS="$WIFI_IF_LIST"
+		CPU1_RPS="$WIFI_IF_LIST"
+		CPU2_RPS="$WIFI_IF_LIST"
+		CPU3_RPS=""
+	fi
+	dbg2 "CPU0_AFFINITY = $CPU0_AFFINITY"
+	dbg2 "CPU1_AFFINITY = $CPU1_AFFINITY"
+	dbg2 "CPU2_AFFINITY = $CPU2_AFFINITY"
+	dbg2 "CPU3_AFFINITY = $CPU3_AFFINITY"
+}
+
 MT7986()
 {
 	num_of_wifi=$1
@@ -254,7 +328,10 @@
 	board=$(board_name)
 	num_of_wifi=$NUM_WIFI_CARD
 
-	if [[ $board == "*7986*" ]]; then
+	if [[ $board == "*7988*" ]]; then
+		dbg "setup_model: MT7988 NUM_WIFI_CARD=$num_of_wifi"
+		MT7988 $num_of_wifi
+	elif [[ $board == "*7986*" ]]; then
 		dbg "setup_model: MT7986 NUM_WIFI_CARD=$num_of_wifi"
 		MT7986 $num_of_wifi
 	elif [[ $board == "*7981*" ]]; then