All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Habets <habetsm.xilinx@gmail.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com, jonathan.s.cooper@amd.com
Cc: netdev@vger.kernel.org, ecree.xilinx@gmail.com
Subject: [PATCH net-next v2 02/10] sfc: Add a PROBED state for EF100 VDPA use.
Date: Tue, 28 Jun 2022 14:59:08 +0100	[thread overview]
Message-ID: <165642474801.31669.7428696396724224721.stgit@palantir17.mph.net> (raw)
In-Reply-To: <165642465886.31669.17429834766693417246.stgit@palantir17.mph.net>

From: Jonathan Cooper <jonathan.s.cooper@amd.com>

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>
---
 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(-)

diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c
index b9106ce678d9..3bb9a79bad22 100644
--- 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_nic *efx)
 {
 	if (efx_dev_registered(efx)) {
 		efx_fini_mcdi_logging(efx);
-		efx->state = STATE_UNINIT;
+		efx->state = STATE_PROBED;
 		unregister_netdev(efx->net_dev);
 	}
 }
diff --git a/drivers/net/ethernet/sfc/efx_common.c b/drivers/net/ethernet/sfc/efx_common.c
index f6baebd9d632..0e0e86a53407 100644
--- 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_detected(struct pci_dev *pdev,
 
 		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 {
diff --git a/drivers/net/ethernet/sfc/efx_common.h b/drivers/net/ethernet/sfc/efx_common.h
index c72e819da8fd..022ba56736a7 100644
--- 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 *efx);
 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);
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 95069125931a..546552d5d86f 100644
--- 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 */
 



  parent reply	other threads:[~2022-06-28 13:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 13:58 [PATCH net-next v2 00/10] sfc: Add extra states for VDPA Martin Habets
2022-06-28 13:58 ` [PATCH net-next v2 01/10] sfc: Split STATE_READY in to STATE_NET_DOWN and STATE_NET_UP Martin Habets
2022-06-28 13:59 ` Martin Habets [this message]
2022-06-28 13:59 ` [PATCH net-next v2 03/10] sfc: Remove netdev init from efx_init_struct Martin Habets
2022-06-28 13:59 ` [PATCH net-next v2 04/10] sfc: Change BUG_ON to WARN_ON and recovery code Martin Habets
2022-06-28 13:59 ` [PATCH net-next v2 05/10] sfc: Encapsulate access to netdev_priv() Martin Habets
2022-06-28 13:59 ` [PATCH net-next v2 06/10] sfc: Separate efx_nic memory from net_device memory Martin Habets
2022-06-28 14:00 ` [PATCH net-next v2 07/10] sfc: Move EF100 efx_nic_type structs to the end of the file Martin Habets
2022-06-28 14:00 ` [PATCH net-next v2 08/10] sfc: Unsplit literal string Martin Habets
2022-06-28 14:00 ` [PATCH net-next v2 09/10] sfc: replace function name in string with __func__ Martin Habets
2022-06-28 14:00 ` [PATCH net-next v2 10/10] sfc: Separate netdev probe/remove from PCI probe/remove Martin Habets
2022-06-29 12:50 ` [PATCH net-next v2 00/10] sfc: Add extra states for VDPA patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=165642474801.31669.7428696396724224721.stgit@palantir17.mph.net \
    --to=habetsm.xilinx@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=jonathan.s.cooper@amd.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.