summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarybchik <arybchik@FreeBSD.org>2017-01-02 09:37:15 +0000
committerarybchik <arybchik@FreeBSD.org>2017-01-02 09:37:15 +0000
commit67bed62d298f5e536ee51b95bee68e5cf1cbffb9 (patch)
tree635769b591167c338d172388cad6e4628ac5a935
parent9ef15333c1f08c09bb94d46f966d5395cedede95 (diff)
downloadFreeBSD-src-67bed62d298f5e536ee51b95bee68e5cf1cbffb9.zip
FreeBSD-src-67bed62d298f5e536ee51b95bee68e5cf1cbffb9.tar.gz
MFC r310754
sfxge(4): don't use Tx descriptor push with TSO option descriptors It is not safe to push TSO option descriptors if pacer bypass is enabled, so to make sure that doesn't happen never push TSO option descriptors. Submitted by: Mark Spender <mspender at solarflare.com> Sponsored by: Solarflare Communications, Inc.
-rwxr-xr-xsys/dev/sfxge/common/ef10_tx.c56
1 files changed, 43 insertions, 13 deletions
diff --git a/sys/dev/sfxge/common/ef10_tx.c b/sys/dev/sfxge/common/ef10_tx.c
index a4729a1..2b0ec5e 100755
--- a/sys/dev/sfxge/common/ef10_tx.c
+++ b/sys/dev/sfxge/common/ef10_tx.c
@@ -470,9 +470,9 @@ fail1:
}
/*
- * This improves performance by pushing a TX descriptor at the same time as the
- * doorbell. The descriptor must be added to the TXQ, so that can be used if the
- * hardware decides not to use the pushed descriptor.
+ * This improves performance by, when possible, pushing a TX descriptor at the
+ * same time as the doorbell. The descriptor must be added to the TXQ, so that
+ * can be used if the hardware decides not to use the pushed descriptor.
*/
void
ef10_tx_qpush(
@@ -492,16 +492,46 @@ ef10_tx_qpush(
offset = id * sizeof (efx_qword_t);
EFSYS_MEM_READQ(etp->et_esmp, offset, &desc);
- EFX_POPULATE_OWORD_3(oword,
- ERF_DZ_TX_DESC_WPTR, wptr,
- ERF_DZ_TX_DESC_HWORD, EFX_QWORD_FIELD(desc, EFX_DWORD_1),
- ERF_DZ_TX_DESC_LWORD, EFX_QWORD_FIELD(desc, EFX_DWORD_0));
-
- /* Guarantee ordering of memory (descriptors) and PIO (doorbell) */
- EFX_DMA_SYNC_QUEUE_FOR_DEVICE(etp->et_esmp, etp->et_mask + 1, wptr, id);
- EFSYS_PIO_WRITE_BARRIER();
- EFX_BAR_TBL_DOORBELL_WRITEO(enp, ER_DZ_TX_DESC_UPD_REG, etp->et_index,
- &oword);
+
+ /*
+ * SF Bug 65776: TSO option descriptors cannot be pushed if pacer bypass
+ * is enabled on the event queue this transmit queue is attached to.
+ *
+ * To ensure the code is safe, it is easiest to simply test the type of
+ * the descriptor to push, and only push it is if it not a TSO option
+ * descriptor.
+ */
+ if ((EFX_QWORD_FIELD(desc, ESF_DZ_TX_DESC_IS_OPT) != 1) ||
+ (EFX_QWORD_FIELD(desc, ESF_DZ_TX_OPTION_TYPE) !=
+ ESE_DZ_TX_OPTION_DESC_TSO)) {
+ /* Push the descriptor and update the wptr. */
+ EFX_POPULATE_OWORD_3(oword, ERF_DZ_TX_DESC_WPTR, wptr,
+ ERF_DZ_TX_DESC_HWORD, EFX_QWORD_FIELD(desc, EFX_DWORD_1),
+ ERF_DZ_TX_DESC_LWORD, EFX_QWORD_FIELD(desc, EFX_DWORD_0));
+
+ /* Ensure ordering of memory (descriptors) and PIO (doorbell) */
+ EFX_DMA_SYNC_QUEUE_FOR_DEVICE(etp->et_esmp, etp->et_mask + 1,
+ wptr, id);
+ EFSYS_PIO_WRITE_BARRIER();
+ EFX_BAR_TBL_DOORBELL_WRITEO(enp, ER_DZ_TX_DESC_UPD_REG,
+ etp->et_index, &oword);
+ } else {
+ efx_dword_t dword;
+
+ /*
+ * Only update the wptr. This is signalled to the hardware by
+ * only writing one DWORD of the doorbell register.
+ */
+ EFX_POPULATE_OWORD_1(oword, ERF_DZ_TX_DESC_WPTR, wptr);
+ dword = oword.eo_dword[2];
+
+ /* Ensure ordering of memory (descriptors) and PIO (doorbell) */
+ EFX_DMA_SYNC_QUEUE_FOR_DEVICE(etp->et_esmp, etp->et_mask + 1,
+ wptr, id);
+ EFSYS_PIO_WRITE_BARRIER();
+ EFX_BAR_TBL_WRITED2(enp, ER_DZ_TX_DESC_UPD_REG,
+ etp->et_index, &dword, B_FALSE);
+ }
}
__checkReturn efx_rc_t
OpenPOWER on IntegriCloud