summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/lantiq_xrx200.c
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2020-09-22 23:41:12 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-22 10:14:12 +0100
commitcd61f14592df1054eda1dfcee6dafd248d07c1b8 (patch)
tree4fd1baad472728f26b609473da6411d124b336c0 /drivers/net/ethernet/lantiq_xrx200.c
parent8cad37eb129f9374bfcc5552a84a28db4e9daccc (diff)
net: lantiq: Add locking for TX DMA channel
commit f9317ae5523f99999fb54c513ebabbb2bc887ddf upstream. The TX DMA channel data is accessed by the xrx200_start_xmit() and the xrx200_tx_housekeeping() function from different threads. Make sure the accesses are synchronized by acquiring the netif_tx_lock() in the xrx200_tx_housekeeping() function too. This lock is acquired by the kernel before calling xrx200_start_xmit(). Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/ethernet/lantiq_xrx200.c')
-rw-r--r--drivers/net/ethernet/lantiq_xrx200.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index 96948276b2bc..4e44a39267eb 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -245,6 +245,7 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget)
int pkts = 0;
int bytes = 0;
+ netif_tx_lock(net_dev);
while (pkts < budget) {
struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->tx_free];
@@ -268,6 +269,7 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget)
net_dev->stats.tx_bytes += bytes;
netdev_completed_queue(ch->priv->net_dev, pkts, bytes);
+ netif_tx_unlock(net_dev);
if (netif_queue_stopped(net_dev))
netif_wake_queue(net_dev);