Skip to content

Commit f3226ee

Browse files
committed
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2022-04-13 This series contains updates to igc and e1000e drivers. Sasha removes waiting for hardware semaphore as it could cause an infinite loop and changes usleep_range() calls done under atomic context to udelay() for igc. For e1000e, he changes some variables from u16 to u32 to prevent possible overflow of values. Vinicius disables PTM when going to suspend as it is causing hang issues on some platforms for igc. * '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: e1000e: Fix possible overflow in LTR decoding igc: Fix suspending when PTM is active igc: Fix BUG: scheduling while atomic igc: Fix infinite loop in release_swfw_sync ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 6049606 + 04ebaa1 commit f3226ee

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

drivers/net/ethernet/intel/e1000e/ich8lan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,8 +1009,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
10091009
{
10101010
u32 reg = link << (E1000_LTRV_REQ_SHIFT + E1000_LTRV_NOSNOOP_SHIFT) |
10111011
link << E1000_LTRV_REQ_SHIFT | E1000_LTRV_SEND;
1012-
u16 max_ltr_enc_d = 0; /* maximum LTR decoded by platform */
1013-
u16 lat_enc_d = 0; /* latency decoded */
1012+
u32 max_ltr_enc_d = 0; /* maximum LTR decoded by platform */
1013+
u32 lat_enc_d = 0; /* latency decoded */
10141014
u16 lat_enc = 0; /* latency encoded */
10151015

10161016
if (link) {

drivers/net/ethernet/intel/igc/igc_i225.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,15 @@ void igc_release_swfw_sync_i225(struct igc_hw *hw, u16 mask)
156156
{
157157
u32 swfw_sync;
158158

159-
while (igc_get_hw_semaphore_i225(hw))
160-
; /* Empty */
159+
/* Releasing the resource requires first getting the HW semaphore.
160+
* If we fail to get the semaphore, there is nothing we can do,
161+
* except log an error and quit. We are not allowed to hang here
162+
* indefinitely, as it may cause denial of service or system crash.
163+
*/
164+
if (igc_get_hw_semaphore_i225(hw)) {
165+
hw_dbg("Failed to release SW_FW_SYNC.\n");
166+
return;
167+
}
161168

162169
swfw_sync = rd32(IGC_SW_FW_SYNC);
163170
swfw_sync &= ~mask;

drivers/net/ethernet/intel/igc/igc_phy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ static s32 igc_read_phy_reg_mdic(struct igc_hw *hw, u32 offset, u16 *data)
581581
* the lower time out
582582
*/
583583
for (i = 0; i < IGC_GEN_POLL_TIMEOUT; i++) {
584-
usleep_range(500, 1000);
584+
udelay(50);
585585
mdic = rd32(IGC_MDIC);
586586
if (mdic & IGC_MDIC_READY)
587587
break;
@@ -638,7 +638,7 @@ static s32 igc_write_phy_reg_mdic(struct igc_hw *hw, u32 offset, u16 data)
638638
* the lower time out
639639
*/
640640
for (i = 0; i < IGC_GEN_POLL_TIMEOUT; i++) {
641-
usleep_range(500, 1000);
641+
udelay(50);
642642
mdic = rd32(IGC_MDIC);
643643
if (mdic & IGC_MDIC_READY)
644644
break;

drivers/net/ethernet/intel/igc/igc_ptp.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,17 @@ static void igc_ptp_time_restore(struct igc_adapter *adapter)
992992
igc_ptp_write_i225(adapter, &ts);
993993
}
994994

995+
static void igc_ptm_stop(struct igc_adapter *adapter)
996+
{
997+
struct igc_hw *hw = &adapter->hw;
998+
u32 ctrl;
999+
1000+
ctrl = rd32(IGC_PTM_CTRL);
1001+
ctrl &= ~IGC_PTM_CTRL_EN;
1002+
1003+
wr32(IGC_PTM_CTRL, ctrl);
1004+
}
1005+
9951006
/**
9961007
* igc_ptp_suspend - Disable PTP work items and prepare for suspend
9971008
* @adapter: Board private structure
@@ -1009,8 +1020,10 @@ void igc_ptp_suspend(struct igc_adapter *adapter)
10091020
adapter->ptp_tx_skb = NULL;
10101021
clear_bit_unlock(__IGC_PTP_TX_IN_PROGRESS, &adapter->state);
10111022

1012-
if (pci_device_is_present(adapter->pdev))
1023+
if (pci_device_is_present(adapter->pdev)) {
10131024
igc_ptp_time_save(adapter);
1025+
igc_ptm_stop(adapter);
1026+
}
10141027
}
10151028

10161029
/**

0 commit comments

Comments
 (0)