1
0
Fork 0
alistair23-linux/drivers/net/ethernet/broadcom
Florian Fainelli 7cb6a2a2c7 net: systemport: Protect stop from timeout
A timing hazard exists when the network interface is stopped that
allows a watchdog timeout to be processed by a separate core in
parallel. This creates the potential for the timeout handler to
wake the queues while the driver is shutting down, or access
registers after their clocks have been removed.

The more common case is that the watchdog timeout will produce a
warning message which doesn't lead to a crash. The chances of this
are greatly increased by the fact that bcm_sysport_netif_stop stops
the transmit queues which can easily precipitate a watchdog time-
out because of stale trans_start data in the queues.

This commit corrects the behavior by ensuring that the watchdog
timeout is disabled before enterring bcm_sysport_netif_stop. There
are currently only two users of the bcm_sysport_netif_stop function:
close and suspend.

The close case already handles the issue by exiting the RUNNING
state before invoking the driver close service.

The suspend case now performs the netif_device_detach to exit the
PRESENT state before the call to bcm_sysport_netif_stop rather than
after it.

These behaviors prevent any future scheduling of the driver timeout
service during the window. The netif_tx_stop_all_queues function
in bcm_sysport_netif_stop is replaced with netif_tx_disable to ensure
synchronization with any transmit or timeout threads that may
already be executing on other cores.

For symmetry, the netif_device_attach call upon resume is moved to
after the call to bcm_sysport_netif_start. Since it wakes the transmit
queues it is not necessary to invoke netif_tx_start_all_queues from
bcm_sysport_netif_start so it is moved into the driver open service.

Fixes: 40755a0fce ("net: systemport: add suspend and resume support")
Fixes: 80105befdb ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-11-03 00:03:40 -07:00
..
bnx2x Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-10-26 19:25:07 -07:00
bnxt pci-v4.20-changes 2018-10-25 06:50:48 -07:00
genet net: bcmgenet: protect stop from timeout 2018-11-03 00:03:39 -07:00
Kconfig bnxt_en: Add hwmon sysfs support to read temperature 2018-08-05 17:08:26 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
b44.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
b44.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bcm63xx_enet.c net: broadcom: fix return type of ndo_start_xmit function 2018-09-19 21:17:58 -07:00
bcm63xx_enet.h bcm63xx_enet: use platform device id directly for miibus name 2017-12-19 11:07:16 -05:00
bcmsysport.c net: systemport: Protect stop from timeout 2018-11-03 00:03:40 -07:00
bcmsysport.h net: systemport: Add software counters to track reallocations 2018-10-01 23:11:53 -07:00
bgmac-bcma-mdio.c net: bgmac: use PHY subsystem for initializing PHY 2017-01-31 13:44:49 -05:00
bgmac-bcma.c net: bgmac: enable master mode for BCM54210E and B50212E PHYs 2017-10-12 22:59:38 -07:00
bgmac-platform.c net: ethernet: bgmac: mark expected switch fall-through 2017-11-11 18:49:26 +09:00
bgmac.c net: bgmac: remove set but not used variable 'err' 2018-09-01 22:30:41 -07:00
bgmac.h net: bgmac: Correctly annotate register space 2018-04-01 22:20:48 -04:00
bnx2.c PCI/AER: Remove pci_cleanup_aer_uncorrect_error_status() calls 2018-10-02 16:04:40 -05:00
bnx2.h ethernet/broadcom: use core min/max MTU checking 2016-10-18 11:34:18 -04:00
bnx2_fw.h
cnic.c cnic: use kvzalloc to allocate memory for csk_tbl 2018-07-11 22:55:52 -07:00
cnic.h
cnic_defs.h
cnic_if.h cnic: Add the interfaces to get FC-NPIV table. 2015-08-06 21:54:12 -07:00
sb1250-mac.c net: broadcom: fix return type of ndo_start_xmit function 2018-09-19 21:17:58 -07:00
tg3.c tg3: Fix fall-through annotations 2018-09-13 15:36:41 -07:00
tg3.h tg3: Update copyright 2018-07-16 14:42:10 -07:00