stmmac: fix stmmac_tx_avail should be called with TX locked
authorFabrice Gasnier <fabrice.gasnier@st.com>
Tue, 4 Nov 2014 16:08:05 +0000 (17:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Nov 2014 21:22:56 +0000 (16:22 -0500)
commit16ee817e4365cdfe665ae8d6f6bc8f09befa1272
tree32e8e721051138198ae714cdcbcb3cacc6bbe444
parentb994ca6b67ade73c2d69c00a449ad7006cd4546e
stmmac: fix stmmac_tx_avail should be called with TX locked

stmmac_tx_avail() may lie if used unprotected. It's using cur_tx
and dirty_tx index. These index may be already in use by tx_clean
when entering xmit routine. So, this should be called locked.

This can cause transmit queue to be stuck, with following message:
NETDEV WATCHDOG: eth0 (stmmaceth): transmit queue 0 timed out

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c