mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 06:33:41 +00:00
64ed3d8056
Signed-off-by: Felix Fietkau <nbd@nbd.name>
64 lines
1.8 KiB
Diff
64 lines
1.8 KiB
Diff
From: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
Date: Sun, 18 Apr 2021 23:11:44 +0200
|
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: missing mutex
|
|
|
|
Patch 2ed37183abb7 ("netfilter: flowtable: separate replace, destroy and
|
|
stats to different workqueues") splits the workqueue per event type. Add
|
|
a mutex to serialize updates.
|
|
|
|
Fixes: 502e84e2382d ("net: ethernet: mtk_eth_soc: add flow offloading support")
|
|
Reported-by: Frank Wunderlich <frank-w@public-files.de>
|
|
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
|
|
@@ -392,6 +392,8 @@ mtk_flow_offload_stats(struct mtk_eth *e
|
|
return 0;
|
|
}
|
|
|
|
+static DEFINE_MUTEX(mtk_flow_offload_mutex);
|
|
+
|
|
static int
|
|
mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv)
|
|
{
|
|
@@ -399,6 +401,7 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_
|
|
struct net_device *dev = cb_priv;
|
|
struct mtk_mac *mac = netdev_priv(dev);
|
|
struct mtk_eth *eth = mac->hw;
|
|
+ int err;
|
|
|
|
if (!tc_can_offload(dev))
|
|
return -EOPNOTSUPP;
|
|
@@ -406,18 +409,24 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_
|
|
if (type != TC_SETUP_CLSFLOWER)
|
|
return -EOPNOTSUPP;
|
|
|
|
+ mutex_lock(&mtk_flow_offload_mutex);
|
|
switch (cls->command) {
|
|
case FLOW_CLS_REPLACE:
|
|
- return mtk_flow_offload_replace(eth, cls);
|
|
+ err = mtk_flow_offload_replace(eth, cls);
|
|
+ break;
|
|
case FLOW_CLS_DESTROY:
|
|
- return mtk_flow_offload_destroy(eth, cls);
|
|
+ err = mtk_flow_offload_destroy(eth, cls);
|
|
+ break;
|
|
case FLOW_CLS_STATS:
|
|
- return mtk_flow_offload_stats(eth, cls);
|
|
+ err = mtk_flow_offload_stats(eth, cls);
|
|
+ break;
|
|
default:
|
|
- return -EOPNOTSUPP;
|
|
+ err = -EOPNOTSUPP;
|
|
+ break;
|
|
}
|
|
+ mutex_unlock(&mtk_flow_offload_mutex);
|
|
|
|
- return 0;
|
|
+ return err;
|
|
}
|
|
|
|
static int
|