Skip to content

Commit aa9b8cc

Browse files
aabodunrinJeff Kirsher
authored andcommitted
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: Akeem G Abodunrin <akeem.g.abodunrin@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 53ea6c7 commit aa9b8cc

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

drivers/net/ethernet/intel/igb/igb.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@ struct igb_adapter {
448448
struct i2c_client *i2c_client;
449449
u32 rss_indir_tbl_init;
450450
u8 rss_indir_tbl[IGB_RETA_SIZE];
451+
452+
unsigned long link_check_timeout;
451453
};
452454

453455
#define IGB_FLAG_HAS_MSI (1 << 0)
@@ -459,6 +461,7 @@ struct igb_adapter {
459461
#define IGB_FLAG_RSS_FIELD_IPV4_UDP (1 << 6)
460462
#define IGB_FLAG_RSS_FIELD_IPV6_UDP (1 << 7)
461463
#define IGB_FLAG_WOL_SUPPORTED (1 << 8)
464+
#define IGB_FLAG_NEED_LINK_UPDATE (1 << 9)
462465

463466
/* DMA Coalescing defines */
464467
#define IGB_MIN_TXPBSIZE 20408

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,8 @@ void igb_down(struct igb_adapter *adapter)
16711671

16721672
igb_irq_disable(adapter);
16731673

1674+
adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE;
1675+
16741676
for (i = 0; i < adapter->num_q_vectors; i++) {
16751677
napi_synchronize(&(adapter->q_vector[i]->napi));
16761678
napi_disable(&(adapter->q_vector[i]->napi));
@@ -3886,6 +3888,17 @@ bool igb_has_link(struct igb_adapter *adapter)
38863888
break;
38873889
}
38883890

3891+
if (((hw->mac.type == e1000_i210) ||
3892+
(hw->mac.type == e1000_i211)) &&
3893+
(hw->phy.id == I210_I_PHY_ID)) {
3894+
if (!netif_carrier_ok(adapter->netdev)) {
3895+
adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE;
3896+
} else if (!(adapter->flags & IGB_FLAG_NEED_LINK_UPDATE)) {
3897+
adapter->flags |= IGB_FLAG_NEED_LINK_UPDATE;
3898+
adapter->link_check_timeout = jiffies;
3899+
}
3900+
}
3901+
38893902
return link_active;
38903903
}
38913904

@@ -3930,6 +3943,14 @@ static void igb_watchdog_task(struct work_struct *work)
39303943
int i;
39313944

39323945
link = igb_has_link(adapter);
3946+
3947+
if (adapter->flags & IGB_FLAG_NEED_LINK_UPDATE) {
3948+
if (time_after(jiffies, (adapter->link_check_timeout + HZ)))
3949+
adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE;
3950+
else
3951+
link = false;
3952+
}
3953+
39333954
if (link) {
39343955
/* Cancel scheduled suspend requests. */
39353956
pm_runtime_resume(netdev->dev.parent);
@@ -4054,9 +4075,14 @@ static void igb_watchdog_task(struct work_struct *work)
40544075
igb_ptp_rx_hang(adapter);
40554076

40564077
/* Reset the timer */
4057-
if (!test_bit(__IGB_DOWN, &adapter->state))
4058-
mod_timer(&adapter->watchdog_timer,
4059-
round_jiffies(jiffies + 2 * HZ));
4078+
if (!test_bit(__IGB_DOWN, &adapter->state)) {
4079+
if (adapter->flags & IGB_FLAG_NEED_LINK_UPDATE)
4080+
mod_timer(&adapter->watchdog_timer,
4081+
round_jiffies(jiffies + HZ));
4082+
else
4083+
mod_timer(&adapter->watchdog_timer,
4084+
round_jiffies(jiffies + 2 * HZ));
4085+
}
40604086
}
40614087

40624088
enum latency_range {

0 commit comments

Comments
 (0)