net: fec: quiesce packet processing before stopping device in fec_suspend()
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 8 Jul 2014 11:40:23 +0000 (12:40 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Jul 2014 03:02:59 +0000 (20:02 -0700)
commit31a6de34f3daa9b1f412931befd9f82fd4a1b968
tree160dd8c66b6f6b082da81252bfe5ac5d17156595
parent6af42d420bcfa0c837911bd5b518fd4a3cfa4fe4
net: fec: quiesce packet processing before stopping device in fec_suspend()

fec_suspend() calls fec_stop() to stop the transmit ring while the
transmit packet processing is still active.  This can lead to the
transmit queue being restarted by an intervening packet queued for
transmission, or by the tx quirk timer expiring.

Fix this by disabling NAPI first, which will ensure that the NAPI
handlers are not running.  Then, take the transmit lock before
detaching the netif device.  This ensures that there are no races
with the transmit path - and also ensures that the watchdog won't
fire.

We can then safely stop the ethernet device itself, knowing that the
rest of the driver is safely shut down.

On resume, we bring the device back up in reverse order - we restart
the device, reattach the device (under the tx lock), and then enable
the NAPI handlers.

We also need to adjust the close function to cope with this new
sequence, so that it's possible to cleanly close down the driver
after the hardware fails to resume (eg, due to the regulator_enable()
or pinctrl calls in the resume path returning an error.)

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c
This page took 0.025738 seconds and 5 git commands to generate.