summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarybchik <arybchik@FreeBSD.org>2017-01-06 07:33:22 +0000
committerarybchik <arybchik@FreeBSD.org>2017-01-06 07:33:22 +0000
commit50e2c9cfe409141f5d4c5e0659ad623725b59d85 (patch)
treef0a3c2b9c269e3a63cdebc3c7cc8971c71fa3c65
parent4d2a475f47f82adc6eca482282321fe776a43508 (diff)
downloadFreeBSD-src-50e2c9cfe409141f5d4c5e0659ad623725b59d85.zip
FreeBSD-src-50e2c9cfe409141f5d4c5e0659ad623725b59d85.tar.gz
MFC r310818
sfxge(4): support per-command MCDI timeout Submitted by: Andy Moreton <amoreton at solarflare.com> Sponsored by: Solarflare Communications, Inc.
-rw-r--r--sys/dev/sfxge/sfxge_mcdi.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/sfxge/sfxge_mcdi.c b/sys/dev/sfxge/sfxge_mcdi.c
index 02b59ac..9954eee 100644
--- a/sys/dev/sfxge/sfxge_mcdi.c
+++ b/sys/dev/sfxge/sfxge_mcdi.c
@@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
#define SFXGE_MCDI_POLL_INTERVAL_MIN 10 /* 10us in 1us units */
#define SFXGE_MCDI_POLL_INTERVAL_MAX 100000 /* 100ms in 1us units */
-#define SFXGE_MCDI_WATCHDOG_INTERVAL 10000000 /* 10s in 1us units */
static void
sfxge_mcdi_timeout(struct sfxge_softc *sc)
@@ -70,7 +69,7 @@ sfxge_mcdi_timeout(struct sfxge_softc *sc)
}
static void
-sfxge_mcdi_poll(struct sfxge_softc *sc)
+sfxge_mcdi_poll(struct sfxge_softc *sc, uint32_t timeout_us)
{
efx_nic_t *enp;
clock_t delay_total;
@@ -87,7 +86,7 @@ sfxge_mcdi_poll(struct sfxge_softc *sc)
return;
}
- if (delay_total > SFXGE_MCDI_WATCHDOG_INTERVAL) {
+ if (delay_total > timeout_us) {
aborted = efx_mcdi_request_abort(enp);
KASSERT(aborted, ("abort failed"));
sfxge_mcdi_timeout(sc);
@@ -115,6 +114,7 @@ sfxge_mcdi_execute(void *arg, efx_mcdi_req_t *emrp)
{
struct sfxge_softc *sc;
struct sfxge_mcdi *mcdi;
+ uint32_t timeout_us = 0;
sc = (struct sfxge_softc *)arg;
mcdi = &sc->mcdi;
@@ -125,8 +125,11 @@ sfxge_mcdi_execute(void *arg, efx_mcdi_req_t *emrp)
("MCDI not initialized"));
/* Issue request and poll for completion. */
+ efx_mcdi_get_timeout(sc->enp, emrp, &timeout_us);
+ KASSERT(timeout_us > 0, ("MCDI timeout not initialized"));
+
efx_mcdi_request_start(sc->enp, emrp, B_FALSE);
- sfxge_mcdi_poll(sc);
+ sfxge_mcdi_poll(sc, timeout_us);
SFXGE_MCDI_UNLOCK(mcdi);
}
OpenPOWER on IntegriCloud