summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2017-08-01 01:11:35 +0000
committerdlg <dlg@openbsd.org>2017-08-01 01:11:35 +0000
commit431d4b64e07bb59ddbfa192e5a83b5944964d95a (patch)
tree03a6673bbb85836bb823eeafd31f3aca27f7c91e
parentSilence some warnings generated by clang. (diff)
downloadwireguard-openbsd-431d4b64e07bb59ddbfa192e5a83b5944964d95a.tar.xz
wireguard-openbsd-431d4b64e07bb59ddbfa192e5a83b5944964d95a.zip
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@
-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) {