aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-07-08 07:32:39 +0200
committerFelix Fietkau <nbd@nbd.name>2021-07-08 07:38:41 +0200
commitf4e3ff5b075bbab279bd06a7d3e0d9c950ee098c (patch)
tree9f6cce7b72c5fbaf1252cba940b6fc7498697e16
parent64ed3d80567280e5cccb4c4642464223862dabc6 (diff)
downloadupstream-f4e3ff5b075bbab279bd06a7d3e0d9c950ee098c.tar.gz
upstream-f4e3ff5b075bbab279bd06a7d3e0d9c950ee098c.tar.bz2
upstream-f4e3ff5b075bbab279bd06a7d3e0d9c950ee098c.zip
mediatek: prevent duplicate hardware flow offload entries
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--target/linux/generic/pending-5.10/700-net-ethernet-mtk_eth_soc-avoid-creating-duplicate-of.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/target/linux/generic/pending-5.10/700-net-ethernet-mtk_eth_soc-avoid-creating-duplicate-of.patch b/target/linux/generic/pending-5.10/700-net-ethernet-mtk_eth_soc-avoid-creating-duplicate-of.patch
new file mode 100644
index 0000000000..ff090f07f1
--- /dev/null
+++ b/target/linux/generic/pending-5.10/700-net-ethernet-mtk_eth_soc-avoid-creating-duplicate-of.patch
@@ -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;
+