forked from openwrt/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generic: sync MediaTek Ethernet driver with upstream
Import commits from upstream Linux replacing some downstream patches. Move accepted patches from pending-{5.15,6.1} to backport-{5.15,6.1}. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
- Loading branch information
Showing
112 changed files
with
10,043 additions
and
6,304 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...eric/backport-5.15/728-v6.1-04-net-ethernet-mtk_eth_soc-fix-resource-leak-in-error-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
From 8110437e59616293228cd781c486d8495a61e36a Mon Sep 17 00:00:00 2001 | ||
From: Yan Cangang <nalanzeyu@gmail.com> | ||
Date: Sun, 20 Nov 2022 13:52:58 +0800 | ||
Subject: [PATCH] net: ethernet: mtk_eth_soc: fix resource leak in error path | ||
|
||
In mtk_probe(), when mtk_ppe_init() or mtk_eth_offload_init() failed, | ||
mtk_mdio_cleanup() isn't called. Fix it. | ||
|
||
Fixes: ba37b7caf1ed ("net: ethernet: mtk_eth_soc: add support for initializing the PPE") | ||
Fixes: 502e84e2382d ("net: ethernet: mtk_eth_soc: add flow offloading support") | ||
Signed-off-by: Yan Cangang <nalanzeyu@gmail.com> | ||
Reviewed-by: Leon Romanovsky <leonro@nvidia.com> | ||
Signed-off-by: Jakub Kicinski <kuba@kernel.org> | ||
--- | ||
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
@@ -4087,13 +4087,13 @@ static int mtk_probe(struct platform_dev | ||
eth->soc->offload_version, i); | ||
if (!eth->ppe[i]) { | ||
err = -ENOMEM; | ||
- goto err_free_dev; | ||
+ goto err_deinit_mdio; | ||
} | ||
} | ||
|
||
err = mtk_eth_offload_init(eth); | ||
if (err) | ||
- goto err_free_dev; | ||
+ goto err_deinit_mdio; | ||
} | ||
|
||
for (i = 0; i < MTK_MAX_DEVS; i++) { |
107 changes: 107 additions & 0 deletions
107
...eric/backport-5.15/728-v6.1-05-net-ethernet-mtk_eth_soc-fix-memory-leak-in-error-pa.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
From 603ea5e7ffa73c7fac07d8713d97285990695213 Mon Sep 17 00:00:00 2001 | ||
From: Yan Cangang <nalanzeyu@gmail.com> | ||
Date: Sun, 20 Nov 2022 13:52:59 +0800 | ||
Subject: [PATCH] net: ethernet: mtk_eth_soc: fix memory leak in error path | ||
|
||
In mtk_ppe_init(), when dmam_alloc_coherent() or devm_kzalloc() failed, | ||
the rhashtable ppe->l2_flows isn't destroyed. Fix it. | ||
|
||
In mtk_probe(), when mtk_ppe_init() or mtk_eth_offload_init() or | ||
register_netdev() failed, have the same problem. Fix it. | ||
|
||
Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries") | ||
Signed-off-by: Yan Cangang <nalanzeyu@gmail.com> | ||
Reviewed-by: Leon Romanovsky <leonro@nvidia.com> | ||
Signed-off-by: Jakub Kicinski <kuba@kernel.org> | ||
--- | ||
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 9 +++++---- | ||
drivers/net/ethernet/mediatek/mtk_ppe.c | 19 +++++++++++++++++-- | ||
drivers/net/ethernet/mediatek/mtk_ppe.h | 1 + | ||
3 files changed, 23 insertions(+), 6 deletions(-) | ||
|
||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
@@ -4087,13 +4087,13 @@ static int mtk_probe(struct platform_dev | ||
eth->soc->offload_version, i); | ||
if (!eth->ppe[i]) { | ||
err = -ENOMEM; | ||
- goto err_deinit_mdio; | ||
+ goto err_deinit_ppe; | ||
} | ||
} | ||
|
||
err = mtk_eth_offload_init(eth); | ||
if (err) | ||
- goto err_deinit_mdio; | ||
+ goto err_deinit_ppe; | ||
} | ||
|
||
for (i = 0; i < MTK_MAX_DEVS; i++) { | ||
@@ -4103,7 +4103,7 @@ static int mtk_probe(struct platform_dev | ||
err = register_netdev(eth->netdev[i]); | ||
if (err) { | ||
dev_err(eth->dev, "error bringing up device\n"); | ||
- goto err_deinit_mdio; | ||
+ goto err_deinit_ppe; | ||
} else | ||
netif_info(eth, probe, eth->netdev[i], | ||
"mediatek frame engine at 0x%08lx, irq %d\n", | ||
@@ -4123,7 +4123,8 @@ static int mtk_probe(struct platform_dev | ||
|
||
return 0; | ||
|
||
-err_deinit_mdio: | ||
+err_deinit_ppe: | ||
+ mtk_ppe_deinit(eth); | ||
mtk_mdio_cleanup(eth); | ||
err_free_dev: | ||
mtk_free_dev(eth); | ||
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c | ||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c | ||
@@ -743,7 +743,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ | ||
MTK_PPE_ENTRIES * soc->foe_entry_size, | ||
&ppe->foe_phys, GFP_KERNEL); | ||
if (!foe) | ||
- return NULL; | ||
+ goto err_free_l2_flows; | ||
|
||
ppe->foe_table = foe; | ||
|
||
@@ -751,11 +751,26 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ | ||
sizeof(*ppe->foe_flow); | ||
ppe->foe_flow = devm_kzalloc(dev, foe_flow_size, GFP_KERNEL); | ||
if (!ppe->foe_flow) | ||
- return NULL; | ||
+ goto err_free_l2_flows; | ||
|
||
mtk_ppe_debugfs_init(ppe, index); | ||
|
||
return ppe; | ||
+ | ||
+err_free_l2_flows: | ||
+ rhashtable_destroy(&ppe->l2_flows); | ||
+ return NULL; | ||
+} | ||
+ | ||
+void mtk_ppe_deinit(struct mtk_eth *eth) | ||
+{ | ||
+ int i; | ||
+ | ||
+ for (i = 0; i < ARRAY_SIZE(eth->ppe); i++) { | ||
+ if (!eth->ppe[i]) | ||
+ return; | ||
+ rhashtable_destroy(ð->ppe[i]->l2_flows); | ||
+ } | ||
} | ||
|
||
static void mtk_ppe_init_foe_table(struct mtk_ppe *ppe) | ||
--- a/drivers/net/ethernet/mediatek/mtk_ppe.h | ||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.h | ||
@@ -304,6 +304,7 @@ struct mtk_ppe { | ||
|
||
struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, | ||
int version, int index); | ||
+void mtk_ppe_deinit(struct mtk_eth *eth); | ||
void mtk_ppe_start(struct mtk_ppe *ppe); | ||
int mtk_ppe_stop(struct mtk_ppe *ppe); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
...eric/backport-5.15/730-07-v6.3-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.