aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-11-24 23:27:06 +0100
committerWolfgang Denk <wd@denx.de>2009-11-24 23:27:06 +0100
commit5a1b1f36dab86668aaeead61198779d2bca35d2e (patch)
treed2fdc87cb7558fb7b90532b8f32e2c8f1d48e82f
parent7c32dc5bed053348003da5ba3635d4c61c420e66 (diff)
parent67b96e87da1b84660fa1e5b78cc760246d116814 (diff)
downloadu-boot-linaro-stable-5a1b1f36dab86668aaeead61198779d2bca35d2e.tar.gz
Merge branch 'master' of git://git.denx.de/u-boot-net
-rw-r--r--net/net.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/net/net.c b/net/net.c
index cab4b2dd8..fd13cd93f 100644
--- a/net/net.c
+++ b/net/net.c
@@ -197,6 +197,8 @@ volatile uchar *NetTxPacket = 0; /* THE transmit packet */
static int net_check_prereq (proto_t protocol);
+static int NetTryCount;
+
/**********************************************************************/
IPaddr_t NetArpWaitPacketIP;
@@ -320,6 +322,7 @@ NetLoop(proto_t protocol)
NetArpWaitReplyIP = 0;
NetArpWaitTxPacket = NULL;
NetTxPacket = NULL;
+ NetTryCount = 1;
if (!NetTxPacket) {
int i;
@@ -558,17 +561,30 @@ startAgainHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
void NetStartAgain (void)
{
char *nretry;
- int noretry = 0, once = 0;
+ int retry_forever = 0;
+ unsigned long retrycnt = 0;
+
+ nretry = getenv("netretry");
+ if (nretry) {
+ if (!strcmp(nretry, "yes"))
+ retry_forever = 1;
+ else if (!strcmp(nretry, "no"))
+ retrycnt = 0;
+ else if (!strcmp(nretry, "once"))
+ retrycnt = 1;
+ else
+ retrycnt = simple_strtoul(nretry, NULL, 0);
+ } else
+ retry_forever = 1;
- if ((nretry = getenv ("netretry")) != NULL) {
- noretry = (strcmp (nretry, "no") == 0);
- once = (strcmp (nretry, "once") == 0);
- }
- if (noretry) {
- eth_halt ();
+ if ((!retry_forever) && (NetTryCount >= retrycnt)) {
+ eth_halt();
NetState = NETLOOP_FAIL;
return;
}
+
+ NetTryCount++;
+
#ifndef CONFIG_NET_MULTI
NetSetTimeout (10000UL, startAgainTimeout);
NetSetHandler (startAgainHandler);
@@ -580,7 +596,7 @@ void NetStartAgain (void)
eth_init (gd->bd);
if (NetRestartWrap) {
NetRestartWrap = 0;
- if (NetDevExists && !once) {
+ if (NetDevExists) {
NetSetTimeout (10000UL, startAgainTimeout);
NetSetHandler (startAgainHandler);
} else {