Skip to contentSkip to conversation

net: via-rhine: Stop the NIC on platform device shutdown

PATCH Applied Alexey Charkov 2 participants 2 messages Nov 13 – Nov 19

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: via-rhine: Stop the NIC on platform device shutdown

Close a running interface on platform device shutdown, so that the chip stops its receive DMA before kexec hands its memory to the next kernel. Do it in the driver, as the platform (OF) variant lacks a .shutdown callback and nothing else stops it, unlike for PCI, where the core clears bus mastering ahead of kexec.

Keep incoming frames from landing in receive buffers the old kernel had
allocated: on a WonderMedia WM8950 board, broadcast traffic alone corrupts the next kernel at random points as it decompresses and boots, hanging about a third of kexec attempts early on, e.g. with "unrecognized/unsupported processor variant".

Fixes 2d283862dc62 ("net: via-rhine: add OF bus binding")
---
 drivers/net/ethernet/via/via-rhine.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/net/ethernet/via/via-rhine.c +12 -0
index e56ebbdd428d..dbbbaf7f20ac 100644
@@ -2461,6 +2461,17 @@ static void rhine_remove_one_platform(struct platform_device *pdev)
 	free_netdev(dev);
 }
 
+static void rhine_shutdown_platform(struct platform_device *pdev)
+{
+	struct net_device *dev = platform_get_drvdata(pdev);
+
+	rtnl_lock();
+	netif_device_detach(dev);
+	if (netif_running(dev))
+		dev_close(dev);
+	rtnl_unlock();
+}
+
 static void rhine_shutdown_pci(struct pci_dev *pdev)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
@@ -2580,6 +2591,7 @@ static struct pci_driver rhine_driver_pci = {
 static struct platform_driver rhine_driver_platform = {
 	.probe		= rhine_init_one_platform,
 	.remove		= rhine_remove_one_platform,
+	.shutdown	= rhine_shutdown_platform,
 	.driver = {
 		.name	= DRV_NAME,
 		.of_match_table	= rhine_of_tbl,

---
base-commit: ead6fa9a0ab194f02a2f36d634b193e9c5f9a1c6
change-id: 20261113-vt8500-rhine-shutdown-b2ac8a702688

Best regards,

Signature · 1 line
Alexey Charkov <[email protected]>
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 6 lines · On Fri, 13 Nov 2026 17:01:05 +0400 you wrote:

Close a running interface on platform device shutdown, so that the chip stops its receive DMA before kexec hands its memory to the next kernel. Do it in the driver, as the platform (OF) variant lacks a .shutdown callback and nothing else stops it, unlike for PCI, where the core clears bus mastering ahead of kexec.

Quoted 7 lines

Keep incoming frames from landing in receive buffers the old kernel had
allocated: on a WonderMedia WM8950 board, broadcast traffic alone corrupts the next kernel at random points as it decompresses and boots, hanging about a third of kexec attempts early on, e.g. with "unrecognized/unsupported processor variant".

[...]

Here is the summary with links:
- [net] net: via-rhine: Stop the NIC on platform device shutdown

    https://git.kernel.org/netdev/net/c/3d10dc3ae1f7

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html