From: Jonathan Cooper <jonathan.s.cooper@amd.com>
Date: Tue, 28 Jun 2022 14:59:08 +0100
Subject: sfc: Add a PROBED state for EF100 VDPA use.
Patch-mainline: v6.0-rc1
Git-commit: 8b39db19b21b7edfa0a48ca8a00ba042353b7887
References: jsc#PED-1565
For VDPA we need to tear down the driver to the point where it
has various control channels like MCDI, but it no longer has
a network device. This adds a state corresponding to
that mode that will be used when VDPA support is added.
Signed-off-by: Jonathan Cooper <jonathan.s.cooper@amd.com>
Co-developed-by: Martin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: Martin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
drivers/net/ethernet/sfc/ef100_netdev.c | 2 +-
drivers/net/ethernet/sfc/efx_common.c | 6 ++++--
drivers/net/ethernet/sfc/efx_common.h | 9 +++++----
drivers/net/ethernet/sfc/net_driver.h | 3 ++-
4 files changed, 12 insertions(+), 8 deletions(-)
--- a/drivers/net/ethernet/sfc/ef100_netdev.c
+++ b/drivers/net/ethernet/sfc/ef100_netdev.c
@@ -291,7 +291,7 @@ void ef100_unregister_netdev(struct efx_
{
if (efx_dev_registered(efx)) {
efx_fini_mcdi_logging(efx);
- efx->state = STATE_UNINIT;
+ efx->state = STATE_PROBED;
unregister_netdev(efx->net_dev);
}
}
--- a/drivers/net/ethernet/sfc/efx_common.c
+++ b/drivers/net/ethernet/sfc/efx_common.c
@@ -1222,8 +1222,10 @@ static pci_ers_result_t efx_io_error_det
efx_device_detach_sync(efx);
- efx_stop_all(efx);
- efx_disable_interrupts(efx);
+ if (efx_net_active(efx->state)) {
+ efx_stop_all(efx);
+ efx_disable_interrupts(efx);
+ }
status = PCI_ERS_RESULT_NEED_RESET;
} else {
--- a/drivers/net/ethernet/sfc/efx_common.h
+++ b/drivers/net/ethernet/sfc/efx_common.h
@@ -43,10 +43,11 @@ void efx_start_monitor(struct efx_nic *e
int __efx_reconfigure_port(struct efx_nic *efx);
int efx_reconfigure_port(struct efx_nic *efx);
-#define EFX_ASSERT_RESET_SERIALISED(efx) \
- do { \
- if (efx->state != STATE_UNINIT) \
- ASSERT_RTNL(); \
+#define EFX_ASSERT_RESET_SERIALISED(efx) \
+ do { \
+ if ((efx)->state != STATE_UNINIT && \
+ (efx)->state != STATE_PROBED) \
+ ASSERT_RTNL(); \
} while (0)
int efx_try_recovery(struct efx_nic *efx);
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -623,7 +623,8 @@ enum efx_int_mode {
enum nic_state {
STATE_UNINIT = 0, /* device being probed/removed */
- STATE_NET_DOWN, /* hardware probed and netdev registered */
+ STATE_PROBED, /* hardware probed */
+ STATE_NET_DOWN, /* netdev registered */
STATE_NET_UP, /* ready for traffic */
STATE_DISABLED, /* device disabled due to hardware errors */