Commit 01b38de1 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by David S. Miller

net: ethernet: mtk_wed: do not assume offload callbacks are always set

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: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c123e0d3
...@@ -1713,19 +1713,20 @@ mtk_wed_irq_set_mask(struct mtk_wed_device *dev, u32 mask) ...@@ -1713,19 +1713,20 @@ mtk_wed_irq_set_mask(struct mtk_wed_device *dev, u32 mask)
int mtk_wed_flow_add(int index) int mtk_wed_flow_add(int index)
{ {
struct mtk_wed_hw *hw = hw_list[index]; struct mtk_wed_hw *hw = hw_list[index];
int ret; int ret = 0;
if (!hw || !hw->wed_dev) mutex_lock(&hw_lock);
return -ENODEV;
if (hw->num_flows) { if (!hw || !hw->wed_dev) {
hw->num_flows++; ret = -ENODEV;
return 0; goto out;
} }
mutex_lock(&hw_lock); if (!hw->wed_dev->wlan.offload_enable)
if (!hw->wed_dev) { goto out;
ret = -ENODEV;
if (hw->num_flows) {
hw->num_flows++;
goto out; goto out;
} }
...@@ -1744,14 +1745,15 @@ void mtk_wed_flow_remove(int index) ...@@ -1744,14 +1745,15 @@ void mtk_wed_flow_remove(int index)
{ {
struct mtk_wed_hw *hw = hw_list[index]; struct mtk_wed_hw *hw = hw_list[index];
if (!hw) mutex_lock(&hw_lock);
return;
if (--hw->num_flows) if (!hw || !hw->wed_dev)
return; goto out;
mutex_lock(&hw_lock); if (!hw->wed_dev->wlan.offload_disable)
if (!hw->wed_dev) goto out;
if (--hw->num_flows)
goto out; goto out;
hw->wed_dev->wlan.offload_disable(hw->wed_dev); hw->wed_dev->wlan.offload_disable(hw->wed_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment