@@ -28,6 +28,7 @@
#include <linux/types.h>
#include <linux/module.h>
#include <linux/pci.h>
+#include <linux/pci-aspm.h>
#include <linux/netdevice.h>
#include <linux/vmalloc.h>
#include <linux/string.h>
@@ -3962,10 +3963,12 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
struct net_device *netdev;
struct ixgbe_adapter *adapter = NULL;
struct ixgbe_hw *hw;
+ struct pci_dev *us_dev;
const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data];
static int cards_found;
- int i, err, pci_using_dac;
+ int i, err, pci_using_dac, pos;
u16 link_status, link_speed, link_width;
+ u16 state = 0;
u32 part_num, eec;
err = pci_enable_device(pdev);
@@ -3994,6 +3997,31 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
goto err_pci_reg;
}
+ /*
+ * Workaround of Silicon errata on 82598. Disable L0s in the PCIe
+ * switch port to which the 82598 is connected to prevent duplicate
+ * completions caused by L0s. We check the mac type so that we only
+ * do this on 82598 devices.
+ */
+ if (ii->mac == ixgbe_mac_82598EB) {
+ us_dev = pdev->bus->self;
+ pos = pci_find_capability(us_dev, PCI_CAP_ID_EXP);
+ if (pos) {
+ pci_read_config_word(us_dev,
+ pos + PCI_EXP_LNKCTL,
+ &state);
+ state &= ~PCIE_LINK_STATE_L0S;
+ pci_write_config_word(us_dev,
+ pos + PCI_EXP_LNKCTL,
+ state);
+ printk(KERN_INFO "ixgbe: Disabling ASPM L0s between "
+ "%x:%x.%x and %x:%x.%x\n",
+ us_dev->bus->number, PCI_SLOT(us_dev->devfn),
+ PCI_FUNC(us_dev->devfn), pdev->bus->number,
+ PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+ }
+ }
+
err = pci_enable_pcie_error_reporting(pdev);
if (err) {
dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed "