Skip to contentSkip to conversation

Intel Wired LAN Driver Updates

PATCH Superseded Aaron Brown 2 participants 6 messages Feb 20, 2014 – Feb 21, 2014

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Intel Wired LAN Driver Updates

This series contains updates to ixgbe for LER / adapter removal. Mark restores the HW address in the recovery path so the device is not perpetually removed, fixes up some removed state ethtool results and adds checks related to config space access.

Mark Rustad (3):
ixgbe: Restore hw_addr in LER recovery paths
ixgbe: Fix up some ethtool results when adapter is removed
ixgbe: Check config reads for removal

 drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c   | 10 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c  | 16 +++---
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.h  |  6 ++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |  9 +++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c    | 62 +++++++++++++++++++++---
 5 files changed, 85 insertions(+), 18 deletions(-)
Signature · 1 line
1.8.5.GIT
#1 lore raw

PATCH 1/3 ixgbe: Restore hw_addr in LER recovery paths

From: Mark Rustad <[email protected]>

The hw_addr needs to be restored in the pcie recovery path or else the device will be perpetually removed. Also restore the value in the resume path.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +4 -2
index 18076c4..b7e9f1c 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2013 Intel Corporation.
+  Copyright(c) 1999 - 2014 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -67,7 +67,7 @@ static char ixgbe_default_device_descr[] =
 #define DRV_VERSION "3.19.1-k"
 const char ixgbe_driver_version[] = DRV_VERSION;
 static const char ixgbe_copyright[] =
-				"Copyright (c) 1999-2013 Intel Corporation.";
+				"Copyright (c) 1999-2014 Intel Corporation.";
 
 static const struct ixgbe_info *ixgbe_info_tbl[] = {
 	[board_82598] = &ixgbe_82598_info,
@@ -5502,6 +5502,7 @@ static int ixgbe_resume(struct pci_dev *pdev)
 	struct net_device *netdev = adapter->netdev;
 	u32 err;
 
+	adapter->hw.hw_addr = adapter->io_addr;
 	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
 	/*
@@ -8446,6 +8447,7 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)
 		e_err(probe, "Cannot re-enable PCI device after reset.\n");
 		result = PCI_ERS_RESULT_DISCONNECT;
 	} else {
+		adapter->hw.hw_addr = adapter->io_addr;
 		pci_set_master(pdev);
 		pci_restore_state(pdev);
 		pci_save_state(pdev);
Signature · 1 line
1.8.5.GIT
#2 lore raw

PATCH 2/3 ixgbe: Fix up some ethtool results when adapter is removed

In reply to Aaron Brown

From: Mark Rustad <[email protected]>

Some ethtool tests returned apparently good results when the adapter was in a removed state. Fix that by checking for removal. This also fixes two paths that could return uninitialized memory in data[4].

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +8 -1
index 0433070..f2d35c0 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2013 Intel Corporation.
+  Copyright(c) 1999 - 2014 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -1247,6 +1247,11 @@ static int ixgbe_link_test(struct ixgbe_adapter *adapter, u64 *data)
 	struct ixgbe_hw *hw = &adapter->hw;
 	bool link_up;
 	u32 link_speed = 0;
+
+	if (ixgbe_removed(hw->hw_addr)) {
+		*data = 1;
+		return 1;
+	}
 	*data = 0;
 
 	hw->mac.ops.check_link(hw, &link_speed, &link_up, true);
@@ -1969,6 +1974,7 @@ static void ixgbe_diag_test(struct net_device *netdev,
 		data[1] = 1;
 		data[2] = 1;
 		data[3] = 1;
+		data[4] = 1;
 		eth_test->flags |= ETH_TEST_FL_FAILED;
 		return;
 	}
@@ -1988,6 +1994,7 @@ static void ixgbe_diag_test(struct net_device *netdev,
 					data[1] = 1;
 					data[2] = 1;
 					data[3] = 1;
+					data[4] = 1;
 					eth_test->flags |= ETH_TEST_FL_FAILED;
 					clear_bit(__IXGBE_TESTING,
 						  &adapter->state);
Signature · 1 line
1.8.5.GIT
#3 lore raw

PATCH 3/3 ixgbe: Check config reads for removal

In reply to Aaron Brown

From: Mark Rustad <[email protected]>

Configuration space reads should also be checked for removal. So add some checks related to config space accesses.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c  | 10 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 16 +++----
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.h |  6 ++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c   | 56 +++++++++++++++++++++++--
 4 files changed, 73 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +7 -3
index a26f3fe..3d2d288 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2013 Intel Corporation.
+  Copyright(c) 1999 - 2014 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -61,6 +61,9 @@ static void ixgbe_set_pcie_completion_timeout(struct ixgbe_hw *hw)
 	u32 gcr = IXGBE_READ_REG(hw, IXGBE_GCR);
 	u16 pcie_devctl2;
 
+	if (ixgbe_removed(hw->hw_addr))
+		return;
+
 	/* only take action if timeout value is defaulted to 0 */
 	if (gcr & IXGBE_GCR_CMPL_TMOUT_MASK)
 		goto out;
@@ -79,8 +82,9 @@ static void ixgbe_set_pcie_completion_timeout(struct ixgbe_hw *hw)
 	 * directly in order to set the completion timeout value for
 	 * 16ms to 55ms
 	 */
-	pci_read_config_word(adapter->pdev,
-	                     IXGBE_PCI_DEVICE_CONTROL2, &pcie_devctl2);
+	pcie_devctl2 = ixgbe_read_pci_cfg_word(hw, IXGBE_PCI_DEVICE_CONTROL2);
+	if (ixgbe_removed(hw->hw_addr))
+		return;
 	pcie_devctl2 |= IXGBE_PCI_DEVICE_CONTROL2_16ms;
 	pci_write_config_word(adapter->pdev,
 	                      IXGBE_PCI_DEVICE_CONTROL2, pcie_devctl2);
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +9 -7
index b5c434b..fbc78eb 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2013 Intel Corporation.
+  Copyright(c) 1999 - 2014 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -2447,7 +2447,6 @@ out:
  **/
 static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
 {
-	struct ixgbe_adapter *adapter = hw->back;
 	s32 status = 0;
 	u32 i;
 	u16 value;
@@ -2456,7 +2455,8 @@ static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
 	IXGBE_WRITE_REG(hw, IXGBE_CTRL, IXGBE_CTRL_GIO_DIS);
 
 	/* Exit if master requests are blocked */
-	if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO))
+	if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO) ||
+		ixgbe_removed(hw->hw_addr))
 		goto out;
 
 	/* Poll for master request bit to clear */
@@ -2483,8 +2483,9 @@ static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
 	 */
 	for (i = 0; i < IXGBE_PCI_MASTER_DISABLE_TIMEOUT; i++) {
 		udelay(100);
-		pci_read_config_word(adapter->pdev, IXGBE_PCI_DEVICE_STATUS,
-							 &value);
+		value = ixgbe_read_pci_cfg_word(hw, IXGBE_PCI_DEVICE_STATUS);
+		if (ixgbe_removed(hw->hw_addr))
+			goto out;
 		if (!(value & IXGBE_PCI_DEVICE_STATUS_TRANSACTION_PENDING))
 			goto out;
 	}
@@ -2817,7 +2818,6 @@ san_mac_addr_clr:
  **/
 u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw)
 {
-	struct ixgbe_adapter *adapter = hw->back;
 	u16 msix_count = 1;
 	u16 max_msix_count;
 	u16 pcie_offset;
@@ -2836,7 +2836,9 @@ u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw)
 		return msix_count;
 	}
 
-	pci_read_config_word(adapter->pdev, pcie_offset, &msix_count);
+	msix_count = ixgbe_read_pci_cfg_word(hw, pcie_offset);
+	if (ixgbe_removed(hw->hw_addr))
+		msix_count = 0;
 	msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK;
 
 	/* MSI-X count is zero-based in HW */
drivers/net/ethernet/intel/ixgbe/ixgbe_common.h +5 -1
index f2e3919..0777126 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2013 Intel Corporation.
+  Copyright(c) 1999 - 2014 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -125,6 +125,10 @@ s32 ixgbe_get_thermal_sensor_data_generic(struct ixgbe_hw *hw);
 s32 ixgbe_init_thermal_sensor_thresh_generic(struct ixgbe_hw *hw);
 
 #define IXGBE_FAILED_READ_REG 0xffffffffU
+#define IXGBE_FAILED_READ_CFG_DWORD 0xffffffffU
+#define IXGBE_FAILED_READ_CFG_WORD 0xffffU
+
+u16 ixgbe_read_pci_cfg_word(struct ixgbe_hw *hw, u32 reg);
 
 static inline bool ixgbe_removed(void __iomem *addr)
 {
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +52 -4

86 lines not on this page · raw message

Signature · 1 line
1.8.5.GIT
maintainer
#4 lore raw

Re: [net-next 3/3] ixgbe: Check config reads for removal

From: Aaron Brown <[email protected]>
Date: Wed, 19 Feb 2014 20:45:21 -0800

drivers/net/ethernet/intel/ixgbe/ixgbe_common.c static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw) · line 2460

Quoted 4 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +2 -1
-	if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO))
+	if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO) ||
+		ixgbe_removed(hw->hw_addr))
 		goto out;

This is not indented correctly, the second line of the if() statement should start at the first column after the openning parenthesis of the top-level if() statement.

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static int ixgbe_read_pci_cfg_word_parent(struct ixgbe_adapter *adapter, · line 176

Quoted 3 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -0
+	if (*value == IXGBE_FAILED_READ_CFG_WORD &&
+	    ixgbe_check_cfg_remove(&adapter->hw, parent_dev))
+		return -1;

Just as you correctly did here.

#5 lore raw

RE: [net-next 3/3] ixgbe: Check config reads for removal

Quoted 10 lines

From: David Miller [mailto:[email protected]]
Sent: Thursday, February 20, 2014 10:32 AM
To: Brown, Aaron F
Cc: Rustad, Mark D; [email protected]; [email protected]; [email protected]
Subject: Re: [net-next 3/3] ixgbe: Check config reads for removal

From: Aaron Brown <[email protected]>
Date: Wed, 19 Feb 2014 20:45:21 -0800

Quoted 8 lines

drivers/net/ethernet/intel/ixgbe/ixgbe_common.c static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw) · line 2460

Quoted 4 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +2 -1
-	if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO))
+	if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO) ||
+		ixgbe_removed(hw->hw_addr))
 		goto out;

This is not indented correctly, the second line of the if() statement should start at the first column after the openning parenthesis of the top-level if() statement.

Thanks Dave,

Turns out we noticed another minor issue in this as well, but significant enough to warrant running it through test again, so I'll resubmit the series again once it gets through the process.

Quoted 6 lines

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static int ixgbe_read_pci_cfg_word_parent(struct ixgbe_adapter *adapter, · line 176

Quoted 4 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -0
+	if (*value == IXGBE_FAILED_READ_CFG_WORD &&
+	    ixgbe_check_cfg_remove(&adapter->hw, parent_dev))
+		return -1;

Just as you correctly did here.