summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2019-06-12 01:38:31 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2019-06-12 01:38:31 +0000
commit824c2554ae55b76aa45cda4140510807b15ac86c (patch)
tree4b2b72859b0e737677cd661d7eb5635c89f89571 /sys
parentd357c52bf710e7f1f545c0eb6681590c0d8a03c1 (diff)
Set interrupt moderation on the completion queue for around 10000
interrupts per second, or 90% of the cq size. ok dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_mcx.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/pci/if_mcx.c b/sys/dev/pci/if_mcx.c
index fba4c01a6a0..c1fcd15817c 100644
--- a/sys/dev/pci/if_mcx.c
+++ b/sys/dev/pci/if_mcx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mcx.c,v 1.26 2019/06/11 06:28:09 dlg Exp $ */
+/* $OpenBSD: if_mcx.c,v 1.27 2019/06/12 01:38:30 jmatthew Exp $ */
/*
* Copyright (c) 2017 David Gwynne <dlg@openbsd.org>
@@ -75,6 +75,10 @@
#define MCX_LOG_RQ_SIZE 10
#define MCX_LOG_SQ_SIZE 11
+/* completion event moderation - about 10khz, or 90% of the cq */
+#define MCX_CQ_MOD_PERIOD 50
+#define MCX_CQ_MOD_COUNTER (((1 << (MCX_LOG_CQ_SIZE - 1)) * 9) / 10)
+
#define MCX_LOG_SQ_ENTRY_SIZE 6
#define MCX_SQ_ENTRY_MAX_SLOTS 4
#define MCX_SQ_SEGS_PER_SLOT \
@@ -3879,7 +3883,9 @@ mcx_create_cq(struct mcx_softc *sc, int eqn)
mbin->cmd_cq_ctx.cq_uar_size = htobe32(
(MCX_LOG_CQ_SIZE << MCX_CQ_CTX_LOG_CQ_SIZE_SHIFT) | sc->sc_uar);
mbin->cmd_cq_ctx.cq_eqn = htobe32(eqn);
- /* set event moderation bits here */
+ mbin->cmd_cq_ctx.cq_period_max_count = htobe32(
+ (MCX_CQ_MOD_PERIOD << MCX_CQ_CTX_PERIOD_SHIFT) |
+ MCX_CQ_MOD_COUNTER);
mbin->cmd_cq_ctx.cq_doorbell = htobe64(
MCX_DMA_DVA(&sc->sc_doorbell_mem) +
MCX_CQ_DOORBELL_OFFSET + (MCX_CQ_DOORBELL_SIZE * sc->sc_num_cq));