mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-19 14:06:29 +07:00
sfc: Change state names to be clearer, and comment them
STATE_INIT and STATE_FINI are equivalent and represent incompletely initialised states; combine them as STATE_UNINIT. Rename STATE_RUNNING to STATE_READY, to avoid confusion with netif_running() and IFF_RUNNING. The comments do not quite match current usage, but this will be corrected in subsequent fixes. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
This commit is contained in:
parent
9714284f83
commit
f16aeea0e6
@ -202,7 +202,7 @@ static void efx_stop_all(struct efx_nic *efx);
|
|||||||
|
|
||||||
#define EFX_ASSERT_RESET_SERIALISED(efx) \
|
#define EFX_ASSERT_RESET_SERIALISED(efx) \
|
||||||
do { \
|
do { \
|
||||||
if ((efx->state == STATE_RUNNING) || \
|
if ((efx->state == STATE_READY) || \
|
||||||
(efx->state == STATE_DISABLED)) \
|
(efx->state == STATE_DISABLED)) \
|
||||||
ASSERT_RTNL(); \
|
ASSERT_RTNL(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -1556,7 +1556,7 @@ static void efx_start_all(struct efx_nic *efx)
|
|||||||
* of these flags are safe to read under just the rtnl lock */
|
* of these flags are safe to read under just the rtnl lock */
|
||||||
if (efx->port_enabled)
|
if (efx->port_enabled)
|
||||||
return;
|
return;
|
||||||
if ((efx->state != STATE_RUNNING) && (efx->state != STATE_INIT))
|
if ((efx->state != STATE_READY) && (efx->state != STATE_UNINIT))
|
||||||
return;
|
return;
|
||||||
if (!netif_running(efx->net_dev))
|
if (!netif_running(efx->net_dev))
|
||||||
return;
|
return;
|
||||||
@ -2286,11 +2286,11 @@ static void efx_reset_work(struct work_struct *data)
|
|||||||
if (!pending)
|
if (!pending)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* If we're not RUNNING then don't reset. Leave the reset_pending
|
/* If we're not READY then don't reset. Leave the reset_pending
|
||||||
* flags set so that efx_pci_probe_main will be retried */
|
* flags set so that efx_pci_probe_main will be retried */
|
||||||
if (efx->state != STATE_RUNNING) {
|
if (efx->state != STATE_READY) {
|
||||||
netif_info(efx, drv, efx->net_dev,
|
netif_info(efx, drv, efx->net_dev,
|
||||||
"scheduled reset quenched. NIC not RUNNING\n");
|
"scheduled reset quenched; NIC not ready\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2402,7 +2402,7 @@ static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type,
|
|||||||
INIT_DELAYED_WORK(&efx->selftest_work, efx_selftest_async_work);
|
INIT_DELAYED_WORK(&efx->selftest_work, efx_selftest_async_work);
|
||||||
efx->pci_dev = pci_dev;
|
efx->pci_dev = pci_dev;
|
||||||
efx->msg_enable = debug;
|
efx->msg_enable = debug;
|
||||||
efx->state = STATE_INIT;
|
efx->state = STATE_UNINIT;
|
||||||
strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name));
|
strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name));
|
||||||
|
|
||||||
efx->net_dev = net_dev;
|
efx->net_dev = net_dev;
|
||||||
@ -2490,7 +2490,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev)
|
|||||||
|
|
||||||
/* Mark the NIC as fini, then stop the interface */
|
/* Mark the NIC as fini, then stop the interface */
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
efx->state = STATE_FINI;
|
efx->state = STATE_UNINIT;
|
||||||
dev_close(efx->net_dev);
|
dev_close(efx->net_dev);
|
||||||
|
|
||||||
/* Allow any queued efx_resets() to complete */
|
/* Allow any queued efx_resets() to complete */
|
||||||
@ -2684,9 +2684,9 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
|
|||||||
goto fail4;
|
goto fail4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Switch to the running state before we expose the device to the OS,
|
/* Switch to the READY state before we expose the device to the OS,
|
||||||
* so that dev_open()|efx_start_all() will actually start the device */
|
* so that dev_open()|efx_start_all() will actually start the device */
|
||||||
efx->state = STATE_RUNNING;
|
efx->state = STATE_READY;
|
||||||
|
|
||||||
rc = efx_register_netdev(efx);
|
rc = efx_register_netdev(efx);
|
||||||
if (rc)
|
if (rc)
|
||||||
@ -2727,7 +2727,7 @@ static int efx_pm_freeze(struct device *dev)
|
|||||||
{
|
{
|
||||||
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
|
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
|
||||||
|
|
||||||
efx->state = STATE_FINI;
|
efx->state = STATE_UNINIT;
|
||||||
|
|
||||||
netif_device_detach(efx->net_dev);
|
netif_device_detach(efx->net_dev);
|
||||||
|
|
||||||
@ -2741,8 +2741,6 @@ static int efx_pm_thaw(struct device *dev)
|
|||||||
{
|
{
|
||||||
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
|
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
|
||||||
|
|
||||||
efx->state = STATE_INIT;
|
|
||||||
|
|
||||||
efx_start_interrupts(efx, false);
|
efx_start_interrupts(efx, false);
|
||||||
|
|
||||||
mutex_lock(&efx->mac_lock);
|
mutex_lock(&efx->mac_lock);
|
||||||
@ -2753,7 +2751,7 @@ static int efx_pm_thaw(struct device *dev)
|
|||||||
|
|
||||||
netif_device_attach(efx->net_dev);
|
netif_device_attach(efx->net_dev);
|
||||||
|
|
||||||
efx->state = STATE_RUNNING;
|
efx->state = STATE_READY;
|
||||||
|
|
||||||
efx->type->resume_wol(efx);
|
efx->type->resume_wol(efx);
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev,
|
|||||||
|
|
||||||
|
|
||||||
ASSERT_RTNL();
|
ASSERT_RTNL();
|
||||||
if (efx->state != STATE_RUNNING) {
|
if (efx->state != STATE_READY) {
|
||||||
rc = -EIO;
|
rc = -EIO;
|
||||||
goto fail1;
|
goto fail1;
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ static ssize_t set_phy_flash_cfg(struct device *dev,
|
|||||||
new_mode = PHY_MODE_SPECIAL;
|
new_mode = PHY_MODE_SPECIAL;
|
||||||
if (!((old_mode ^ new_mode) & PHY_MODE_SPECIAL)) {
|
if (!((old_mode ^ new_mode) & PHY_MODE_SPECIAL)) {
|
||||||
err = 0;
|
err = 0;
|
||||||
} else if (efx->state != STATE_RUNNING || netif_running(efx->net_dev)) {
|
} else if (efx->state != STATE_READY || netif_running(efx->net_dev)) {
|
||||||
err = -EBUSY;
|
err = -EBUSY;
|
||||||
} else {
|
} else {
|
||||||
/* Reset the PHY, reconfigure the MAC and enable/disable
|
/* Reset the PHY, reconfigure the MAC and enable/disable
|
||||||
|
@ -430,11 +430,9 @@ enum efx_int_mode {
|
|||||||
#define EFX_INT_MODE_USE_MSI(x) (((x)->interrupt_mode) <= EFX_INT_MODE_MSI)
|
#define EFX_INT_MODE_USE_MSI(x) (((x)->interrupt_mode) <= EFX_INT_MODE_MSI)
|
||||||
|
|
||||||
enum nic_state {
|
enum nic_state {
|
||||||
STATE_INIT = 0,
|
STATE_UNINIT = 0, /* device being probed/removed or is frozen */
|
||||||
STATE_RUNNING = 1,
|
STATE_READY = 1, /* hardware ready and netdev registered */
|
||||||
STATE_FINI = 2,
|
STATE_DISABLED = 2, /* device disabled due to hardware errors */
|
||||||
STATE_DISABLED = 3,
|
|
||||||
STATE_MAX,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -654,7 +652,7 @@ struct vfdi_status;
|
|||||||
* @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues
|
* @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues
|
||||||
* @irq_rx_moderation: IRQ moderation time for RX event queues
|
* @irq_rx_moderation: IRQ moderation time for RX event queues
|
||||||
* @msg_enable: Log message enable flags
|
* @msg_enable: Log message enable flags
|
||||||
* @state: Device state flag. Serialised by the rtnl_lock.
|
* @state: Device state number (%STATE_*). Serialised by the rtnl_lock.
|
||||||
* @reset_pending: Bitmask for pending resets
|
* @reset_pending: Bitmask for pending resets
|
||||||
* @tx_queue: TX DMA queues
|
* @tx_queue: TX DMA queues
|
||||||
* @rx_queue: RX DMA queues
|
* @rx_queue: RX DMA queues
|
||||||
|
Loading…
Reference in New Issue
Block a user