Message ID | ea9e1313e01f7925b9fc4040f3776070447f261d.1694630374.git.lorenzo@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 01b38de18d06af5e6a703ed2fb8677c376cafc91 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [v2,net-next] net: ethernet: mtk_wed: do not assume offload callbacks are always set | expand |
On Wed, Sep 13, 2023 at 08:42:47PM +0200, Lorenzo Bianconi wrote: > Check if wlan.offload_enable and wlan.offload_disable callbacks are set > in mtk_wed_flow_add/mtk_wed_flow_remove since mt7996 will not rely > on them. > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > --- > Changes since v1: > - move offload check inside hw_lock critical section Reviewed-by: Simon Horman <horms@kernel.org>
Hello: This patch was applied to netdev/net-next.git (main) by David S. Miller <davem@davemloft.net>: On Wed, 13 Sep 2023 20:42:47 +0200 you wrote: > Check if wlan.offload_enable and wlan.offload_disable callbacks are set > in mtk_wed_flow_add/mtk_wed_flow_remove since mt7996 will not rely > on them. > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > --- > Changes since v1: > - move offload check inside hw_lock critical section > > [...] Here is the summary with links: - [v2,net-next] net: ethernet: mtk_wed: do not assume offload callbacks are always set https://git.kernel.org/netdev/net-next/c/01b38de18d06 You are awesome, thank you!
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c index 94376aa2b34c..e7d3525d2e30 100644 --- a/drivers/net/ethernet/mediatek/mtk_wed.c +++ b/drivers/net/ethernet/mediatek/mtk_wed.c @@ -1713,19 +1713,20 @@ mtk_wed_irq_set_mask(struct mtk_wed_device *dev, u32 mask) int mtk_wed_flow_add(int index) { struct mtk_wed_hw *hw = hw_list[index]; - int ret; + int ret = 0; - if (!hw || !hw->wed_dev) - return -ENODEV; + mutex_lock(&hw_lock); - if (hw->num_flows) { - hw->num_flows++; - return 0; + if (!hw || !hw->wed_dev) { + ret = -ENODEV; + goto out; } - mutex_lock(&hw_lock); - if (!hw->wed_dev) { - ret = -ENODEV; + if (!hw->wed_dev->wlan.offload_enable) + goto out; + + if (hw->num_flows) { + hw->num_flows++; goto out; } @@ -1744,14 +1745,15 @@ void mtk_wed_flow_remove(int index) { struct mtk_wed_hw *hw = hw_list[index]; - if (!hw) - return; + mutex_lock(&hw_lock); - if (--hw->num_flows) - return; + if (!hw || !hw->wed_dev) + goto out; - mutex_lock(&hw_lock); - if (!hw->wed_dev) + if (!hw->wed_dev->wlan.offload_disable) + goto out; + + if (--hw->num_flows) goto out; hw->wed_dev->wlan.offload_disable(hw->wed_dev);
Check if wlan.offload_enable and wlan.offload_disable callbacks are set in mtk_wed_flow_add/mtk_wed_flow_remove since mt7996 will not rely on them. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> --- Changes since v1: - move offload check inside hw_lock critical section --- drivers/net/ethernet/mediatek/mtk_wed.c | 32 +++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-)