1 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
2 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
3 @@ -1904,12 +1904,16 @@ static int mtk_open(struct net_device *d
4 struct mtk_mac *mac = netdev_priv(dev);
5 struct mtk_eth *eth = mac->hw;
7 + spin_lock(ð->iface_lock);
9 /* we run 2 netdevs on the same dma ring so we only bring it up once */
10 if (!atomic_read(ð->dma_refcnt)) {
11 int err = mtk_start_dma(eth);
15 + spin_unlock(ð->iface_lock);
19 napi_enable(ð->tx_napi);
20 napi_enable(ð->rx_napi);
21 @@ -1923,6 +1927,7 @@ static int mtk_open(struct net_device *d
23 phy_start(dev->phydev);
24 netif_start_queue(dev);
25 + spin_unlock(ð->iface_lock);
29 @@ -1955,12 +1960,15 @@ static int mtk_stop(struct net_device *d
30 struct mtk_mac *mac = netdev_priv(dev);
31 struct mtk_eth *eth = mac->hw;
33 + spin_lock(ð->iface_lock);
34 netif_tx_disable(dev);
35 phy_stop(dev->phydev);
37 /* only shutdown DMA if this is the last user */
38 - if (!atomic_dec_and_test(ð->dma_refcnt))
39 + if (!atomic_dec_and_test(ð->dma_refcnt)) {
40 + spin_unlock(ð->iface_lock);
44 del_timer(ð->napi_timer);
46 @@ -1974,6 +1982,8 @@ static int mtk_stop(struct net_device *d
50 + spin_unlock(ð->iface_lock);
55 @@ -2623,6 +2633,7 @@ static int mtk_probe(struct platform_dev
56 if (IS_ERR(eth->base))
57 return PTR_ERR(eth->base);
59 + spin_lock_init(ð->iface_lock);
60 spin_lock_init(ð->page_lock);
61 spin_lock_init(ð->tx_irq_lock);
62 spin_lock_init(ð->rx_irq_lock);
63 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
64 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
65 @@ -573,6 +573,7 @@ struct mtk_rx_ring {
69 + spinlock_t iface_lock;
71 spinlock_t tx_irq_lock;
72 spinlock_t rx_irq_lock;