[U-Boot] [PATCH] net: tftp: Add TFTP specific config for retry count

amessier.tyco at gmail.com amessier.tyco at gmail.com
Fri Jan 22 20:18:27 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 number of retries
specifically for TFTP.

Signed-off-by: Alexandre Messier <amessier at tycoint.com>
---
 README     | 5 +++++
 net/tftp.c | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/README b/README
index ece4793..9d53c2e 100644
--- a/README
+++ b/README
@@ -2845,6 +2845,11 @@ CBFS (Coreboot Filesystem) support
 		before giving up the operation. If not defined, a
 		default value of 5 is used.
 
+		CONFIG_NET_RETRY_COUNT_TFTP
+
+		Override CONFIG_NET_RETRY_COUNT for TFTP. If not defined,
+		falls back to CONFIG_NET_RETRY_COUNT.
+
 		CONFIG_ARP_TIMEOUT
 
 		Timeout waiting for an ARP reply in milliseconds.
diff --git a/net/tftp.c b/net/tftp.c
index f2889fe..884cfaa 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -20,12 +20,16 @@
 #define WELL_KNOWN_PORT	69
 /* Millisecs to timeout for lost pkt */
 #define TIMEOUT		5000UL
+#ifndef CONFIG_NET_RETRY_COUNT_TFTP
 #ifndef	CONFIG_NET_RETRY_COUNT
 /* # of timeouts before giving up */
 # define TIMEOUT_COUNT	10
 #else
 # define TIMEOUT_COUNT  (CONFIG_NET_RETRY_COUNT * 2)
 #endif
+#else
+# define TIMEOUT_COUNT	CONFIG_NET_RETRY_COUNT_TFTP
+#endif
 /* Number of "loading" hashes per line (for checking the image size) */
 #define HASHES_PER_LINE	65
 
-- 
2.7.0



More information about the U-Boot mailing list