1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Mon, 20 Mar 2023 15:37:55 +0100
3 Subject: [PATCH] net: ethernet: mediatek: mtk_ppe: prefer newly added l2
4 flows over existing ones
6 When a device is roaming between interfaces and a new flow entry is created,
7 we should assume that its output device is more up to date than whatever
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
13 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
14 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
15 @@ -656,10 +656,20 @@ void mtk_foe_entry_clear(struct mtk_ppe
17 mtk_foe_entry_commit_l2(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
19 + struct mtk_flow_entry *prev;
21 entry->type = MTK_FLOW_TYPE_L2;
23 - return rhashtable_insert_fast(&ppe->l2_flows, &entry->l2_node,
24 - mtk_flow_l2_ht_params);
25 + prev = rhashtable_lookup_get_insert_fast(&ppe->l2_flows, &entry->l2_node,
26 + mtk_flow_l2_ht_params);
31 + return PTR_ERR(prev);
33 + return rhashtable_replace_fast(&ppe->l2_flows, &prev->l2_node,
34 + &entry->l2_node, mtk_flow_l2_ht_params);
37 int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)