From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-net-drivers@solarflare.com>
Subject: [PATCH net-next 09/16] sfc: use MCDI epoch flag to improve MC reboot detection in the driver
Date: Wed, 28 Aug 2013 16:19:54 +0100 [thread overview]
Message-ID: <1377703194.2264.31.camel@bwh-desktop.uk.level5networks.com> (raw)
In-Reply-To: <1377702837.2264.21.camel@bwh-desktop.uk.level5networks.com>
From: Daniel Pieczko <dpieczko@solarflare.com>
The Huntington MC will reject all MCDI requests after an MC reboot until it sees
one with the NOT_EPOCH flag clear. This flag is set by default for all requests,
and then cleared on the first request after we detect that an MC reboot has
occurred.
The old MCDI_STATUS_DELAY_COUNT gave a timeout of 10ms, which was not long enough
for the driver to detect that a reboot had occurred based on the warm boot count
while calling efx_mcdi_poll_reboot() from the loop in efx_mcdi_ev_death().
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/ethernet/sfc/mcdi.c | 19 +++++++++++++------
drivers/net/ethernet/sfc/mcdi.h | 2 ++
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index 3810634..63121ad 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -26,9 +26,10 @@
/* A reboot/assertion causes the MCDI status word to be set after the
* command word is set or a REBOOT event is sent. If we notice a reboot
- * via these mechanisms then wait 10ms for the status word to be set. */
+ * via these mechanisms then wait 20ms for the status word to be set.
+ */
#define MCDI_STATUS_DELAY_US 100
-#define MCDI_STATUS_DELAY_COUNT 100
+#define MCDI_STATUS_DELAY_COUNT 200
#define MCDI_STATUS_SLEEP_MS \
(MCDI_STATUS_DELAY_US * MCDI_STATUS_DELAY_COUNT / 1000)
@@ -56,6 +57,7 @@ int efx_mcdi_init(struct efx_nic *efx)
mcdi->mode = MCDI_MODE_POLL;
(void) efx_mcdi_poll_reboot(efx);
+ mcdi->new_epoch = true;
/* Recover from a failed assertion before probing */
return efx_mcdi_handle_assertion(efx);
@@ -85,24 +87,26 @@ static void efx_mcdi_copyin(struct efx_nic *efx, unsigned cmd,
if (efx->type->mcdi_max_ver == 1) {
/* MCDI v1 */
- EFX_POPULATE_DWORD_6(hdr[0],
+ EFX_POPULATE_DWORD_7(hdr[0],
MCDI_HEADER_RESPONSE, 0,
MCDI_HEADER_RESYNC, 1,
MCDI_HEADER_CODE, cmd,
MCDI_HEADER_DATALEN, inlen,
MCDI_HEADER_SEQ, seqno,
- MCDI_HEADER_XFLAGS, xflags);
+ MCDI_HEADER_XFLAGS, xflags,
+ MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
hdr_len = 4;
} else {
/* MCDI v2 */
BUG_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
- EFX_POPULATE_DWORD_6(hdr[0],
+ EFX_POPULATE_DWORD_7(hdr[0],
MCDI_HEADER_RESPONSE, 0,
MCDI_HEADER_RESYNC, 1,
MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
MCDI_HEADER_DATALEN, 0,
MCDI_HEADER_SEQ, seqno,
- MCDI_HEADER_XFLAGS, xflags);
+ MCDI_HEADER_XFLAGS, xflags,
+ MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
EFX_POPULATE_DWORD_2(hdr[1],
MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
@@ -373,6 +377,7 @@ int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
spin_unlock_bh(&mcdi->iface_lock);
efx_mcdi_copyin(efx, cmd, inbuf, inlen);
+ mcdi->new_epoch = false;
return 0;
}
@@ -435,6 +440,7 @@ int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
if (rc == -EIO || rc == -EINTR) {
msleep(MCDI_STATUS_SLEEP_MS);
efx_mcdi_poll_reboot(efx);
+ mcdi->new_epoch = true;
}
}
@@ -530,6 +536,7 @@ static void efx_mcdi_ev_death(struct efx_nic *efx, int rc)
break;
udelay(MCDI_STATUS_DELAY_US);
}
+ mcdi->new_epoch = true;
}
spin_unlock(&mcdi->iface_lock);
diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
index 5f67ac3..303d9e8 100644
--- a/drivers/net/ethernet/sfc/mcdi.h
+++ b/drivers/net/ethernet/sfc/mcdi.h
@@ -36,6 +36,7 @@ enum efx_mcdi_mode {
* @state: Request handling state. Waited for by @wq.
* @mode: Poll for mcdi completion, or wait for an mcdi_event.
* @wq: Wait queue for threads waiting for @state != %MCDI_STATE_RUNNING
+ * @new_epoch: Indicates start of day or start of MC reboot recovery
* @iface_lock: Serialises access to all the following fields
* @seqno: The next sequence number to use for mcdi requests.
* @credits: Number of spurious MCDI completion events allowed before we
@@ -49,6 +50,7 @@ struct efx_mcdi_iface {
enum efx_mcdi_mode mode;
wait_queue_head_t wq;
spinlock_t iface_lock;
+ bool new_epoch;
unsigned int credits;
unsigned int seqno;
int resprc;
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2013-08-28 15:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-28 15:13 Pull request: sfc-next 2013-08-28 Ben Hutchings
2013-08-28 15:16 ` [PATCH net-next 01/16] sfc: Move NIC-type-specific MTD partition date into separate structures Ben Hutchings
2013-08-28 15:17 ` [PATCH net-next 02/16] sfc: Move MTD operations into efx_nic_type Ben Hutchings
2013-08-28 15:17 ` [PATCH net-next 03/16] sfc: Remove more left-overs from Falcon GMAC support Ben Hutchings
2013-08-28 15:18 ` [PATCH net-next 04/16] sfc: Remove driver-local struct ethtool_string Ben Hutchings
2013-08-28 15:18 ` [PATCH net-next 05/16] sfc: Delegate MAC/NIC statistic description to efx_nic_type Ben Hutchings
2013-08-28 15:18 ` [PATCH net-next 06/16] sfc: PTP MCDI requests need to initialise periph ID field Ben Hutchings
2013-08-28 15:18 ` [PATCH net-next 07/16] sfc: Add a function pointer to abstract write of host time into NIC shared memory Ben Hutchings
2013-08-28 15:19 ` [PATCH net-next 08/16] sfc: Add EF10 support for TX/RX DMA error events handling Ben Hutchings
2013-08-28 15:19 ` Ben Hutchings [this message]
2013-08-28 15:20 ` [PATCH net-next 10/16] sfc: Remove early call to efx_nic_type::reconfigure_mac in efx_reset_up() Ben Hutchings
2013-08-28 15:20 ` [PATCH net-next 11/16] sfc: Rename EFX_PAGE_BLOCK_SIZE to EFX_VI_PAGE_SIZE and adjust comments Ben Hutchings
2013-08-28 15:21 ` [PATCH net-next 12/16] sfc: Generalise packet hash lookup to support EF10 RX prefix Ben Hutchings
2013-08-28 15:21 ` [PATCH net-next 13/16] sfc: Add TX merged completion counter Ben Hutchings
2013-08-28 15:22 ` [PATCH net-next 14/16] sfc: Add support for reading packet length from prefix Ben Hutchings
2013-08-28 15:22 ` [PATCH net-next 15/16] sfc: Return an error code when a sensor is busy Ben Hutchings
2013-08-28 15:23 ` [PATCH net-next 16/16] sfc: Use extended MC_CMD_SENSOR_INFO and MC_CMD_READ_SENSORS Ben Hutchings
2013-08-29 5:56 ` Pull request: sfc-next 2013-08-28 David Miller
2013-08-29 11:29 ` Ben Hutchings
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=1377703194.2264.31.camel@bwh-desktop.uk.level5networks.com \
--to=bhutchings@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