[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5156c006ee7c362ef26b2ad28eea2196c847a106.camel@infinera.com>
Date: Thu, 14 Jul 2022 17:16:02 +0000
From: Joakim Tjernlund <Joakim.Tjernlund@...inera.com>
To: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"f.fainelli@...il.com" <f.fainelli@...il.com>
Subject: Re: network driver takedown at reboof -f ?
On Thu, 2022-07-14 at 07:58 -0700, Florian Fainelli wrote:
>
> On 7/14/2022 7:21 AM, Joakim Tjernlund wrote:
> > Doing a fast reboot -f I notice that the ethernet I/Fs are NOT shutdown/stopped.
> > Is this expected? I sort of expected kernel to do ifconfig down automatically.
> >
> > Is there some function in netdev I can hook into to make reboot shutdown my eth I/Fs?
>
> If you want that to happen you typically have to implement a ->shutdown
> callback in your network driver registered via platform/pci/bus, if
> nothing else to turn off all DMAs and prevent, e.g.: a kexec'd kernel to
> be corrupted by a wild DMA engine still running.
>
> There is no generic provision in the network stack to deal with those cases.
>
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2Fcommit%2F%3Fid%3Dd9f45ab9e671166004b75427f10389e1f70cfc30&data=05%7C01%7CJoakim.Tjernlund%40infinera.com%7Cf107ea4c5731411a813d08da65a96a4d%7C285643de5f5b4b03a1530ae2dc8aaf77%7C1%7C0%7C637934075577842203%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=QerJo10uvNJW9aI4PaREvoWsZKAzn8SGx6HAP1Zr%2Bt0%3D&reserved=0
Exactly what I need, thank you :)
Trying to add a shutdown I have a problem getting at priv ptr:
static void ccip_shutdown(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct net_device *ndev = (void*)dev->parent;
struct ccip_priv *priv = netdev_priv(ndev);;
Above does not work, my probe has:
ndev = alloc_netdev(sizeof(struct ccip_priv), if_name,
NET_NAME_UNKNOWN, ccip_init_dev);
priv = netdev_priv(ndev);
SET_NETDEV_DEV(ndev, &pdev->dev);
I must be missing something obvious ....
Powered by blists - more mailing lists