summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2017-08-01 01:11:36 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2017-08-01 01:11:36 +0000
commit42b03ea71787c75b974ef1df5eb51dfbc294e6cb (patch)
tree8dd7bc99b57cfdd014f2a323d3b855c7ee4c58ab /sys/dev/pci
parent8bc5303726597e55859432912d1dd573a0c755bf (diff)
defer init of the myxmcl pool to mountroot, and enable pool cpu caches.
pool_cache_init cannot be called during autoconf because we cant be confident about the number of cpus in the machine until the first run of attaches. mountroot is after autoconf, and myx already has code that runs there for the firmware loading. discussed with deraadt@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_myx.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/sys/dev/pci/if_myx.c b/sys/dev/pci/if_myx.c
index b069e983dac..0208ad7c7e7 100644
--- a/sys/dev/pci/if_myx.c
+++ b/sys/dev/pci/if_myx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_myx.c,v 1.102 2017/02/07 06:51:58 dlg Exp $ */
+/* $OpenBSD: if_myx.c,v 1.103 2017/08/01 01:11:35 dlg Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
@@ -292,20 +292,6 @@ myx_attach(struct device *parent, struct device *self, void *aux)
part[0] == '\0' ? "(unknown)" : part,
ether_sprintf(sc->sc_ac.ac_enaddr));
- /* this is sort of racy */
- if (myx_mcl_pool == NULL) {
- myx_mcl_pool = malloc(sizeof(*myx_mcl_pool), M_DEVBUF,
- M_WAITOK);
- if (myx_mcl_pool == NULL) {
- printf("%s: unable to allocate mcl pool\n",
- DEVNAME(sc));
- goto unmap;
- }
-
- m_pool_init(myx_mcl_pool, MYX_RXBIG_SIZE, MYX_BOUNDARY,
- "myxmcl");
- }
-
if (myx_pcie_dc(sc, pa) != 0)
printf("%s: unable to configure PCI Express\n", DEVNAME(sc));
@@ -469,6 +455,16 @@ myx_attachhook(struct device *self)
struct ifnet *ifp = &sc->sc_ac.ac_if;
struct myx_cmd mc;
+ /* this is sort of racy */
+ if (myx_mcl_pool == NULL) {
+ myx_mcl_pool = malloc(sizeof(*myx_mcl_pool), M_DEVBUF,
+ M_WAITOK);
+
+ m_pool_init(myx_mcl_pool, MYX_RXBIG_SIZE, MYX_BOUNDARY,
+ "myxmcl");
+ pool_cache_init(myx_mcl_pool);
+ }
+
/* Allocate command DMA memory */
if (myx_dmamem_alloc(sc, &sc->sc_cmddma, MYXALIGN_CMD,
MYXALIGN_CMD) != 0) {