Commit c5e70991 authored by David S. Miller's avatar David S. Miller

Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
1GbE Intel Wired LAN Driver Updates 2017-01-06

This series contains updates/fixes to igb and e1000e.

Joe fixes indentation and improper line wrapping in igb.

David Singleton fixes an issue in e1000e where in systemd, where things
are done in parallel and can create a condition where e1000_shutdown is
called after e1000_close, hitting BUG_ON assert in free_msi_irqs.

Cao Jin fixes a code comment on the wakeup status register.  Also fixes
a possible NULL pointer dereference by using igb_adapter->io_addr
instead of e1000_hw->hw_addr in igb_configure_tx_ring().

Chris Arges works around a firmware issue, which can cause probe of i210
NIC to fail, so zero the page select register during igb_get_phy_id() to
workaround the issue.  Aaron Sierra adds also a check for this issue
during the initialization of PHY parameters to ensure that this same
issue happens after probe.

Todd fixes a possible race condition in close/suspend by extending
the rtnl_lock() to protect the call to netif_device_detach() and
igb_clear_interrupt_scheme().  Also adds i211 to a known i210/i211
workaround.

Hannu Lounento fixes inverted logic on a debug statement.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c7b371e3 76ed5a8f
...@@ -6276,8 +6276,8 @@ static int e1000e_pm_freeze(struct device *dev) ...@@ -6276,8 +6276,8 @@ static int e1000e_pm_freeze(struct device *dev)
/* Quiesce the device without resetting the hardware */ /* Quiesce the device without resetting the hardware */
e1000e_down(adapter, false); e1000e_down(adapter, false);
e1000_free_irq(adapter); e1000_free_irq(adapter);
e1000e_reset_interrupt_capability(adapter);
} }
e1000e_reset_interrupt_capability(adapter);
/* Allow time for pending master requests to run */ /* Allow time for pending master requests to run */
e1000e_disable_pcie_master(&adapter->hw); e1000e_disable_pcie_master(&adapter->hw);
......
...@@ -245,6 +245,17 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw) ...@@ -245,6 +245,17 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
hw->bus.func = (rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) >> hw->bus.func = (rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) >>
E1000_STATUS_FUNC_SHIFT; E1000_STATUS_FUNC_SHIFT;
/* Make sure the PHY is in a good state. Several people have reported
* firmware leaving the PHY's page select register set to something
* other than the default of zero, which causes the PHY ID read to
* access something other than the intended register.
*/
ret_val = hw->phy.ops.reset(hw);
if (ret_val) {
hw_dbg("Error resetting the PHY.\n");
goto out;
}
/* Set phy->phy_addr and phy->id. */ /* Set phy->phy_addr and phy->id. */
ret_val = igb_get_phy_id_82575(hw); ret_val = igb_get_phy_id_82575(hw);
if (ret_val) if (ret_val)
......
...@@ -699,9 +699,9 @@ static s32 igb_update_flash_i210(struct e1000_hw *hw) ...@@ -699,9 +699,9 @@ static s32 igb_update_flash_i210(struct e1000_hw *hw)
ret_val = igb_pool_flash_update_done_i210(hw); ret_val = igb_pool_flash_update_done_i210(hw);
if (ret_val) if (ret_val)
hw_dbg("Flash update complete\n");
else
hw_dbg("Flash update time out\n"); hw_dbg("Flash update time out\n");
else
hw_dbg("Flash update complete\n");
out: out:
return ret_val; return ret_val;
......
...@@ -792,15 +792,13 @@ static s32 igb_set_default_fc(struct e1000_hw *hw) ...@@ -792,15 +792,13 @@ static s32 igb_set_default_fc(struct e1000_hw *hw)
* control setting, then the variable hw->fc will * control setting, then the variable hw->fc will
* be initialized based on a value in the EEPROM. * be initialized based on a value in the EEPROM.
*/ */
if (hw->mac.type == e1000_i350) { if (hw->mac.type == e1000_i350)
lan_offset = NVM_82580_LAN_FUNC_OFFSET(hw->bus.func); lan_offset = NVM_82580_LAN_FUNC_OFFSET(hw->bus.func);
ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG else
+ lan_offset, 1, &nvm_data); lan_offset = 0;
} else {
ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG,
1, &nvm_data);
}
ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG + lan_offset,
1, &nvm_data);
if (ret_val) { if (ret_val) {
hw_dbg("NVM Read Error\n"); hw_dbg("NVM Read Error\n");
goto out; goto out;
...@@ -808,8 +806,7 @@ static s32 igb_set_default_fc(struct e1000_hw *hw) ...@@ -808,8 +806,7 @@ static s32 igb_set_default_fc(struct e1000_hw *hw)
if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 0) if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == 0)
hw->fc.requested_mode = e1000_fc_none; hw->fc.requested_mode = e1000_fc_none;
else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == else if ((nvm_data & NVM_WORD0F_PAUSE_MASK) == NVM_WORD0F_ASM_DIR)
NVM_WORD0F_ASM_DIR)
hw->fc.requested_mode = e1000_fc_tx_pause; hw->fc.requested_mode = e1000_fc_tx_pause;
else else
hw->fc.requested_mode = e1000_fc_full; hw->fc.requested_mode = e1000_fc_full;
......
...@@ -77,6 +77,10 @@ s32 igb_get_phy_id(struct e1000_hw *hw) ...@@ -77,6 +77,10 @@ s32 igb_get_phy_id(struct e1000_hw *hw)
s32 ret_val = 0; s32 ret_val = 0;
u16 phy_id; u16 phy_id;
/* ensure PHY page selection to fix misconfigured i210 */
if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211))
phy->ops.write_reg(hw, I347AT4_PAGE_SELECT, 0);
ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id); ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id);
if (ret_val) if (ret_val)
goto out; goto out;
......
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
#define E1000_VT_CTL 0x0581C /* VMDq Control - RW */ #define E1000_VT_CTL 0x0581C /* VMDq Control - RW */
#define E1000_WUC 0x05800 /* Wakeup Control - RW */ #define E1000_WUC 0x05800 /* Wakeup Control - RW */
#define E1000_WUFC 0x05808 /* Wakeup Filter Control - RW */ #define E1000_WUFC 0x05808 /* Wakeup Filter Control - RW */
#define E1000_WUS 0x05810 /* Wakeup Status - RO */ #define E1000_WUS 0x05810 /* Wakeup Status - R/W1C */
#define E1000_MANC 0x05820 /* Management Control - RW */ #define E1000_MANC 0x05820 /* Management Control - RW */
#define E1000_IPAV 0x05838 /* IP Address Valid - RW */ #define E1000_IPAV 0x05838 /* IP Address Valid - RW */
#define E1000_WUPL 0x05900 /* Wakeup Packet Length - RW */ #define E1000_WUPL 0x05900 /* Wakeup Packet Length - RW */
......
...@@ -3275,7 +3275,9 @@ static int __igb_close(struct net_device *netdev, bool suspending) ...@@ -3275,7 +3275,9 @@ static int __igb_close(struct net_device *netdev, bool suspending)
int igb_close(struct net_device *netdev) int igb_close(struct net_device *netdev)
{ {
return __igb_close(netdev, false); if (netif_device_present(netdev))
return __igb_close(netdev, false);
return 0;
} }
/** /**
...@@ -3394,7 +3396,7 @@ void igb_configure_tx_ring(struct igb_adapter *adapter, ...@@ -3394,7 +3396,7 @@ void igb_configure_tx_ring(struct igb_adapter *adapter,
tdba & 0x00000000ffffffffULL); tdba & 0x00000000ffffffffULL);
wr32(E1000_TDBAH(reg_idx), tdba >> 32); wr32(E1000_TDBAH(reg_idx), tdba >> 32);
ring->tail = hw->hw_addr + E1000_TDT(reg_idx); ring->tail = adapter->io_addr + E1000_TDT(reg_idx);
wr32(E1000_TDH(reg_idx), 0); wr32(E1000_TDH(reg_idx), 0);
writel(0, ring->tail); writel(0, ring->tail);
...@@ -3733,7 +3735,7 @@ void igb_configure_rx_ring(struct igb_adapter *adapter, ...@@ -3733,7 +3735,7 @@ void igb_configure_rx_ring(struct igb_adapter *adapter,
ring->count * sizeof(union e1000_adv_rx_desc)); ring->count * sizeof(union e1000_adv_rx_desc));
/* initialize head and tail */ /* initialize head and tail */
ring->tail = hw->hw_addr + E1000_RDT(reg_idx); ring->tail = adapter->io_addr + E1000_RDT(reg_idx);
wr32(E1000_RDH(reg_idx), 0); wr32(E1000_RDH(reg_idx), 0);
writel(0, ring->tail); writel(0, ring->tail);
...@@ -7564,6 +7566,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, ...@@ -7564,6 +7566,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake,
int retval = 0; int retval = 0;
#endif #endif
rtnl_lock();
netif_device_detach(netdev); netif_device_detach(netdev);
if (netif_running(netdev)) if (netif_running(netdev))
...@@ -7572,6 +7575,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, ...@@ -7572,6 +7575,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake,
igb_ptp_suspend(adapter); igb_ptp_suspend(adapter);
igb_clear_interrupt_scheme(adapter); igb_clear_interrupt_scheme(adapter);
rtnl_unlock();
#ifdef CONFIG_PM #ifdef CONFIG_PM
retval = pci_save_state(pdev); retval = pci_save_state(pdev);
...@@ -7690,16 +7694,15 @@ static int igb_resume(struct device *dev) ...@@ -7690,16 +7694,15 @@ static int igb_resume(struct device *dev)
wr32(E1000_WUS, ~0); wr32(E1000_WUS, ~0);
if (netdev->flags & IFF_UP) { rtnl_lock();
rtnl_lock(); if (!err && netif_running(netdev))
err = __igb_open(netdev, true); err = __igb_open(netdev, true);
rtnl_unlock();
if (err)
return err;
}
netif_device_attach(netdev); if (!err)
return 0; netif_device_attach(netdev);
rtnl_unlock();
return err;
} }
static int igb_runtime_idle(struct device *dev) static int igb_runtime_idle(struct device *dev)
...@@ -7898,6 +7901,11 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev) ...@@ -7898,6 +7901,11 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
pci_enable_wake(pdev, PCI_D3hot, 0); pci_enable_wake(pdev, PCI_D3hot, 0);
pci_enable_wake(pdev, PCI_D3cold, 0); pci_enable_wake(pdev, PCI_D3cold, 0);
/* In case of PCI error, adapter lose its HW address
* so we should re-assign it here.
*/
hw->hw_addr = adapter->io_addr;
igb_reset(adapter); igb_reset(adapter);
wr32(E1000_WUS, ~0); wr32(E1000_WUS, ~0);
result = PCI_ERS_RESULT_RECOVERED; result = PCI_ERS_RESULT_RECOVERED;
......
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