1 Index: linux-4.9.44/drivers/net/ethernet/mediatek/mtk_eth_soc.c
2 ===================================================================
3 --- linux-4.9.44.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c
4 +++ linux-4.9.44/drivers/net/ethernet/mediatek/mtk_eth_soc.c
5 @@ -1904,12 +1904,16 @@ static int mtk_open(struct net_device *d
6 struct mtk_mac *mac = netdev_priv(dev);
7 struct mtk_eth *eth = mac->hw;
9 + spin_lock(ð->iface_lock);
11 /* we run 2 netdevs on the same dma ring so we only bring it up once */
12 if (!atomic_read(ð->dma_refcnt)) {
13 int err = mtk_start_dma(eth);
17 + spin_unlock(ð->iface_lock);
21 napi_enable(ð->tx_napi);
22 napi_enable(ð->rx_napi);
23 @@ -1923,6 +1927,7 @@ static int mtk_open(struct net_device *d
25 phy_start(dev->phydev);
26 netif_start_queue(dev);
27 + spin_unlock(ð->iface_lock);
31 @@ -1955,12 +1960,15 @@ static int mtk_stop(struct net_device *d
32 struct mtk_mac *mac = netdev_priv(dev);
33 struct mtk_eth *eth = mac->hw;
35 + spin_lock(ð->iface_lock);
36 netif_tx_disable(dev);
37 phy_stop(dev->phydev);
39 /* only shutdown DMA if this is the last user */
40 - if (!atomic_dec_and_test(ð->dma_refcnt))
41 + if (!atomic_dec_and_test(ð->dma_refcnt)) {
42 + spin_unlock(ð->iface_lock);
46 del_timer(ð->napi_timer);
48 @@ -1974,6 +1982,8 @@ static int mtk_stop(struct net_device *d
52 + spin_unlock(ð->iface_lock);
57 @@ -2623,6 +2633,7 @@ static int mtk_probe(struct platform_dev
58 if (IS_ERR(eth->base))
59 return PTR_ERR(eth->base);
61 + spin_lock_init(ð->iface_lock);
62 spin_lock_init(ð->page_lock);
63 spin_lock_init(ð->tx_irq_lock);
64 spin_lock_init(ð->rx_irq_lock);
65 Index: linux-4.9.44/drivers/net/ethernet/mediatek/mtk_eth_soc.h
66 ===================================================================
67 --- linux-4.9.44.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.h
68 +++ linux-4.9.44/drivers/net/ethernet/mediatek/mtk_eth_soc.h
69 @@ -573,6 +573,7 @@ struct mtk_rx_ring {
73 + spinlock_t iface_lock;
75 spinlock_t tx_irq_lock;
76 spinlock_t rx_irq_lock;