summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRabin Vincent <rabinv@axis.com>2016-02-29 18:22:30 +0300
committerDavid S. Miller <davem@davemloft.net>2016-03-02 22:57:14 +0300
commit8afb6c474b0dd8f9cf7e122a19c71924566fdb97 (patch)
tree6446f96b2ae1b14d03fecb4fc605e628c6e31f01 /drivers
parent11351bf762d27116dd9fb362b198bebdfd427d53 (diff)
downloadlinux-8afb6c474b0dd8f9cf7e122a19c71924566fdb97.tar.xz
dwc_eth_qos: fix race condition in dwceqos_start_xmit
The xmit handler and the tx_reclaim tasklet had a race on the tx_free variable which could lead to a tx timeout if tx_free was updated after the tx complete interrupt. Signed-off-by: Rabin Vincent <rabinv@axis.com> Signed-off-by: Lars Persson <larper@axis.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/synopsys/dwc_eth_qos.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/ethernet/synopsys/dwc_eth_qos.c b/drivers/net/ethernet/synopsys/dwc_eth_qos.c
index fc8bbff2d7e3..926db2d58fb5 100644
--- a/drivers/net/ethernet/synopsys/dwc_eth_qos.c
+++ b/drivers/net/ethernet/synopsys/dwc_eth_qos.c
@@ -2178,12 +2178,10 @@ static int dwceqos_start_xmit(struct sk_buff *skb, struct net_device *ndev)
((trans.initial_descriptor + trans.nr_descriptors) %
DWCEQOS_TX_DCNT));
- dwceqos_tx_finalize(skb, lp, &trans);
-
- netdev_sent_queue(ndev, skb->len);
-
spin_lock_bh(&lp->tx_lock);
lp->tx_free -= trans.nr_descriptors;
+ dwceqos_tx_finalize(skb, lp, &trans);
+ netdev_sent_queue(ndev, skb->len);
spin_unlock_bh(&lp->tx_lock);
ndev->trans_start = jiffies;