changeset 1565:5c539c544148

* 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.
author asl
date Mon, 05 Apr 2004 16:23:53 +0000
parents d8ce80bf8e90
children aaf044e992cf
files packages/net/bsd_tcpip/current/ChangeLog packages/net/bsd_tcpip/current/include/sys/mbuf.h packages/net/bsd_tcpip/current/src/ecos/support.c packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c
diffstat 4 files changed, 14 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/packages/net/bsd_tcpip/current/ChangeLog
+++ b/packages/net/bsd_tcpip/current/ChangeLog
@@ -1,3 +1,12 @@
+2004-03-30  Horst Kronstorfer  <horst.kronstorfer@frequentis.com>
+ 
+        * 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  <andrew.lunn@ascom.ch>
 
 	* src/ecos/support.c (_dumpentry): Don't skip routes which don't
--- 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);
--- 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)
 {
--- 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;