net-next: mediatek: add IRQ locking
authorJohn Crispin <john@phrozen.org>
Wed, 29 Jun 2016 11:38:10 +0000 (13:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 Jun 2016 12:52:04 +0000 (08:52 -0400)
The code that enables and disables IRQs is missing proper locking. After
adding the IRQ grouping patch and routing the RX and TX IRQs to different
cores we experienced IRQ stalls. Fix this by adding proper locking.
We use a dedicated lock to reduce the latency if the IRQ code.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/mediatek/mtk_eth_soc.h

index d6c3a17a0d5c16715a1094a6559a40cdcd88d417..698caba6506faa79d3f7604c1253c65270493ebd 100644 (file)
@@ -328,18 +328,24 @@ static void mtk_mdio_cleanup(struct mtk_eth *eth)
 
 static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask)
 {
+       unsigned long flags;
        u32 val;
 
+       spin_lock_irqsave(&eth->irq_lock, flags);
        val = mtk_r32(eth, MTK_QDMA_INT_MASK);
        mtk_w32(eth, val & ~mask, MTK_QDMA_INT_MASK);
+       spin_unlock_irqrestore(&eth->irq_lock, flags);
 }
 
 static inline void mtk_irq_enable(struct mtk_eth *eth, u32 mask)
 {
+       unsigned long flags;
        u32 val;
 
+       spin_lock_irqsave(&eth->irq_lock, flags);
        val = mtk_r32(eth, MTK_QDMA_INT_MASK);
        mtk_w32(eth, val | mask, MTK_QDMA_INT_MASK);
+       spin_unlock_irqrestore(&eth->irq_lock, flags);
 }
 
 static int mtk_set_mac_address(struct net_device *dev, void *p)
@@ -1760,6 +1766,7 @@ static int mtk_probe(struct platform_device *pdev)
                return PTR_ERR(eth->base);
 
        spin_lock_init(&eth->page_lock);
+       spin_lock_init(&eth->irq_lock);
 
        eth->ethsys = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
                                                      "mediatek,ethsys");
index a5eb7c62306b66116df10a75df115fb4810534d9..3159d2a46ab17753e5d80a72c2fb3cee8ce95d14 100644 (file)
@@ -373,6 +373,7 @@ struct mtk_eth {
        void __iomem                    *base;
        struct reset_control            *rstc;
        spinlock_t                      page_lock;
+       spinlock_t                      irq_lock;
        struct net_device               dummy_dev;
        struct net_device               *netdev[MTK_MAX_DEVS];
        struct mtk_mac                  *mac[MTK_MAX_DEVS];
This page took 0.027416 seconds and 5 git commands to generate.