I compared offloading code with BPI-R2 5.12 kernel code and took changes to ours.
--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
@@ -142,6 +142,29 @@
}
static int
+mtk_flow_mangle_ipv6(const struct flow_action_entry *act,
+ struct mtk_flow_data *data)
+{
+ __be32 *dest = 0;
+ size_t offset_of_ip6_daddr = offsetof(struct ipv6hdr, daddr);
+ size_t offset_of_ip6_saddr = offsetof(struct ipv6hdr, saddr);
+ u32 idx;
+
+ if (act->mangle.offset >= offset_of_ip6_saddr && act->mangle.offset < offset_of_ip6_daddr) {
+ idx = (act->mangle.offset - offset_of_ip6_saddr) / 4;
+ dest = &data->v6.src_addr.s6_addr32[idx];
+ } else if (act->mangle.offset >= offset_of_ip6_daddr &&
+ act->mangle.offset < offset_of_ip6_daddr + 16) {
+ idx = (act->mangle.offset - offset_of_ip6_daddr) / 4;
+ dest = &data->v6.dst_addr.s6_addr32[idx];
+ }
+ if (dest)
+ memcpy(dest, &act->mangle.val, sizeof(u32));
+
+ return 0;
+}
+
+static int
mtk_flow_get_dsa_port(struct net_device **dev)
{
#if IS_ENABLED(CONFIG_NET_DSA)
@@ -306,6 +324,7 @@
mtk_flow_set_ipv4_addr(&foe, &data, false);
}
+
if (addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS) {
struct flow_match_ipv6_addrs addrs;
@@ -329,6 +348,9 @@
case FLOW_ACT_MANGLE_HDR_TYPE_IP4:
err = mtk_flow_mangle_ipv4(act, &data);
break;
+ case FLOW_ACT_MANGLE_HDR_TYPE_IP6:
+ err = mtk_flow_mangle_ipv6(act, &data);
+ break;
case FLOW_ACT_MANGLE_HDR_TYPE_ETH:
/* handled earlier */
break;
Now the router is rock stable. I'm using static IPv4 and IPv6-6in4.
Not sure if these changes are the correct fix, but no more kernel panics.