summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2016-05-23 15:22:46 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2016-05-23 15:22:46 +0000
commit8edbf305d54e4f20446f8c2bc0b4cbe9317af367 (patch)
treeb968a9dbe0a2c69b9fc27030b99c9327dd87ab1c /sys/dev/pci
parent930ffb11c330d96ed42b6192bccfc7381bfd4c14 (diff)
remove the function pointer from mbufs. this memory is shared with data
via unions, and we don't want to make it easy to control the target. instead an integer index into an array of acceptable functions is used. drivers using custom functions must register them to receive an index. ok deraadt
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_myx.c4
-rw-r--r--sys/dev/pci/if_nep.c9
2 files changed, 9 insertions, 4 deletions
diff --git a/sys/dev/pci/if_myx.c b/sys/dev/pci/if_myx.c
index 6e98c1ab64f..cae0b82daa3 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.94 2016/04/13 11:36:00 mpi Exp $ */
+/* $OpenBSD: if_myx.c,v 1.95 2016/05/23 15:22:44 tedu Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
@@ -1931,7 +1931,7 @@ myx_mcl_big(void)
return (NULL);
}
- MEXTADD(m, mcl, MYX_RXBIG_SIZE, M_EXTWR, m_extfree_pool, myx_mcl_pool);
+ MEXTADD(m, mcl, MYX_RXBIG_SIZE, M_EXTWR, MEXTFREE_POOL, myx_mcl_pool);
m->m_len = m->m_pkthdr.len = MYX_RXBIG_SIZE;
return (m);
diff --git a/sys/dev/pci/if_nep.c b/sys/dev/pci/if_nep.c
index ae3d817d588..62417f15776 100644
--- a/sys/dev/pci/if_nep.c
+++ b/sys/dev/pci/if_nep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nep.c,v 1.24 2015/11/25 03:09:59 dlg Exp $ */
+/* $OpenBSD: if_nep.c,v 1.25 2016/05/23 15:22:44 tedu Exp $ */
/*
* Copyright (c) 2014, 2015 Mark Kettenis
*
@@ -465,6 +465,8 @@ struct cfdriver nep_cd = {
NULL, "nep", DV_DULL
};
+static u_int nep_mextfree_idx;
+
int nep_pci_enaddr(struct nep_softc *, struct pci_attach_args *);
uint64_t nep_read(struct nep_softc *, uint32_t);
@@ -541,6 +543,9 @@ nep_attach(struct device *parent, struct device *self, void *aux)
pcireg_t memtype;
uint64_t val;
+ if (nep_mextfree_idx == 0)
+ nep_mextfree_idx = mextfree_register(nep_extfree);
+
sc->sc_dmat = pa->pa_dmat;
memtype = PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_64BIT;
@@ -1024,7 +1029,7 @@ nep_rx_proc(struct nep_softc *sc)
ifp->if_ierrors++;
} else {
MEXTADD(m, block + off, PAGE_SIZE, M_EXTWR,
- nep_extfree, block);
+ nep_mextfree_idx, block);
m->m_pkthdr.len = m->m_len = len;
m->m_data += ETHER_ALIGN;