mtk_ppe_offload fixes
Subsystems (4)
cover mtk_ppe_offload fixes
Hi,
A few incremental fixes for the initial flowtable offload support and this driver:
1) Fix undefined reference to `dsa_port_from_netdev' due to missing dependencies in Kconfig, reported by Kbuild robot.
2) Missing mutex to serialize flow events via workqueue to the driver.
3) Handle FLOW_ACTION_VLAN_POP tag action.
Please apply, thanks!
Pablo Neira Ayuso (3):
net: ethernet: mtk_eth_soc: fix undefined reference to `dsa_port_from_netdev'
net: ethernet: mtk_eth_soc: missing mutex
net: ethernet: mtk_eth_soc: handle VLAN pop action
drivers/net/ethernet/mediatek/Kconfig | 1 + .../net/ethernet/mediatek/mtk_ppe_offload.c | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/3 net: ethernet: mtk_eth_soc: fix undefined reference to `dsa_port_from_netdev'
Caused by:
CONFIG_NET_DSA=m
CONFIG_NET_MEDIATEK_SOC=y
mtk_ppe_offload.c:undefined reference to `dsa_port_from_netdev'
--- drivers/net/ethernet/mediatek/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mediatek/Kconfig +1 -0
@@ -9,6 +9,7 @@ if NET_VENDOR_MEDIATEK config NET_MEDIATEK_SOC tristate "MediaTek SoC Gigabit Ethernet support" + depends on NET_DSA || !NET_DSA select PHYLINK help This driver supports the gigabit ethernet MACs in the
Signature · 1 line
2.20.1
PATCH 2/3 net: ethernet: mtk_eth_soc: missing mutex
In reply to Pablo Neira AyusoPatch 2ed37183abb7 ("netfilter: flowtable: separate replace, destroy and stats to different workqueues") splits the workqueue per event type. Add a mutex to serialize updates.
--- .../net/ethernet/mediatek/mtk_ppe_offload.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/net/ethernet/mediatek/mtk_ppe_offload.c +14 -5
@@ -391,6 +391,8 @@ mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f)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) {
@@ -398,6 +400,7 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_pristruct 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 ;
@@ -405,18 +408,24 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priif (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
Signature · 1 line
2.20.1
PATCH 3/3 net: ethernet: mtk_eth_soc: handle VLAN pop action
In reply to Pablo Neira AyusoDo not hit EOPNOTSUPP when flowtable offload provides a VLAN pop action.
---efce49dfe6a8 is coming in the nf-next PR for net-next.
drivers/net/ethernet/mediatek/mtk_ppe_offload.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mediatek/mtk_ppe_offload.c +2 -0
@@ -232,6 +232,8 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f) data.vlan.proto = act->vlan.proto; data.vlan.num++;break ; +case FLOW_ACTION_VLAN_POP : +break ;case FLOW_ACTION_PPPOE_PUSH :if (data.pppoe.num ==1 )return -EOPNOTSUPP ;
Signature · 1 line
2.20.1
Jakub Kicinski
maintainerRe: [PATCH net-next 2/3] net: ethernet: mtk_eth_soc: missing mutex
In reply to Pablo Neira AyusoQuoted 7 lines · On Sun, 18 Apr 2021 23:11:44 +0200 Pablo Neira Ayuso wrote:
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 <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>
This driver doesn't set unlocked_driver_cb, why is it expected to take any locks? I thought the contract is that caller should hold rtnl.
Re: [PATCH net-next 2/3] net: ethernet: mtk_eth_soc: missing mutex
Quoted 11 lines · Jakub Kicinski
Quoted 7 lines · On Sun, 18 Apr 2021 23:11:44 +0200 Pablo Neira Ayuso wrote:
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 <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>This driver doesn't set
unlocked_driver_cb, why is it expected to take any locks? I thought the contract is that caller should hold rtnl.
No rtnl lock is held from the netfilter side, see:
42f1c2712090 ("netfilter: nftables: comment indirect serialization of commit_mutex with rtnl_mutex")
Jakub Kicinski
maintainerRe: [PATCH net-next 2/3] net: ethernet: mtk_eth_soc: missing mutex
Quoted 10 lines · On Mon, 19 Apr 2021 23:40:19 +0200 Pablo Neira Ayuso wrote:
Quoted 9 lines · Jakub Kicinski
Quoted 7 lines · On Sun, 18 Apr 2021 23:11:44 +0200 Pablo Neira Ayuso wrote:
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 <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>
Quoted 7 lines
Quoted 2 lines
This driver doesn't set
unlocked_driver_cb, why is it expected to take any locks? I thought the contract is that caller should hold rtnl.No rtnl lock is held from the netfilter side, see:
42f1c2712090("netfilter: nftables: comment indirect serialization ofcommit_mutexwithrtnl_mutex")
All the tc-centric drivers but mlx5 depend on rtnl_lock, is there something preventing them from binding to netfilter blocks?
Re: [PATCH net-next 2/3] net: ethernet: mtk_eth_soc: missing mutex
Quoted 14 lines · Jakub Kicinski
Quoted 13 lines · On Mon, 19 Apr 2021 23:40:19 +0200 Pablo Neira Ayuso wrote:
Quoted 11 lines · Jakub Kicinski
Quoted 7 lines · On Sun, 18 Apr 2021 23:11:44 +0200 Pablo Neira Ayuso wrote:
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 <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>This driver doesn't set
unlocked_driver_cb, why is it expected to take any locks? I thought the contract is that caller should hold rtnl.
Quoted 7 lines
Quoted 4 lines
No rtnl lock is held from the netfilter side, see:
42f1c2712090("netfilter: nftables: comment indirect serialization ofcommit_mutexwithrtnl_mutex")All the tc-centric drivers but mlx5 depend on
rtnl_lock, is there something preventing them from binding to netfilter blocks?
Only mlx5 and this driver support for TC_SETUP_FT.
This fix is targetting at the TC_SETUP_FT flow block type.
Jakub Kicinski
maintainerRe: [PATCH net-next 2/3] net: ethernet: mtk_eth_soc: missing mutex
Quoted 7 lines · On Mon, 19 Apr 2021 23:54:32 +0200 Pablo Neira Ayuso wrote:
Quoted 6 lines · Jakub Kicinski
Quoted 4 lines · On Mon, 19 Apr 2021 23:40:19 +0200 Pablo Neira Ayuso wrote:
No rtnl lock is held from the netfilter side, see:
42f1c2712090("netfilter: nftables: comment indirect serialization ofcommit_mutexwithrtnl_mutex")
Quoted 6 lines
Quoted 2 lines
All the tc-centric drivers but mlx5 depend on
rtnl_lock, is there something preventing them from binding to netfilter blocks?Only mlx5 and this driver support for
TC_SETUP_FT.This fix is targetting at the
TC_SETUP_FTflow block type.
Ah, there is a separate block type. Thanks.
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 9 lines · On Sun, 18 Apr 2021 23:11:42 +0200 you wrote:
Hi,
A few incremental fixes for the initial flowtable offload support and this driver:
1) Fix undefined reference to `dsa_port_from_netdev' due to missing dependencies in
Kconfig, reported byKbuildrobot.[...]
Here is the summary with links:
- [net-next,1/3] net: ethernet: mtk_eth_soc: fix undefined reference to `dsa_port_from_netdev'
https://git.kernel.org/netdev/net-next/c/0e389028ad75 - [net-next,2/3] net: ethernet: mtk_eth_soc: missing mutex https://git.kernel.org/netdev/net-next/c/014d029876b2 - [net-next,3/3] net: ethernet: mtk_eth_soc: handle VLAN pop action https://git.kernel.org/netdev/net-next/c/f5c2cb583abe
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Re: [PATCH net-next 2/3] net: ethernet: mtk_eth_soc: missing mutex
In reply to Pablo Neira AyusoAm 18. April 2021 23:11:44 MESZ schrieb Pablo Neira Ayuso <[email protected]>:
Quoted 10 lines
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 offloadingsupport")
Reported-by Frank Wunderlich <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>
Hi Pablo,
As far we tested it, the mutex does not avoid the hang. It looks a bit better,but at the end it was fixed by this Patch
https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/
Alex did some tests without the lock here and it still looks stable. So it looks like it is not needed regards Frank
Re: [PATCH net-next 2/3] net: ethernet: mtk_eth_soc: missing mutex
Quoted 12 lines · Frank Wunderlich
Am 18. April 2021 23:11:44 MESZ schrieb Pablo Neira Ayuso <[email protected]>:
Quoted 10 lines
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 offloadingsupport")
Reported-by Frank Wunderlich <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>
Quoted 8 lines
Hi Pablo,
As far we tested it, the mutex does not avoid the hang. It looks a bit better,but at the end it was fixed by this Patch
https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/
Alex did some tests without the lock here and it still looks stable. So it looks like it is not needed
It might be hard to trigger the race, but it's needed. There are several workqueues racing to add and delete entries from the driver flowtable representation which has no locks.