This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dhcp_mgt_stack isn't configurable


On Thu, Dec 28, 2006 at 04:09:43PM +0100, ?yvind Harboe wrote:
> Shouldn't this stack size be configurable?
> 
> With CYGDBG_IO_ETH_DRIVERS_DEBUG_VERBOSITY=10, diag_printf() makes it
> overflow on my rocket(AT91EB40a w/ethermac) so I increased it by
> 0x1000 and things work fine + eCos no longer detects stack problems
> via it's diagnostic code.

This patch makes the stack size configurable.

     Andrew
Index: net/common/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/ChangeLog,v
retrieving revision 1.78
diff -u -r1.78 ChangeLog
--- net/common/current/ChangeLog	19 Dec 2006 01:45:30 -0000	1.78
+++ net/common/current/ChangeLog	7 Jan 2007 14:46:30 -0000
@@ -1,3 +1,10 @@
+2007-01-07  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* src/dhcp_support.c: 
+	* cdl/net.cdl:
+	Added CDL to control the size of the stack used by
+	the DHCP management thread.
+
 2006-12-18  Sergei Gavrikov  <sg@sgs.gomel.by>
 
 	* tests/ga_server_test.c: Updated flags argument in call of
Index: net/common/current/cdl/net.cdl
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/cdl/net.cdl,v
retrieving revision 1.16
diff -u -r1.16 net.cdl
--- net/common/current/cdl/net.cdl	17 Jun 2006 20:11:06 -0000	1.16
+++ net/common/current/cdl/net.cdl	7 Jan 2007 14:46:30 -0000
@@ -271,6 +271,17 @@
             network thread itself."
         }
 
+        cdl_option CYGPKG_NET_DHCP_THREAD_STACK_SIZE {
+            display "Stack size for DHCP management threads."
+            flavor  data
+            default_value { "(CYGNUM_HAL_STACK_SIZE_TYPICAL+sizeof(struct bootp))" }
+            description   "
+               This option controls the size of the stack used for the
+               DHCP mamagement thread. The default should be
+               sufficient for most cases but some applications my
+               require bigger stacks when using for example diag_printf."
+        }
+
         cdl_option CYGOPT_NET_DHCP_PARM_REQ_LIST_REPLACE {
             display "Replace DHCP request options"
             flavor  booldata
Index: net/common/current/src/dhcp_support.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/src/dhcp_support.c,v
retrieving revision 1.2
diff -u -r1.2 dhcp_support.c
--- net/common/current/src/dhcp_support.c	12 Jan 2003 04:53:28 -0000	1.2
+++ net/common/current/src/dhcp_support.c	7 Jan 2007 14:46:31 -0000
@@ -222,22 +222,21 @@
 cyg_handle_t dhcp_mgt_thread_h = 0;
 cyg_thread   dhcp_mgt_thread;
 
-#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + sizeof(struct bootp))
-static cyg_uint8 dhcp_mgt_stack[ STACK_SIZE ];
+static cyg_uint8 dhcp_mgt_stack[ CYGPKG_NET_DHCP_THREAD_STACK_SIZE ];
 
 void dhcp_start_dhcp_mgt_thread( void )
 {
     if ( ! dhcp_mgt_thread_h ) {
         cyg_semaphore_init( &dhcp_needs_attention, 0 );
         cyg_thread_create(
-            CYGPKG_NET_DHCP_THREAD_PRIORITY, /* scheduling info (eg pri) */
-            dhcp_mgt_entry,             /* entry point function */
+            CYGPKG_NET_DHCP_THREAD_PRIORITY,   /* scheduling info (eg pri) */
+            dhcp_mgt_entry,                    /* entry point function */
             CYGOPT_NET_DHCP_DHCP_THREAD_PARAM, /* entry data */
-            "DHCP lease mgt",           /* optional thread name */
-            dhcp_mgt_stack,             /* stack base, NULL = alloc */
-            STACK_SIZE,                 /* stack size, 0 = default */
-            &dhcp_mgt_thread_h,         /* returned thread handle */
-            &dhcp_mgt_thread           /* put thread here */
+            "DHCP lease mgt",                  /* optional thread name */
+            dhcp_mgt_stack,                    /* stack base, NULL = alloc */
+            CYGPKG_NET_DHCP_THREAD_STACK_SIZE, /* stack size, 0 = default */
+            &dhcp_mgt_thread_h,                /* returned thread handle */
+            &dhcp_mgt_thread                   /* put thread here */
             );
 
         cyg_thread_resume(dhcp_mgt_thread_h);

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]