FIX: support rstamps from the future too.
authorIanR778 <IanR778@users.noreply.github.com>
Wed, 8 Oct 2014 20:00:37 +0000 (21:00 +0100)
committerIanR778 <IanR778@users.noreply.github.com>
Wed, 8 Oct 2014 20:00:37 +0000 (21:00 +0100)
commit07a2fecf33ddaf1e497fa9118458f71230dc0032
treeefa07b5ca63ed4ad9847285a5b490b11b1a99cb6
parent583a029b620214fce590e7fbb960dbba290afe23
FIX: support rstamps from the future too.

 * Extend a 32 bit TSF to nearest 64 bit TSF value.
 * When the adapter is a STATION, its local TSF is periodically modified by
 * the hardware to match the BSS TSF (as received in beacon packets), and
 * rstamp may appear to be from the future or from the past (with reference
 * to the current local TSF) because of jitter. This is mostly noticable in
 * highly congested channels. The code uses signed modulo arithmetic to
 * handle both past/future cases and signed-extension to avoid branches.
 * Test cases:
 * extend(0x0000001200000004, 0x00000006) == 0x0000001200000006
 * extend(0x0000001200000004, 0x00000002) == 0x0000001200000002
 * extend(0x0000001200000004, 0xfffffffe) == 0x00000011fffffffe  ! tsfhigh--
 * extend(0x00000012fffffffc, 0xfffffffe) == 0x00000012fffffffe
 * extend(0x00000012fffffffc, 0xfffffffa) == 0x00000012fffffffa
 * extend(0x00000012fffffffc, 0x00000002) == 0x0000001300000002  ! tsfhigh++
target_firmware/wlan/if_ath.c