netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edward Cree <ecree@solarflare.com>
To: <linux-net-drivers@solarflare.com>, <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
Subject: [PATCH v2 net-next 05/16] sfc_ef100: reset-handling stub
Date: Mon, 13 Jul 2020 12:32:40 +0100	[thread overview]
Message-ID: <b98a3659-acbc-63ea-b147-289c14536e21@solarflare.com> (raw)
In-Reply-To: <dbd87499-161e-09f3-7dec-8b7c13ad02dd@solarflare.com>

We don't actually do the efx_mcdi_reset() because we don't have MCDI yet.

Signed-off-by: Edward Cree <ecree@solarflare.com>
---
 drivers/net/ethernet/sfc/ef100_nic.c | 50 ++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
index 20b6f4bb35ad..772cde009472 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.c
+++ b/drivers/net/ethernet/sfc/ef100_nic.c
@@ -26,6 +26,8 @@
 
 #define EF100_MAX_VIS 4096
 
+#define EF100_RESET_PORT ((ETH_RESET_MAC | ETH_RESET_PHY) << ETH_RESET_SHARED_SHIFT)
+
 /*	MCDI
  */
 static int ef100_get_warm_boot_count(struct efx_nic *efx)
@@ -78,6 +80,51 @@ static irqreturn_t ef100_msi_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+/*	Other
+ */
+
+static enum reset_type ef100_map_reset_reason(enum reset_type reason)
+{
+	if (reason == RESET_TYPE_TX_WATCHDOG)
+		return reason;
+	return RESET_TYPE_DISABLE;
+}
+
+static int ef100_map_reset_flags(u32 *flags)
+{
+	/* Only perform a RESET_TYPE_ALL because we don't support MC_REBOOTs */
+	if ((*flags & EF100_RESET_PORT)) {
+		*flags &= ~EF100_RESET_PORT;
+		return RESET_TYPE_ALL;
+	}
+	if (*flags & ETH_RESET_MGMT) {
+		*flags &= ~ETH_RESET_MGMT;
+		return RESET_TYPE_DISABLE;
+	}
+
+	return -EINVAL;
+}
+
+static int ef100_reset(struct efx_nic *efx, enum reset_type reset_type)
+{
+	int rc;
+
+	dev_close(efx->net_dev);
+
+	if (reset_type == RESET_TYPE_TX_WATCHDOG) {
+		netif_device_attach(efx->net_dev);
+		__clear_bit(reset_type, &efx->reset_pending);
+		rc = dev_open(efx->net_dev, NULL);
+	} else if (reset_type == RESET_TYPE_ALL) {
+		netif_device_attach(efx->net_dev);
+
+		rc = dev_open(efx->net_dev, NULL);
+	} else {
+		rc = 1;	/* Leave the device closed */
+	}
+	return rc;
+}
+
 /*	NIC level access functions
  */
 const struct efx_nic_type ef100_pf_nic_type = {
@@ -89,6 +136,9 @@ const struct efx_nic_type ef100_pf_nic_type = {
 	.irq_disable_non_ev = efx_port_dummy_op_void,
 	.push_irq_moderation = efx_channel_dummy_op_void,
 	.min_interrupt_mode = EFX_INT_MODE_MSIX,
+	.map_reset_reason = ef100_map_reset_reason,
+	.map_reset_flags = ef100_map_reset_flags,
+	.reset = ef100_reset,
 
 	.ev_probe = ef100_ev_probe,
 	.irq_handle_msi = ef100_msi_interrupt,


  parent reply	other threads:[~2020-07-13 11:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13 11:27 [PATCH v2 net-next 00/16] sfc_ef100: driver for EF100 family NICs, part 1 Edward Cree
2020-07-13 11:29 ` [PATCH v2 net-next 01/16] sfc: remove efx_ethtool_nway_reset() Edward Cree
2020-07-13 11:30 ` [PATCH v2 net-next 02/16] sfc_ef100: add EF100 register definitions Edward Cree
2020-07-13 11:31 ` [PATCH v2 net-next 03/16] sfc_ef100: register accesses on EF100 Edward Cree
2020-07-13 11:32 ` [PATCH v2 net-next 04/16] sfc_ef100: skeleton EF100 PF driver Edward Cree
2020-07-13 23:02   ` Jakub Kicinski
2020-07-14  9:02     ` Edward Cree
2020-07-14 16:33       ` Jakub Kicinski
2020-07-13 23:07   ` Jakub Kicinski
2020-07-13 23:08   ` Jakub Kicinski
2020-07-13 11:32 ` Edward Cree [this message]
2020-07-13 11:32 ` [PATCH v2 net-next 06/16] sfc_ef100: PHY probe stub Edward Cree
2020-07-13 11:33 ` [PATCH v2 net-next 07/16] sfc_ef100: don't call efx_reset_down()/up() on EF100 Edward Cree
2020-07-13 11:33 ` [PATCH v2 net-next 08/16] sfc_ef100: implement MCDI transport Edward Cree
2020-07-13 11:34 ` [PATCH v2 net-next 09/16] sfc_ef100: implement ndo_open/close and EVQ probing Edward Cree
2020-07-13 11:34 ` [PATCH v2 net-next 10/16] sfc_ef100: process events for MCDI completions Edward Cree
2020-07-13 11:35 ` [PATCH v2 net-next 11/16] sfc_ef100: read datapath caps, implement check_caps Edward Cree
2020-07-13 11:35 ` [PATCH v2 net-next 12/16] sfc_ef100: extend ef100_check_caps to cover datapath_caps3 Edward Cree
2020-07-13 11:36 ` [PATCH v2 net-next 13/16] sfc_ef100: actually perform resets Edward Cree
2020-07-13 11:36 ` [PATCH v2 net-next 14/16] sfc_ef100: probe the PHY and configure the MAC Edward Cree
2020-07-13 11:37 ` [PATCH v2 net-next 15/16] sfc_ef100: read device MAC address at probe time Edward Cree
2020-07-13 11:37 ` [PATCH v2 net-next 16/16] sfc_ef100: implement ndo_get_phys_port_{id,name} Edward Cree

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=b98a3659-acbc-63ea-b147-289c14536e21@solarflare.com \
    --to=ecree@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).