[][HIGH][kernel][mt7988][hnat][Remove unnecessary paths for the keep_ecn/keep_dscp features]
[Description]
Remove unnecessary paths for the keep_ecn/keep_dscp features.
Without this patch, MAPE egress IP might get corrupted when populating
the keep_ecn/keep_dscp field.
[Release-log]
N/A
Change-Id: I8965e2d9b0f28c1f3525392e54b7fbc25f52223b
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9346313
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
index 5d9de7d..f7ca61c 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
@@ -389,9 +389,9 @@
u32 resv3_1 : 9;
u32 eg_keep_ecn : 1;
u32 eg_keep_dscp : 1;
- u32 resv3_2:13;
+ u32 resv3_2 : 13;
#else
- u32 resv3:24;
+ u32 resv3 : 24;
#endif
u32 act_dp : 8; /* UDF */
u16 vlan1;
@@ -448,12 +448,12 @@
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_cls : 1;
- u32 resv2_2 : 13;
+ u32 resv2_1 : 1;
+ u32 eg_keep_ecn : 1;
+ u32 eg_keep_cls : 1;
+ u32 resv2_2 : 13;
#else
- u32 resv2 : 16;
+ u32 resv2 : 16;
#endif
u32 act_dp : 8; /* UDF */
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
index f831d4a..cbebcd4 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
@@ -1301,10 +1301,6 @@
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
@@ -1373,17 +1369,16 @@
entry.ipv4_hnapt.new_sport = ntohs(pptr->src);
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
} else {
return 0;
}
entry.ipv4_hnapt.bfib1.udp = udp;
-
-#if defined(CONFIG_MEDIATEK_NETSYS_V3)
- entry.ipv4_hnapt.eg_keep_ecn = 1;
- entry.ipv4_hnapt.eg_keep_dscp = 1;
-#endif
-
break;
default:
@@ -1427,11 +1422,6 @@
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 =
@@ -1452,24 +1442,21 @@
entry.ipv6_3t_route.ipv6_dip3 =
foe->ipv6_3t_route.ipv6_dip3;
+#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_3T_ROUTE(&entry)) {
entry.ipv6_3t_route.prot =
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
} else if (IS_IPV6_5T_ROUTE(&entry) || IS_IPV6_6RD(&entry)) {
entry.ipv6_5t_route.sport =
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
} else {
return 0;
}
@@ -1512,10 +1499,6 @@
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
@@ -1583,10 +1566,6 @@
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 &&