summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_mcx.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2021-01-25 12:27:43 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2021-01-25 12:27:43 +0000
commitca99bd40f588b784882f05d1c6e89478523ded27 (patch)
tree9921bc3021a5816a30b4de52fb93000da43c49d1 /sys/dev/pci/if_mcx.c
parentd68150f2d844fcc57d99b7ee33c2f69e11dce95e (diff)
raise the max number of queues/interrupts to 16, up from 1.
jmatthew@ has tried this before, but hrvoje popovski experienced breakage so it wasn't enabled. we've tightened the code up since then so it's time to try again. this diff has been tested by hrvoje popovski and myself ok jmatthew@
Diffstat (limited to 'sys/dev/pci/if_mcx.c')
-rw-r--r--sys/dev/pci/if_mcx.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/dev/pci/if_mcx.c b/sys/dev/pci/if_mcx.c
index a33c68af084..72fba2f0357 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.96 2021/01/25 09:36:48 dlg Exp $ */
+/* $OpenBSD: if_mcx.c,v 1.97 2021/01/25 12:27:42 dlg Exp $ */
/*
* Copyright (c) 2017 David Gwynne <dlg@openbsd.org>
@@ -85,7 +85,7 @@
#define MCX_LOG_RQ_SIZE 10
#define MCX_LOG_SQ_SIZE 11
-#define MCX_MAX_QUEUES 1
+#define MCX_MAX_QUEUES 16
/* completion event moderation - about 10khz, or 90% of the cq */
#define MCX_CQ_MOD_PERIOD 50
@@ -2479,7 +2479,7 @@ struct mcx_softc {
uint32_t sc_khz;
struct intrmap *sc_intrmap;
- struct mcx_queues sc_queues[MCX_MAX_QUEUES];
+ struct mcx_queues *sc_queues;
int sc_mcam_reg;
@@ -2885,6 +2885,12 @@ mcx_attach(struct device *parent, struct device *self, void *aux)
printf("%s: unable to create interrupt map\n", DEVNAME(sc));
goto teardown;
}
+ sc->sc_queues = mallocarray(intrmap_count(sc->sc_intrmap),
+ sizeof(*sc->sc_queues), M_DEVBUF, M_WAITOK|M_ZERO);
+ if (sc->sc_queues == NULL) {
+ printf("%s: unable to create queues\n", DEVNAME(sc));
+ goto intrunmap;
+ }
strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ);
ifp->if_softc = sc;
@@ -2996,6 +3002,9 @@ intrdisestablish:
pci_intr_disestablish(sc->sc_pc, q->q_ihc);
q->q_ihc = NULL;
}
+ free(sc->sc_queues, M_DEVBUF,
+ intrmap_count(sc->sc_intrmap) * sizeof(*sc->sc_queues));
+intrunmap:
intrmap_destroy(sc->sc_intrmap);
sc->sc_intrmap = NULL;
teardown: