changeset 1693:9f18943c887e

*cdl/freebsd_net.cdl: *src/ecos/support.c: made memory pools default to current size, but separately controllable from the cdl file. This is useful for systems with tight memory budgets.
author asl
date Fri, 16 Jul 2004 10:43:28 +0000
parents f7cb1caf8d2a
children 5629b7c30ed2
files packages/net/bsd_tcpip/current/ChangeLog packages/net/bsd_tcpip/current/cdl/freebsd_net.cdl packages/net/bsd_tcpip/current/src/ecos/support.c
diffstat 3 files changed, 38 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/packages/net/bsd_tcpip/current/ChangeLog
+++ b/packages/net/bsd_tcpip/current/ChangeLog
@@ -1,3 +1,10 @@
+2004-07-15 Oyvind Harboe <oyvind.harboe@zylin.com>	
+	
+	*cdl/freebsd_net.cdl:
+	*src/ecos/support.c: made memory pools default to current size, 
+	but separately controllable from the cdl file. This is useful for 
+	systems with tight memory budgets.
+	
 2004-06-01  Sandeep Kumar  <sandeep@codito.com>
 
 	* tests/sysctl1.c: Call CYG_TEST_EXIT at the end of the test.
--- a/packages/net/bsd_tcpip/current/cdl/freebsd_net.cdl
+++ b/packages/net/bsd_tcpip/current/cdl/freebsd_net.cdl
@@ -280,7 +280,34 @@ cdl_package CYGPKG_NET_FREEBSD_STACK {
             This option controls the amount of memory pre-allocated
         for buffers used by the networking code.  The number is an
         upper limit, with at least enough space to get the stack
-        initialized."
+        initialized. Tip: setting a breakpoint at cyg_memalloc_alloc_fail() 
+	is an especially useful tool in establishing when there is too 
+        little memory for an application. "
+    }
+
+    cdl_option CYGPKG_NET_MEMPOOL_SIZE {
+        display "Memory designated for network dynamically allocated memory"
+        flavor  data
+        default_value CYGPKG_NET_MEM_USAGE/4
+        description   "
+            Controls the amount of memory in the pool used for dynamically
+            allocated memory. This does not include mbufs or clusters."
+    }
+
+    cdl_option CYGPKG_NET_MBUFS_SIZE {
+        display "MBUFs memory size"
+        flavor  data
+        default_value CYGPKG_NET_MEM_USAGE/4
+        description   "
+            Size of MBUFs pool."
+    }
+
+    cdl_option CYGPKG_NET_CLUSTERS_SIZE {
+        display "Clusters size"
+        flavor  data
+        default_value CYGPKG_NET_MEM_USAGE/2
+        description   "
+            Clusters size."
     }
 
     cdl_option CYGPKG_NET_MAXSOCKETS {
--- a/packages/net/bsd_tcpip/current/src/ecos/support.c
+++ b/packages/net/bsd_tcpip/current/src/ecos/support.c
@@ -127,9 +127,9 @@ cyg_panic(const char *msg, ...)
     cyg_test_exit();  // FIXME
 }
 
-#define NET_MEMPOOL_SIZE  roundup(CYGPKG_NET_MEM_USAGE/4,MSIZE)
-#define NET_MBUFS_SIZE    roundup(CYGPKG_NET_MEM_USAGE/4,MSIZE)
-#define NET_CLUSTERS_SIZE roundup(CYGPKG_NET_MEM_USAGE/2,MCLBYTES)
+#define NET_MEMPOOL_SIZE  roundup(CYGPKG_NET_MEMPOOL_SIZE,MSIZE)
+#define NET_MBUFS_SIZE    roundup(CYGPKG_NET_MBUFS_SIZE,MSIZE)
+#define NET_CLUSTERS_SIZE roundup(CYGPKG_NET_CLUSTERS_SIZE,MCLBYTES)
 
 static unsigned char net_mempool_area[NET_MEMPOOL_SIZE];
 static cyg_mempool_var net_mem_pool;