From 42b03ea71787c75b974ef1df5eb51dfbc294e6cb Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Tue, 1 Aug 2017 01:11:36 +0000 Subject: 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@ --- sys/dev/pci/if_myx.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'sys/dev/pci') 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 @@ -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) { -- cgit v1.2.3