From a3d991bd0da8b9fb9dbf2c7481091c3d082b9b13 Mon Sep 17 00:00:00 2001 From: wdenk Date: Thu, 15 Apr 2004 21:48:45 +0000 Subject: Patches by Pantelis Antoniou, 30 Mar 2004: add networking support for VLANs (802.1q), and CDP (Cisco Discovery Protocol) --- net/eth.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'net/eth.c') diff --git a/net/eth.c b/net/eth.c index 7eae469..7f8afe7 100644 --- a/net/eth.c +++ b/net/eth.c @@ -87,6 +87,14 @@ int eth_register(struct eth_device* dev) if (!eth_devices) { eth_current = eth_devices = dev; +#ifdef CONFIG_NET_MULTI + /* update current ethernet name */ + { + char *act = getenv("ethact"); + if (act == NULL || strcmp(act, eth_current->name) != 0) + setenv("ethact", eth_current->name); + } +#endif } else { for (d=eth_devices; d->next!=eth_devices; d=d->next); d->next = dev; @@ -221,6 +229,16 @@ int eth_initialize(bd_t *bis) dev = dev->next; } while(dev != eth_devices); +#ifdef CONFIG_NET_MULTI + /* update current ethernet name */ + if (eth_current) { + char *act = getenv("ethact"); + if (act == NULL || strcmp(act, eth_current->name) != 0) + setenv("ethact", eth_current->name); + } else + setenv("ethact", NULL); +#endif + putc ('\n'); } @@ -326,12 +344,44 @@ void eth_try_another(int first_restart) eth_current = eth_current->next; +#ifdef CONFIG_NET_MULTI + /* update current ethernet name */ + { + char *act = getenv("ethact"); + if (act == NULL || strcmp(act, eth_current->name) != 0) + setenv("ethact", eth_current->name); + } +#endif + if (first_failed == eth_current) { NetRestartWrap = 1; } } +#ifdef CONFIG_NET_MULTI +void eth_set_current(void) +{ + char *act; + struct eth_device* old_current; + + if (!eth_current) /* XXX no current */ + return; + + act = getenv("ethact"); + if (act != NULL) { + old_current = eth_current; + do { + if (strcmp(eth_current->name, act) == 0) + return; + eth_current = eth_current->next; + } while (old_current != eth_current); + } + + setenv("ethact", eth_current->name); +} +#endif + char *eth_get_name (void) { return (eth_current ? eth_current->name : "unknown"); -- cgit v1.1