]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
sfc: Fix timekeeping in efx_mcdi_poll()
authorBen Hutchings <bhutchings@solarflare.com>
Sat, 1 Dec 2012 02:21:17 +0000 (02:21 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Mar 2013 19:11:55 +0000 (12:11 -0700)
commit3ad735c406aa1b411dd55b354410f8751a9e16e5
tree71626c37080a7ae6aa612542abf69b0c1a8fa533
parent54ad9a8b55456fc16e326f79f9038a213a2df4c4
sfc: Fix timekeeping in efx_mcdi_poll()

[ Upstream commit ebf98e797b4e26ad52ace1511a0b503ee60a6cd4 ]

efx_mcdi_poll() uses get_seconds() to read the current time and to
implement a polling timeout.  The use of this function was chosen
partly because it could easily be replaced in a co-sim environment
with a macro that read the simulated time.

Unfortunately the real get_seconds() returns the system time (real
time) which is subject to adjustment by e.g. ntpd.  If the system time
is adjusted forward during a polled MCDI operation, the effective
timeout can be shorter than the intended 10 seconds, resulting in a
spurious failure.  It is also possible for a backward adjustment to
delay detection of a areal failure.

Use jiffies instead, and change MCDI_RPC_TIMEOUT to be denominated in
jiffies.  Also correct rounding of the timeout: check time > finish
(or rather time_after(time, finish)) and not time >= finish.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/sfc/mcdi.c