Commit e2853114 authored by Felix Fietkau's avatar Felix Fietkau Committed by David S. Miller

net: ethernet: mtk_eth_soc: mtk_ppe: prefer newly added l2 flows

When a device is roaming between interfaces and a new flow entry is
created, we should assume that its output device is more up to date than
whatever entry existed already.
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 05f3ab77
...@@ -635,10 +635,20 @@ void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) ...@@ -635,10 +635,20 @@ void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
static int static int
mtk_foe_entry_commit_l2(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) mtk_foe_entry_commit_l2(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
{ {
struct mtk_flow_entry *prev;
entry->type = MTK_FLOW_TYPE_L2; entry->type = MTK_FLOW_TYPE_L2;
return rhashtable_insert_fast(&ppe->l2_flows, &entry->l2_node, prev = rhashtable_lookup_get_insert_fast(&ppe->l2_flows, &entry->l2_node,
mtk_flow_l2_ht_params); mtk_flow_l2_ht_params);
if (likely(!prev))
return 0;
if (IS_ERR(prev))
return PTR_ERR(prev);
return rhashtable_replace_fast(&ppe->l2_flows, &prev->l2_node,
&entry->l2_node, mtk_flow_l2_ht_params);
} }
int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment