Skip to content

Commit f9317ae

Browse files
haukedavem330
authored andcommitted
net: lantiq: Add locking for TX DMA channel
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ea6754a commit f9317ae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/lantiq_xrx200.c

+2
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)