Skip to content

Commit cd61f14

Browse files
haukegregkh
authored andcommitted
net: lantiq: Add locking for TX DMA channel
commit f9317ae 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>
1 parent 8cad37e commit cd61f14

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/net/ethernet/lantiq_xrx200.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget)
245245
int pkts = 0;
246246
int bytes = 0;
247247

248+
netif_tx_lock(net_dev);
248249
while (pkts < budget) {
249250
struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->tx_free];
250251

@@ -268,6 +269,7 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget)
268269
net_dev->stats.tx_bytes += bytes;
269270
netdev_completed_queue(ch->priv->net_dev, pkts, bytes);
270271

272+
netif_tx_unlock(net_dev);
271273
if (netif_queue_stopped(net_dev))
272274
netif_wake_queue(net_dev);
273275

0 commit comments

Comments
 (0)