[][Change NF-HNAT binding flow]

[Description]
Change NF-HNAT binding flow to prevent INFO1 field
(e.g., vlan layer) being modified by PPE BNDR counter
when a new packet arrives.

[Release-log]
N/A

Change-Id: Iba8f9d16e19bf91a6cd45402478ca7e5a5691989
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/4643336
diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
index 73fe7af..7ced311 100644
--- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
+++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
@@ -1511,6 +1511,13 @@
 #endif
 	}
 
+	/* The INFO2.port_mg and 2nd VLAN ID fields of PPE entry are redefined
+	 * by Wi-Fi whnat engine. These data and INFO2.dp will be updated and
+	 * the entry is set to BIND state in mtk_sw_nat_hook_tx().
+	 */
+	if (!whnat)
+		entry.bfib1.state = BIND;
+
 	memcpy(foe, &entry, sizeof(entry));
 	/*reset statistic for this entry*/
 	if (hnat_priv->data->per_flow_accounting)
@@ -1518,12 +1525,6 @@
 		       0, sizeof(struct mib_entry));
 
 	wmb();
-	/* The INFO2.port_mg and 2nd VLAN ID fields of PPE entry are redefined
-	 * by Wi-Fi whnat engine. These data and INFO2.dp will be updated and
-	 * the entry is set to BIND state in mtk_sw_nat_hook_tx().
-	 */
-	if (!whnat)
-		foe->bfib1.state = BIND;
 
 	return 0;
 }
@@ -1578,6 +1579,9 @@
 		break;
 	}
 
+	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;