aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/patches/850-etop_irq.patch
blob: bc868f81878ada63f3d40b22cbc4a67d3f70c384 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Index: linux-3.1.10/drivers/net/lantiq_etop.c
===================================================================
--- linux-3.1.10.orig/drivers/net/lantiq_etop.c	2012-02-23 09:06:47.274557678 +0100
+++ linux-3.1.10/drivers/net/lantiq_etop.c	2012-02-23 09:07:03.006558044 +0100
@@ -203,8 +203,10 @@
 {
 	struct ltq_etop_chan *ch = container_of(napi,
 				struct ltq_etop_chan, napi);
+	struct ltq_etop_priv *priv = netdev_priv(ch->netdev);
 	int rx = 0;
 	int complete = 0;
+	unsigned long flags;
 
 	while ((rx < budget) && !complete) {
 		struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc];
@@ -218,7 +220,9 @@
 	}
 	if (complete || !rx) {
 		napi_complete(&ch->napi);
+		spin_lock_irqsave(&priv->lock, flags);
 		ltq_dma_ack_irq(&ch->dma);
+		spin_unlock_irqrestore(&priv->lock, flags);
 	}
 	return rx;
 }
@@ -248,7 +252,9 @@
 	if (netif_tx_queue_stopped(txq))
 		netif_tx_start_queue(txq);
 	napi_complete(&ch->napi);
+	spin_lock_irqsave(&priv->lock, flags);
 	ltq_dma_ack_irq(&ch->dma);
+	spin_unlock_irqrestore(&priv->lock, flags);
 	return 1;
 }
 
@@ -615,13 +621,16 @@
 {
 	struct ltq_etop_priv *priv = netdev_priv(dev);
 	int i;
+	unsigned long flags;
 
 	for (i = 0; i < MAX_DMA_CHAN; i++) {
 		struct ltq_etop_chan *ch = &priv->ch[i];
 
 		if (!IS_TX(i) && (!IS_RX(i)))
 			continue;
+		spin_lock_irqsave(&priv->lock, flags);
 		ltq_dma_open(&ch->dma);
+		spin_unlock_irqrestore(&priv->lock, flags);
 		napi_enable(&ch->napi);
 	}
 	if (priv->phydev)
@@ -635,6 +644,7 @@
 {
 	struct ltq_etop_priv *priv = netdev_priv(dev);
 	int i;
+	unsigned long flags;
 
 	netif_tx_stop_all_queues(dev);
 	if (priv->phydev)
@@ -645,7 +655,9 @@
 		if (!IS_RX(i) && !IS_TX(i))
 			continue;
 		napi_disable(&ch->napi);
+		spin_lock_irqsave(&priv->lock, flags);
 		ltq_dma_close(&ch->dma);
+		spin_unlock_irqrestore(&priv->lock, flags);
 	}
 	return 0;
 }