1 From 504a577c9b000f9e0e99e1b28616fb4eb369e1ef Mon Sep 17 00:00:00 2001
2 From: Lorenzo Bianconi <lorenzo@kernel.org>
3 Date: Mon, 2 Jun 2025 12:55:38 +0200
4 Subject: [PATCH 2/3] net: airoha: Fix IPv6 hw acceleration in bridge mode
6 ib2 and airoha_foe_mac_info_common have not the same offsets in
7 airoha_foe_bridge and airoha_foe_ipv6 structures. Current codebase does
8 not accelerate IPv6 traffic in bridge mode since ib2 and l2 info are not
9 set properly copying airoha_foe_bridge struct into airoha_foe_ipv6 one
10 in airoha_ppe_foe_commit_subflow_entry routine.
11 Fix IPv6 hw acceleration in bridge mode resolving ib2 and
12 airoha_foe_mac_info_common overwrite in
13 airoha_ppe_foe_commit_subflow_entry() and configuring them with proper
16 Fixes: cd53f622611f ("net: airoha: Add L2 hw acceleration support")
17 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
18 Reviewed-by: Simon Horman <horms@kernel.org>
19 Link: https://patch.msgid.link/20250602-airoha-flowtable-ipv6-fix-v2-2-3287f8b55214@kernel.org
20 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
22 drivers/net/ethernet/airoha/airoha_ppe.c | 23 ++++++++++++-----------
23 1 file changed, 12 insertions(+), 11 deletions(-)
25 --- a/drivers/net/ethernet/airoha/airoha_ppe.c
26 +++ b/drivers/net/ethernet/airoha/airoha_ppe.c
27 @@ -639,7 +639,6 @@ airoha_ppe_foe_commit_subflow_entry(stru
28 u32 mask = AIROHA_FOE_IB1_BIND_PACKET_TYPE | AIROHA_FOE_IB1_BIND_UDP;
29 struct airoha_foe_entry *hwe_p, hwe;
30 struct airoha_flow_table_entry *f;
31 - struct airoha_foe_mac_info *l2;
34 hwe_p = airoha_ppe_foe_get_entry(ppe, hash);
35 @@ -656,18 +655,20 @@ airoha_ppe_foe_commit_subflow_entry(stru
37 memcpy(&hwe, hwe_p, sizeof(*hwe_p));
38 hwe.ib1 = (hwe.ib1 & mask) | (e->data.ib1 & ~mask);
39 - l2 = &hwe.bridge.l2;
40 - memcpy(l2, &e->data.bridge.l2, sizeof(*l2));
42 type = FIELD_GET(AIROHA_FOE_IB1_BIND_PACKET_TYPE, hwe.ib1);
43 - if (type == PPE_PKT_TYPE_IPV4_HNAPT)
44 - memcpy(&hwe.ipv4.new_tuple, &hwe.ipv4.orig_tuple,
45 - sizeof(hwe.ipv4.new_tuple));
46 - else if (type >= PPE_PKT_TYPE_IPV6_ROUTE_3T &&
47 - l2->common.etype == ETH_P_IP)
48 - l2->common.etype = ETH_P_IPV6;
49 + if (type >= PPE_PKT_TYPE_IPV6_ROUTE_3T) {
50 + memcpy(&hwe.ipv6.l2, &e->data.bridge.l2, sizeof(hwe.ipv6.l2));
51 + hwe.ipv6.ib2 = e->data.bridge.ib2;
53 + memcpy(&hwe.bridge.l2, &e->data.bridge.l2,
54 + sizeof(hwe.bridge.l2));
55 + hwe.bridge.ib2 = e->data.bridge.ib2;
56 + if (type == PPE_PKT_TYPE_IPV4_HNAPT)
57 + memcpy(&hwe.ipv4.new_tuple, &hwe.ipv4.orig_tuple,
58 + sizeof(hwe.ipv4.new_tuple));
61 - hwe.bridge.ib2 = e->data.bridge.ib2;
62 hwe.bridge.data = e->data.bridge.data;
63 airoha_ppe_foe_commit_entry(ppe, &hwe, hash);