[U-Boot] [PATCH 2/2] net: bootp: Add BOOTP specific config for timeout value
amessier.tyco at gmail.com
amessier.tyco at gmail.com
Fri Jan 22 20:22:43 CET 2016
From: Alexandre Messier <amessier at tycoint.com>
There is currently one config option (CONFIG_NET_RETRY_COUNT) that
is available to tune the retries of the network stack.
Unfortunately, it is global to all protocols, and the value is
interpreted differently in all of them.
Add a new config option that sets directly the timeout delay used by
BOOTP, instead of it being derived from CONFIG_NET_RETRY_COUNT.
Signed-off-by: Alexandre Messier <amessier at tycoint.com>
---
README | 6 ++++++
net/bootp.c | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/README b/README
index 05966ab..9703f83 100644
--- a/README
+++ b/README
@@ -2191,6 +2191,7 @@ CBFS (Coreboot Filesystem) support
CONFIG_BOOTP_TIMEOFFSET
CONFIG_BOOTP_VENDOREX
CONFIG_BOOTP_MAY_FAIL
+ CONFIG_BOOTP_TIMEOUT_MS
CONFIG_BOOTP_DHCPREQ_BOOTFILE
CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip
@@ -2232,6 +2233,11 @@ CBFS (Coreboot Filesystem) support
the DHCP timeout and retry process takes a longer than
this delay.
+ CONFIG_BOOTP_TIMEOUT_MS - Explicitly configure the BOOTP
+ timeout in milliseconds, instead of basing it on the configured
+ number of retries, which is either CONFIG_NET_RETRY_COUNT or
+ the BOOTP default value of 5 retries.
+
CONFIG_BOOTP_DHCPREQ_BOOTFILE - Set the bootfile name in
DHCPREQUEST packet, in addition to DHCPDISCOVER. This may be
needed by some DHCP servers in specific cases.
diff --git a/net/bootp.c b/net/bootp.c
index 8da94cf..edb0b39 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -33,12 +33,16 @@
* execute that many retries, and keep sending retry packets until that time
* is reached.
*/
+#ifndef CONFIG_BOOTP_TIMEOUT_MS
#ifndef CONFIG_NET_RETRY_COUNT
# define TIMEOUT_COUNT 5 /* # of timeouts before giving up */
#else
# define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT)
#endif
#define TIMEOUT_MS ((3 + (TIMEOUT_COUNT * 5)) * 1000)
+#else
+#define TIMEOUT_MS CONFIG_BOOTP_TIMEOUT_MS
+#endif
#define PORT_BOOTPS 67 /* BOOTP server UDP port */
#define PORT_BOOTPC 68 /* BOOTP client UDP port */
--
1.8.3.1
More information about the U-Boot
mailing list