0098-net-next-mediatek-only-trigger-the-tx-watchdog-reset.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From cd1343c14328a5de1a58c47b81b8a2febb31d542 Mon Sep 17 00:00:00 2001
  2. From: John Crispin <john@phrozen.org>
  3. Date: Tue, 10 May 2016 11:16:30 +0200
  4. Subject: [PATCH 098/102] net-next: mediatek: only trigger the tx watchdog
  5. reset when all devices are stalled
  6. Signed-off-by: Sean Wang <keyhaede@gmail.com>
  7. Signed-off-by: John Crispin <john@phrozen.org>
  8. ---
  9. drivers/net/ethernet/mediatek/mtk_eth_soc.c | 14 ++++++++++++--
  10. drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 +
  11. 2 files changed, 13 insertions(+), 2 deletions(-)
  12. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  13. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  14. @@ -1267,11 +1267,21 @@ static void mtk_tx_timeout(struct net_de
  15. {
  16. struct mtk_mac *mac = netdev_priv(dev);
  17. struct mtk_eth *eth = mac->hw;
  18. + int i, reset = 0;
  19. eth->netdev[mac->id]->stats.tx_errors++;
  20. netif_err(eth, tx_err, dev,
  21. "transmit timed out\n");
  22. - schedule_work(&eth->pending_work);
  23. +
  24. + for (i = 0; i < MTK_MAC_COUNT; i++) {
  25. + if (!eth->netdev[i] ||
  26. + time_after(jiffies, dev_trans_start(eth->netdev[i]) +
  27. + MTK_WDT_TIMEOUT))
  28. + reset++;
  29. + }
  30. +
  31. + if (reset == MTK_MAC_COUNT)
  32. + schedule_work(&eth->pending_work);
  33. }
  34. static irqreturn_t mtk_handle_irq_rx(int irq, void *_eth)
  35. @@ -1765,7 +1775,7 @@ static int mtk_add_mac(struct mtk_eth *e
  36. mac->hw_stats->reg_offset = id * MTK_STAT_OFFSET;
  37. SET_NETDEV_DEV(eth->netdev[id], eth->dev);
  38. - eth->netdev[id]->watchdog_timeo = 5 * HZ;
  39. + eth->netdev[id]->watchdog_timeo = MTK_WDT_TIMEOUT;
  40. eth->netdev[id]->netdev_ops = &mtk_netdev_ops;
  41. eth->netdev[id]->base_addr = (unsigned long)eth->base;
  42. eth->netdev[id]->vlan_features = MTK_HW_FEATURES &
  43. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
  44. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
  45. @@ -15,6 +15,7 @@
  46. #ifndef MTK_ETH_H
  47. #define MTK_ETH_H
  48. +#define MTK_WDT_TIMEOUT (4 * HZ)
  49. #define MTK_QDMA_PAGE_SIZE 2048
  50. #define MTK_MAX_RX_LENGTH 1536
  51. #define MTK_TX_DMA_BUF_LEN 0x3fff