Repair the 'netretry=once' option.

'netretry = once' does the same as 'netretry = yes', because it is not stored
when it was tried once.

Signed-off-by: Remy Bohmer <linux@bohmer.net>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
This commit is contained in:
Remy Bohmer 2009-10-28 22:13:39 +01:00 committed by Ben Warren
parent fcffb680e7
commit 67b96e87da

View file

@ -197,6 +197,8 @@ volatile uchar *NetTxPacket = 0; /* THE transmit packet */
static int net_check_prereq (proto_t protocol); static int net_check_prereq (proto_t protocol);
static int NetTryCount;
/**********************************************************************/ /**********************************************************************/
IPaddr_t NetArpWaitPacketIP; IPaddr_t NetArpWaitPacketIP;
@ -320,6 +322,7 @@ NetLoop(proto_t protocol)
NetArpWaitReplyIP = 0; NetArpWaitReplyIP = 0;
NetArpWaitTxPacket = NULL; NetArpWaitTxPacket = NULL;
NetTxPacket = NULL; NetTxPacket = NULL;
NetTryCount = 1;
if (!NetTxPacket) { if (!NetTxPacket) {
int i; int i;
@ -558,17 +561,30 @@ startAgainHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
void NetStartAgain (void) void NetStartAgain (void)
{ {
char *nretry; char *nretry;
int noretry = 0, once = 0; int retry_forever = 0;
unsigned long retrycnt = 0;
if ((nretry = getenv ("netretry")) != NULL) { nretry = getenv("netretry");
noretry = (strcmp (nretry, "no") == 0); if (nretry) {
once = (strcmp (nretry, "once") == 0); if (!strcmp(nretry, "yes"))
} retry_forever = 1;
if (noretry) { else if (!strcmp(nretry, "no"))
eth_halt (); retrycnt = 0;
else if (!strcmp(nretry, "once"))
retrycnt = 1;
else
retrycnt = simple_strtoul(nretry, NULL, 0);
} else
retry_forever = 1;
if ((!retry_forever) && (NetTryCount >= retrycnt)) {
eth_halt();
NetState = NETLOOP_FAIL; NetState = NETLOOP_FAIL;
return; return;
} }
NetTryCount++;
#ifndef CONFIG_NET_MULTI #ifndef CONFIG_NET_MULTI
NetSetTimeout (10000UL, startAgainTimeout); NetSetTimeout (10000UL, startAgainTimeout);
NetSetHandler (startAgainHandler); NetSetHandler (startAgainHandler);
@ -580,7 +596,7 @@ void NetStartAgain (void)
eth_init (gd->bd); eth_init (gd->bd);
if (NetRestartWrap) { if (NetRestartWrap) {
NetRestartWrap = 0; NetRestartWrap = 0;
if (NetDevExists && !once) { if (NetDevExists) {
NetSetTimeout (10000UL, startAgainTimeout); NetSetTimeout (10000UL, startAgainTimeout);
NetSetHandler (startAgainHandler); NetSetHandler (startAgainHandler);
} else { } else {