This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
RedBoot - Try initializing default ethernet first
- From: David Vrabel <dvrabel at arcom dot com>
- To: eCos Patches <ecos-patches at ecos dot sourceware dot org>
- Date: Tue, 06 Jul 2004 12:01:29 +0100
- Subject: RedBoot - Try initializing default ethernet first
Hi,
The attached patches changes the way RedBoot initializes the ethernet
devices. Now it tries the default before falling back to trying all the
others. This can speed up boot times as ethernet initialization can be
a slow process with some drivers (auto-negotiation timeouts etc.) and
now (in most cases) only one ethernet device (the default) will be
initialized.
2004-07-06 David Vrabel <dvrabel@arcom.com>
* src/net/net_io.c (net_init): Try initializing the default
ethernet device first before falling back to trying all the
others.
David Vrabel
--
David Vrabel, Design Engineer
Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK Web: http://www.arcom.com/
Index: redboot/current/src/net/net_io.c
===================================================================
RCS file: /var/cvs/ecos/packages/redboot/current/src/net/net_io.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -B -p -r1.8 -r1.9
--- redboot/current/src/net/net_io.c 2 Jul 2004 15:00:47 -0000 1.8
+++ redboot/current/src/net/net_io.c 6 Jul 2004 10:48:58 -0000 1.9
@@ -673,7 +673,6 @@ 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;
int default_index;
@@ -718,24 +717,25 @@ net_init(void)
// Initialize network device(s).
#if defined(CYGHWR_NET_DRIVERS) && (CYGHWR_NET_DRIVERS > 1)
+ /* Try the default first */
default_index = net_devindex(default_devname);
if (default_index < 0)
default_index = 0;
-#endif
- for (index = 0; (t = net_devtab_entry(index)) != NULL; index++) {
- if (t->init(t)) {
+ t = net_devtab_entry(default_index);
+ if (t->init(t)) {
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)
- if (index == default_index) {
- primary_net = __local_enet_sc;
- }
+ } else {
#endif
+ /* otherwise, try all the others */
+ for (index = 0; (t = net_devtab_entry(index)) != NULL; index++) {
+ if (t->init(t)) {
+ t->status = CYG_NETDEVTAB_STATUS_AVAIL;
+ break;
+ }
}
+#if defined(CYGHWR_NET_DRIVERS) && (CYGHWR_NET_DRIVERS > 1)
}
- __local_enet_sc = primary_net;
+#endif
if (!__local_enet_sc) {
diag_printf("No network interfaces found\n");