/* This function is called after a PCI bus error affecting this device has been detected.  */
static pci_ers_result_t bnx2x_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
/* This function is called after a PCI bus error affecting this device has been detected.  */
static pci_ers_result_t bnx2x_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
{
	struct net_device *dev = pci_get_drvdata(pdev);
	struct bnx2x *bp = netdev_priv(dev);
	rtnl_lock();
	netif_device_detach(dev);
	if (state == pci_channel_io_perm_failure) {
		rtnl_unlock();
		return PCI_ERS_RESULT_DISCONNECT;
	}
	if (netif_running(dev))
		bnx2x_eeh_nic_unload(bp);
	pci_disable_device(pdev);
	rtnl_unlock();
	return PCI_ERS_RESULT_NEED_RESET;
}