Commit be1b5b78 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 2019-05-28

This series contains updates to e1000e, igb and igc.

Feng adds additional information on a warning message when a read of a
hardware register fails.

Gustavo A. R. Silva fixes up two "fall through" code comments so that
the checkers can actually determine that we did comment that the case
statement is falling through to the next case.

Sasha does some cleanup on the igc driver by removing duplicate
white space and removed a unneeded workaround for igc.  Adds support for
flow control to the igc driver.

Konstantin Khlebnikov reverts a previous fix which was causing a false
positive for a hardware hang.  Provides a fix so that when link is lost
the packets in the transmit queue are flushed and wakes the transmit
queue when the NIC is ready to send packets.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c38e57ae 62a5b842
...@@ -4208,7 +4208,7 @@ void e1000e_up(struct e1000_adapter *adapter) ...@@ -4208,7 +4208,7 @@ void e1000e_up(struct e1000_adapter *adapter)
e1000_configure_msix(adapter); e1000_configure_msix(adapter);
e1000_irq_enable(adapter); e1000_irq_enable(adapter);
netif_start_queue(adapter->netdev); /* Tx queue started by watchdog timer when link is up */
e1000e_trigger_lsc(adapter); e1000e_trigger_lsc(adapter);
} }
...@@ -4606,6 +4606,7 @@ int e1000e_open(struct net_device *netdev) ...@@ -4606,6 +4606,7 @@ int e1000e_open(struct net_device *netdev)
pm_runtime_get_sync(&pdev->dev); pm_runtime_get_sync(&pdev->dev);
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_stop_queue(netdev);
/* allocate transmit descriptors */ /* allocate transmit descriptors */
err = e1000e_setup_tx_resources(adapter->tx_ring); err = e1000e_setup_tx_resources(adapter->tx_ring);
...@@ -4666,7 +4667,6 @@ int e1000e_open(struct net_device *netdev) ...@@ -4666,7 +4667,6 @@ int e1000e_open(struct net_device *netdev)
e1000_irq_enable(adapter); e1000_irq_enable(adapter);
adapter->tx_hang_recheck = false; adapter->tx_hang_recheck = false;
netif_start_queue(netdev);
hw->mac.get_link_status = true; hw->mac.get_link_status = true;
pm_runtime_put(&pdev->dev); pm_runtime_put(&pdev->dev);
...@@ -5288,6 +5288,7 @@ static void e1000_watchdog_task(struct work_struct *work) ...@@ -5288,6 +5288,7 @@ static void e1000_watchdog_task(struct work_struct *work)
if (phy->ops.cfg_on_link_up) if (phy->ops.cfg_on_link_up)
phy->ops.cfg_on_link_up(hw); phy->ops.cfg_on_link_up(hw);
netif_wake_queue(netdev);
netif_carrier_on(netdev); netif_carrier_on(netdev);
if (!test_bit(__E1000_DOWN, &adapter->state)) if (!test_bit(__E1000_DOWN, &adapter->state))
...@@ -5301,6 +5302,7 @@ static void e1000_watchdog_task(struct work_struct *work) ...@@ -5301,6 +5302,7 @@ static void e1000_watchdog_task(struct work_struct *work)
/* Link status message must follow this format */ /* Link status message must follow this format */
pr_info("%s NIC Link is Down\n", adapter->netdev->name); pr_info("%s NIC Link is Down\n", adapter->netdev->name);
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_stop_queue(netdev);
if (!test_bit(__E1000_DOWN, &adapter->state)) if (!test_bit(__E1000_DOWN, &adapter->state))
mod_timer(&adapter->phy_info_timer, mod_timer(&adapter->phy_info_timer,
round_jiffies(jiffies + 2 * HZ)); round_jiffies(jiffies + 2 * HZ));
...@@ -5308,13 +5310,8 @@ static void e1000_watchdog_task(struct work_struct *work) ...@@ -5308,13 +5310,8 @@ static void e1000_watchdog_task(struct work_struct *work)
/* 8000ES2LAN requires a Rx packet buffer work-around /* 8000ES2LAN requires a Rx packet buffer work-around
* on link down event; reset the controller to flush * on link down event; reset the controller to flush
* the Rx packet buffer. * the Rx packet buffer.
*
* If the link is lost the controller stops DMA, but
* if there is queued Tx work it cannot be done. So
* reset the controller to flush the Tx packet buffers.
*/ */
if ((adapter->flags & FLAG_RX_NEEDS_RESTART) || if (adapter->flags & FLAG_RX_NEEDS_RESTART)
e1000_desc_unused(tx_ring) + 1 < tx_ring->count)
adapter->flags |= FLAG_RESTART_NOW; adapter->flags |= FLAG_RESTART_NOW;
else else
pm_schedule_suspend(netdev->dev.parent, pm_schedule_suspend(netdev->dev.parent,
...@@ -5337,6 +5334,14 @@ static void e1000_watchdog_task(struct work_struct *work) ...@@ -5337,6 +5334,14 @@ static void e1000_watchdog_task(struct work_struct *work)
adapter->gotc_old = adapter->stats.gotc; adapter->gotc_old = adapter->stats.gotc;
spin_unlock(&adapter->stats64_lock); spin_unlock(&adapter->stats64_lock);
/* If the link is lost the controller stops DMA, but
* if there is queued Tx work it cannot be done. So
* reset the controller to flush the Tx packet buffers.
*/
if (!netif_carrier_ok(netdev) &&
(e1000_desc_unused(tx_ring) + 1 < tx_ring->count))
adapter->flags |= FLAG_RESTART_NOW;
/* If reset is necessary, do it outside of interrupt context. */ /* If reset is necessary, do it outside of interrupt context. */
if (adapter->flags & FLAG_RESTART_NOW) { if (adapter->flags & FLAG_RESTART_NOW) {
schedule_work(&adapter->reset_task); schedule_work(&adapter->reset_task);
......
...@@ -638,7 +638,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) ...@@ -638,7 +638,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
dev_spec->sgmii_active = true; dev_spec->sgmii_active = true;
break; break;
} }
/* fall through for I2C based SGMII */ /* fall through - for I2C based SGMII */
case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES: case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES:
/* read media type from SFP EEPROM */ /* read media type from SFP EEPROM */
ret_val = igb_set_sfp_media_type_82575(hw); ret_val = igb_set_sfp_media_type_82575(hw);
......
...@@ -753,6 +753,7 @@ u32 igb_rd32(struct e1000_hw *hw, u32 reg) ...@@ -753,6 +753,7 @@ u32 igb_rd32(struct e1000_hw *hw, u32 reg)
struct net_device *netdev = igb->netdev; struct net_device *netdev = igb->netdev;
hw->hw_addr = NULL; hw->hw_addr = NULL;
netdev_err(netdev, "PCIe link lost\n"); netdev_err(netdev, "PCIe link lost\n");
WARN(1, "igb: Failed to read reg 0x%x!\n", reg);
} }
return value; return value;
...@@ -6695,7 +6696,7 @@ static int __igb_notify_dca(struct device *dev, void *data) ...@@ -6695,7 +6696,7 @@ static int __igb_notify_dca(struct device *dev, void *data)
igb_setup_dca(adapter); igb_setup_dca(adapter);
break; break;
} }
/* Fall Through since DCA is disabled. */ /* Fall Through - since DCA is disabled. */
case DCA_PROVIDER_REMOVE: case DCA_PROVIDER_REMOVE:
if (adapter->flags & IGB_FLAG_DCA_ENABLED) { if (adapter->flags & IGB_FLAG_DCA_ENABLED) {
/* without this a class_device is left /* without this a class_device is left
......
...@@ -9,50 +9,6 @@ ...@@ -9,50 +9,6 @@
#include "igc_base.h" #include "igc_base.h"
#include "igc.h" #include "igc.h"
/**
* igc_set_pcie_completion_timeout - set pci-e completion timeout
* @hw: pointer to the HW structure
*/
static s32 igc_set_pcie_completion_timeout(struct igc_hw *hw)
{
u32 gcr = rd32(IGC_GCR);
u16 pcie_devctl2;
s32 ret_val = 0;
/* only take action if timeout value is defaulted to 0 */
if (gcr & IGC_GCR_CMPL_TMOUT_MASK)
goto out;
/* if capabilities version is type 1 we can write the
* timeout of 10ms to 200ms through the GCR register
*/
if (!(gcr & IGC_GCR_CAP_VER2)) {
gcr |= IGC_GCR_CMPL_TMOUT_10ms;
goto out;
}
/* for version 2 capabilities we need to write the config space
* directly in order to set the completion timeout value for
* 16ms to 55ms
*/
ret_val = igc_read_pcie_cap_reg(hw, PCIE_DEVICE_CONTROL2,
&pcie_devctl2);
if (ret_val)
goto out;
pcie_devctl2 |= PCIE_DEVICE_CONTROL2_16ms;
ret_val = igc_write_pcie_cap_reg(hw, PCIE_DEVICE_CONTROL2,
&pcie_devctl2);
out:
/* disable completion timeout resend */
gcr &= ~IGC_GCR_CMPL_TMOUT_RESEND;
wr32(IGC_GCR, gcr);
return ret_val;
}
/** /**
* igc_reset_hw_base - Reset hardware * igc_reset_hw_base - Reset hardware
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
...@@ -72,11 +28,6 @@ static s32 igc_reset_hw_base(struct igc_hw *hw) ...@@ -72,11 +28,6 @@ static s32 igc_reset_hw_base(struct igc_hw *hw)
if (ret_val) if (ret_val)
hw_dbg("PCI-E Master disable polling has failed.\n"); hw_dbg("PCI-E Master disable polling has failed.\n");
/* set the completion timeout for interface */
ret_val = igc_set_pcie_completion_timeout(hw);
if (ret_val)
hw_dbg("PCI-E Set completion timeout has failed.\n");
hw_dbg("Masking off all interrupts\n"); hw_dbg("Masking off all interrupts\n");
wr32(IGC_IMC, 0xffffffff); wr32(IGC_IMC, 0xffffffff);
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#define _IGC_DEFINES_H_ #define _IGC_DEFINES_H_
/* Number of Transmit and Receive Descriptors must be a multiple of 8 */ /* Number of Transmit and Receive Descriptors must be a multiple of 8 */
#define REQ_TX_DESCRIPTOR_MULTIPLE 8 #define REQ_TX_DESCRIPTOR_MULTIPLE 8
#define REQ_RX_DESCRIPTOR_MULTIPLE 8 #define REQ_RX_DESCRIPTOR_MULTIPLE 8
#define IGC_CTRL_EXT_DRV_LOAD 0x10000000 /* Drv loaded bit for FW */ #define IGC_CTRL_EXT_DRV_LOAD 0x10000000 /* Drv loaded bit for FW */
...@@ -29,12 +29,6 @@ ...@@ -29,12 +29,6 @@
/* Status of Master requests. */ /* Status of Master requests. */
#define IGC_STATUS_GIO_MASTER_ENABLE 0x00080000 #define IGC_STATUS_GIO_MASTER_ENABLE 0x00080000
/* PCI Express Control */
#define IGC_GCR_CMPL_TMOUT_MASK 0x0000F000
#define IGC_GCR_CMPL_TMOUT_10ms 0x00001000
#define IGC_GCR_CMPL_TMOUT_RESEND 0x00010000
#define IGC_GCR_CAP_VER2 0x00040000
/* Receive Address /* Receive Address
* Number of high/low register pairs in the RAR. The RAR (Receive Address * Number of high/low register pairs in the RAR. The RAR (Receive Address
* Registers) holds the directed and multicast addresses that we monitor. * Registers) holds the directed and multicast addresses that we monitor.
...@@ -72,6 +66,9 @@ ...@@ -72,6 +66,9 @@
#define IGC_CONNSW_AUTOSENSE_EN 0x1 #define IGC_CONNSW_AUTOSENSE_EN 0x1
/* As per the EAS the maximum supported size is 9.5KB (9728 bytes) */
#define MAX_JUMBO_FRAME_SIZE 0x2600
/* PBA constants */ /* PBA constants */
#define IGC_PBA_34K 0x0022 #define IGC_PBA_34K 0x0022
...@@ -264,9 +261,6 @@ ...@@ -264,9 +261,6 @@
#define IGC_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */ #define IGC_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */
#define IGC_TCTL_MULR 0x10000000 /* Multiple request support */ #define IGC_TCTL_MULR 0x10000000 /* Multiple request support */
#define IGC_CT_SHIFT 4
#define IGC_COLLISION_THRESHOLD 15
/* Flow Control Constants */ /* Flow Control Constants */
#define FLOW_CONTROL_ADDRESS_LOW 0x00C28001 #define FLOW_CONTROL_ADDRESS_LOW 0x00C28001
#define FLOW_CONTROL_ADDRESS_HIGH 0x00000100 #define FLOW_CONTROL_ADDRESS_HIGH 0x00000100
...@@ -398,7 +392,7 @@ ...@@ -398,7 +392,7 @@
#define IGC_MDIC_ERROR 0x40000000 #define IGC_MDIC_ERROR 0x40000000
#define IGC_MDIC_DEST 0x80000000 #define IGC_MDIC_DEST 0x80000000
#define IGC_N0_QUEUE -1 #define IGC_N0_QUEUE -1
#define IGC_MAX_MAC_HDR_LEN 127 #define IGC_MAX_MAC_HDR_LEN 127
#define IGC_MAX_NETWORK_HDR_LEN 511 #define IGC_MAX_NETWORK_HDR_LEN 511
......
...@@ -114,11 +114,8 @@ struct igc_nvm_operations { ...@@ -114,11 +114,8 @@ struct igc_nvm_operations {
struct igc_phy_operations { struct igc_phy_operations {
s32 (*acquire)(struct igc_hw *hw); s32 (*acquire)(struct igc_hw *hw);
s32 (*check_polarity)(struct igc_hw *hw);
s32 (*check_reset_block)(struct igc_hw *hw); s32 (*check_reset_block)(struct igc_hw *hw);
s32 (*force_speed_duplex)(struct igc_hw *hw); s32 (*force_speed_duplex)(struct igc_hw *hw);
s32 (*get_cfg_done)(struct igc_hw *hw);
s32 (*get_cable_length)(struct igc_hw *hw);
s32 (*get_phy_info)(struct igc_hw *hw); s32 (*get_phy_info)(struct igc_hw *hw);
s32 (*read_reg)(struct igc_hw *hw, u32 address, u16 *data); s32 (*read_reg)(struct igc_hw *hw, u32 address, u16 *data);
void (*release)(struct igc_hw *hw); void (*release)(struct igc_hw *hw);
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "igc_hw.h" #include "igc_hw.h"
/* forward declaration */ /* forward declaration */
static s32 igc_set_default_fc(struct igc_hw *hw);
static s32 igc_set_fc_watermarks(struct igc_hw *hw); static s32 igc_set_fc_watermarks(struct igc_hw *hw);
/** /**
...@@ -96,13 +95,10 @@ s32 igc_setup_link(struct igc_hw *hw) ...@@ -96,13 +95,10 @@ s32 igc_setup_link(struct igc_hw *hw)
goto out; goto out;
/* If requested flow control is set to default, set flow control /* If requested flow control is set to default, set flow control
* based on the EEPROM flow control settings. * to the both 'rx' and 'tx' pause frames.
*/ */
if (hw->fc.requested_mode == igc_fc_default) { if (hw->fc.requested_mode == igc_fc_default)
ret_val = igc_set_default_fc(hw); hw->fc.requested_mode = igc_fc_full;
if (ret_val)
goto out;
}
/* We want to save off the original Flow Control configuration just /* We want to save off the original Flow Control configuration just
* in case we get disconnected and then reconnected into a different * in case we get disconnected and then reconnected into a different
...@@ -135,19 +131,6 @@ s32 igc_setup_link(struct igc_hw *hw) ...@@ -135,19 +131,6 @@ s32 igc_setup_link(struct igc_hw *hw)
return ret_val; return ret_val;
} }
/**
* igc_set_default_fc - Set flow control default values
* @hw: pointer to the HW structure
*
* Read the EEPROM for the default values for flow control and store the
* values.
*/
static s32 igc_set_default_fc(struct igc_hw *hw)
{
hw->fc.requested_mode = igc_fc_full;
return 0;
}
/** /**
* igc_force_mac_fc - Force the MAC's flow control settings * igc_force_mac_fc - Force the MAC's flow control settings
* @hw: pointer to the HW structure * @hw: pointer to the HW structure
......
...@@ -72,6 +72,27 @@ void igc_reset(struct igc_adapter *adapter) ...@@ -72,6 +72,27 @@ void igc_reset(struct igc_adapter *adapter)
{ {
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
struct igc_hw *hw = &adapter->hw; struct igc_hw *hw = &adapter->hw;
struct igc_fc_info *fc = &hw->fc;
u32 pba, hwm;
/* Repartition PBA for greater than 9k MTU if required */
pba = IGC_PBA_34K;
/* flow control settings
* The high water mark must be low enough to fit one full frame
* after transmitting the pause frame. As such we must have enough
* space to allow for us to complete our current transmit and then
* receive the frame that is in progress from the link partner.
* Set it to:
* - the full Rx FIFO size minus one full Tx plus one full Rx frame
*/
hwm = (pba << 10) - (adapter->max_frame_size + MAX_JUMBO_FRAME_SIZE);
fc->high_water = hwm & 0xFFFFFFF0; /* 16-byte granularity */
fc->low_water = fc->high_water - 16;
fc->pause_time = 0xFFFF;
fc->send_xon = 1;
fc->current_mode = fc->requested_mode;
hw->mac.ops.reset_hw(hw); hw->mac.ops.reset_hw(hw);
...@@ -3934,6 +3955,7 @@ u32 igc_rd32(struct igc_hw *hw, u32 reg) ...@@ -3934,6 +3955,7 @@ u32 igc_rd32(struct igc_hw *hw, u32 reg)
hw->hw_addr = NULL; hw->hw_addr = NULL;
netif_device_detach(netdev); netif_device_detach(netdev);
netdev_err(netdev, "PCIe link lost, device now detached\n"); netdev_err(netdev, "PCIe link lost, device now detached\n");
WARN(1, "igc: Failed to read reg 0x%x!\n", reg);
} }
return value; return value;
......
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