Re: [U-Boot] [PATCH] Repair the 'netry=once' option.

2009-11-23 Thread Wolfgang Denk
Dear Ben Warren,

In message 4af9080e.3050...@gmail.com you wrote:
 Hi Remy,
 
 Remy Bohmer wrote:
  'netretry = once' does the same as 'netretry = yes', because it is not 
  stored
  when it was tried once.
 
  Signed-off-by: Remy Bohmer li...@bohmer.net
  ---
   net/net.c |   34 +-
   1 files changed, 25 insertions(+), 9 deletions(-)

 Applied to net/next.

I think this is a bug fix and should go into this release (with a fix
of the typo (s/netry/netretry/) in the Subject, of course).

Can you please do that?  Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Love is an ideal thing, marriage a real thing; a  confusion  of  the
real with the ideal never goes unpunished.  - Goethe
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Repair the 'netry=once' option.

2009-11-09 Thread Ben Warren
Hi Remy,

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

 Signed-off-by: Remy Bohmer li...@bohmer.net
 ---
  net/net.c |   34 +-
  1 files changed, 25 insertions(+), 9 deletions(-)
   
Applied to net/next.

thanks,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] Repair the 'netry=once' option.

2009-10-28 Thread Remy Bohmer
'netretry = once' does the same as 'netretry = yes', because it is not stored
when it was tried once.

Signed-off-by: Remy Bohmer li...@bohmer.net
---
 net/net.c |   34 +-
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/net/net.c b/net/net.c
index cab4b2d..fd13cd9 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 (1UL, startAgainTimeout);
NetSetHandler (startAgainHandler);
@@ -580,7 +596,7 @@ void NetStartAgain (void)
eth_init (gd-bd);
if (NetRestartWrap) {
NetRestartWrap = 0;
-   if (NetDevExists  !once) {
+   if (NetDevExists) {
NetSetTimeout (1UL, startAgainTimeout);
NetSetHandler (startAgainHandler);
} else {
-- 
1.6.0.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot