fb36ddf380979871716d5bc52d5de102789614fa
[openwrt/staging/chunkeey.git] / target / linux / mediatek / patches-4.9 / 0060-eth-debug.patch
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 @@ -851,6 +851,7 @@ static void mtk_stop_queue(struct mtk_et
6 continue;
7 netif_stop_queue(eth->netdev[i]);
8 }
9 + mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
10 }
11
12 static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
13 @@ -1885,6 +1886,19 @@ static int mtk_start_dma(struct mtk_eth
14 return 0;
15 }
16
17 +#define NAPI_TIMER_EXPIRE HZ
18 +
19 +static void napi_timer_handler(unsigned long priv)
20 +{
21 + struct mtk_eth *eth = (struct mtk_eth*) priv;
22 +
23 + mtk_wake_queue(eth);
24 + mtk_handle_irq_rx(0, eth);
25 + mtk_handle_irq_tx(0, eth);
26 +
27 + mod_timer(&eth->napi_timer, jiffies + NAPI_TIMER_EXPIRE);
28 +}
29 +
30 static int mtk_open(struct net_device *dev)
31 {
32 struct mtk_mac *mac = netdev_priv(dev);
33 @@ -1901,6 +1915,9 @@ static int mtk_open(struct net_device *d
34 napi_enable(&eth->rx_napi);
35 mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
36 mtk_rx_irq_enable(eth, MTK_RX_DONE_INT);
37 +
38 + setup_timer(&eth->napi_timer, napi_timer_handler, (unsigned long) eth);
39 + mod_timer(&eth->napi_timer, jiffies + NAPI_TIMER_EXPIRE);
40 }
41 atomic_inc(&eth->dma_refcnt);
42
43 @@ -1945,6 +1962,8 @@ static int mtk_stop(struct net_device *d
44 if (!atomic_dec_and_test(&eth->dma_refcnt))
45 return 0;
46
47 + del_timer(&eth->napi_timer);
48 +
49 mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
50 mtk_rx_irq_disable(eth, MTK_RX_DONE_INT);
51 napi_disable(&eth->tx_napi);
52 @@ -2524,7 +2543,7 @@ static int mtk_add_mac(struct mtk_eth *e
53 mac->hw_stats->reg_offset = id * MTK_STAT_OFFSET;
54
55 SET_NETDEV_DEV(eth->netdev[id], eth->dev);
56 - eth->netdev[id]->watchdog_timeo = 15 * HZ;
57 + eth->netdev[id]->watchdog_timeo = 30 * HZ;
58 eth->netdev[id]->netdev_ops = &mtk_netdev_ops;
59 eth->netdev[id]->base_addr = (unsigned long)eth->base;
60
61 Index: linux-4.9.44/drivers/net/ethernet/mediatek/mtk_eth_soc.h
62 ===================================================================
63 --- linux-4.9.44.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.h
64 +++ linux-4.9.44/drivers/net/ethernet/mediatek/mtk_eth_soc.h
65 @@ -601,6 +601,8 @@ struct mtk_eth {
66 struct mii_bus *mii_bus;
67 struct work_struct pending_work;
68 unsigned long state;
69 +
70 + struct timer_list napi_timer;
71 };
72
73 /* struct mtk_mac - the structure that holds the info about the MACs of the