diff options
author | Tom Rini <trini@konsulko.com> | 2022-02-25 19:44:19 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-03-09 14:13:20 -0500 |
commit | b85b833a5b0add802025661b83efa9cfa2d3cee5 (patch) | |
tree | 8d345b35fd43b875b7f32f9e090362450a9aff41 /net | |
parent | bfc794bbee5693ed630752b469713caad54713fa (diff) | |
download | u-boot-b85b833a5b0add802025661b83efa9cfa2d3cee5.zip u-boot-b85b833a5b0add802025661b83efa9cfa2d3cee5.tar.gz u-boot-b85b833a5b0add802025661b83efa9cfa2d3cee5.tar.bz2 |
Convert CONFIG_NET_RETRY_COUNT to Kconfig
This converts the following to Kconfig:
CONFIG_NET_RETRY_COUNT
Cc: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/Kconfig | 7 | ||||
-rw-r--r-- | net/arp.c | 8 | ||||
-rw-r--r-- | net/bootp.c | 9 | ||||
-rw-r--r-- | net/rarp.c | 7 | ||||
-rw-r--r-- | net/tftp.c | 10 |
5 files changed, 13 insertions, 28 deletions
diff --git a/net/Kconfig b/net/Kconfig index 683c2ad..2e32b55 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -12,6 +12,13 @@ config ARP_TIMEOUT int "Milliseconds before trying ARP again" default 5000 +config NET_RETRY_COUNT + int "Number of timeouts before giving up" + default 5 + help + This variable defines the number of retries for network operations + like ARP, RARP, TFTP, or BOOTP before giving up the operation. + config PROT_UDP bool "Enable generic udp framework" help @@ -17,12 +17,6 @@ #include "arp.h" -#ifndef CONFIG_NET_RETRY_COUNT -# define ARP_TIMEOUT_COUNT 5 /* # of timeouts before giving up */ -#else -# define ARP_TIMEOUT_COUNT CONFIG_NET_RETRY_COUNT -#endif - struct in_addr net_arp_wait_packet_ip; static struct in_addr net_arp_wait_reply_ip; /* MAC address of waiting packet's destination */ @@ -104,7 +98,7 @@ int arp_timeout_check(void) if ((t - arp_wait_timer_start) > CONFIG_ARP_TIMEOUT) { arp_wait_try++; - if (arp_wait_try >= ARP_TIMEOUT_COUNT) { + if (arp_wait_try >= CONFIG_NET_RETRY_COUNT) { puts("\nARP Retry count exceeded; starting again\n"); arp_wait_try = 0; net_set_state(NETLOOP_FAIL); diff --git a/net/bootp.c b/net/bootp.c index a896e1e..a544bfc 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -31,7 +31,7 @@ /* * The timeout for the initial BOOTP/DHCP request used to be described by a - * counter of fixed-length timeout periods. TIMEOUT_COUNT represents + * counter of fixed-length timeout periods. CONFIG_NET_RETRY_COUNT represents * that counter * * Now that the timeout periods are variable (exponential backoff and retry) @@ -39,12 +39,7 @@ * execute that many retries, and keep sending retry packets until that time * is reached. */ -#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) +#define TIMEOUT_MS ((3 + (CONFIG_NET_RETRY_COUNT * 5)) * 1000) #define PORT_BOOTPS 67 /* BOOTP server UDP port */ #define PORT_BOOTPC 68 /* BOOTP client UDP port */ @@ -14,11 +14,6 @@ #include "rarp.h" #define TIMEOUT 5000UL /* Milliseconds before trying BOOTP again */ -#ifndef CONFIG_NET_RETRY_COUNT -#define TIMEOUT_COUNT 5 /* # of timeouts before giving up */ -#else -#define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT) -#endif int rarp_try; @@ -57,7 +52,7 @@ void rarp_receive(struct ip_udp_hdr *ip, unsigned len) */ static void rarp_timeout_handler(void) { - if (rarp_try >= TIMEOUT_COUNT) { + if (rarp_try >= CONFIG_NET_RETRY_COUNT) { puts("\nRetry count exceeded; starting again\n"); net_start_again(); } else { @@ -27,12 +27,6 @@ DECLARE_GLOBAL_DATA_PTR; #define WELL_KNOWN_PORT 69 /* Millisecs to timeout for lost pkt */ #define TIMEOUT 5000UL -#ifndef CONFIG_NET_RETRY_COUNT -/* # of timeouts before giving up */ -# define TIMEOUT_COUNT 10 -#else -# define TIMEOUT_COUNT (CONFIG_NET_RETRY_COUNT * 2) -#endif /* Number of "loading" hashes per line (for checking the image size) */ #define HASHES_PER_LINE 65 @@ -47,7 +41,7 @@ DECLARE_GLOBAL_DATA_PTR; #define TFTP_OACK 6 static ulong timeout_ms = TIMEOUT; -static int timeout_count_max = TIMEOUT_COUNT; +static int timeout_count_max = (CONFIG_NET_RETRY_COUNT * 2); static ulong time_start; /* Record time we started tftp */ /* @@ -60,7 +54,7 @@ static ulong time_start; /* Record time we started tftp */ * non-standard timeout behavior when initiating a TFTP transfer. */ ulong tftp_timeout_ms = TIMEOUT; -int tftp_timeout_count_max = TIMEOUT_COUNT; +int tftp_timeout_count_max = (CONFIG_NET_RETRY_COUNT * 2); enum { TFTP_ERR_UNDEFINED = 0, |