mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
use busy waiting for receiving the IP address => reduce the latency
This commit is contained in:
parent
e221677fe1
commit
5e9f932869
1 changed files with 12 additions and 1 deletions
|
@ -228,7 +228,19 @@ success:
|
|||
int mscnt = 0;
|
||||
/* wait for ip address */
|
||||
while(!default_netif.ip_addr.addr) {
|
||||
uint64_t end_tsc, start_tsc = rdtsc();
|
||||
|
||||
#if 1
|
||||
do {
|
||||
if (default_netif.ip_addr.addr)
|
||||
return 0;
|
||||
check_workqueues();
|
||||
end_tsc = rdtsc();
|
||||
} while(((end_tsc - start_tsc) / (get_cpu_frequency() * 1000)) < DHCP_FINE_TIMER_MSECS);
|
||||
#else
|
||||
sys_msleep(DHCP_FINE_TIMER_MSECS);
|
||||
#endif
|
||||
|
||||
dhcp_fine_tmr();
|
||||
mscnt += DHCP_FINE_TIMER_MSECS;
|
||||
if (mscnt >= DHCP_COARSE_TIMER_SECS*1000) {
|
||||
|
@ -238,7 +250,6 @@ success:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue