Subject: RE: [PATCH net-next v4 5/5] net: wangxun: implement pci_error_handlers ops

From: Jiawen Wu <[email-masked]>
Date: Tue, 2 Jun 2026 10:28:09 +0800

> > +static void wx_io_resume(struct pci_dev *pdev)
> > +{
> > +	struct wx *wx = pci_get_drvdata(pdev);
> > +	struct net_device *netdev;
> > +	int err;
> > +
> > +	netdev = wx->netdev;
> > +	rtnl_lock();
> > +	if (netif_running(netdev)) {
> > +		err = netdev->netdev_ops->ndo_open(netdev);
> > +		if (err) {
> > +			wx_err(wx, "Failed to open netdev after
> > reset\n");
> If you jump over the netif_device_attach(netdev);
> I'm afraid the interface probably will be UP (IFF_UP set, because netif_running() returned true)
> but permanently "detached" - the kernel's watchdog, TX queue wakeups,
> and carrier-change notifications all check netif_device_present() and
> will silently no-op.

If .ndo_open() fails during recovery, the device has not been successfully
reinitialized and therefore should remain detached. 
Calling netif_device_attach() unconditionally would expose an interface whose
queues, interrupts or other resources may not have been restored successfully.