summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/machdep.c9
-rw-r--r--sys/arch/amiga/amiga/machdep.c9
-rw-r--r--sys/arch/hp300/hp300/machdep.c9
-rw-r--r--sys/arch/hppa/hppa/machdep.c9
-rw-r--r--sys/arch/i386/i386/machdep.c9
-rw-r--r--sys/arch/mac68k/mac68k/machdep.c9
-rw-r--r--sys/arch/mvme68k/mvme68k/machdep.c9
-rw-r--r--sys/arch/mvme88k/mvme88k/machdep.c9
-rw-r--r--sys/arch/pmax/pmax/machdep.c9
-rw-r--r--sys/arch/powerpc/powerpc/machdep.c8
-rw-r--r--sys/arch/sparc/sparc/machdep.c9
-rw-r--r--sys/arch/sun3/sun3/machdep.c9
-rw-r--r--sys/arch/vax/vax/machdep.c5
-rw-r--r--sys/conf/param.c14
-rw-r--r--sys/dev/pci/if_ti.c58
-rw-r--r--sys/dev/pci/if_wb.c13
-rw-r--r--sys/kern/init_main.c12
-rw-r--r--sys/kern/uipc_mbuf.c282
-rw-r--r--sys/kern/uipc_mbuf2.c4
-rw-r--r--sys/net/if_sl.c138
-rw-r--r--sys/net/if_slvar.h5
-rw-r--r--sys/netinet/in.h5
-rw-r--r--sys/netinet/ip_ah.c6
-rw-r--r--sys/netinet/ip_esp.c6
-rw-r--r--sys/sys/mbuf.h278
25 files changed, 436 insertions, 497 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index c654f1e355b..bacb7df3164 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.45 2001/05/05 22:33:23 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.46 2001/05/17 18:41:47 provos Exp $ */
/* $NetBSD: machdep.c,v 1.206 2000/05/23 05:12:54 thorpej Exp $ */
/*-
@@ -983,13 +983,6 @@ cpu_startup()
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, 0, FALSE, NULL);
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES);
mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);
diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c
index 13d498d0fec..7dd3a14dc76 100644
--- a/sys/arch/amiga/amiga/machdep.c
+++ b/sys/arch/amiga/amiga/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.43 2001/05/05 22:33:28 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.44 2001/05/17 18:41:47 provos Exp $ */
/* $NetBSD: machdep.c,v 1.95 1997/08/27 18:31:17 is Exp $ */
/*
@@ -532,13 +532,6 @@ again:
TRUE);
#endif
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS + PAGE_SIZE / MCLBYTES, M_MBUF,
- M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES);
#if defined(UVM)
mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);
diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c
index ac6eb43e825..0070a59e5bf 100644
--- a/sys/arch/hp300/hp300/machdep.c
+++ b/sys/arch/hp300/hp300/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.46 2001/05/15 01:57:49 millert Exp $ */
+/* $OpenBSD: machdep.c,v 1.47 2001/05/17 18:41:48 provos Exp $ */
/* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */
/*
@@ -404,13 +404,6 @@ cpu_startup()
VM_PHYS_SIZE, TRUE);
#endif
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES);
#if defined(UVM)
mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);
diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c
index 90ed27ba5b8..d0e0374fc59 100644
--- a/sys/arch/hppa/hppa/machdep.c
+++ b/sys/arch/hppa/hppa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.33 2001/05/05 22:33:40 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.34 2001/05/17 18:41:48 provos Exp $ */
/*
* Copyright (c) 1999-2000 Michael Shalayeff
@@ -667,13 +667,6 @@ cpu_startup()
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, 0, FALSE, NULL);
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES);
mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 2b9bcf6f8ba..b7a1104ec13 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.161 2001/05/13 19:06:52 jason Exp $ */
+/* $OpenBSD: machdep.c,v 1.162 2001/05/17 18:41:48 provos Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -399,13 +399,6 @@ cpu_startup()
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, 0, FALSE, NULL);
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES, M_MBUF,
- M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES);
mb_map = uvm_km_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);
diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c
index fe65b885cbc..051fd5a9dac 100644
--- a/sys/arch/mac68k/mac68k/machdep.c
+++ b/sys/arch/mac68k/mac68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.70 2001/05/08 17:30:41 aaron Exp $ */
+/* $OpenBSD: machdep.c,v 1.71 2001/05/17 18:41:48 provos Exp $ */
/* $NetBSD: machdep.c,v 1.207 1998/07/08 04:39:34 thorpej Exp $ */
/*
@@ -576,13 +576,6 @@ again:
VM_PHYS_SIZE, TRUE);
#endif
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *) malloc(NMBCLUSTERS + PAGE_SIZE / MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS + PAGE_SIZE / MCLBYTES);
#if defined(UVM)
mb_map = uvm_km_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE, FALSE, NULL);
diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c
index af79cf637f9..76d2948219d 100644
--- a/sys/arch/mvme68k/mvme68k/machdep.c
+++ b/sys/arch/mvme68k/mvme68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.38 2001/05/05 22:33:58 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.39 2001/05/17 18:41:49 provos Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -394,13 +394,6 @@ cpu_startup()
phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, TRUE);
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES);
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c
index c701e0cfcda..1c81ac4c65a 100644
--- a/sys/arch/mvme88k/mvme88k/machdep.c
+++ b/sys/arch/mvme88k/mvme88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.34 2001/05/05 22:34:02 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.35 2001/05/17 18:41:49 provos Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -754,13 +754,6 @@ cpu_startup()
if (iomap_extent == 0)
panic("unable to allocate extent for iomap");
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES);
#if defined(UVM)
mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);
diff --git a/sys/arch/pmax/pmax/machdep.c b/sys/arch/pmax/pmax/machdep.c
index 4ebf71853ed..f7b38a21ac1 100644
--- a/sys/arch/pmax/pmax/machdep.c
+++ b/sys/arch/pmax/pmax/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.29 2001/05/12 22:47:08 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.30 2001/05/17 18:41:49 provos Exp $ */
/* $NetBSD: machdep.c,v 1.67 1996/10/23 20:04:40 mhitch Exp $ */
/*
@@ -855,13 +855,6 @@ cpu_startup()
phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, TRUE);
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES);
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
diff --git a/sys/arch/powerpc/powerpc/machdep.c b/sys/arch/powerpc/powerpc/machdep.c
index 1c06ac541d3..bdd812a02bb 100644
--- a/sys/arch/powerpc/powerpc/machdep.c
+++ b/sys/arch/powerpc/powerpc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.60 2001/05/07 01:24:55 drahn Exp $ */
+/* $OpenBSD: machdep.c,v 1.61 2001/05/17 18:41:50 provos Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -549,12 +549,6 @@ cpu_startup()
#endif
ppc_malloc_ok = 1;
- /*
- * Allocate mbuf pool.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS + PAGE_SIZE/MCLBYTES, M_MBUF,
- M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS + PAGE_SIZE/MCLBYTES);
#ifdef UVM
mb_map = uvm_km_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE, FALSE, NULL);
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index 9d53b3ab259..02deb6b068c 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.57 2001/05/10 10:34:47 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.58 2001/05/17 18:41:50 provos Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
@@ -279,13 +279,6 @@ cpu_startup()
if (dvmamap_extent == 0)
panic("unable to allocate extent for dvma");
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES);
mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);
/*
diff --git a/sys/arch/sun3/sun3/machdep.c b/sys/arch/sun3/sun3/machdep.c
index d0b3c2955f8..1f1112389d4 100644
--- a/sys/arch/sun3/sun3/machdep.c
+++ b/sys/arch/sun3/sun3/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.30 2001/05/05 22:34:24 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.31 2001/05/17 18:41:50 provos Exp $ */
/* $NetBSD: machdep.c,v 1.77 1996/10/13 03:47:51 christos Exp $ */
/*
@@ -335,13 +335,6 @@ cpu_startup()
* device drivers clone the kernel mappings into DVMA space.
*/
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES);
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c
index cde030e1f05..5ccd3c82fb3 100644
--- a/sys/arch/vax/vax/machdep.c
+++ b/sys/arch/vax/vax/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.31 2001/05/05 22:34:29 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.32 2001/05/17 18:41:50 provos Exp $ */
/* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */
/*
@@ -267,9 +267,6 @@ cpu_startup()
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, 0, FALSE, NULL);
- mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES);
mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);
diff --git a/sys/conf/param.c b/sys/conf/param.c
index 2cb893efcb2..e288d06566c 100644
--- a/sys/conf/param.c
+++ b/sys/conf/param.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.c,v 1.11 2001/05/05 20:56:57 art Exp $ */
+/* $OpenBSD: param.c,v 1.12 2001/05/17 18:41:47 provos Exp $ */
/* $NetBSD: param.c,v 1.16 1996/03/12 03:08:40 mrg Exp $ */
/*
@@ -103,6 +103,18 @@ int ntimeout = (16 + NPROC) * 2;
int nclist = 60 + 12 * MAXUSERS;
#endif
int nmbclusters = NMBCLUSTERS;
+
+#ifndef MBLOWAT
+#define MBLOWAT 16
+#endif
+int mblowat = MBLOWAT;
+
+#ifndef MCLLOWAT
+#define MCLLOWAT 8
+#endif
+int mcllowat = MCLLOWAT;
+
+
int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */
/*
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;
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index bde4bd42c10..6a0e8ea168f 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.64 2001/05/16 12:49:45 art Exp $ */
+/* $OpenBSD: init_main.c,v 1.65 2001/05/17 18:41:44 provos Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -222,6 +222,13 @@ main(framep)
disk_init(); /* must come before autoconfiguration */
tty_init(); /* initialise tty's */
cpu_startup();
+
+ /*
+ * Initialize mbuf's. Do this now because we might attempt to
+ * allocate mbufs or mbuf clusters during autoconfiguration.
+ */
+ mbinit();
+
cpu_configure();
/* Initialize sysctls (must be done before any processes run) */
@@ -339,9 +346,6 @@ main(framep)
/* Start real time and statistics clocks. */
initclocks();
- /* Initialize mbuf's. */
- mbinit();
-
#ifdef REAL_CLISTS
/* Initialize clists. */
clist_init();
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 6ca1e718531..25e7854c879 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.28 2001/05/16 08:59:04 art Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.29 2001/05/17 18:41:44 provos Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -59,6 +59,7 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
#include <sys/syslog.h>
#include <sys/domain.h>
#include <sys/protosw.h>
+#include <sys/pool.h>
#include <machine/cpu.h>
@@ -68,71 +69,75 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
#include <uvm/uvm_extern.h>
#endif
+struct pool mbpool; /* mbuf pool */
+struct pool mclpool; /* mbuf cluster pool */
+
extern vm_map_t mb_map;
struct mbuf *mbutl;
-char *mclrefcnt;
int needqueuedrain;
+void *mclpool_alloc __P((unsigned long, int, int));
+void mclpool_release __P((void *, unsigned long, int));
+struct mbuf *m_copym0 __P((struct mbuf *, int, int, int, int));
+
+const char *mclpool_warnmsg =
+ "WARNING: mclpool limit reached; increase NMBCLUSTERS";
+
+/*
+ * Initialize the mbuf allcator.
+ */
void
mbinit()
{
- int s;
+ pool_init(&mbpool, MSIZE, 0, 0, 0, "mbpl", 0, NULL, NULL, 0);
+ pool_init(&mclpool, MCLBYTES, 0, 0, 0, "mclpl", 0, mclpool_alloc,
+ mclpool_release, 0);
- s = splimp();
- if (m_clalloc(max(4096 / PAGE_SIZE, 1), M_DONTWAIT) == 0)
- goto bad;
- splx(s);
- return;
-bad:
- splx(s);
- panic("mbinit");
+ /*
+ * Set the hard limit on the mclpool to the number of
+ * mbuf clusters the kernel is to support. Log the limit
+ * reached message max once a minute.
+ */
+ pool_sethardlimit(&mclpool, nmbclusters, mclpool_warnmsg, 60);
+
+ /*
+ * Set a low water mark for both mbufs and clusters. This should
+ * help ensure that they can be allocated in a memory starvation
+ * situation. This is important for e.g. diskless systems which
+ * must allocate mbufs in order for the pagedaemon to clean pages.
+ */
+ pool_setlowat(&mbpool, mblowat);
+ pool_setlowat(&mclpool, mcllowat);
}
-/*
- * Allocate some number of mbuf clusters
- * and place on cluster free list.
- * Must be called at splimp.
- */
-/* ARGSUSED */
-int
-m_clalloc(ncl, nowait)
- register int ncl;
- int nowait;
+
+void *
+mclpool_alloc(sz, flags, mtype)
+ unsigned long sz;
+ int flags;
+ int mtype;
{
- volatile static struct timeval lastlogged;
- struct timeval curtime, logdiff;
- register caddr_t p;
- register int i;
- int npg, s;
+#if defined(UVM)
+ boolean_t waitok = (flags & PR_WAITOK) ? TRUE : FALSE;
- npg = ncl;
+ return ((void *)uvm_km_alloc_poolpage1(mb_map, uvmexp.mb_object,
+ waitok));
+#else
+ return pool_page_alloc(sz, flags, mtype);
+#endif
+}
+
+void
+mclpool_release(v, sz, mtype)
+ void *v;
+ unsigned long sz;
+ int mtype;
+{
#if defined(UVM)
- p = (caddr_t)uvm_km_kmemalloc(mb_map, uvmexp.mb_object, ctob(npg),
- nowait ? 0 : UVM_KMF_NOWAIT);
+ uvm_km_free_poolpage1(mb_map, (vaddr_t)v);
#else
- p = (caddr_t)kmem_malloc(mb_map, ctob(npg), !nowait);
+ pool_page_free(v, sz, mtype);
#endif
- if (p == NULL) {
- s = splclock();
- curtime = time;
- splx(s);
- timersub(&curtime, &lastlogged, &logdiff);
- if (logdiff.tv_sec >= 60) {
- lastlogged = curtime;
- log(LOG_ERR, "mb_map full\n");
- }
- m_reclaim();
- return (mclfree != NULL);
- }
- ncl = ncl * PAGE_SIZE / MCLBYTES;
- for (i = 0; i < ncl; i++) {
- ((union mcluster *)p)->mcl_next = mclfree;
- mclfree = (union mcluster *)p;
- p += MCLBYTES;
- mbstat.m_clfree++;
- }
- mbstat.m_clusters += ncl;
- return (1);
}
/*
@@ -154,6 +159,10 @@ m_retry(i, t)
#define m_retry(i, t) NULL
MGET(m, i, t);
#undef m_retry
+ if (m != NULL)
+ mbstat.m_wait++;
+ else
+ mbstat.m_drops++;
return (m);
}
@@ -175,6 +184,10 @@ m_retryhdr(i, t)
#define m_retryhdr(i, t) NULL
MGETHDR(m, i, t);
#undef m_retryhdr
+ if (m != NULL)
+ mbstat.m_wait++;
+ else
+ mbstat.m_drops++;
return (m);
}
@@ -228,7 +241,7 @@ m_getclr(nowait, type)
MGET(m, nowait, type);
if (m == NULL)
return (NULL);
- bzero(mtod(m, caddr_t), MLEN);
+ memset(mtod(m, caddr_t), 0, MLEN);
return (m);
}
@@ -298,74 +311,11 @@ int MCFail;
struct mbuf *
m_copym(m, off0, len, wait)
- register struct mbuf *m;
+ struct mbuf *m;
int off0, wait;
- register int len;
+ int len;
{
- register struct mbuf *n, **np;
- register int off = off0;
- struct mbuf *top;
- int copyhdr = 0;
-
- if (off < 0)
- panic("m_copym: off %d < 0", off);
- if (len < 0)
- panic("m_copym: len %d < 0", len);
- if (off == 0 && m->m_flags & M_PKTHDR)
- copyhdr = 1;
- while (off > 0) {
- if (m == NULL)
- panic("m_copym: null mbuf");
- if (off < m->m_len)
- break;
- off -= m->m_len;
- m = m->m_next;
- }
- np = &top;
- top = NULL;
- while (len > 0) {
- if (m == NULL) {
- if (len != M_COPYALL)
- panic("m_copym: %d not M_COPYALL", len);
- break;
- }
- MGET(n, wait, m->m_type);
- *np = n;
- if (n == NULL)
- goto nospace;
- if (copyhdr) {
- M_DUP_PKTHDR(n, m);
- if (len == M_COPYALL)
- n->m_pkthdr.len -= off0;
- else
- n->m_pkthdr.len = len;
- copyhdr = 0;
- }
- n->m_len = min(len, m->m_len - off);
- if (m->m_flags & M_EXT) {
- n->m_data = m->m_data + off;
- if (!m->m_ext.ext_ref)
- mclrefcnt[mtocl(m->m_ext.ext_buf)]++;
- else
- (*(m->m_ext.ext_ref))(m);
- n->m_ext = m->m_ext;
- n->m_flags |= M_EXT;
- } else
- bcopy(mtod(m, caddr_t)+off, mtod(n, caddr_t),
- (unsigned)n->m_len);
- if (len != M_COPYALL)
- len -= n->m_len;
- off = 0;
- m = m->m_next;
- np = &n->m_next;
- }
- if (top == NULL)
- MCFail++;
- return (top);
-nospace:
- m_freem(top);
- MCFail++;
- return (NULL);
+ return m_copym0(m, off0, len, wait, 0); /* shallow copy on M_EXT */
}
/*
@@ -374,40 +324,48 @@ nospace:
*/
struct mbuf *
m_copym2(m, off0, len, wait)
- register struct mbuf *m;
+ struct mbuf *m;
int off0, wait;
- register int len;
+ int len;
{
- register struct mbuf *n, **np;
- register int off = off0;
+ return m_copym0(m, off0, len, wait, 1); /* deep copy */
+}
+
+struct mbuf *
+m_copym0(m, off0, len, wait, deep)
+ struct mbuf *m;
+ int off0, wait;
+ int len;
+ int deep; /* deep copy */
+{
+ struct mbuf *n, **np;
+ int off = off0;
struct mbuf *top;
int copyhdr = 0;
- if (len < 0)
- panic("m_copym2: len %d < 0", len);
- if (off < 0)
- panic("m_copym2: off %d < 0", off);
+ if (off < 0 || len < 0)
+ panic("m_copym0: off %d, len %d", off, len);
if (off == 0 && m->m_flags & M_PKTHDR)
copyhdr = 1;
while (off > 0) {
- if (m == NULL)
- panic("m_copym2: null mbuf");
+ if (m == 0)
+ panic("m_copym0: null mbuf");
if (off < m->m_len)
break;
off -= m->m_len;
m = m->m_next;
}
np = &top;
- top = NULL;
+ top = 0;
while (len > 0) {
- if (m == NULL) {
+ if (m == 0) {
if (len != M_COPYALL)
- panic("m_copym2: %d != M_COPYALL", len);
+ panic("m_copym0: m == 0 and not COPYALL");
break;
}
MGET(n, wait, m->m_type);
*np = n;
- if (n == NULL)
+ if (n == 0)
goto nospace;
if (copyhdr) {
M_DUP_PKTHDR(n, m);
@@ -418,30 +376,47 @@ m_copym2(m, off0, len, wait)
copyhdr = 0;
}
n->m_len = min(len, m->m_len - off);
- if ((m->m_flags & M_EXT) && (n->m_len > MHLEN)) {
- /* This is a cheesy hack. */
- MCLGET(n, wait);
- if (n->m_flags & M_EXT)
- bcopy(mtod(m, caddr_t) + off, mtod(n, caddr_t),
+ if (m->m_flags & M_EXT) {
+ if (!deep) {
+ n->m_data = m->m_data + off;
+ n->m_ext = m->m_ext;
+ MCLADDREFERENCE(m, n);
+ } else {
+ /*
+ * we are unsure about the way m was allocated.
+ * copy into multiple MCLBYTES cluster mbufs.
+ */
+ MCLGET(n, wait);
+ n->m_len = 0;
+ n->m_len = M_TRAILINGSPACE(n);
+ n->m_len = min(n->m_len, len);
+ n->m_len = min(n->m_len, m->m_len - off);
+ memcpy(mtod(n, caddr_t), mtod(m, caddr_t) + off,
(unsigned)n->m_len);
- else
- goto nospace;
+ }
} else
- bcopy(mtod(m, caddr_t) + off, mtod(n, caddr_t),
+ memcpy(mtod(n, caddr_t), mtod(m, caddr_t)+off,
(unsigned)n->m_len);
if (len != M_COPYALL)
len -= n->m_len;
- off = 0;
- m = m->m_next;
+ off += n->m_len;
+#ifdef DIAGNOSTIC
+ if (off > m->m_len)
+ panic("m_copym0 overrun");
+#endif
+ if (off == m->m_len) {
+ m = m->m_next;
+ off = 0;
+ }
np = &n->m_next;
}
- if (top == NULL)
+ if (top == 0)
MCFail++;
return (top);
nospace:
m_freem(top);
MCFail++;
- return (NULL);
+ return (0);
}
/*
@@ -875,12 +850,7 @@ m_split(m0, len0, wait)
extpacket:
if (m->m_flags & M_EXT) {
n->m_flags |= M_EXT;
- n->m_ext = m->m_ext;
- if(!m->m_ext.ext_ref)
- mclrefcnt[mtocl(m->m_ext.ext_buf)]++;
- else
- (*(m->m_ext.ext_ref))(m);
- m->m_ext.ext_size = 0; /* For Accounting XXXXXX danger */
+ MCLADDREFERENCE(m, n);
n->m_data = m->m_data + len;
} else {
bcopy(mtod(m, caddr_t) + len, mtod(n, caddr_t), remain);
@@ -973,14 +943,14 @@ m_zero(m)
{
while (m) {
if (m->m_flags & M_PKTHDR)
- bzero((void *)m + sizeof(struct m_hdr) +
- sizeof(struct pkthdr), MHLEN);
+ memset((void *)m + sizeof(struct m_hdr) +
+ sizeof(struct pkthdr), 0, MHLEN);
else
- bzero((void *)m + sizeof(struct m_hdr), MLEN);
+ memset((void *)m + sizeof(struct m_hdr), 0, MLEN);
if ((m->m_flags & M_EXT) &&
(m->m_ext.ext_free == NULL) &&
- !mclrefcnt[mtocl((m)->m_ext.ext_buf)])
- bzero(m->m_ext.ext_buf, m->m_ext.ext_size);
+ !MCLISREFERENCED(m))
+ memset(m->m_ext.ext_buf, 0, m->m_ext.ext_size);
m = m->m_next;
}
}
@@ -1056,4 +1026,4 @@ _sk_mclget(struct mbuf *m, int how)
{
_MCLGET(m, how);
}
-#endif /* SMALL_KERNEL */ \ No newline at end of file
+#endif /* SMALL_KERNEL */
diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c
index d1b437b5944..3b335c320ef 100644
--- a/sys/kern/uipc_mbuf2.c
+++ b/sys/kern/uipc_mbuf2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf2.c,v 1.6 2001/03/28 20:03:00 angelos Exp $ */
+/* $OpenBSD: uipc_mbuf2.c,v 1.7 2001/05/17 18:41:45 provos Exp $ */
/* $KAME: uipc_mbuf2.c,v 1.29 2001/02/14 13:42:10 itojun Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.40 1999/04/01 00:23:25 thorpej Exp $ */
@@ -74,7 +74,7 @@
#define M_SHAREDCLUSTER(m) \
(((m)->m_flags & M_EXT) != 0 && \
- ((m)->m_ext.ext_free || mclrefcnt[mtocl((m)->m_ext.ext_buf)] > 1))
+ ((m)->m_ext.ext_free || MCLISREFERENCED((m))))
/* can't call it m_dup(), as freebsd[34] uses m_dup() with different arg */
static struct mbuf *m_dup1 __P((struct mbuf *, int, int, int));
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index c1ac7a7fa4a..a0784101bfe 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sl.c,v 1.10 2001/03/13 05:16:06 mickey Exp $ */
+/* $OpenBSD: if_sl.c,v 1.11 2001/05/17 18:41:46 provos Exp $ */
/* $NetBSD: if_sl.c,v 1.39.4.1 1996/06/02 16:26:31 thorpej Exp $ */
/*
@@ -227,21 +227,23 @@ static int
slinit(sc)
register struct sl_softc *sc;
{
- register caddr_t p;
-
if (sc->sc_ep == (u_char *) 0) {
- MCLALLOC(p, M_WAIT);
- if (p)
- sc->sc_ep = (u_char *)p + SLBUFSIZE;
- else {
+ MGETHDR(sc->sc_mbuf, M_WAIT, MT_DATA);
+ if (sc->sc_mbuf)
+ MCLGET(sc->sc_mbuf, M_WAIT);
+ if (sc->sc_mbuf == NULL || sc->sc_mbuf->m_ext.ext_buf == NULL) {
printf("sl%d: can't allocate buffer\n", sc->sc_unit);
sc->sc_if.if_flags &= ~IFF_UP;
return (0);
}
}
- sc->sc_buf = sc->sc_ep - SLMAX;
- sc->sc_mp = sc->sc_buf;
+ sc->sc_ep = (u_char *) sc->sc_mbuf->m_ext.ext_buf +
+ sc->sc_mbuf->m_ext.ext_size;
+ sc->sc_mp = sc->sc_pktstart = (u_char *) sc->sc_mbuf->m_ext.ext_buf +
+ BUFOFFSET;
+
sl_compress_init(&sc->sc_comp);
+
return (1);
}
@@ -317,26 +319,28 @@ slclose(tp)
int s;
ttywflush(tp);
- s = splimp(); /* actually, max(spltty, splsoftnet) */
tp->t_line = 0;
sc = (struct sl_softc *)tp->t_sc;
if (sc != NULL) {
+ s = splimp(); /* actually, max(spltty, splsoftnet) */
+
if_down(&sc->sc_if);
sc->sc_ttyp = NULL;
tp->t_sc = NULL;
- MCLFREE((caddr_t)(sc->sc_ep - SLBUFSIZE));
- sc->sc_ep = 0;
- sc->sc_mp = 0;
- sc->sc_buf = 0;
- }
+
+ m_freem(sc->sc_mbuf);
+ sc->sc_mbuf = NULL;
+ sc->sc_ep = sc->sc_mp = sc->sc_pktstart = NULL;
+
#if defined(__NetBSD__) || defined(__OpenBSD__)
- /* if necessary, install a new outq buffer of the appropriate size */
- if (sc->sc_oldbufsize != 0) {
- clfree(&tp->t_outq);
- clalloc(&tp->t_outq, sc->sc_oldbufsize, sc->sc_oldbufquot);
- }
+ /* if necessary, install a new outq buffer of the appropriate size */
+ if (sc->sc_oldbufsize != 0) {
+ clfree(&tp->t_outq);
+ clalloc(&tp->t_outq, sc->sc_oldbufsize, sc->sc_oldbufquot);
+ }
#endif
- splx(s);
+ splx(s);
+ }
}
/*
@@ -652,34 +656,31 @@ sl_btom(sc, len)
register struct sl_softc *sc;
register int len;
{
- register struct mbuf *m;
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == NULL)
- return (NULL);
+ struct mbuf *m;
/*
- * If we have more than MHLEN bytes, it's cheaper to
- * queue the cluster we just filled & allocate a new one
- * for the input buffer. Otherwise, fill the mbuf we
- * allocated above. Note that code in the input routine
- * guarantees that packet will fit in a cluster.
+ * Allocate a new input buffer and swap.
*/
- if (len >= MHLEN) {
- MCLGET(m, M_DONTWAIT);
- if ((m->m_flags & M_EXT) == 0) {
- /*
- * we couldn't get a cluster - if memory's this
- * low, it's time to start dropping packets.
- */
- (void) m_free(m);
- return (NULL);
- }
- sc->sc_ep = mtod(m, u_char *) + SLBUFSIZE;
- m->m_data = (caddr_t)sc->sc_buf;
- m->m_ext.ext_buf = (caddr_t)((long)sc->sc_buf &~ MCLOFSET);
- } else
- bcopy((caddr_t)sc->sc_buf, mtod(m, caddr_t), len);
+ m = sc->sc_mbuf;
+ MGETHDR(sc->sc_mbuf, M_DONTWAIT, MT_DATA);
+ if (sc->sc_mbuf == NULL) {
+ sc->sc_mbuf = m;
+ return (NULL);
+ }
+ MCLGET(sc->sc_mbuf, M_DONTWAIT);
+ if ((sc->sc_mbuf->m_flags & M_EXT) == 0) {
+ /*
+ * we couldn't get a cluster - if memory's this
+ * low, it's time to start dropping packets.
+ */
+ m_freem(sc->sc_mbuf);
+ sc->sc_mbuf = m;
+ return (NULL);
+ }
+ sc->sc_ep = (u_char *) sc->sc_mbuf->m_ext.ext_buf +
+ sc->sc_mbuf->m_ext.ext_size;
+
+ m->m_data = sc->sc_pktstart;
m->m_len = len;
m->m_pkthdr.len = len;
@@ -763,7 +764,7 @@ slinput(c, tp)
sc->sc_flags &= ~SC_ERROR;
goto newpack;
}
- len = sc->sc_mp - sc->sc_buf;
+ len = sc->sc_mp - sc->sc_pktstart;
if (len < 3)
/* less than min length packet - ignore */
goto newpack;
@@ -778,15 +779,15 @@ slinput(c, tp)
* where the buffer started so we can
* compute the new header length.
*/
- bcopy(sc->sc_buf, chdr, CHDR_LEN);
+ bcopy(sc->sc_pktstart, chdr, CHDR_LEN);
}
#endif
- if ((c = (*sc->sc_buf & 0xf0)) != (IPVERSION << 4)) {
+ if ((c = (*sc->sc_pktstart & 0xf0)) != (IPVERSION << 4)) {
if (c & 0x80)
c = TYPE_COMPRESSED_TCP;
else if (c == TYPE_UNCOMPRESSED_TCP)
- *sc->sc_buf &= 0x4f; /* XXX */
+ *sc->sc_pktstart &= 0x4f; /* XXX */
/*
* We've got something that's not an IP packet.
* If compression is enabled, try to decompress it.
@@ -795,13 +796,13 @@ slinput(c, tp)
* enable compression. Otherwise, drop it.
*/
if (sc->sc_if.if_flags & SC_COMPRESS) {
- len = sl_uncompress_tcp(&sc->sc_buf, len,
+ len = sl_uncompress_tcp(&sc->sc_pktstart, len,
(u_int)c, &sc->sc_comp);
if (len <= 0)
goto error;
} else if ((sc->sc_if.if_flags & SC_AUTOCOMP) &&
c == TYPE_UNCOMPRESSED_TCP && len >= 40) {
- len = sl_uncompress_tcp(&sc->sc_buf, len,
+ len = sl_uncompress_tcp(&sc->sc_pktstart, len,
(u_int)c, &sc->sc_comp);
if (len <= 0)
goto error;
@@ -809,24 +810,36 @@ slinput(c, tp)
} else
goto error;
}
+
+ m = sl_btom(sc, len);
+ if (m == NULL)
+ goto error;
+
#if NBPFILTER > 0
if (sc->sc_bpf) {
/*
* Put the SLIP pseudo-"link header" in place.
- * We couldn't do this any earlier since
- * decompression probably moved the buffer
- * pointer. Then, invoke BPF.
+ * Note this M_PREPEND() should bever fail,
+ * since we know we always have enough space
+ * in the input buffer.
*/
- register u_char *hp = sc->sc_buf - SLIP_HDRLEN;
+ u_char *hp;
+
+ M_PREPEND(m, SLIP_HDRLEN, M_DONTWAIT);
+ if (m == NULL)
+ goto error;
+ hp = mtod(m, u_char *);
hp[SLX_DIR] = SLIPDIR_IN;
- bcopy(chdr, &hp[SLX_CHDR], CHDR_LEN);
- bpf_tap(sc->sc_bpf, hp, len + SLIP_HDRLEN);
+ memcpy(&hp[SLX_CHDR], chdr, CHDR_LEN);
+
+ s = splnet();
+ bpf_mtap(sc->sc_bpf, m);
+ splx(s);
+
+ m_adj(m, SLIP_HDRLEN);
}
#endif
- m = sl_btom(sc, len);
- if (m == NULL)
- goto error;
sc->sc_if.if_ipackets++;
sc->sc_if.if_lastchange = time;
@@ -855,7 +868,8 @@ slinput(c, tp)
error:
sc->sc_if.if_ierrors++;
newpack:
- sc->sc_mp = sc->sc_buf = sc->sc_ep - SLMAX;
+ sc->sc_mp = sc->sc_pktstart = (u_char *) sc->sc_mbuf->m_ext.ext_buf +
+ BUFOFFSET;
sc->sc_escape = 0;
}
diff --git a/sys/net/if_slvar.h b/sys/net/if_slvar.h
index 9f52e09b92b..75c21d64e5e 100644
--- a/sys/net/if_slvar.h
+++ b/sys/net/if_slvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_slvar.h,v 1.5 2001/03/13 05:16:07 mickey Exp $ */
+/* $OpenBSD: if_slvar.h,v 1.6 2001/05/17 18:41:46 provos Exp $ */
/* $NetBSD: if_slvar.h,v 1.16 1996/05/07 02:40:46 thorpej Exp $ */
/*-
@@ -49,7 +49,8 @@ struct sl_softc {
struct tty *sc_ttyp; /* pointer to tty structure */
u_char *sc_mp; /* pointer to next available buf char */
u_char *sc_ep; /* pointer to last available buf char */
- u_char *sc_buf; /* input buffer */
+ u_char *sc_pktstart; /* pointer to beginning of packet */
+ struct mbuf *sc_mbuf; /* input buffer */
u_int sc_flags; /* see below */
u_int sc_escape; /* =1 if last char input was FRAME_ESCAPE */
long sc_lasttime; /* last time a char arrived */
diff --git a/sys/netinet/in.h b/sys/netinet/in.h
index 2d8b72d1cb6..835a84676e3 100644
--- a/sys/netinet/in.h
+++ b/sys/netinet/in.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.h,v 1.43 2000/12/09 01:32:09 itojun Exp $ */
+/* $OpenBSD: in.h,v 1.44 2001/05/17 18:41:46 provos Exp $ */
/* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
/*
@@ -502,6 +502,9 @@ int in_localaddr __P((struct in_addr));
void in_socktrim __P((struct sockaddr_in *));
char *inet_ntoa __P((struct in_addr));
+#define in_hosteq(s,t) ((s).s_addr == (t).s_addr)
+#define in_nullhost(x) ((x).s_addr == INADDR_ANY)
+
#define satosin(sa) ((struct sockaddr_in *)(sa))
#define sintosa(sin) ((struct sockaddr *)(sin))
#define ifatoia(ifa) ((struct in_ifaddr *)(ifa))
diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c
index e03f422a67b..bc2ca954399 100644
--- a/sys/netinet/ip_ah.c
+++ b/sys/netinet/ip_ah.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ah.c,v 1.52 2001/05/13 15:39:27 deraadt Exp $ */
+/* $OpenBSD: ip_ah.c,v 1.53 2001/05/17 18:41:46 provos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -967,9 +967,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
*/
mi = m;
while (mi != NULL &&
- (!(mi->m_flags & M_EXT) ||
- (mi->m_ext.ext_ref == NULL &&
- mclrefcnt[mtocl(mi->m_ext.ext_buf)] <= 1)))
+ (!(mi->m_flags & M_EXT) || !MCLISREFERENCED(mi)))
{
mo = mi;
mi = mi->m_next;
diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c
index d927bd7525e..faedc72e53f 100644
--- a/sys/netinet/ip_esp.c
+++ b/sys/netinet/ip_esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp.c,v 1.58 2001/05/13 15:39:27 deraadt Exp $ */
+/* $OpenBSD: ip_esp.c,v 1.59 2001/05/17 18:41:47 provos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -823,9 +823,7 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
*/
mi = m;
while (mi != NULL &&
- (!(mi->m_flags & M_EXT) ||
- (mi->m_ext.ext_ref == NULL &&
- mclrefcnt[mtocl(mi->m_ext.ext_buf)] <= 1)))
+ (!(mi->m_flags & M_EXT) || !MCLISREFERENCED(mi)))
{
mo = mi;
mi = mi->m_next;
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 9a2f8c04d32..1a373fecd25 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbuf.h,v 1.24 2001/05/16 08:59:04 art Exp $ */
+/* $OpenBSD: mbuf.h,v 1.25 2001/05/17 18:41:44 provos Exp $ */
/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
/*
@@ -39,6 +39,7 @@
#ifndef M_WAITOK
#include <sys/malloc.h>
#endif
+#include <sys/pool.h>
extern void *ipsp_copy_ident(void *);
@@ -59,14 +60,8 @@ extern void *ipsp_copy_ident(void *);
/*
* Macros for type conversion
* mtod(m,t) - convert mbuf pointer to data pointer of correct type
- * dtom(x) - convert data pointer within mbuf to mbuf pointer (XXX)
- * mtocl(x) - convert pointer within cluster to cluster index #
- * cltom(x) - convert cluster # to ptr to beginning of cluster
*/
#define mtod(m,t) ((t)((m)->m_data))
-#define dtom(x) ((struct mbuf *)((long)(x) & ~(MSIZE-1)))
-#define mtocl(x) (((u_long)(x) - (u_long)mbutl) >> MCLSHIFT)
-#define cltom(x) ((caddr_t)((u_long)mbutl + ((u_long)(x) << MCLSHIFT)))
/* header at beginning of each mbuf: */
struct m_hdr {
@@ -89,11 +84,12 @@ struct pkthdr {
struct m_ext {
caddr_t ext_buf; /* start of buffer */
void (*ext_free) /* free routine if not the usual */
- __P((struct mbuf *));
+ __P((caddr_t, u_int, void *));
+ void *ext_arg; /* argument for ext_free */
u_int ext_size; /* size of buffer, for ext_free */
- void (*ext_ref) /* add a reference to the ext object */
- __P((struct mbuf *));
- void *ext_handle; /* handle for storage manager */
+ int ext_type;
+ struct mbuf *ext_nextref;
+ struct mbuf *ext_prevref;
};
struct mbuf {
@@ -125,7 +121,8 @@ struct mbuf {
#define M_EXT 0x0001 /* has associated external storage */
#define M_PKTHDR 0x0002 /* start of record */
#define M_EOR 0x0004 /* end of record */
-#define M_PROTO1 0x0008 /* protocol-specific */
+#define M_CLUSTER 0x0008 /* external storage is a cluster */
+#define M_PROTO1 0x0010 /* protocol-specific */
/* mbuf pkthdr flags, also in m_flags */
#define M_BCAST 0x0100 /* send/received as link-level broadcast */
@@ -154,18 +151,11 @@ struct mbuf {
#define MT_FREE 0 /* should be on free list */
#define MT_DATA 1 /* dynamic (data) allocation */
#define MT_HEADER 2 /* packet header */
-#define MT_SOCKET 3 /* socket structure */
-#define MT_PCB 4 /* protocol control block */
-#define MT_RTABLE 5 /* routing tables */
-#define MT_HTABLE 6 /* IMP host tables */
-#define MT_ATABLE 7 /* address resolution tables */
-#define MT_SONAME 8 /* socket name */
-#define MT_SOOPTS 10 /* socket options */
-#define MT_FTABLE 11 /* fragment reassembly header */
-#define MT_RIGHTS 12 /* access rights */
-#define MT_IFADDR 13 /* interface address */
-#define MT_CONTROL 14 /* extra-data protocol message */
-#define MT_OOBDATA 15 /* expedited data */
+#define MT_SONAME 3 /* socket name */
+#define MT_SOOPTS 4 /* socket options */
+#define MT_FTABLE 5 /* fragment reassembly header */
+#define MT_CONTROL 6 /* extra-data protocol message */
+#define MT_OOBDATA 7 /* expedited data */
/* flags to m_get/MGET */
#define M_DONTWAIT M_NOWAIT
@@ -194,8 +184,8 @@ struct mbuf {
* allocates an mbuf and initializes it to contain a packet header
* and internal data.
*/
-#define _MGET(m, how, type) { \
- MALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \
+#define _MGET(m, how, type) do { \
+ MBUFLOCK((m) = pool_get(&mbpool, (how) == M_WAIT ? PR_WAITOK|PR_LIMITFAIL : 0);); \
if (m) { \
(m)->m_type = (type); \
MBUFLOCK(mbstat.m_mtypes[type]++;) \
@@ -205,7 +195,7 @@ struct mbuf {
(m)->m_flags = 0; \
} else \
(m) = m_retry((how), (type)); \
-}
+} while(/* CONSTCOND */ 0)
#ifdef SMALL_KERNEL
struct mbuf *_sk_mget(int, int);
@@ -214,8 +204,8 @@ struct mbuf *_sk_mget(int, int);
#define MGET(m, how, type) _MGET(m, how, type)
#endif
-#define _MGETHDR(m, how, type) { \
- MALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \
+#define _MGETHDR(m, how, type) do { \
+ MBUFLOCK((m) = pool_get(&mbpool, (how) == M_WAIT ? PR_WAITOK|PR_LIMITFAIL : 0);); \
if (m) { \
(m)->m_type = (type); \
MBUFLOCK(mbstat.m_mtypes[type]++;) \
@@ -226,7 +216,7 @@ struct mbuf *_sk_mget(int, int);
(m)->m_pkthdr.tdbi = NULL; \
} else \
(m) = m_retryhdr((how), (type)); \
-}
+} while (/* CONSTCOND */ 0)
#ifdef SMALL_KERNEL
struct mbuf *_sk_mgethdr(int, int);
@@ -236,44 +226,139 @@ struct mbuf *_sk_mgethdr(int, int);
#endif
/*
- * Mbuf cluster macros.
- * MCLALLOC(caddr_t p, int how) allocates an mbuf cluster.
- * MCLGET adds such clusters to a normal mbuf;
- * the flag M_EXT is set upon success.
- * MCLFREE releases a reference to a cluster allocated by MCLALLOC,
- * freeing the cluster if the reference count has reached 0.
+ * Macros for tracking external storage associated with an mbuf.
*
- * Normal mbuf clusters are normally treated as character arrays
- * after allocation, but use the first word of the buffer as a free list
- * pointer while on the free list.
+ * Note: add and delete reference must be called at splvm().
*/
-union mcluster {
- union mcluster *mcl_next;
- char mcl_buf[MCLBYTES];
-};
+#ifdef DEBUG
+#define MCLREFDEBUGN(m, file, line) do { \
+ (m)->m_ext.ext_nfile = (file); \
+ (m)->m_ext.ext_nline = (line); \
+ } while (/* CONSTCOND */ 0)
+#define MCLREFDEBUGO(m, file, line) do { \
+ (m)->m_ext.ext_ofile = (file); \
+ (m)->m_ext.ext_oline = (line); \
+ } while (/* CONSTCOND */ 0)
+#else
+#define MCLREFDEBUGN(m, file, line)
+#define MCLREFDEBUGO(m, file, line)
+#endif
+
+#define MCLBUFREF(p)
+#define MCLISREFERENCED(m) ((m)->m_ext.ext_nextref != (m))
+#define _MCLDEREFERENCE(m) do { \
+ (m)->m_ext.ext_nextref->m_ext.ext_prevref = \
+ (m)->m_ext.ext_prevref; \
+ (m)->m_ext.ext_prevref->m_ext.ext_nextref = \
+ (m)->m_ext.ext_nextref; \
+ } while (/* CONSTCOND */ 0)
+#define _MCLADDREFERENCE(o, n) do { \
+ (n)->m_flags |= ((o)->m_flags & (M_EXT|M_CLUSTER)); \
+ (n)->m_ext.ext_nextref = (o)->m_ext.ext_nextref; \
+ (n)->m_ext.ext_prevref = (o); \
+ (o)->m_ext.ext_nextref = (n); \
+ (n)->m_ext.ext_nextref->m_ext.ext_prevref = (n); \
+ MCLREFDEBUGN((n), __FILE__, __LINE__); \
+ } while (/* CONSTCOND */ 0)
+#define MCLINITREFERENCE(m) do { \
+ (m)->m_ext.ext_prevref = (m); \
+ (m)->m_ext.ext_nextref = (m); \
+ MCLREFDEBUGO((m), __FILE__, __LINE__); \
+ MCLREFDEBUGN((m), NULL, 0); \
+ } while (/* CONSTCOND */ 0)
+
+#define MCLADDREFERENCE(o, n) MBUFLOCK(_MCLADDREFERENCE((o), (n));)
-#define MCLALLOC(p, how) \
+/*
+ * Macros for mbuf external storage.
+ *
+ * MCLGET allocates and adds an mbuf cluster to a normal mbuf;
+ * the flag M_EXT is set upon success.
+ *
+ * MEXTMALLOC allocates external storage and adds it to
+ * a normal mbuf; the flag M_EXT is set upon success.
+ *
+ * MEXTADD adds pre-allocated external storage to
+ * a normal mbuf; the flag M_EXT is set upon success.
+ */
+#define _MCLGET(m, how) do { \
MBUFLOCK( \
- if (mclfree == 0) \
- (void)m_clalloc(1, (how)); \
- if (((p) = (caddr_t)mclfree) != 0) { \
- ++mclrefcnt[mtocl(p)]; \
- mbstat.m_clfree--; \
- mclfree = ((union mcluster *)(p))->mcl_next; \
- } \
- )
+ (m)->m_ext.ext_buf = \
+ pool_get(&mclpool, (how) == M_WAIT ? \
+ (PR_WAITOK|PR_LIMITFAIL) : 0); \
+ if ((m)->m_ext.ext_buf == NULL) { \
+ m_reclaim(); \
+ (m)->m_ext.ext_buf = \
+ pool_get(&mclpool, \
+ (how) == M_WAIT ? PR_WAITOK : 0); \
+ } \
+ ); \
+ if ((m)->m_ext.ext_buf != NULL) { \
+ (m)->m_data = (m)->m_ext.ext_buf; \
+ (m)->m_flags |= M_EXT|M_CLUSTER; \
+ (m)->m_ext.ext_size = MCLBYTES; \
+ (m)->m_ext.ext_free = NULL; \
+ (m)->m_ext.ext_arg = NULL; \
+ MCLINITREFERENCE(m); \
+ } \
+} while (/* CONSTCOND */ 0)
-#define _MCLGET(m, how) \
- { MCLALLOC((m)->m_ext.ext_buf, (how)); \
- if ((m)->m_ext.ext_buf != NULL) { \
+#define MEXTMALLOC(m, size, how) do { \
+ (m)->m_ext.ext_buf = \
+ (caddr_t)malloc((size), mbtypes[(m)->m_type], (how)); \
+ if ((m)->m_ext.ext_buf != NULL) { \
(m)->m_data = (m)->m_ext.ext_buf; \
(m)->m_flags |= M_EXT; \
- (m)->m_ext.ext_size = MCLBYTES; \
+ (m)->m_flags &= ~M_CLUSTER; \
+ (m)->m_ext.ext_size = (size); \
(m)->m_ext.ext_free = NULL; \
- (m)->m_ext.ext_ref = NULL; \
- (m)->m_ext.ext_handle = NULL; \
- } \
- }
+ (m)->m_ext.ext_arg = NULL; \
+ (m)->m_ext.ext_type = mbtypes[(m)->m_type]; \
+ MCLINITREFERENCE(m); \
+ } \
+} while (/* CONSTCOND */ 0)
+
+#define MEXTADD(m, buf, size, type, free, arg) do { \
+ (m)->m_data = (m)->m_ext.ext_buf = (caddr_t)(buf); \
+ (m)->m_flags |= M_EXT; \
+ (m)->m_flags &= ~M_CLUSTER; \
+ (m)->m_ext.ext_size = (size); \
+ (m)->m_ext.ext_free = (free); \
+ (m)->m_ext.ext_arg = (arg); \
+ (m)->m_ext.ext_type = (type); \
+ MCLINITREFERENCE(m); \
+} while (/* CONSTCOND */ 0)
+
+#define _MEXTREMOVE(m) do { \
+ if (MCLISREFERENCED(m)) { \
+ _MCLDEREFERENCE(m); \
+ } else if ((m)->m_flags & M_CLUSTER) { \
+ pool_put(&mclpool, (m)->m_ext.ext_buf); \
+ } else if ((m)->m_ext.ext_free) { \
+ (*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \
+ (m)->m_ext.ext_size, (m)->m_ext.ext_arg); \
+ } else { \
+ free((m)->m_ext.ext_buf,(m)->m_ext.ext_type); \
+ } \
+ (m)->m_flags &= ~(M_CLUSTER|M_EXT); \
+ (m)->m_ext.ext_size = 0; /* why ??? */ \
+} while (/* CONSTCOND */ 0)
+
+#define MEXTREMOVE(m) \
+ MBUFLOCK(_MEXTREMOVE((m));)
+
+/*
+ * Reset the data pointer on an mbuf.
+ */
+#define MRESETDATA(m) \
+do { \
+ if ((m)->m_flags & M_EXT) \
+ (m)->m_data = (m)->m_ext.ext_buf; \
+ else if ((m)->m_flags & M_PKTHDR) \
+ (m)->m_data = (m)->m_pktdat; \
+ else \
+ (m)->m_data = (m)->m_dat; \
+} while (/* CONSTCOND */ 0)
#ifdef SMALL_KERNEL
void _sk_mclget(struct mbuf *, int);
@@ -282,41 +367,24 @@ void _sk_mclget(struct mbuf *, int);
#define MCLGET(m, how) _MCLGET(m, how)
#endif
-#define MCLFREE(p) \
- MBUFLOCK ( \
- if (--mclrefcnt[mtocl(p)] == 0) { \
- ((union mcluster *)(p))->mcl_next = mclfree; \
- mclfree = (union mcluster *)(p); \
- mbstat.m_clfree++; \
- } \
- )
-
-/*
- * For cluster mbufs (regardless of header or not).
- */
-#define MCL_ALIGN(m, len) \
- { (m)->m_data += (MCLBYTES - (len)) &~ (sizeof(long) -1); }
-
/*
* MFREE(struct mbuf *m, struct mbuf *n)
* Free a single mbuf and associated external storage.
* Place the successor, if any, in n.
*/
#define MFREE(m, n) \
- { MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--;) \
- if ((m)->m_flags & M_EXT) { \
- if ((m)->m_ext.ext_free) \
- (*((m)->m_ext.ext_free))(m); \
- else \
- MCLFREE((m)->m_ext.ext_buf); \
- } \
- if (((m)->m_flags & M_PKTHDR) && ((m)->m_pkthdr.tdbi)) { \
- free((m)->m_pkthdr.tdbi, M_TEMP); \
- (m)->m_pkthdr.tdbi = NULL; \
- } \
- (n) = (m)->m_next; \
- FREE((m), mbtypes[(m)->m_type]); \
- }
+ MBUFLOCK( \
+ mbstat.m_mtypes[(m)->m_type]--; \
+ if (((m)->m_flags & M_PKTHDR) && ((m)->m_pkthdr.tdbi)) { \
+ free((m)->m_pkthdr.tdbi, M_TEMP); \
+ (m)->m_pkthdr.tdbi = NULL; \
+ } \
+ if ((m)->m_flags & M_EXT) { \
+ _MEXTREMOVE((m)); \
+ } \
+ (n) = (m)->m_next; \
+ pool_put(&mbpool, (m)); \
+ )
/*
* Copy just m_pkthdr from from to to.
@@ -424,12 +492,14 @@ void _sk_mclget(struct mbuf *, int);
/*
* Mbuf statistics.
+ * For statistics related to mbuf and cluster allocations, see also the
+ * pool headers (mbpool and mclpool).
*/
struct mbstat {
- u_long m_mbufs; /* mbufs obtained from page pool */
- u_long m_clusters; /* clusters obtained from page pool */
- u_long m_spare; /* spare field */
- u_long m_clfree; /* free clusters */
+ u_long _m_spare; /* formerly m_mbufs */
+ u_long _m_spare1; /* formerly m_clusters */
+ u_long _m_spare2; /* spare field */
+ u_long _m_spare3; /* formely m_clfree - free clusters */
u_long m_drops; /* times failed to find space */
u_long m_wait; /* times waited for space */
u_long m_drain; /* times drained protocols for space */
@@ -438,10 +508,10 @@ struct mbstat {
#ifdef _KERNEL
extern struct mbuf *mbutl; /* virtual address of mclusters */
-extern char *mclrefcnt; /* cluster reference counts */
struct mbstat mbstat;
-extern int nmbclusters;
-union mcluster *mclfree;
+extern int nmbclusters; /* limit on the # of clusters */
+extern int mblowat; /* mbuf low water mark */
+extern int mcllowat; /* mbuf cluster low water mark */
int max_linkhdr; /* largest link-level header */
int max_protohdr; /* largest protocol header */
int max_hdr; /* largest link+protocol header */
@@ -449,6 +519,8 @@ int max_datalen; /* MHLEN - max_hdr */
extern int mbtypes[]; /* XXX */
extern int needqueuedrain; /* True if allocation failed at */
/* interrupt level */
+extern struct pool mbpool;
+extern struct pool mclpool;
void mbinit __P((void));
struct mbuf *m_copym2 __P((struct mbuf *, int, int, int));
@@ -478,28 +550,18 @@ struct mbuf *m_devget __P((char *, int, int, struct ifnet *,
void m_zero __P((struct mbuf *));
int m_apply __P((struct mbuf *, int, int,
int (*)(caddr_t, caddr_t, unsigned int), caddr_t));
+void mbinit __P((void));
#ifdef MBTYPES
int mbtypes[] = { /* XXX */
M_FREE, /* MT_FREE 0 should be on free list */
M_MBUF, /* MT_DATA 1 dynamic (data) allocation */
M_MBUF, /* MT_HEADER 2 packet header */
- M_SOCKET, /* MT_SOCKET 3 socket structure */
- M_PCB, /* MT_PCB 4 protocol control block */
- M_RTABLE, /* MT_RTABLE 5 routing tables */
- M_HTABLE, /* MT_HTABLE 6 IMP host tables */
- 0, /* MT_ATABLE 7 address resolution tables */
M_MBUF, /* MT_SONAME 8 socket name */
- 0, /* 9 */
M_SOOPTS, /* MT_SOOPTS 10 socket options */
M_FTABLE, /* MT_FTABLE 11 fragment reassembly header */
- M_MBUF, /* MT_RIGHTS 12 access rights */
- M_IFADDR, /* MT_IFADDR 13 interface address */
M_MBUF, /* MT_CONTROL 14 extra-data protocol message */
M_MBUF, /* MT_OOBDATA 15 expedited data */
-#ifdef DATAKIT
- 25, 26, 27, 28, 29, 30, 31, 32 /* datakit ugliness */
-#endif
};
-#endif
+#endif /* MBTYPES */
#endif