linux-stable/drivers/net
Anssi Hannula 620050d9c2 can: xilinx_can: keep only 1-2 frames in TX FIFO to fix TX accounting
The xilinx_can driver assumes that the TXOK interrupt only clears after
it has been acknowledged as many times as there have been successfully
sent frames.

However, the documentation does not mention such behavior, instead
saying just that the interrupt is cleared when the clear bit is set.

Similarly, testing seems to also suggest that it is immediately cleared
regardless of the amount of frames having been sent. Performing some
heavy TX load and then going back to idle has the tx_head drifting
further away from tx_tail over time, steadily reducing the amount of
frames the driver keeps in the TX FIFO (but not to zero, as the TXOK
interrupt always frees up space for 1 frame from the driver's
perspective, so frames continue to be sent) and delaying the local echo
frames.

The TX FIFO tracking is also otherwise buggy as it does not account for
TX FIFO being cleared after software resets, causing
  BUG!, TX FIFO full when queue awake!
messages to be output.

There does not seem to be any way to accurately track the state of the
TX FIFO for local echo support while using the full TX FIFO.

The Zynq version of the HW (but not the soft-AXI version) has watermark
programming support and with it an additional TX-FIFO-empty interrupt
bit.

Modify the driver to only put 1 frame into TX FIFO at a time on soft-AXI
and 2 frames at a time on Zynq. On Zynq the TXFEMP interrupt bit is used
to detect whether 1 or 2 frames have been sent at interrupt processing
time.

Tested with the integrated CAN on Zynq-7000 SoC. The 1-frame-FIFO mode
was also tested.

An alternative way to solve this would be to drop local echo support but
keep using the full TX FIFO.

v2: Add FIFO space check before TX queue wake with locking to
synchronize with queue stop. This avoids waking the queue when xmit()
had just filled it.

v3: Keep local echo support and reduce the amount of frames in FIFO
instead as suggested by Marc Kleine-Budde.

Fixes: b1201e44f5 ("can: xilinx CAN controller support")
Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
Cc: <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-07-23 14:34:46 +02:00
..
appletalk
arcnet
bonding bonding: set default miimon value for non-arp modes if not set 2018-07-21 10:26:21 -07:00
caif
can can: xilinx_can: keep only 1-2 frames in TX FIFO to fix TX accounting 2018-07-23 14:34:46 +02:00
dsa net: dsa: mv88e6xxx: fix races between lock and irq freeing 2018-07-21 22:42:41 -07:00
ethernet net: prevent ISA drivers from building on PPC32 2018-07-22 11:12:29 -07:00
fddi net: fddi: fix a possible null-ptr-deref 2018-06-08 18:47:46 -04:00
fjes
hamradio net: hamradio: use eth_broadcast_addr 2018-06-20 07:51:43 +09:00
hippi treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
hyperv hv_netvsc: Fix napi reschedule while receive completion is busy 2018-07-18 15:23:30 -07:00
ieee802154 net: ieee802154: adf7242: Fix OCL calibration runs 2018-07-09 10:53:12 +02:00
ipvlan ipvlan: call dev_change_flags when ipvlan mode is reset 2018-07-02 20:38:09 +09:00
netdevsim netdevsim: Add extack error message for devlink reload 2018-06-05 12:32:37 -04:00
phy net: phy: consider PHY_IGNORE_INTERRUPT in phy_start_aneg_priv 2018-07-21 16:20:38 -07:00
plip
ppp Revert changes to convert to ->poll_mask() and aio IOCB_CMD_POLL 2018-06-28 10:40:47 -07:00
slip treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
team treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
usb net: usb: asix: replace mii_nway_restart in resume path 2018-07-18 13:43:16 -07:00
vmxnet3
wan treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
wimax
wireless wireless-drivers fixes for 4.18 2018-07-03 23:29:29 +09:00
xen-netback treewide: Use array_size() in vzalloc() 2018-06-12 16:19:22 -07:00
dummy.c
eql.c
geneve.c net: fix use-after-free in GRO with ESP 2018-07-02 20:34:04 +09:00
gtp.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c
macvlan.c
macvtap.c
Makefile
mdio.c
mii.c
net_failover.c net: net_failover: fix typo in net_failover_slave_register() 2018-06-20 07:56:44 +09:00
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c net: in virtio_net_hdr only add VLAN_HLEN to csum_start if payload holds vlan 2018-06-07 16:15:38 -04:00
thunderbolt.c
tun.c tun: Fix use-after-free on XDP_TX 2018-07-16 13:38:29 -07:00
veth.c
virtio_net.c virtio_net: split XDP_TX kick and XDP_REDIRECT map flushing 2018-06-28 14:27:52 +09:00
vrf.c
vsockmon.c
vxlan.c vxlan: fix default fdb entry netlink notify ordering during netdev create 2018-07-22 10:52:37 -07:00
xen-netfront.c xen-netfront: Update features after registering netdev 2018-06-22 07:54:54 +09:00