Commit aa9b8cc4 authored by Akeem G Abodunrin's avatar Akeem G Abodunrin Committed by Jeff Kirsher

igb: Implementation of 1-sec delay for i210 devices

This patch adds 1 sec delay mechanism to i210 device family, in order
to avoid erroneous link issue with the link partner.
Signed-off-by: default avatarAkeem G Abodunrin <akeem.g.abodunrin@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 53ea6c7e
...@@ -448,6 +448,8 @@ struct igb_adapter { ...@@ -448,6 +448,8 @@ struct igb_adapter {
struct i2c_client *i2c_client; struct i2c_client *i2c_client;
u32 rss_indir_tbl_init; u32 rss_indir_tbl_init;
u8 rss_indir_tbl[IGB_RETA_SIZE]; u8 rss_indir_tbl[IGB_RETA_SIZE];
unsigned long link_check_timeout;
}; };
#define IGB_FLAG_HAS_MSI (1 << 0) #define IGB_FLAG_HAS_MSI (1 << 0)
...@@ -459,6 +461,7 @@ struct igb_adapter { ...@@ -459,6 +461,7 @@ struct igb_adapter {
#define IGB_FLAG_RSS_FIELD_IPV4_UDP (1 << 6) #define IGB_FLAG_RSS_FIELD_IPV4_UDP (1 << 6)
#define IGB_FLAG_RSS_FIELD_IPV6_UDP (1 << 7) #define IGB_FLAG_RSS_FIELD_IPV6_UDP (1 << 7)
#define IGB_FLAG_WOL_SUPPORTED (1 << 8) #define IGB_FLAG_WOL_SUPPORTED (1 << 8)
#define IGB_FLAG_NEED_LINK_UPDATE (1 << 9)
/* DMA Coalescing defines */ /* DMA Coalescing defines */
#define IGB_MIN_TXPBSIZE 20408 #define IGB_MIN_TXPBSIZE 20408
......
...@@ -1671,6 +1671,8 @@ void igb_down(struct igb_adapter *adapter) ...@@ -1671,6 +1671,8 @@ void igb_down(struct igb_adapter *adapter)
igb_irq_disable(adapter); igb_irq_disable(adapter);
adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE;
for (i = 0; i < adapter->num_q_vectors; i++) { for (i = 0; i < adapter->num_q_vectors; i++) {
napi_synchronize(&(adapter->q_vector[i]->napi)); napi_synchronize(&(adapter->q_vector[i]->napi));
napi_disable(&(adapter->q_vector[i]->napi)); napi_disable(&(adapter->q_vector[i]->napi));
...@@ -3886,6 +3888,17 @@ bool igb_has_link(struct igb_adapter *adapter) ...@@ -3886,6 +3888,17 @@ bool igb_has_link(struct igb_adapter *adapter)
break; break;
} }
if (((hw->mac.type == e1000_i210) ||
(hw->mac.type == e1000_i211)) &&
(hw->phy.id == I210_I_PHY_ID)) {
if (!netif_carrier_ok(adapter->netdev)) {
adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE;
} else if (!(adapter->flags & IGB_FLAG_NEED_LINK_UPDATE)) {
adapter->flags |= IGB_FLAG_NEED_LINK_UPDATE;
adapter->link_check_timeout = jiffies;
}
}
return link_active; return link_active;
} }
...@@ -3930,6 +3943,14 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -3930,6 +3943,14 @@ static void igb_watchdog_task(struct work_struct *work)
int i; int i;
link = igb_has_link(adapter); link = igb_has_link(adapter);
if (adapter->flags & IGB_FLAG_NEED_LINK_UPDATE) {
if (time_after(jiffies, (adapter->link_check_timeout + HZ)))
adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE;
else
link = false;
}
if (link) { if (link) {
/* Cancel scheduled suspend requests. */ /* Cancel scheduled suspend requests. */
pm_runtime_resume(netdev->dev.parent); pm_runtime_resume(netdev->dev.parent);
...@@ -4054,9 +4075,14 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -4054,9 +4075,14 @@ static void igb_watchdog_task(struct work_struct *work)
igb_ptp_rx_hang(adapter); igb_ptp_rx_hang(adapter);
/* Reset the timer */ /* Reset the timer */
if (!test_bit(__IGB_DOWN, &adapter->state)) if (!test_bit(__IGB_DOWN, &adapter->state)) {
if (adapter->flags & IGB_FLAG_NEED_LINK_UPDATE)
mod_timer(&adapter->watchdog_timer,
round_jiffies(jiffies + HZ));
else
mod_timer(&adapter->watchdog_timer, mod_timer(&adapter->watchdog_timer,
round_jiffies(jiffies + 2 * HZ)); round_jiffies(jiffies + 2 * HZ));
}
} }
enum latency_range { enum latency_range {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment