From 4fb58813f94ac6cc8167138e23a92189fe50b258 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 17 Sep 2020 19:14:13 +0200 Subject: mediatek: fix hardware flow offload Add support for dealing with DSA ports Signed-off-by: Felix Fietkau --- target/linux/mediatek/patches-5.4/0999-hnat.patch | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'target/linux/mediatek') diff --git a/target/linux/mediatek/patches-5.4/0999-hnat.patch b/target/linux/mediatek/patches-5.4/0999-hnat.patch index 685c741043..f86c882eb2 100644 --- a/target/linux/mediatek/patches-5.4/0999-hnat.patch +++ b/target/linux/mediatek/patches-5.4/0999-hnat.patch @@ -321,7 +321,7 @@ #endif /* MTK_ETH_H */ --- /dev/null +++ b/drivers/net/ethernet/mediatek/mtk_offload.c -@@ -0,0 +1,593 @@ +@@ -0,0 +1,609 @@ +/* This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License @@ -430,6 +430,22 @@ + } + } + ++ if (dest->flags & FLOW_OFFLOAD_PATH_DSA) { ++ entry->bfib1.vlan_layer = 1; ++ ++ entry->ipv4_hnapt.bfib1.vpm = 0; ++ entry->ipv4_hnapt.etype = BIT(dest->dsa_port); ++ ++ if (dest->flags & FLOW_OFFLOAD_PATH_VLAN) { ++ if (dest->vlan_proto != htons(ETH_P_8021Q)) ++ return -EINVAL; ++ ++ entry->ipv4_hnapt.etype |= BIT(8); ++ } else { ++ entry->ipv4_hnapt.vlan1 = 0; ++ } ++ } ++ + return 0; +} + -- cgit v1.2.3