summaryrefslogtreecommitdiffstats
path: root/src/net/80211
diff options
context:
space:
mode:
authorMichael Brown2017-01-25 21:59:15 +0100
committerMichael Brown2017-01-26 09:17:37 +0100
commit302f1eeb80706fb10067efedb1279fa3f85ddda2 (patch)
tree90e58309094b20a26cedc8244fabf72d96fe6135 /src/net/80211
parent[cpuid] Provide cpuid_supported() to test for supported functions (diff)
downloadipxe-302f1eeb80706fb10067efedb1279fa3f85ddda2.tar.gz
ipxe-302f1eeb80706fb10067efedb1279fa3f85ddda2.tar.xz
ipxe-302f1eeb80706fb10067efedb1279fa3f85ddda2.zip
[time] Allow timer to be selected at runtime
Allow the active timer (providing udelay() and currticks()) to be selected at runtime based on probing during the INIT_EARLY stage of initialisation. TICKS_PER_SEC is now a fixed compile-time constant for all builds, and is independent of the underlying clock tick rate. We choose the value 1024 to allow multiplications and divisions on seconds to be converted to bit shifts. TICKS_PER_MS is defined as 1, allowing multiplications and divisions on milliseconds to be omitted entirely. The 2% inaccuracy in this definition is negligible when using the standard BIOS timer (running at around 18.2Hz). TIMER_RDTSC now checks for a constant TSC before claiming to be a usable timer. (This timer can be tested in KVM via the command-line option "-cpu host,+invtsc".) Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/80211')
-rw-r--r--src/net/80211/net80211.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/net/80211/net80211.c b/src/net/80211/net80211.c
index d4970ad5..62912741 100644
--- a/src/net/80211/net80211.c
+++ b/src/net/80211/net80211.c
@@ -1321,7 +1321,7 @@ struct net80211_probe_ctx * net80211_probe_start ( struct net80211_device *dev,
ctx->ticks_start = currticks();
ctx->ticks_beacon = 0;
ctx->ticks_channel = currticks();
- ctx->hop_time = ticks_per_sec() / ( active ? 2 : 6 );
+ ctx->hop_time = TICKS_PER_SEC / ( active ? 2 : 6 );
/*
* Channels on 2.4GHz overlap, and the most commonly used
@@ -1363,8 +1363,8 @@ struct net80211_probe_ctx * net80211_probe_start ( struct net80211_device *dev,
int net80211_probe_step ( struct net80211_probe_ctx *ctx )
{
struct net80211_device *dev = ctx->dev;
- u32 start_timeout = NET80211_PROBE_TIMEOUT * ticks_per_sec();
- u32 gather_timeout = ticks_per_sec();
+ u32 start_timeout = NET80211_PROBE_TIMEOUT * TICKS_PER_SEC;
+ u32 gather_timeout = TICKS_PER_SEC;
u32 now = currticks();
struct io_buffer *iob;
int signal;
@@ -2606,7 +2606,7 @@ static void net80211_rx_frag ( struct net80211_device *dev,
/* start a frag cache entry */
int i, newest = -1;
u32 curr_ticks = currticks(), newest_ticks = 0;
- u32 timeout = ticks_per_sec() * NET80211_FRAG_TIMEOUT;
+ u32 timeout = TICKS_PER_SEC * NET80211_FRAG_TIMEOUT;
for ( i = 0; i < NET80211_NR_CONCURRENT_FRAGS; i++ ) {
if ( dev->frags[i].in_use == 0 )