From: Felix Fietkau <nbd@nbd.name>
To: netdev@vger.kernel.org, John Crispin <john@phrozen.org>,
Sean Wang <sean.wang@mediatek.com>,
Mark Lee <Mark-MC.Lee@mediatek.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>
Cc: David Bentham <db260179@gmail.com>,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 09/14] net: ethernet: mtk_eth_soc: add ipv6 flow offload support
Date: Tue, 5 Apr 2022 21:57:50 +0200 [thread overview]
Message-ID: <20220405195755.10817-10-nbd@nbd.name> (raw)
In-Reply-To: <20220405195755.10817-1-nbd@nbd.name>
From: David Bentham <db260179@gmail.com>
Add the missing IPv6 flow offloading support for routing only.
Hardware flow offloading is done by the packet processing engine (PPE)
of the Ethernet MAC and as it doesn't support mangling of IPv6 packets,
IPv6 NAT cannot be supported.
Signed-off-by: David Bentham <db260179@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
.../net/ethernet/mediatek/mtk_ppe_offload.c | 28 +++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
index bcf342bb9051..0113cddcebf4 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
@@ -6,6 +6,7 @@
#include <linux/if_ether.h>
#include <linux/rhashtable.h>
#include <linux/ip.h>
+#include <linux/ipv6.h>
#include <net/flow_offload.h>
#include <net/pkt_cls.h>
#include <net/dsa.h>
@@ -20,6 +21,11 @@ struct mtk_flow_data {
__be32 src_addr;
__be32 dst_addr;
} v4;
+
+ struct {
+ struct in6_addr src_addr;
+ struct in6_addr dst_addr;
+ } v6;
};
__be16 src_port;
@@ -65,6 +71,14 @@ mtk_flow_set_ipv4_addr(struct mtk_foe_entry *foe, struct mtk_flow_data *data,
data->v4.dst_addr, data->dst_port);
}
+static int
+mtk_flow_set_ipv6_addr(struct mtk_foe_entry *foe, struct mtk_flow_data *data)
+{
+ return mtk_foe_entry_set_ipv6_tuple(foe,
+ data->v6.src_addr.s6_addr32, data->src_port,
+ data->v6.dst_addr.s6_addr32, data->dst_port);
+}
+
static void
mtk_flow_offload_mangle_eth(const struct flow_action_entry *act, void *eth)
{
@@ -296,6 +310,9 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f)
case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
offload_type = MTK_PPE_PKT_TYPE_IPV4_HNAPT;
break;
+ case FLOW_DISSECTOR_KEY_IPV6_ADDRS:
+ offload_type = MTK_PPE_PKT_TYPE_IPV6_ROUTE_5T;
+ break;
default:
return -EOPNOTSUPP;
}
@@ -331,6 +348,17 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f)
mtk_flow_set_ipv4_addr(&foe, &data, false);
}
+ if (addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS) {
+ struct flow_match_ipv6_addrs addrs;
+
+ flow_rule_match_ipv6_addrs(rule, &addrs);
+
+ data.v6.src_addr = addrs.key->src;
+ data.v6.dst_addr = addrs.key->dst;
+
+ mtk_flow_set_ipv6_addr(&foe, &data);
+ }
+
flow_action_for_each(i, act, &rule->action) {
if (act->id != FLOW_ACTION_MANGLE)
continue;
--
2.35.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-04-05 20:00 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 19:57 [PATCH v2 00/14] MediaTek SoC flow offload improvements + wireless support Felix Fietkau
2022-04-05 19:57 ` [PATCH v2 01/14] dt-bindings: net: mediatek: add optional properties for the SoC ethernet core Felix Fietkau
2022-04-07 17:20 ` Rob Herring
2022-04-08 9:34 ` Lorenzo Bianconi
2022-04-05 19:57 ` [PATCH v2 02/14] net: ethernet: mtk_eth_soc: add support for coherent DMA Felix Fietkau
2022-04-05 19:57 ` [PATCH v2 03/14] arm64: dts: mediatek: mt7622: " Felix Fietkau
2022-04-05 19:57 ` [PATCH v2 04/14] dt-bindings: arm: mediatek: document WED binding for MT7622 Felix Fietkau
2022-04-06 8:09 ` Krzysztof Kozlowski
2022-04-06 8:18 ` Felix Fietkau
2022-04-06 8:29 ` Arnd Bergmann
2022-04-06 8:32 ` Felix Fietkau
2022-04-06 8:57 ` Krzysztof Kozlowski
2022-04-07 16:59 ` Felix Fietkau
2022-04-07 15:50 ` Andrew Lunn
2022-04-07 16:10 ` Felix Fietkau
2022-04-05 19:57 ` [PATCH v2 05/14] dt-bindings: arm: mediatek: document the pcie mirror node on MT7622 Felix Fietkau
2022-04-06 8:20 ` Krzysztof Kozlowski
2022-04-06 11:01 ` Felix Fietkau
2022-04-07 17:16 ` Rob Herring
2022-04-07 17:29 ` Felix Fietkau
2022-04-07 17:19 ` Rob Herring
2022-04-08 9:03 ` Felix Fietkau
2022-04-05 19:57 ` [PATCH v2 06/14] net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED) Felix Fietkau
2022-04-05 19:57 ` [PATCH v2 07/14] net: ethernet: mtk_eth_soc: implement flow offloading to WED devices Felix Fietkau
2022-04-05 19:57 ` [PATCH v2 08/14] arm64: dts: mediatek: mt7622: introduce nodes for Wireless Ethernet Dispatch Felix Fietkau
2022-04-05 19:57 ` Felix Fietkau [this message]
2022-04-05 19:57 ` [PATCH v2 10/14] net: ethernet: mtk_eth_soc: support TC_SETUP_BLOCK for PPE offload Felix Fietkau
2022-04-05 19:57 ` [PATCH v2 11/14] net: ethernet: mtk_eth_soc: allocate struct mtk_ppe separately Felix Fietkau
2022-04-05 19:57 ` [PATCH v2 12/14] net: ethernet: mtk_eth_soc: rework hardware flow table management Felix Fietkau
2022-04-05 19:57 ` [PATCH v2 13/14] net: ethernet: mtk_eth_soc: remove bridge flow offload type entry support Felix Fietkau
2022-04-05 19:57 ` [PATCH v2 14/14] net: ethernet: mtk_eth_soc: support creating mac address based offload entries Felix Fietkau
2022-04-07 18:10 ` Andrew Lunn
2022-04-07 18:21 ` Felix Fietkau
2022-04-11 13:00 ` Andrew Lunn
2022-04-12 7:13 ` Felix Fietkau
2022-04-12 13:07 ` Andrew Lunn
2022-04-12 13:49 ` Felix Fietkau
2022-04-12 14:21 ` Andrew Lunn
2022-04-12 15:51 ` Felix Fietkau
2022-04-12 17:37 ` Andrew Lunn
2022-04-12 17:51 ` Felix Fietkau
2022-04-06 13:30 ` [PATCH v2 00/14] MediaTek SoC flow offload improvements + wireless support patchwork-bot+netdevbpf
2022-04-07 15:57 ` Andrew Lunn
2022-04-07 17:00 ` Felix Fietkau
2022-04-07 17:28 ` Andrew Lunn
2022-04-07 17:34 ` Felix Fietkau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220405195755.10817-10-nbd@nbd.name \
--to=nbd@nbd.name \
--cc=Mark-MC.Lee@mediatek.com \
--cc=davem@davemloft.net \
--cc=db260179@gmail.com \
--cc=john@phrozen.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sean.wang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).