diff mbox series

[U-Boot] net: dhcp: Allow "MAY_FAIL" to still try each adapter

Message ID 1510107220-3355-1-git-send-email-wilson.lee@ni.com
State Accepted
Commit e258636
Delegated to: Joe Hershberger
Headers show
Series [U-Boot] net: dhcp: Allow "MAY_FAIL" to still try each adapter | expand

Commit Message

Wilson Lee Nov. 8, 2017, 2:13 a.m. UTC
From: Joe Hershberger <joe.hershberger@ni.com>

This change allows the "MAY_FAIL" DHCP option to still attempt to
contact a DHCP server on each adapter and only give up once each
adapter has failed once.  To get the existing behavior, set the
already-existing ethrotate=no variable.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Keng Soon Cheah <keng.soon.cheah@ni.com>
Cc: Chen Yee Chew <chen.yee.chew@ni.com>
---
 net/bootp.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Comments

Joe Hershberger Jan. 22, 2018, 4:54 p.m. UTC | #1
Hi Wilson,

https://patchwork.ozlabs.org/patch/835530/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/net/bootp.c b/net/bootp.c
index 73370a1..cb724e9 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -387,12 +387,19 @@  static void bootp_timeout_handler(void)
 
 	if (time_taken >= time_taken_max) {
 #ifdef CONFIG_BOOTP_MAY_FAIL
-		puts("\nRetry time exceeded\n");
-		net_set_state(NETLOOP_FAIL);
-#else
-		puts("\nRetry time exceeded; starting again\n");
-		net_start_again();
+		char *ethrotate;
+
+		ethrotate = getenv("ethrotate");
+		if ((ethrotate != NULL && strcmp(ethrotate, "no") == 0) ||
+		    net_restart_wrap) {
+			puts("\nRetry time exceeded\n");
+			net_set_state(NETLOOP_FAIL);
+		} else
 #endif
+		{
+			puts("\nRetry time exceeded; starting again\n");
+			net_start_again();
+		}
 	} else {
 		bootp_timeout *= 2;
 		if (bootp_timeout > 2000)