Skip to content

Commit 504a577

Browse files
LorenzoBianconiPaolo Abeni
authored andcommitted
net: airoha: Fix IPv6 hw acceleration in bridge mode
ib2 and airoha_foe_mac_info_common have not the same offsets in airoha_foe_bridge and airoha_foe_ipv6 structures. Current codebase does not accelerate IPv6 traffic in bridge mode since ib2 and l2 info are not set properly copying airoha_foe_bridge struct into airoha_foe_ipv6 one in airoha_ppe_foe_commit_subflow_entry routine. Fix IPv6 hw acceleration in bridge mode resolving ib2 and airoha_foe_mac_info_common overwrite in airoha_ppe_foe_commit_subflow_entry() and configuring them with proper values. Fixes: cd53f62 ("net: airoha: Add L2 hw acceleration support") Signed-off-by: Lorenzo Bianconi <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent a869d3a commit 504a577

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

drivers/net/ethernet/airoha/airoha_ppe.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,6 @@ airoha_ppe_foe_commit_subflow_entry(struct airoha_ppe *ppe,
639639
u32 mask = AIROHA_FOE_IB1_BIND_PACKET_TYPE | AIROHA_FOE_IB1_BIND_UDP;
640640
struct airoha_foe_entry *hwe_p, hwe;
641641
struct airoha_flow_table_entry *f;
642-
struct airoha_foe_mac_info *l2;
643642
int type;
644643

645644
hwe_p = airoha_ppe_foe_get_entry(ppe, hash);
@@ -656,18 +655,20 @@ airoha_ppe_foe_commit_subflow_entry(struct airoha_ppe *ppe,
656655

657656
memcpy(&hwe, hwe_p, sizeof(*hwe_p));
658657
hwe.ib1 = (hwe.ib1 & mask) | (e->data.ib1 & ~mask);
659-
l2 = &hwe.bridge.l2;
660-
memcpy(l2, &e->data.bridge.l2, sizeof(*l2));
661658

662659
type = FIELD_GET(AIROHA_FOE_IB1_BIND_PACKET_TYPE, hwe.ib1);
663-
if (type == PPE_PKT_TYPE_IPV4_HNAPT)
664-
memcpy(&hwe.ipv4.new_tuple, &hwe.ipv4.orig_tuple,
665-
sizeof(hwe.ipv4.new_tuple));
666-
else if (type >= PPE_PKT_TYPE_IPV6_ROUTE_3T &&
667-
l2->common.etype == ETH_P_IP)
668-
l2->common.etype = ETH_P_IPV6;
669-
670-
hwe.bridge.ib2 = e->data.bridge.ib2;
660+
if (type >= PPE_PKT_TYPE_IPV6_ROUTE_3T) {
661+
memcpy(&hwe.ipv6.l2, &e->data.bridge.l2, sizeof(hwe.ipv6.l2));
662+
hwe.ipv6.ib2 = e->data.bridge.ib2;
663+
} else {
664+
memcpy(&hwe.bridge.l2, &e->data.bridge.l2,
665+
sizeof(hwe.bridge.l2));
666+
hwe.bridge.ib2 = e->data.bridge.ib2;
667+
if (type == PPE_PKT_TYPE_IPV4_HNAPT)
668+
memcpy(&hwe.ipv4.new_tuple, &hwe.ipv4.orig_tuple,
669+
sizeof(hwe.ipv4.new_tuple));
670+
}
671+
671672
hwe.bridge.data = e->data.bridge.data;
672673
airoha_ppe_foe_commit_entry(ppe, &hwe, hash);
673674

0 commit comments

Comments
 (0)