diff options
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_ti.c | 58 | ||||
-rw-r--r-- | sys/dev/pci/if_wb.c | 13 |
2 files changed, 17 insertions, 54 deletions
diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index a120af151cc..f15e0653909 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ti.c,v 1.19 2001/05/07 18:48:31 jason Exp $ */ +/* $OpenBSD: if_ti.c,v 1.20 2001/05/17 18:41:46 provos Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -166,8 +166,7 @@ void ti_cmd_ext __P((struct ti_softc *, struct ti_cmd_desc *, void ti_handle_events __P((struct ti_softc *)); int ti_alloc_jumbo_mem __P((struct ti_softc *)); void *ti_jalloc __P((struct ti_softc *)); -void ti_jfree __P((struct mbuf *)); -void ti_jref __P((struct mbuf *)); +void ti_jfree __P((caddr_t, u_int, void *)); int ti_newbuf_std __P((struct ti_softc *, int, struct mbuf *)); int ti_newbuf_mini __P((struct ti_softc *, int, struct mbuf *)); int ti_newbuf_jumbo __P((struct ti_softc *, int, struct mbuf *)); @@ -641,62 +640,24 @@ void *ti_jalloc(sc) } /* - * Adjust usage count on a jumbo buffer. In general this doesn't - * get used much because our jumbo buffers don't get passed around - * too much, but it's implemented for correctness. - */ -void -ti_jref(m) - struct mbuf *m; -{ - caddr_t buf = m->m_ext.ext_buf; - u_int size = m->m_ext.ext_size; - struct ti_softc *sc; - register int i; - - /* Extract the softc struct pointer. */ - sc = (struct ti_softc *)m->m_ext.ext_handle; - - if (sc == NULL) - panic("ti_jref: can't find softc pointer!"); - - if (size != TI_JUMBO_FRAMELEN) - panic("ti_jref: adjusting refcount of buf of wrong size!"); - - /* calculate the slot this buffer belongs to */ - i = ((vaddr_t)buf - (vaddr_t)sc->ti_cdata.ti_jumbo_buf) / TI_JLEN; - - if ((i < 0) || (i >= TI_JSLOTS)) - panic("ti_jref: asked to reference buffer " - "that we don't manage!"); - else if (sc->ti_cdata.ti_jslots[i].ti_inuse == 0) - panic("ti_jref: buffer already free!"); - else - sc->ti_cdata.ti_jslots[i].ti_inuse++; -} - -/* * Release a jumbo buffer. */ void -ti_jfree(m) - struct mbuf *m; +ti_jfree(buf, size, arg) + caddr_t buf; + u_int size; + void *arg; { - caddr_t buf = m->m_ext.ext_buf; - u_int size = m->m_ext.ext_size; struct ti_softc *sc; int i; struct ti_jpool_entry *entry; /* Extract the softc struct pointer. */ - sc = (struct ti_softc *)m->m_ext.ext_handle; + sc = (struct ti_softc *)arg; if (sc == NULL) panic("ti_jfree: can't find softc pointer!"); - if (size != TI_JUMBO_FRAMELEN) - panic("ti_jfree: freeing buffer of wrong size!"); - /* calculate the slot this buffer belongs to */ i = ((vaddr_t)buf - (vaddr_t)sc->ti_cdata.ti_jumbo_buf) / TI_JLEN; @@ -846,15 +807,14 @@ int ti_newbuf_jumbo(sc, i, m) m_new->m_len = m_new->m_pkthdr.len = m_new->m_ext.ext_size = TI_JUMBO_FRAMELEN; m_new->m_ext.ext_free = ti_jfree; - m_new->m_ext.ext_ref = ti_jref; + m_new->m_ext.ext_arg = sc; + MCLINITREFERENCE(m_new); } else { m_new = m; m_new->m_data = m_new->m_ext.ext_buf; m_new->m_ext.ext_size = TI_JUMBO_FRAMELEN; } - m_new->m_ext.ext_handle = sc; - m_adj(m_new, ETHER_ALIGN); /* Set up the descriptor. */ r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index a2bdabd5656..a123689bcc7 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.8 2001/02/20 19:39:44 mickey Exp $ */ +/* $OpenBSD: if_wb.c,v 1.9 2001/05/17 18:41:46 provos Exp $ */ /* * Copyright (c) 1997, 1998 @@ -136,7 +136,7 @@ int wb_probe __P((struct device *, void *, void *)); void wb_attach __P((struct device *, struct device *, void *)); -void wb_bfree __P((struct mbuf *)); +void wb_bfree __P((caddr_t, u_int, void *)); int wb_newbuf __P((struct wb_softc *, struct wb_chain_onefrag *, struct mbuf *)); int wb_encap __P((struct wb_softc *, struct wb_chain *, @@ -1007,8 +1007,10 @@ int wb_list_rx_init(sc) } void -wb_bfree(m) - struct mbuf *m; +wb_bfree(buf, size, arg) + caddr_t buf; + u_int size; + void *arg; { } @@ -1032,7 +1034,8 @@ wb_newbuf(sc, c, m) m_new->m_ext.ext_size = m_new->m_pkthdr.len = m_new->m_len = WB_BUFBYTES; m_new->m_ext.ext_free = wb_bfree; - m_new->m_ext.ext_ref = wb_bfree; + m_new->m_ext.ext_arg = NULL; + MCLINITREFERENCE(m_new); } else { m_new = m; m_new->m_len = m_new->m_pkthdr.len = WB_BUFBYTES; |