ath5k/ath9k: Fix 64 bits TSF reads
authorBenoit Papillault <benoit.papillault@free.fr>
Thu, 15 Apr 2010 22:07:26 +0000 (00:07 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 16 Apr 2010 19:46:54 +0000 (15:46 -0400)
commit1c0fc65e6de4e941ff483df445e721d6edb1f84b
tree817e2d467d656b845b649f5ec883fbf100bc4b1e
parent733f0ea4498a24db5b8ac048ef99983600f1eff9
ath5k/ath9k: Fix 64 bits TSF reads

According to tests, both TSF lower and upper registers kept counting, so
the higher part could have been updated after the lower part has been
read, as shown in the following log where the upper part is read first
and the lower part next.

tsf = {00000003-fffffffd}
tsf = {00000003-00000001}
tsf = {00000004-0000000b}

This patch corrects this by checking that the upper part has not been
changed while the lower part was read. It has been tested in an IBSS
network where artifical IBSS merges have been done in order to trigger
hundreds of rollover for the TSF lower part.

It follows the logic mentionned by Derek, with only 2 register reads
needed at each additional steps instead of 3 (the minimum number of
register reads is still 3).

Signed-off-by: Benoit Papillault <benoit.papillault@free.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/pcu.c
drivers/net/wireless/ath/ath9k/hw.c