# HG changeset patch # User asl # Date 1081182233 0 # Node ID 5c539c544148dc2d5cc99b50eca0b4b9cd32f711 # Parent d8ce80bf8e90c4d39827fb29c8b4817392534d33 * src/sys/kern/uipc_mbuf.c * src/ecos/support.c * include/sys/mbuf.h: Avoid blocking alloc from (empty) mbuf pool. Freed mbufs are never returned to the pool, but to the mbuf "free list". This can cause a deadlock situation. Duplicated incrementing of mbuf statistics removed. diff --git a/packages/net/bsd_tcpip/current/ChangeLog b/packages/net/bsd_tcpip/current/ChangeLog --- a/packages/net/bsd_tcpip/current/ChangeLog +++ b/packages/net/bsd_tcpip/current/ChangeLog @@ -1,3 +1,12 @@ +2004-03-30 Horst Kronstorfer + + * src/sys/kern/uipc_mbuf.c + * src/ecos/support.c + * include/sys/mbuf.h: Avoid blocking alloc from (empty) mbuf pool. + Freed mbufs are never returned to the pool, but to the mbuf + "free list". This can cause a deadlock situation. + Duplicated incrementing of mbuf statistics removed. + 2004-03-27 Andrew Lunn * src/ecos/support.c (_dumpentry): Don't skip routes which don't diff --git a/packages/net/bsd_tcpip/current/include/sys/mbuf.h b/packages/net/bsd_tcpip/current/include/sys/mbuf.h --- a/packages/net/bsd_tcpip/current/include/sys/mbuf.h +++ b/packages/net/bsd_tcpip/current/include/sys/mbuf.h @@ -631,8 +631,7 @@ struct mbuf *m_aux_find2 __P((struct mbu struct mbuf *m_aux_add __P((struct mbuf *, int, int)); struct mbuf *m_aux_find __P((struct mbuf *, int, int)); void m_aux_delete __P((struct mbuf *, struct mbuf *)); -extern void *cyg_net_mbuf_alloc(int type, int flags); -extern void cyg_net_mbuf_free(caddr_t addr, int type); +extern void *cyg_net_mbuf_alloc(void); extern void *cyg_net_cluster_alloc(void ); #ifdef CYGDBG_NET_SHOW_MBUFS extern void cyg_net_show_mbufs(void); diff --git a/packages/net/bsd_tcpip/current/src/ecos/support.c b/packages/net/bsd_tcpip/current/src/ecos/support.c --- a/packages/net/bsd_tcpip/current/src/ecos/support.c +++ b/packages/net/bsd_tcpip/current/src/ecos/support.c @@ -267,19 +267,14 @@ void cyg_net_show_mbufs(void) #endif void * -cyg_net_mbuf_alloc(int type, int flags) +cyg_net_mbuf_alloc(void) { void *res; START_STATS(); log(LOG_MDEBUG, "Alloc mbuf = "); - mbstat.m_mbufs++; - if (flags & M_NOWAIT) { - res = cyg_mempool_fix_try_alloc(net_mbufs); - } else { - res = cyg_mempool_fix_alloc(net_mbufs); - } - FINISH_STATS(stats_mbuf_alloc); + res = cyg_mempool_fix_try_alloc(net_mbufs); +FINISH_STATS(stats_mbuf_alloc); #ifdef CYGDBG_NET_SHOW_MBUFS { int i; @@ -298,15 +293,6 @@ cyg_net_mbuf_alloc(int type, int flags) return (res); } -void -cyg_net_mbuf_free(caddr_t addr, int type) -{ - START_STATS(); - mbstat.m_mbufs--; - cyg_mempool_fix_free(net_mbufs, addr); - FINISH_STATS(stats_mbuf_free); -} - void * cyg_net_cluster_alloc(void) { diff --git a/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c --- a/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c +++ b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c @@ -139,7 +139,7 @@ m_mballoc(nmb, how) int i; for (i = 0; i < nmb; i++) { - p = (struct mbuf *)cyg_net_mbuf_alloc(0, how); + p = (struct mbuf *)cyg_net_mbuf_alloc( ); if (p != (struct mbuf *)0) { ((struct mbuf *)p)->m_next = mmbfree; mmbfree = (struct mbuf *)p;