190-5-5-e1000e-Avoid-receiver-overrun-interrupt-bursts.patch 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. From patchwork Fri Jul 21 18:36:27 2017
  2. Content-Type: text/plain; charset="utf-8"
  3. MIME-Version: 1.0
  4. Content-Transfer-Encoding: 7bit
  5. Subject: [5/5] e1000e: Avoid receiver overrun interrupt bursts
  6. From: Benjamin Poirier <[email protected]>
  7. X-Patchwork-Id: 9857493
  8. Message-Id: <[email protected]>
  9. To: Jeff Kirsher <[email protected]>
  10. Cc: Lennart Sorensen <[email protected]>,
  11. [email protected], [email protected],
  12. [email protected]
  13. Date: Fri, 21 Jul 2017 11:36:27 -0700
  14. When e1000e_poll() is not fast enough to keep up with incoming traffic, the
  15. adapter (when operating in msix mode) raises the Other interrupt to signal
  16. Receiver Overrun.
  17. This is a double problem because 1) at the moment e1000_msix_other()
  18. assumes that it is only called in case of Link Status Change and 2) if the
  19. condition persists, the interrupt is repeatedly raised again in quick
  20. succession.
  21. Ideally we would configure the Other interrupt to not be raised in case of
  22. receiver overrun but this doesn't seem possible on this adapter. Instead,
  23. we handle the first part of the problem by reverting to the practice of
  24. reading ICR in the other interrupt handler, like before commit 16ecba59bc33
  25. ("e1000e: Do not read ICR in Other interrupt"). Thanks to commit
  26. 0a8047ac68e5 ("e1000e: Fix msi-x interrupt automask") which cleared IAME
  27. from CTRL_EXT, reading ICR doesn't interfere with RxQ0, TxQ0 interrupts
  28. anymore. We handle the second part of the problem by not re-enabling the
  29. Other interrupt right away when there is overrun. Instead, we wait until
  30. traffic subsides, napi polling mode is exited and interrupts are
  31. re-enabled.
  32. Reported-by: Lennart Sorensen <[email protected]>
  33. Fixes: 16ecba59bc33 ("e1000e: Do not read ICR in Other interrupt")
  34. Signed-off-by: Benjamin Poirier <[email protected]>
  35. ---
  36. drivers/net/ethernet/intel/e1000e/defines.h | 1 +
  37. drivers/net/ethernet/intel/e1000e/netdev.c | 33 +++++++++++++++++++++++------
  38. 2 files changed, 27 insertions(+), 7 deletions(-)
  39. --- a/drivers/net/ethernet/intel/e1000e/defines.h
  40. +++ b/drivers/net/ethernet/intel/e1000e/defines.h
  41. @@ -398,6 +398,7 @@
  42. #define E1000_ICR_LSC 0x00000004 /* Link Status Change */
  43. #define E1000_ICR_RXSEQ 0x00000008 /* Rx sequence error */
  44. #define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */
  45. +#define E1000_ICR_RXO 0x00000040 /* Receiver Overrun */
  46. #define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */
  47. #define E1000_ICR_ECCER 0x00400000 /* Uncorrectable ECC Error */
  48. /* If this bit asserted, the driver should claim the interrupt */
  49. --- a/drivers/net/ethernet/intel/e1000e/netdev.c
  50. +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
  51. @@ -1905,12 +1905,30 @@ static irqreturn_t e1000_msix_other(int
  52. struct net_device *netdev = data;
  53. struct e1000_adapter *adapter = netdev_priv(netdev);
  54. struct e1000_hw *hw = &adapter->hw;
  55. + u32 icr;
  56. + bool enable = true;
  57. - hw->mac.get_link_status = true;
  58. + icr = er32(ICR);
  59. + if (icr & E1000_ICR_RXO) {
  60. + ew32(ICR, E1000_ICR_RXO);
  61. + enable = false;
  62. + /* napi poll will re-enable Other, make sure it runs */
  63. + if (napi_schedule_prep(&adapter->napi)) {
  64. + adapter->total_rx_bytes = 0;
  65. + adapter->total_rx_packets = 0;
  66. + __napi_schedule(&adapter->napi);
  67. + }
  68. + }
  69. + if (icr & E1000_ICR_LSC) {
  70. + ew32(ICR, E1000_ICR_LSC);
  71. + hw->mac.get_link_status = true;
  72. + /* guard against interrupt when we're going down */
  73. + if (!test_bit(__E1000_DOWN, &adapter->state)) {
  74. + mod_timer(&adapter->watchdog_timer, jiffies + 1);
  75. + }
  76. + }
  77. - /* guard against interrupt when we're going down */
  78. - if (!test_bit(__E1000_DOWN, &adapter->state)) {
  79. - mod_timer(&adapter->watchdog_timer, jiffies + 1);
  80. + if (enable && !test_bit(__E1000_DOWN, &adapter->state)) {
  81. ew32(IMS, E1000_IMS_OTHER);
  82. }
  83. @@ -2683,7 +2701,8 @@ static int e1000e_poll(struct napi_struc
  84. napi_complete_done(napi, work_done);
  85. if (!test_bit(__E1000_DOWN, &adapter->state)) {
  86. if (adapter->msix_entries)
  87. - ew32(IMS, adapter->rx_ring->ims_val);
  88. + ew32(IMS, adapter->rx_ring->ims_val |
  89. + E1000_IMS_OTHER);
  90. else
  91. e1000_irq_enable(adapter);
  92. }
  93. @@ -4178,7 +4197,7 @@ static void e1000e_trigger_lsc(struct e1
  94. struct e1000_hw *hw = &adapter->hw;
  95. if (adapter->msix_entries)
  96. - ew32(ICS, E1000_ICS_OTHER);
  97. + ew32(ICS, E1000_ICS_LSC | E1000_ICS_OTHER);
  98. else
  99. ew32(ICS, E1000_ICS_LSC);
  100. }