fm10k: Cleanup exception handling for changing queues
This patch is meant to cleanup the exception handling for the paths where we reset the interrupts and then reconfigure them. In all of these paths we had very different levels of exception handling. I have updated the driver so that all of the paths should result in a similar state if we fail. Specifically the driver will now unload the mailbox interrupt, free the queue vectors and MSI-X, and then detach the interface. In addition for any of the PCIe related resets I have added a check with the hw_ready function to just make sure the registers are in a readable state prior to reopening the interface. Signed-off-by: Alexander Duyck <aduyck@mirantis.com> Reviewed-by: Bruce Allan <bruce.w.allan@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
8c2a029c7e
commit
09f8a82b6a
|
@ -1153,6 +1153,7 @@ static struct rtnl_link_stats64 *fm10k_get_stats64(struct net_device *netdev,
|
|||
int fm10k_setup_tc(struct net_device *dev, u8 tc)
|
||||
{
|
||||
struct fm10k_intfc *interface = netdev_priv(dev);
|
||||
int err;
|
||||
|
||||
/* Currently only the PF supports priority classes */
|
||||
if (tc && (interface->hw.mac.type != fm10k_mac_pf))
|
||||
|
@ -1177,17 +1178,30 @@ int fm10k_setup_tc(struct net_device *dev, u8 tc)
|
|||
netdev_reset_tc(dev);
|
||||
netdev_set_num_tc(dev, tc);
|
||||
|
||||
fm10k_init_queueing_scheme(interface);
|
||||
err = fm10k_init_queueing_scheme(interface);
|
||||
if (err)
|
||||
goto err_queueing_scheme;
|
||||
|
||||
fm10k_mbx_request_irq(interface);
|
||||
err = fm10k_mbx_request_irq(interface);
|
||||
if (err)
|
||||
goto err_mbx_irq;
|
||||
|
||||
if (netif_running(dev))
|
||||
fm10k_open(dev);
|
||||
err = netif_running(dev) ? fm10k_open(dev) : 0;
|
||||
if (err)
|
||||
goto err_open;
|
||||
|
||||
/* flag to indicate SWPRI has yet to be updated */
|
||||
interface->flags |= FM10K_FLAG_SWPRI_CONFIG;
|
||||
|
||||
return 0;
|
||||
err_open:
|
||||
fm10k_mbx_free_irq(interface);
|
||||
err_mbx_irq:
|
||||
fm10k_clear_queueing_scheme(interface);
|
||||
err_queueing_scheme:
|
||||
netif_device_detach(dev);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int fm10k_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
|
||||
|
|
|
@ -186,7 +186,13 @@ static void fm10k_reinit(struct fm10k_intfc *interface)
|
|||
}
|
||||
|
||||
/* reassociate interrupts */
|
||||
fm10k_mbx_request_irq(interface);
|
||||
err = fm10k_mbx_request_irq(interface);
|
||||
if (err)
|
||||
goto err_mbx_irq;
|
||||
|
||||
err = fm10k_hw_ready(interface);
|
||||
if (err)
|
||||
goto err_open;
|
||||
|
||||
/* update hardware address for VFs if perm_addr has changed */
|
||||
if (hw->mac.type == fm10k_mac_vf) {
|
||||
|
@ -206,14 +212,23 @@ static void fm10k_reinit(struct fm10k_intfc *interface)
|
|||
/* reset clock */
|
||||
fm10k_ts_reset(interface);
|
||||
|
||||
if (netif_running(netdev))
|
||||
fm10k_open(netdev);
|
||||
err = netif_running(netdev) ? fm10k_open(netdev) : 0;
|
||||
if (err)
|
||||
goto err_open;
|
||||
|
||||
fm10k_iov_resume(interface->pdev);
|
||||
|
||||
rtnl_unlock();
|
||||
|
||||
clear_bit(__FM10K_RESETTING, &interface->state);
|
||||
|
||||
return;
|
||||
err_open:
|
||||
fm10k_mbx_free_irq(interface);
|
||||
err_mbx_irq:
|
||||
fm10k_clear_queueing_scheme(interface);
|
||||
reinit_err:
|
||||
if (err)
|
||||
netif_device_detach(netdev);
|
||||
netif_device_detach(netdev);
|
||||
|
||||
rtnl_unlock();
|
||||
|
||||
|
@ -2131,17 +2146,23 @@ static int fm10k_resume(struct pci_dev *pdev)
|
|||
rtnl_lock();
|
||||
|
||||
err = fm10k_init_queueing_scheme(interface);
|
||||
if (!err) {
|
||||
fm10k_mbx_request_irq(interface);
|
||||
if (netif_running(netdev))
|
||||
err = fm10k_open(netdev);
|
||||
}
|
||||
if (err)
|
||||
goto err_queueing_scheme;
|
||||
|
||||
err = fm10k_mbx_request_irq(interface);
|
||||
if (err)
|
||||
goto err_mbx_irq;
|
||||
|
||||
err = fm10k_hw_ready(interface);
|
||||
if (err)
|
||||
goto err_open;
|
||||
|
||||
err = netif_running(netdev) ? fm10k_open(netdev) : 0;
|
||||
if (err)
|
||||
goto err_open;
|
||||
|
||||
rtnl_unlock();
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* assume host is not ready, to prevent race with watchdog in case we
|
||||
* actually don't have connection to the switch
|
||||
*/
|
||||
|
@ -2158,6 +2179,14 @@ static int fm10k_resume(struct pci_dev *pdev)
|
|||
netif_device_attach(netdev);
|
||||
|
||||
return 0;
|
||||
err_open:
|
||||
fm10k_mbx_free_irq(interface);
|
||||
err_mbx_irq:
|
||||
fm10k_clear_queueing_scheme(interface);
|
||||
err_queueing_scheme:
|
||||
rtnl_unlock();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue