diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2010-05-27 11:37:46 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-06-17 08:28:16 +0200 |
commit | 994f95c073caf4df62d1271aef4112ce8aaa8add (patch) | |
tree | c0167dbdedb5c3ebc68f374c3f3df7d0b0b8bfdb /net/net.c | |
parent | c21a7fb9f15ee1fb213e22c0e7a9d0f53b274cb2 (diff) | |
download | barebox-994f95c073caf4df62d1271aef4112ce8aaa8add.tar.gz barebox-994f95c073caf4df62d1271aef4112ce8aaa8add.tar.xz |
net: remove need for eth_halt/eth_open
We used to eth_open/eth_halt the network devices during NetLoopInit
which is called whenever the user enters a network command.
Change this behaviour so that the current network device gets opened
when making it the current one.
With this change it's always possible to send packages and we are able
to implement a new network stack in the next step.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net/net.c')
-rw-r--r-- | net/net.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -228,9 +228,6 @@ int NetLoopInit(proto_t protocol) NetArpWaitTxPacket -= (ulong)NetArpWaitTxPacket % PKTALIGN; NetArpWaitTxPacketSize = 0; - if (eth_open() < 0) - return -1; - string_to_ethaddr(dev_get_param(ð_get_current()->dev, "ethaddr"), NetOurEther); @@ -243,8 +240,6 @@ int NetLoopInit(proto_t protocol) NetServerIP = dev_get_param_ip(ð_current->dev, "serverip"); ret = net_check_prereq(protocol); - if (ret) - eth_halt(); return ret; } @@ -281,7 +276,6 @@ int NetLoop(void) * Abort if ctrl-c was pressed. */ if (ctrlc()) { - eth_halt(); puts ("\nAbort\n"); return -1; } @@ -315,11 +309,9 @@ int NetLoop(void) sprintf(buf, "0x%lx", NetBootFileXferSize); setenv("filesize", buf); } - eth_halt(); return NetBootFileXferSize; case NETLOOP_FAIL: - eth_halt(); return -1; } } @@ -959,3 +951,16 @@ void ethaddr_to_string(const unsigned char *enetaddr, char *str) enetaddr[4], enetaddr[5]); } +void net_update_env(void) +{ + struct eth_device *edev = eth_get_current(); + + NetOurIP = dev_get_param_ip(&edev->dev, "ipaddr"); + NetServerIP = dev_get_param_ip(&edev->dev, "serverip"); + NetOurGatewayIP = dev_get_param_ip(&edev->dev, "gateway"); + NetOurSubnetMask = dev_get_param_ip(&edev->dev, "netmask"); + + string_to_ethaddr(dev_get_param(&edev->dev, "ethaddr"), + NetOurEther); +} + |