diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/bootp.c | 14 | ||||
-rw-r--r-- | net/bootp.h | 2 | ||||
-rw-r--r-- | net/net.c | 19 | ||||
-rw-r--r-- | net/nfs.c | 6 | ||||
-rw-r--r-- | net/rarp.c | 6 | ||||
-rw-r--r-- | net/sntp.c | 4 | ||||
-rw-r--r-- | net/tftp.c | 10 |
7 files changed, 28 insertions, 33 deletions
diff --git a/net/bootp.c b/net/bootp.c index 64552ac..c2078c6 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -33,7 +33,7 @@ #if defined(CONFIG_CMD_NET) -#define TIMEOUT 5UL /* Seconds before trying BOOTP again */ +#define TIMEOUT 5000UL /* Milliseconds before trying BOOTP again */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else @@ -371,7 +371,7 @@ BootpTimeout(void) puts ("\nRetry count exceeded; starting again\n"); NetStartAgain (); } else { - NetSetTimeout (TIMEOUT * CFG_HZ, BootpTimeout); + NetSetTimeout (TIMEOUT, BootpTimeout); BootpRequest (); } } @@ -671,7 +671,7 @@ BootpRequest (void) bp->bp_htype = HWT_ETHER; bp->bp_hlen = HWL_ETHER; bp->bp_hops = 0; - bp->bp_secs = htons(get_timer(0) / CFG_HZ); + bp->bp_secs = htons(get_timer(0) / 1000); NetWriteIP(&bp->bp_ciaddr, 0); NetWriteIP(&bp->bp_yiaddr, 0); NetWriteIP(&bp->bp_siaddr, 0); @@ -688,7 +688,7 @@ BootpRequest (void) /* * Bootp ID is the lower 4 bytes of our ethernet address - * plus the current time in HZ. + * plus the current time in ms. */ BootpID = ((ulong)NetOurEther[2] << 24) | ((ulong)NetOurEther[3] << 16) @@ -705,7 +705,7 @@ BootpRequest (void) pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + ext_len; iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + ext_len; NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen); - NetSetTimeout(SELECT_TIMEOUT * CFG_HZ, BootpTimeout); + NetSetTimeout(SELECT_TIMEOUT, BootpTimeout); #if defined(CONFIG_CMD_DHCP) dhcp_state = SELECTING; @@ -849,7 +849,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) bp->bp_htype = HWT_ETHER; bp->bp_hlen = HWL_ETHER; bp->bp_hops = 0; - bp->bp_secs = htons(get_timer(0) / CFG_HZ); + bp->bp_secs = htons(get_timer(0) / 1000); /* Do not set the client IP, your IP, or server IP yet, since it hasn't been ACK'ed by * the server yet */ @@ -924,7 +924,7 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC)) DhcpOptionsProcess((u8 *)&bp->bp_vend[4], bp); - NetSetTimeout(TIMEOUT * CFG_HZ, BootpTimeout); + NetSetTimeout(TIMEOUT, BootpTimeout); DhcpSendRequestPkt(bp); #ifdef CFG_BOOTFILE_PREFIX } diff --git a/net/bootp.h b/net/bootp.h index c2f011c..50625ab 100644 --- a/net/bootp.h +++ b/net/bootp.h @@ -88,7 +88,7 @@ typedef enum { INIT, #define DHCP_NAK 6 #define DHCP_RELEASE 7 -#define SELECT_TIMEOUT 3UL /* Seconds to wait for offers */ +#define SELECT_TIMEOUT 3000UL /* Milliseconds to wait for offers */ /**********************************************************************/ @@ -95,14 +95,9 @@ DECLARE_GLOBAL_DATA_PTR; #ifndef CONFIG_ARP_TIMEOUT -# define ARP_TIMEOUT 50UL /* Deciseconds before trying ARP again */ -#elif (CONFIG_ARP_TIMEOUT < 100) -# error "Due to possible overflow CONFIG_ARP_TIMEOUT must be greater than 100ms" +# define ARP_TIMEOUT 5000UL /* Milliseconds before trying ARP again */ #else -# if (CONFIG_ARP_TIMEOUT % 100) -# warning "Supported ARP_TIMEOUT precision is 100ms" -# endif -# define ARP_TIMEOUT (CONFIG_ARP_TIMEOUT / 100) +# define ARP_TIMEOUT CONFIG_ARP_TIMEOUT #endif @@ -264,7 +259,7 @@ void ArpTimeoutCheck(void) t = get_timer(0); /* check for arp timeout */ - if ((t - NetArpWaitTimerStart) > ARP_TIMEOUT * CFG_HZ / 10) { + if ((t - NetArpWaitTimerStart) > ARP_TIMEOUT) { NetArpWaitTry++; if (NetArpWaitTry >= ARP_TIMEOUT_COUNT) { @@ -603,7 +598,7 @@ void NetStartAgain (void) return; } #ifndef CONFIG_NET_MULTI - NetSetTimeout (10UL * CFG_HZ, startAgainTimeout); + NetSetTimeout (10000UL, startAgainTimeout); NetSetHandler (startAgainHandler); #else /* !CONFIG_NET_MULTI*/ eth_halt (); @@ -614,7 +609,7 @@ void NetStartAgain (void) if (NetRestartWrap) { NetRestartWrap = 0; if (NetDevExists && !once) { - NetSetTimeout (10UL * CFG_HZ, startAgainTimeout); + NetSetTimeout (10000UL, startAgainTimeout); NetSetHandler (startAgainHandler); } else { NetState = NETLOOP_FAIL; @@ -790,7 +785,7 @@ static void PingStart(void) #if defined(CONFIG_NET_MULTI) printf ("Using %s device\n", eth_get_name()); #endif /* CONFIG_NET_MULTI */ - NetSetTimeout (10UL * CFG_HZ, PingTimeout); + NetSetTimeout (10000UL, PingTimeout); NetSetHandler (PingHandler); PingSend(); @@ -813,7 +808,7 @@ static void PingStart(void) #define CDP_SYSOBJECT_TLV 0x0015 #define CDP_MANAGEMENT_ADDRESS_TLV 0x0016 -#define CDP_TIMEOUT (CFG_HZ/4) /* one packet every 250ms */ +#define CDP_TIMEOUT 250UL /* one packet every 250ms */ static int CDPSeq; static int CDPOK; @@ -35,7 +35,7 @@ #define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ #define NFS_RETRY_COUNT 30 -#define NFS_TIMEOUT 2UL +#define NFS_TIMEOUT 2000UL static int fs_mounted = 0; static unsigned long rpc_id = 0; @@ -674,7 +674,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) case STATE_READ_REQ: rlen = nfs_read_reply (pkt, len); - NetSetTimeout (NFS_TIMEOUT * CFG_HZ, NfsTimeout); + NetSetTimeout (NFS_TIMEOUT, NfsTimeout); if (rlen > 0) { nfs_offset += rlen; NfsSend (); @@ -763,7 +763,7 @@ NfsStart (void) printf ("\nLoad address: 0x%lx\n" "Loading: *\b", load_addr); - NetSetTimeout (NFS_TIMEOUT * CFG_HZ, NfsTimeout); + NetSetTimeout (NFS_TIMEOUT, NfsTimeout); NetSetHandler (NfsHandler); NfsTimeoutCount = 0; @@ -31,7 +31,7 @@ #if defined(CONFIG_CMD_NET) -#define TIMEOUT 5UL /* Seconds before trying BOOTP again */ +#define TIMEOUT 5000UL /* Milliseconds before trying BOOTP again */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 5 /* # of timeouts before giving up */ #else @@ -80,7 +80,7 @@ RarpTimeout(void) puts ("\nRetry count exceeded; starting again\n"); NetStartAgain (); } else { - NetSetTimeout (TIMEOUT * CFG_HZ, RarpTimeout); + NetSetTimeout (TIMEOUT, RarpTimeout); RarpRequest (); } } @@ -115,7 +115,7 @@ RarpRequest (void) NetSendPacket(NetTxPacket, (pkt - NetTxPacket) + ARP_HDR_SIZE); - NetSetTimeout(TIMEOUT * CFG_HZ, RarpTimeout); + NetSetTimeout(TIMEOUT, RarpTimeout); NetSetHandler(RarpHandler); } @@ -14,7 +14,7 @@ #if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_SNTP) -#define SNTP_TIMEOUT 10 +#define SNTP_TIMEOUT 10000UL static int SntpOurPort; @@ -82,7 +82,7 @@ SntpStart (void) { debug ("%s\n", __FUNCTION__); - NetSetTimeout (SNTP_TIMEOUT * CFG_HZ, SntpTimeout); + NetSetTimeout (SNTP_TIMEOUT, SntpTimeout); NetSetHandler(SntpHandler); memset (NetServerEther, 0, 6); @@ -15,7 +15,7 @@ #if defined(CONFIG_CMD_NET) #define WELL_KNOWN_PORT 69 /* Well known TFTP port # */ -#define TIMEOUT 5UL /* Seconds to timeout for a lost pkt */ +#define TIMEOUT 5000UL /* Millisecs to timeout for lost pkt */ #ifndef CONFIG_NET_RETRY_COUNT # define TIMEOUT_COUNT 10 /* # of timeouts before giving up */ #else @@ -180,7 +180,7 @@ TftpSend (void) pkt += 5 /*strlen("octet")*/ + 1; strcpy ((char *)pkt, "timeout"); pkt += 7 /*strlen("timeout")*/ + 1; - sprintf((char *)pkt, "%lu", TIMEOUT); + sprintf((char *)pkt, "%lu", TIMEOUT / 1000); #ifdef ET_DEBUG printf("send option \"timeout %s\"\n", (char *)pkt); #endif @@ -370,7 +370,7 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) } TftpLastBlock = TftpBlock; - NetSetTimeout (TIMEOUT * CFG_HZ, TftpTimeout); + NetSetTimeout (TIMEOUT, TftpTimeout); store_block (TftpBlock - 1, pkt + 2, len); @@ -449,7 +449,7 @@ TftpTimeout (void) NetStartAgain (); } else { puts ("T "); - NetSetTimeout (TIMEOUT * CFG_HZ, TftpTimeout); + NetSetTimeout (TIMEOUT, TftpTimeout); TftpSend (); } } @@ -520,7 +520,7 @@ TftpStart (void) puts ("Loading: *\b"); - NetSetTimeout (TIMEOUT * CFG_HZ, TftpTimeout); + NetSetTimeout (TIMEOUT, TftpTimeout); NetSetHandler (TftpHandler); TftpServerPort = WELL_KNOWN_PORT; |