linux/drivers/net/ethernet/ti
Grygorii Strashko 62f94c2101 net: ethernet: ti: cpsw: fix net watchdog timeout
It was discovered that simple program which indefinitely sends 200b UDP
packets and runs on TI AM574x SoC (SMP) under RT Kernel triggers network
watchdog timeout in TI CPSW driver (<6 hours run). The network watchdog
timeout is triggered due to race between cpsw_ndo_start_xmit() and
cpsw_tx_handler() [NAPI]

cpsw_ndo_start_xmit()
	if (unlikely(!cpdma_check_free_tx_desc(txch))) {
		txq = netdev_get_tx_queue(ndev, q_idx);
		netif_tx_stop_queue(txq);

^^ as per [1] barier has to be used after set_bit() otherwise new value
might not be visible to other cpus
	}

cpsw_tx_handler()
	if (unlikely(netif_tx_queue_stopped(txq)))
		netif_tx_wake_queue(txq);

and when it happens ndev TX queue became disabled forever while driver's HW
TX queue is empty.

Fix this, by adding smp_mb__after_atomic() after netif_tx_stop_queue()
calls and double check for free TX descriptors after stopping ndev TX queue
- if there are free TX descriptors wake up ndev TX queue.

[1] https://www.kernel.org/doc/html/latest/core-api/atomic_ops.html
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-07 21:57:10 -05:00
..
cpmac.c cpmac: remove hopeless #warning 2017-01-16 11:54:36 -05:00
cpsw_ale.c net: ethernet: ti: ale: fix port check in cpsw_ale_control_set/get 2017-12-01 16:36:33 -05:00
cpsw_ale.h net: ethernet: ti: ale: use devm_kzalloc in cpsw_ale_create() 2017-12-01 16:36:32 -05:00
cpsw-common.c net: ti: cpsw-common: dont print error if ti_cm_get_macid() fails 2017-08-30 10:05:07 -07:00
cpsw-phy-sel.c drivers: net: cpsw-phy-sel: Clear RGMII_IDMODE on "rgmii" links 2016-12-07 13:12:17 -05:00
cpsw.c net: ethernet: ti: cpsw: fix net watchdog timeout 2018-02-07 21:57:10 -05:00
cpsw.h net: ethernet: ti: cpsw: move mac_hi/lo defines in cpsw.h 2017-12-01 16:36:32 -05:00
cpts.c net: ethernet: make ptp_clock_info const 2017-08-22 11:04:51 -07:00
cpts.h net: ethernet: ti: cpts: fix tx timestamping timeout 2017-08-01 15:22:55 -07:00
davinci_cpdma.c net: ethernet: ti: cpdma: correct error handling for chan create 2017-12-13 15:49:53 -05:00
davinci_cpdma.h net: ethernet: ti: cpsw: add support for ringparam configuration 2017-01-07 20:48:14 -05:00
davinci_emac.c net: ethernet: ti: cpdma: correct error handling for chan create 2017-12-13 15:49:53 -05:00
davinci_mdio.c drivers: net: davinci_mdio: print bus frequency 2017-08-11 14:23:59 -07:00
Kconfig cpsw/netcp: refine cpts dependency 2017-04-28 15:55:14 -04:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
netcp_core.c Net: ethernet: ti: netcp: Fix inbound ping crash if MTU size is greater than 1500 2018-01-17 16:19:37 -05:00
netcp_ethss.c net: ethernet: ti: ale: use devm_kzalloc in cpsw_ale_create() 2017-12-01 16:36:32 -05:00
netcp_sgmii.c
netcp_xgbepcsr.c
netcp.h net: netcp: use hw capability to remove FCS word from rx packets 2017-01-07 21:03:50 -05:00
tlan.c treewide: Remove TIMER_FUNC_TYPE and TIMER_DATA_TYPE casts 2017-11-21 16:35:54 -08:00
tlan.h