Advertisement
rgadsdon

Unofficial e1000e patch for Kernel 5.4.13.

Jan 20th, 2020
333
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.15 KB | None
  1. _Unofficial_ e1000e 'disconnect' patch for Kernel 5.4.13, created/modified from earlier patch on linux/netdev, and tested with Kernel 5.4.13.
  2. Usual disclaimers apply, use at your own risk. RG. January 21, 2020.
  3.  
  4. -------------------------- CUT HERE -------------------------------------------------------
  5. diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
  6. --- a/drivers/net/ethernet/intel/e1000e/e1000.h
  7. +++ b/drivers/net/ethernet/intel/e1000e/e1000.h
  8. @@ -185,13 +185,12 @@
  9.  
  10. /* board specific private data structure */
  11. struct e1000_adapter {
  12. + struct timer_list watchdog_timer;
  13. struct timer_list phy_info_timer;
  14. struct timer_list blink_timer;
  15.  
  16. struct work_struct reset_task;
  17. - struct delayed_work watchdog_task;
  18. -
  19. - struct workqueue_struct *e1000_workqueue;
  20. + struct work_struct watchdog_task;
  21.  
  22. const struct e1000_info *ei;
  23.  
  24. diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
  25. --- a/drivers/net/ethernet/intel/e1000e/netdev.c
  26. +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
  27. @@ -1780,8 +1780,7 @@
  28. }
  29. /* guard against interrupt when we're going down */
  30. if (!test_bit(__E1000_DOWN, &adapter->state))
  31. - mod_delayed_work(adapter->e1000_workqueue,
  32. - &adapter->watchdog_task, HZ);
  33. + mod_timer(&adapter->watchdog_timer, jiffies + 1);
  34. }
  35.  
  36. /* Reset on uncorrectable ECC error */
  37. @@ -1861,8 +1860,7 @@
  38. }
  39. /* guard against interrupt when we're going down */
  40. if (!test_bit(__E1000_DOWN, &adapter->state))
  41. - mod_delayed_work(adapter->e1000_workqueue,
  42. - &adapter->watchdog_task, HZ);
  43. + mod_timer(&adapter->watchdog_timer, jiffies + 1);
  44. }
  45.  
  46. /* Reset on uncorrectable ECC error */
  47. @@ -1907,8 +1905,7 @@
  48. hw->mac.get_link_status = true;
  49. /* guard against interrupt when we're going down */
  50. if (!test_bit(__E1000_DOWN, &adapter->state))
  51. - mod_delayed_work(adapter->e1000_workqueue,
  52. - &adapter->watchdog_task, HZ);
  53. + mod_timer(&adapter->watchdog_timer, jiffies + 1);
  54. }
  55.  
  56. if (!test_bit(__E1000_DOWN, &adapter->state))
  57. @@ -4281,6 +4278,7 @@
  58.  
  59. napi_synchronize(&adapter->napi);
  60.  
  61. + del_timer_sync(&adapter->watchdog_timer);
  62. del_timer_sync(&adapter->phy_info_timer);
  63.  
  64. spin_lock(&adapter->stats64_lock);
  65. @@ -5152,11 +5150,25 @@
  66. }
  67. }
  68.  
  69. +/**
  70. + * e1000_watchdog - Timer Call-back
  71. + * @data: pointer to adapter cast into an unsigned long
  72. + **/
  73. +static void e1000_watchdog(struct timer_list *t)
  74. +{
  75. + struct e1000_adapter *adapter = from_timer(adapter, t, watchdog_timer);
  76. +
  77. + /* Do the rest outside of interrupt context */
  78. + schedule_work(&adapter->watchdog_task);
  79. +
  80. + /* TODO: make this use queue_delayed_work() */
  81. +}
  82. +
  83. static void e1000_watchdog_task(struct work_struct *work)
  84. {
  85. struct e1000_adapter *adapter = container_of(work,
  86. struct e1000_adapter,
  87. - watchdog_task.work);
  88. + watchdog_task);
  89. struct net_device *netdev = adapter->netdev;
  90. struct e1000_mac_info *mac = &adapter->hw.mac;
  91. struct e1000_phy_info *phy = &adapter->hw.phy;
  92. @@ -5404,9 +5416,8 @@
  93.  
  94. /* Reset the timer */
  95. if (!test_bit(__E1000_DOWN, &adapter->state))
  96. - queue_delayed_work(adapter->e1000_workqueue,
  97. - &adapter->watchdog_task,
  98. - round_jiffies(2 * HZ));
  99. + mod_timer(&adapter->watchdog_timer,
  100. + round_jiffies(jiffies + 2 * HZ));
  101. }
  102.  
  103. #define E1000_TX_FLAGS_CSUM 0x00000001
  104. @@ -7259,21 +7270,11 @@
  105. goto err_eeprom;
  106. }
  107.  
  108. - adapter->e1000_workqueue = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0,
  109. - e1000e_driver_name);
  110. -
  111. - if (!adapter->e1000_workqueue) {
  112. - err = -ENOMEM;
  113. - goto err_workqueue;
  114. - }
  115. -
  116. - INIT_DELAYED_WORK(&adapter->watchdog_task, e1000_watchdog_task);
  117. - queue_delayed_work(adapter->e1000_workqueue, &adapter->watchdog_task,
  118. - 0);
  119. -
  120. + timer_setup(&adapter->watchdog_timer, e1000_watchdog, 0);
  121. timer_setup(&adapter->phy_info_timer, e1000_update_phy_info, 0);
  122.  
  123. INIT_WORK(&adapter->reset_task, e1000_reset_task);
  124. + INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
  125. INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround);
  126. INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task);
  127. INIT_WORK(&adapter->print_hang_task, e1000_print_hw_hang);
  128. @@ -7367,9 +7368,6 @@
  129. return 0;
  130.  
  131. err_register:
  132. - flush_workqueue(adapter->e1000_workqueue);
  133. - destroy_workqueue(adapter->e1000_workqueue);
  134. -err_workqueue:
  135. if (!(adapter->flags & FLAG_HAS_AMT))
  136. e1000e_release_hw_control(adapter);
  137. err_eeprom:
  138. @@ -7416,17 +7414,15 @@
  139. */
  140. if (!down)
  141. set_bit(__E1000_DOWN, &adapter->state);
  142. + del_timer_sync(&adapter->watchdog_timer);
  143. del_timer_sync(&adapter->phy_info_timer);
  144.  
  145. cancel_work_sync(&adapter->reset_task);
  146. + cancel_work_sync(&adapter->watchdog_task);
  147. cancel_work_sync(&adapter->downshift_task);
  148. cancel_work_sync(&adapter->update_phy_task);
  149. cancel_work_sync(&adapter->print_hang_task);
  150.  
  151. - cancel_delayed_work(&adapter->watchdog_task);
  152. - flush_workqueue(adapter->e1000_workqueue);
  153. - destroy_workqueue(adapter->e1000_workqueue);
  154. -
  155. if (adapter->flags & FLAG_HAS_HW_TIMESTAMP) {
  156. cancel_work_sync(&adapter->tx_hwtstamp_work);
  157. if (adapter->tx_hwtstamp_skb) {
Advertisement
RAW Paste Data Copied
Advertisement