Re: [PATCH 1/2] net: thunderbolt: Call tbnet_stop() upon shutdown

Mika Westerberg
2026-04-29T16:57:32Z

On Wed, Apr 29, 2026 at 03:31:43PM +0200, Andrew Lunn wrote:
> On Wed, Apr 29, 2026 at 07:30:46AM +0200, Mika Westerberg wrote:
> > On Tue, Apr 28, 2026 at 06:12:24PM -0700, Jakub Kicinski wrote:
> > > This is an AI-generated review of your patch. The human sending this
> > > email has considered the AI review valid, or at least plausible.
> > > ---
> > > net: thunderbolt: Call tbnet_stop() upon shutdown
> > >
> > > This commit updates the shutdown callback for the Thunderbolt network service
> > > driver to call tbnet_stop() if the interface is running. This ensures the
> > > service drivers release the rings upon shutdown.
> > >
> > > > diff --git a/drivers/net/thunderbolt/main.c b/drivers/net/thunderbolt/main.c
> > > > index 7aae5d915a1e..631af237998d 100644
> > > > --- a/drivers/net/thunderbolt/main.c
> > > > +++ b/drivers/net/thunderbolt/main.c
> > > > @@ -1417,7 +1417,10 @@ static void tbnet_remove(struct tb_service *svc)
> > > >
> > > > static void tbnet_shutdown(struct tb_service *svc)
> > > > {
> > > > - tbnet_tear_down(tb_service_get_drvdata(svc), true);
> > > > + struct tbnet *net = tb_service_get_drvdata(svc);
> > > > +
> > > > + if (netif_running(net->dev))
> > > > + tbnet_stop(net->dev);
> > >
> > > Does calling tbnet_stop() directly bypass the network stack teardown sequence?
> >
> > This is called when the machine is rebooted or shut down to quiesce the
> > device. I don't think the network stack has anything similar?
>
> You mean that network interfaces are left running while the machine
> reboots, potentially DMAing receive packets over the bootloader or
> freshly loaded kernel? Does that seem reasonable?

Hey! 20+ years ago I spent quite amount of time to investigate an issue
exactly like that where ramdisk randomly corrupted. Not fun.

> Don't you think the core will somehow call the .close function? I cannot
> point to the code doing that without a bit if searching, but i think it
> probably exists.

If I do 'reboot -f' .ndo_stop (I think that's what you mean by .close) is
not called.

If I do just 'reboot' it is called. I suspect based on my added WARN_ON()
that it is done by userspace shutdown scripts.