Skip to contentSkip to conversation

ixgbe: Correct spec violations by waiting after reset

PATCH New Mark D Rustad 2 participants 4 messages Oct 27, 2015 – Nov 11, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ixgbe: Correct spec violations by waiting after reset

The ixgbe driver was violating the specification in the datasheel by not waiting 1ms before checking for the reset bit clearing. This is called out for devices supported by ixgbe, so implement the required delay.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c |    5 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c |    3 ++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c  |    3 ++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c  |    3 ++-
 4 files changed, 9 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +3 -2
index 65db69b862fb..8f09d291a043 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2014 Intel Corporation.
+  Copyright(c) 1999 - 2015 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,
@@ -765,13 +765,14 @@ mac_reset_top:
 	ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL) | IXGBE_CTRL_RST;
 	IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl);
 	IXGBE_WRITE_FLUSH(hw);
+	usleep_range(1000, 1200);
 
 	/* Poll for reset bit to self-clear indicating reset is complete */
 	for (i = 0; i < 10; i++) {
-		udelay(1);
 		ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
 		if (!(ctrl & IXGBE_CTRL_RST))
 			break;
+		udelay(1);
 	}
 	if (ctrl & IXGBE_CTRL_RST) {
 		status = IXGBE_ERR_RESET_FAILED;
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c +2 -1
index a39afcf03e2c..b8bd72589f72 100644
@@ -990,13 +990,14 @@ mac_reset_top:
 	ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL);
 	IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl);
 	IXGBE_WRITE_FLUSH(hw);
+	usleep_range(1000, 1200);
 
 	/* Poll for reset bit to self-clear indicating reset is complete */
 	for (i = 0; i < 10; i++) {
-		udelay(1);
 		ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
 		if (!(ctrl & IXGBE_CTRL_RST_MASK))
 			break;
+		udelay(1);
 	}
 
 	if (ctrl & IXGBE_CTRL_RST_MASK) {
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +2 -1
index c1d4584f6469..b9e9b0c17398 100644
@@ -110,13 +110,14 @@ mac_reset_top:
 	ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL);
 	IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl);
 	IXGBE_WRITE_FLUSH(hw);
+	usleep_range(1000, 1200);
 
 	/* Poll for reset bit to self-clear indicating reset is complete */
 	for (i = 0; i < 10; i++) {
-		udelay(1);
 		ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
 		if (!(ctrl & IXGBE_CTRL_RST_MASK))
 			break;
+		udelay(1);
 	}
 
 	if (ctrl & IXGBE_CTRL_RST_MASK) {
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +2 -1
index b8ad3f212e72..f4ef0d1a5dbe 100644
@@ -2146,13 +2146,14 @@ mac_reset_top:
 	ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL);
 	IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl);
 	IXGBE_WRITE_FLUSH(hw);
+	usleep_range(1000, 1200);
 
 	/* Poll for reset bit to self-clear meaning reset is complete */
 	for (i = 0; i < 10; i++) {
-		udelay(1);
 		ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
 		if (!(ctrl & IXGBE_CTRL_RST_MASK))
 			break;
+		udelay(1);
 	}
 
 	if (ctrl & IXGBE_CTRL_RST_MASK) {
#1 lore raw

PATCH 2/2 ixgbe: Wait for master disable to be set

According to the datasheets, the driver should wait for the master disable bit to read as being set before checking the status register for master disable.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +13 -1
index ce61b36b94f1..daec6aef5dc8 100644
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2014 Intel Corporation.
+  Copyright(c) 1999 - 2015 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,
@@ -2454,6 +2454,17 @@ static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
 	/* Always set this bit to ensure any future transactions are blocked */
 	IXGBE_WRITE_REG(hw, IXGBE_CTRL, IXGBE_CTRL_GIO_DIS);
 
+	/* Poll for bit to read as set */
+	for (i = 0; i < IXGBE_PCI_MASTER_DISABLE_TIMEOUT; i++) {
+		if (IXGBE_READ_REG(hw, IXGBE_CTRL) & IXGBE_CTRL_GIO_DIS)
+			break;
+		usleep_range(100, 120);
+	}
+	if (i >= IXGBE_PCI_MASTER_DISABLE_TIMEOUT) {
+		hw_dbg(hw, "GIO disable did not set - requesting resets\n");
+		goto gio_disable_fail;
+	}
+
 	/* Exit if master requests are blocked */
 	if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO) ||
 	    ixgbe_removed(hw->hw_addr))
@@ -2475,6 +2486,7 @@ static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
 	 * again to clear out any effects they may have had on our device.
 	 */
 	hw_dbg(hw, "GIO Master Disable bit didn't clear - requesting resets\n");
+gio_disable_fail:
 	hw->mac.flags |= IXGBE_FLAGS_DOUBLE_RESET_REQUIRED;
 
 	if (hw->mac.type >= ixgbe_mac_X550)
#2 lore raw

PATCH 2/2 ixgbe: Wait for master disable to be set

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Mark D Rustad
Sent: Tuesday, October 27, 2015 1:23 PM
To: [email protected]
Subject: [Intel-wired-lan] [PATCH 2/2] ixgbe: Wait for master disable to be set

According to the datasheets, the driver should wait for the master disable bit to read as being set before checking the status register for master disable.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
#3 lore raw

PATCH 1/2 ixgbe: Correct spec violations by waiting after reset

In reply to Mark D Rustad

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Mark D Rustad
Sent: Tuesday, October 27, 2015 1:23 PM
To: [email protected]
Subject: [Intel-wired-lan] [PATCH 1/2] ixgbe: Correct spec violations by waiting after reset

The ixgbe driver was violating the specification in the datasheel by not waiting 1ms before checking for the reset bit clearing. This is called out for devices supported by ixgbe, so implement the required delay.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c |    5 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c |    3 ++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c  |    3 ++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c  |    3 ++-
 4 files changed, 9 insertions(+), 5 deletions(-)