diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-11-25 12:47:01 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-11-25 12:47:01 +0000 |
commit | 9b529d43edabe5c2f4075e2b2d83c3ed0cee0e1b (patch) | |
tree | 5c478b1208ee56a9524e99acbd1b22c711da2fef | |
parent | 4ad15fdea872b7f2758f3247a7146ce0fe8b9bce (diff) |
Factor increases are not needed, +1 appears to work as well.
ok dlg
-rw-r--r-- | sys/kern/uipc_mbuf.c | 22 | ||||
-rw-r--r-- | sys/net/if.c | 18 | ||||
-rw-r--r-- | sys/net/if.h | 4 | ||||
-rw-r--r-- | sys/sys/mbuf.h | 3 |
4 files changed, 25 insertions, 22 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 66617e66b9c..c430471239e 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.99 2008/11/25 12:07:55 claudio Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.100 2008/11/25 12:47:00 deraadt Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -96,15 +96,15 @@ struct mbstat mbstat; /* mbuf stats */ struct pool mbpool; /* mbuf pool */ /* mbuf cluster pools */ -struct mclsizes mclsizes[] = { - { MCLBYTES, 4, 1 }, /* must be at slot 0 */ - { 4 * 1024, 4, 2 }, +u_short mclsizes[] = { + MCLBYTES, /* must be at slot 0 */ + 4 * 1024, #if art_doesnt_suck - { 8 * 1024, 4, 2 }, - { 9 * 1024, 4, 2 }, - { 12 * 1024, 4, 2 }, - { 16 * 1024, 4, 2 }, - { 64 * 1024, 4, 2 } + 8 * 1024, + 9 * 1024, + 12 * 1024, + 16 * 1024, + 64 * 1024 #endif }; static char mclnames[MCLPOOLS][8]; @@ -135,8 +135,8 @@ mbinit(void) for (i = 0; i < nitems(mclsizes); i++) { snprintf(mclnames[i], sizeof(mclnames[0]), "mcl%dk", - mclsizes[i].size >> 10); - pool_init(&mclpools[i], mclsizes[i].size, 0, 0, 0, mclnames[i], + mclsizes[i] >> 10); + pool_init(&mclpools[i], mclsizes[i], 0, 0, 0, mclnames[i], NULL); pool_setlowat(&mclpools[i], mcllowat); } diff --git a/sys/net/if.c b/sys/net/if.c index c70d9ed71a5..0e21bdfc88e 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.178 2008/11/25 12:07:55 claudio Exp $ */ +/* $OpenBSD: if.c,v 1.179 2008/11/25 12:47:00 deraadt Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -2019,24 +2019,26 @@ sysctl_ifq(int *name, u_int namelen, void *oldp, size_t *oldlenp, void m_clinitifp(struct ifnet *ifp) { - extern struct mclsizes mclsizes[]; + extern u_short mclsizes[]; int i; /* Initialize high water marks for use of cluster pools */ - for (i = 0; i < MCLPOOLS; i++) - ifp->if_mclstat.mclpool[i].mcl_hwm = mclsizes[i].hwm; + for (i = 0; i < MCLPOOLS; i++) { + ifp->if_mclstat.mclpool[i].mcl_hwm = 4; + ifp->if_mclstat.mclpool[i].mcl_size = mclsizes[i]; + } } int m_cldrop(struct ifnet *ifp, int pi) { struct mclstat *mcls = &ifp->if_mclstat; - extern struct mclsizes mclsizes[]; - if (mcls->mclpool[pi].mcl_alive <= 2 && ISSET(ifp->if_flags, IFF_UP)) { + if (mcls->mclpool[pi].mcl_alive <= 2 && + mcls->mclpool[pi].mcl_hwm < 32768 && + ISSET(ifp->if_flags, IFF_UP)) { /* About to run out, so increase the watermark */ - mcls->mclpool[pi].mcl_hwm += - mcls->mclpool[pi].mcl_hwm / mclsizes[pi].factor; + mcls->mclpool[pi].mcl_hwm++; } else if (mcls->mclpool[pi].mcl_alive >= mcls->mclpool[pi].mcl_hwm) return (1); /* No more packets given */ diff --git a/sys/net/if.h b/sys/net/if.h index b1cdb01aa00..3769f67cb0f 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.97 2008/11/24 14:26:54 deraadt Exp $ */ +/* $OpenBSD: if.h,v 1.98 2008/11/25 12:47:00 deraadt Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -152,6 +152,8 @@ struct mclstat { struct { u_short mcl_alive; u_short mcl_hwm; + u_short mcl_size; + u_short mcl_pad; } mclpool[MCLPOOLS]; }; diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index a8a165fa2c4..db3a3247425 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.114 2008/11/25 12:07:55 claudio Exp $ */ +/* $OpenBSD: mbuf.h,v 1.115 2008/11/25 12:47:00 deraadt Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -393,7 +393,6 @@ struct mbstat { struct mclsizes { u_int size; u_int hwm; - u_int factor; }; extern struct mbstat mbstat; |