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