mediatek: fix hardware flow offload

Add support for dealing with DSA ports

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau
2020-09-17 19:14:13 +02:00
parent 520074e57e
commit 4fb58813f9
2 changed files with 95 additions and 1 deletions

View File

@@ -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;
+}
+