This is the mail archive of the ecos-patches@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: Possible bug with CYGSEM_REDBOOT_NETWORK_INIT_ONE_DEVICE


On Mon, 2006-11-27 at 07:34 -0700, Gary Thomas wrote:
> David Fernandez wrote:
> > On Mon, 2006-11-27 at 05:15 -0700, Gary Thomas wrote:
> >> David Fernandez wrote:
> >>> Hi there,
> >>>
> >>> I'was about to use the feature CYGSEM_REDBOOT_NETWORK_INIT_ONE_DEVICE,
> >>> and I've noticed that may be it doesn't work as per the description in
> >>> the cdl option:
> >>>
> >>> It says that it should stop initializing network devices as soon as one
> >>> is initialized successfully. But it seems that the initialization logic
> >>> for a default interface has someway confused the things.
> >>>
> >>> It tries to initialize the default interface, but if it fails, then it
> >>> seems to initialize all of them... I think there should be a break
> >>> statement within the "if (t->init())" block (net_io.c: net_init()) if
> >>> this options is active and enabled.
> >>>
> >>> May be the we can get rid of CYGSEM_REDBOOT_FLASH_CONFIG condition in
> >>> CYGDAT_REDBOOT_DEFAULT_NETWORK_DEVICE (doing the appropriate changes in
> >>> net_io.c: net_init()), so we could provide a default interface if there
> >>> is no flash configured.
> >>>
There you are the patch.

Have fun.

David Fernandez.

Index: redboot/current/ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/dfernandez/Projects/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.3
diff -u -5 -B -b -w -p -r1.3 ChangeLog
--- redboot/current/ChangeLog	2006/11/28 09:49:05	1.3
+++ redboot/current/ChangeLog	2006/11/28 10:11:29
@@ -1,5 +1,19 @@
+2006-11-28  David Fernandez  <dfernandez@cct.co.uk>
+
+	* cdl/redboot.cdl: Modified to change the option
+	  CYGDAT_REDBOOT_DEFAULT_NETWORK_DEVICE to make it independent of
+	  CYGSEM_REDBOOT_FLASH_CONFIG, changes in net_io.c will allow to
+	  specify a default interface in terms of the name and its position
+	  in the table of interfaces for the driver.
+
+	* src/net/net_io.c: Modified to allow CYGDAT_REDBOOT_DEFAULT_NETWORK_DEVICE
+	  to be used even with no flash available.
+	  Bug regarding CYGSEM_REDBOOT_NETWORK_INIT_ONE_DEVICE fixed, so that
+	  when working with several network interfaces, and the default one
+	  fails to initialize, only the first successfully initialized one is used.
+
 2006-11-24  David Fernandez  <dfernandez@cct.co.uk>
 
 	* cdl/redboot.cdl: Modified to change the proc block that adds a
 	  static definition for CYGNUM_HAL_VIRTUAL_VECTOR_AUX_CHANNELS into
 	  an interface implementation that can be done by more than one
Index: redboot/current/cdl/redboot.cdl
===================================================================
RCS file: /home/cvs/cvsroot/dfernandez/Projects/ecos/packages/redboot/current/cdl/redboot.cdl,v
retrieving revision 1.3
diff -u -5 -B -b -w -p -r1.3 redboot.cdl
--- redboot/current/cdl/redboot.cdl	2006/11/28 09:48:48	1.3
+++ redboot/current/cdl/redboot.cdl	2006/11/28 10:11:29
@@ -513,11 +513,11 @@ cdl_package CYGPKG_REDBOOT {
             }
 
 	    cdl_option CYGDAT_REDBOOT_DEFAULT_NETWORK_DEVICE {
                 display         "Default network device driver"
                 flavor          data
-                active_if       { CYGSEM_REDBOOT_FLASH_CONFIG && CYGHWR_NET_DRIVERS > 1 }
+                active_if       { CYGHWR_NET_DRIVERS > 1 }
                 default_value   { "\"\"" }
                 description     "
                     This is the name of the default network device to use."
             }
 
Index: redboot/current/src/net/net_io.c
===================================================================
RCS file: /home/cvs/cvsroot/dfernandez/Projects/ecos/packages/redboot/current/src/net/net_io.c,v
retrieving revision 1.2
diff -u -5 -B -b -w -p -r1.2 net_io.c
--- redboot/current/src/net/net_io.c	2006/11/28 09:45:32	1.2
+++ redboot/current/src/net/net_io.c	2006/11/28 10:11:29
@@ -671,11 +671,11 @@ net_init(void)
 {
     cyg_netdevtab_entry_t *t;
     unsigned index;
     struct eth_drv_sc *primary_net = (struct eth_drv_sc *)0;
 #if defined(CYGHWR_NET_DRIVERS) && (CYGHWR_NET_DRIVERS > 1)
-    char *default_devname;
+    char *default_devname = CYGDAT_REDBOOT_DEFAULT_NETWORK_DEVICE;
     int default_index;
 #endif
 #ifdef CYGDAT_REDBOOT_DEFAULT_BOOTP_SERVER_IP_ADDR
     char ip_addr[16];
 #endif
@@ -728,11 +728,11 @@ net_init(void)
     if ((t = net_devtab_entry(default_index)) != NULL && t->init(t)) {
 	t->status = CYG_NETDEVTAB_STATUS_AVAIL;
 	primary_net = __local_enet_sc;
     } else
 #endif
-#endif
+#endif // (CYGHWR_NET_DRIVERS) && (CYGHWR_NET_DRIVERS > 1)
     for (index = 0; (t = net_devtab_entry(index)) != NULL; index++) {
 #ifdef CYGSEM_REDBOOT_NETWORK_INIT_ONE_DEVICE
 	if (index == default_index)
 	    continue;
 #endif
@@ -740,13 +740,17 @@ net_init(void)
             t->status = CYG_NETDEVTAB_STATUS_AVAIL;
             if (primary_net == (struct eth_drv_sc *)0) {
                 primary_net = __local_enet_sc;
             }
 #if defined(CYGHWR_NET_DRIVERS) && (CYGHWR_NET_DRIVERS > 1)
+#   ifdef CYGSEM_REDBOOT_NETWORK_INIT_ONE_DEVICE
+            break;
+#   else
             if (index == default_index) {
                 primary_net = __local_enet_sc;
             }
+#   endif // CYGSEM_REDBOOT_NETWORK_INIT_ONE_DEVICE
 #endif
         }
     }
     __local_enet_sc = primary_net;
 

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