summaryrefslogtreecommitdiffstats
path: root/src/net/stp.c
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/stp.c
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/stp.c')
-rw-r--r--src/net/stp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/stp.c b/src/net/stp.c
index defdaed9..3d78400a 100644
--- a/src/net/stp.c
+++ b/src/net/stp.c
@@ -110,7 +110,7 @@ static int stp_rx ( struct io_buffer *iobuf, struct net_device *netdev,
"forwarding\n",
netdev->name, eth_ntoa ( stp->sender.mac ),
ntohs ( stp->port ), stp->flags );
- hello = ( ( ntohs ( stp->hello ) * TICKS_PER_SEC ) / 256 );
+ hello = ( ntohs ( stp->hello ) * ( TICKS_PER_SEC / 256 ) );
netdev_link_block ( netdev, ( hello * 2 ) );
rc = -ENETUNREACH;
goto done;