Skip to contentSkip to conversation

net: ethernet: mtk_eth_soc: avoid creating duplicate offload entries

PATCH Applied Ilya Lipnitskiy 2 participants 2 messages Sep 22, 2021 – Sep 23, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethernet: mtk_eth_soc: avoid creating duplicate offload entries

From: Felix Fietkau <[email protected]>

Sometimes multiple CLS_REPLACE calls are issued for the same connection. rhashtable_insert_fast does not check for these duplicates, so multiple hardware flow entries can be created.
Fix this by checking for an existing entry early

Fixes 502e84e2382d ("net: ethernet: mtk_eth_soc: add flow offloading support")
---
 drivers/net/ethernet/mediatek/mtk_ppe_offload.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/mediatek/mtk_ppe_offload.c +3 -0
index b5f68f66d42a..7bb1f20002b5 100644
@@ -186,6 +186,9 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f)
 	int hash;
 	int i;
 
+	if (rhashtable_lookup(&eth->flow_table, &f->cookie, mtk_flow_ht_params))
+		return -EEXIST;
+
 	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_META)) {
 		struct flow_match_meta match;
 
Signature · 1 line
2.33.0
#1 lore raw
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 8 lines · On Wed, 22 Sep 2021 16:55:48 -0700 you wrote:

From: Felix Fietkau <[email protected]>

Sometimes multiple CLS_REPLACE calls are issued for the same connection. rhashtable_insert_fast does not check for these duplicates, so multiple hardware flow entries can be created.
Fix this by checking for an existing entry early

[...]

Here is the summary with links:
- [net] net: ethernet: mtk_eth_soc: avoid creating duplicate offload entries

    https://git.kernel.org/netdev/net/c/e68daf61ed13

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html