[][Add support for wifi vlan]
[Description]
Add support for wifi vlan.
Wifi driver or kernel will add vlan_tci in skb. Hence we need to
fill vlag info to PPE entry in mtk_sw_nat_hook_tx().
If not, packets will not carry the vlan tag after hnat is bound.
[Release-log]
N/A
Change-Id: I728618a05bfbdd60e54acc6c2c1448fd1daa5d91
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/5175027
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 edc97b6..a904189 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
@@ -1617,8 +1617,26 @@
break;
}
- entry->bfib1.vpm = 0;
- entry->bfib1.vlan_layer = 0;
+ if (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);
+ if(entry->ipv4_hnapt.vlan1)
+ entry->ipv4_hnapt.vlan2 = skb->vlan_tci;
+ else
+ entry->ipv4_hnapt.vlan1 = skb->vlan_tci;
+ } else if (IS_IPV6_GRP(entry)) {
+ entry->ipv6_5t_route.etype = htons(ETH_P_8021Q);
+ if(entry->ipv6_5t_route.vlan1)
+ entry->ipv6_5t_route.vlan2 = skb->vlan_tci;
+ else
+ entry->ipv6_5t_route.vlan1 = skb->vlan_tci;
+ }
+ } else {
+ entry->bfib1.vpm = 0;
+ entry->bfib1.vlan_layer = 0;
+ }
/* MT7622 wifi hw_nat not support QoS */
if (IS_IPV4_GRP(entry)) {