summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2009-08-12 20:02:43 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2009-08-12 20:02:43 +0000
commitb35c15cd66ae4e10e47dbc9e0597fc6304ff937e (patch)
treebdde23e7b83336b1a1669ff08d267e40d0dffe9f /sys/kern
parent910d450cbb67000b11dde35a22bad296166a7129 (diff)
revert my change to m_cluncount which tries to prevent the system
running out of mbufs for rx rings. if the system low watermark is lower than a rx rings low watermark, we'll never send a packet up the stack, we'll always recycle it. found by thib@ on a bge sadface
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_mbuf.c58
1 files changed, 24 insertions, 34 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index a357f84a976..26b61162ee6 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.131 2009/08/12 14:39:05 dlg Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.132 2009/08/12 20:02:42 dlg Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -372,26 +372,20 @@ m_clcount(struct ifnet *ifp, int pi)
ifp->if_data.ifi_mclpool[pi].mcl_alive++;
}
-int
-m_cluncount(struct mbuf *m)
+void
+m_cluncount(struct mbuf *m, int all)
{
- struct mbuf_ext *me = &m->m_ext;
- int pi;
-
- splassert(IPL_NET);
-
- if (((m->m_flags & (M_EXT|M_CLUSTER)) != (M_EXT|M_CLUSTER)) ||
- (me->ext_ifp == NULL))
- return (0);
-
- pi = me->ext_backend;
- me->ext_ifp->if_data.ifi_mclpool[pi].mcl_alive--;
- me->ext_ifp = NULL;
-
- if (mclpools[pi].pr_nitems <= mclpools[pi].pr_minitems)
- return (1);
+ struct mbuf_ext *me;
- return (0);
+ do {
+ me = &m->m_ext;
+ if (((m->m_flags & (M_EXT|M_CLUSTER)) != (M_EXT|M_CLUSTER)) ||
+ (me->ext_ifp == NULL))
+ continue;
+
+ me->ext_ifp->if_data.ifi_mclpool[me->ext_backend].mcl_alive--;
+ me->ext_ifp = NULL;
+ } while (all && (m = m->m_next));
}
struct mbuf *
@@ -474,25 +468,21 @@ m_free(struct mbuf *m)
void
m_extfree(struct mbuf *m)
{
- struct mbuf_ext *me = &m->m_ext;
- int pi;
-
if (MCLISREFERENCED(m)) {
- me->ext_nextref->m_ext.ext_prevref = me->ext_prevref;
- me->ext_prevref->m_ext.ext_nextref = me->ext_nextref;
+ 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;
} else if (m->m_flags & M_CLUSTER) {
- pi = me->ext_backend;
- if (me->ext_ifp != NULL) {
- me->ext_ifp->if_data.ifi_mclpool[pi].mcl_alive--;
- me->ext_ifp = NULL;
- }
- pool_put(&mclpools[pi], me->ext_buf);
- } else if (me->ext_free)
- me->ext_free(me->ext_buf, me->ext_size, me->ext_arg);
+ m_cluncount(m, 0);
+ pool_put(&mclpools[m->m_ext.ext_backend],
+ 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
panic("unknown type of extension buffer");
-
- me->ext_size = 0;
+ m->m_ext.ext_size = 0;
m->m_flags &= ~(M_EXT|M_CLUSTER);
}