Skip to content

Commit

Permalink
mediatek: prevent duplicate hardware flow offload entries
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Jul 8, 2021
1 parent 64ed3d8 commit f4e3ff5
Showing 1 changed file with 26 additions and 0 deletions.
@@ -0,0 +1,26 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 8 Jul 2021 07:08:29 +0200
Subject: [PATCH] net: ethernet: mtk_eth_soc: avoid creating duplicate offload
entries

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")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---

--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
@@ -187,6 +187,9 @@ mtk_flow_offload_replace(struct mtk_eth
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;

0 comments on commit f4e3ff5

Please sign in to comment.