mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 13:48:06 +00:00
6407ef8d2b
Reorder and update existing patches Signed-off-by: Felix Fietkau <nbd@nbd.name>
69 lines
1.5 KiB
Diff
69 lines
1.5 KiB
Diff
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Date: Wed, 13 Sep 2023 20:42:47 +0200
|
|
Subject: [PATCH] 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: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Reviewed-by: Simon Horman <horms@kernel.org>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
|
|
@@ -1712,19 +1712,20 @@ mtk_wed_irq_set_mask(struct mtk_wed_devi
|
|
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;
|
|
}
|
|
|
|
@@ -1743,14 +1744,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);
|