From 7e1059e8218fc3f4f7798d11f1e219a033d20ecd Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Fri, 23 Nov 2018 07:50:56 +0000 Subject: [PATCH] sfxge(4): let caller know that queue is already flushed Tx/Rx queue may be already flushed due to Tx/Rx error on the queue or MC reboot. Caller needs to know that the queue is already flushed to avoid waiting for flush done event. Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D18070 --- sys/dev/sfxge/common/ef10_ev.c | 7 ++++++- sys/dev/sfxge/common/ef10_rx.c | 18 +++++++++++++++--- sys/dev/sfxge/common/ef10_tx.c | 18 +++++++++++++++--- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/sys/dev/sfxge/common/ef10_ev.c b/sys/dev/sfxge/common/ef10_ev.c index 9a5582b0fe0..733719897e6 100644 --- a/sys/dev/sfxge/common/ef10_ev.c +++ b/sys/dev/sfxge/common/ef10_ev.c @@ -434,7 +434,12 @@ efx_mcdi_fini_evq( return (0); fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); + /* + * EALREADY is not an error, but indicates that the MC has rebooted and + * that the EVQ has already been destroyed. + */ + if (rc != EALREADY) + EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); } diff --git a/sys/dev/sfxge/common/ef10_rx.c b/sys/dev/sfxge/common/ef10_rx.c index 9953ddf415c..c1fb5928003 100644 --- a/sys/dev/sfxge/common/ef10_rx.c +++ b/sys/dev/sfxge/common/ef10_rx.c @@ -140,7 +140,7 @@ efx_mcdi_fini_rxq( efx_mcdi_execute_quiet(enp, &req); - if ((req.emr_rc != 0) && (req.emr_rc != EALREADY)) { + if (req.emr_rc != 0) { rc = req.emr_rc; goto fail1; } @@ -148,7 +148,12 @@ efx_mcdi_fini_rxq( return (0); fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); + /* + * EALREADY is not an error, but indicates that the MC has rebooted and + * that the RXQ has already been destroyed. + */ + if (rc != EALREADY) + EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); } @@ -819,7 +824,14 @@ ef10_rx_qflush( return (0); fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); + /* + * EALREADY is not an error, but indicates that the MC has rebooted and + * that the RXQ has already been destroyed. Callers need to know that + * the RXQ flush has completed to avoid waiting until timeout for a + * flush done event that will not be delivered. + */ + if (rc != EALREADY) + EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); } diff --git a/sys/dev/sfxge/common/ef10_tx.c b/sys/dev/sfxge/common/ef10_tx.c index 9916ca10ad3..8a8a51ac68e 100644 --- a/sys/dev/sfxge/common/ef10_tx.c +++ b/sys/dev/sfxge/common/ef10_tx.c @@ -151,7 +151,7 @@ efx_mcdi_fini_txq( efx_mcdi_execute_quiet(enp, &req); - if ((req.emr_rc != 0) && (req.emr_rc != EALREADY)) { + if (req.emr_rc != 0) { rc = req.emr_rc; goto fail1; } @@ -159,7 +159,12 @@ efx_mcdi_fini_txq( return (0); fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); + /* + * EALREADY is not an error, but indicates that the MC has rebooted and + * that the TXQ has already been destroyed. + */ + if (rc != EALREADY) + EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); } @@ -690,7 +695,14 @@ ef10_tx_qpace( return (0); fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); + /* + * EALREADY is not an error, but indicates that the MC has rebooted and + * that the TXQ has already been destroyed. Callers need to know that + * the TXQ flush has completed to avoid waiting until timeout for a + * flush done event that will not be delivered. + */ + if (rc != EALREADY) + EFSYS_PROBE1(fail1, efx_rc_t, rc); return (rc); } -- 2.45.2