Skip to contentSkip to conversation

ixgbe: fix issues with failing to detect insert of unsupported module

PATCH Applied Jeff Kirsher 2 participants 8 messages Jul 2, 2009 – Jul 4, 2009

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

PATCH 1/4 ixgbe: fix issues with failing to detect insert of unsupported module

From: Don Skidmore <[email protected]>

Several small fixes around negative test case of the insertion of a IXGBE_ERR_NOT_SUPPORTED module.

- mdio45_probe call was always failing due to mdio.prtad not being set. The function set to mdio.mdio_read was still working as we just happen to always be at prtad == 0. This will allow us to set the phy_id and phy.type correctly now.

- There was timing issue with i2c calls when initiated from a tasklet. A small delay was added to allow the electrical oscillation to calm down.

- Logic change in ixgbe_sfp_task that allows NOT_SUPPORTED condition to be recognized.

---

 drivers/net/ixgbe/ixgbe_main.c |    8 ++++++--
 drivers/net/ixgbe/ixgbe_phy.c  |    3 +++
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +6 -2
index 5588ef4..aaf482c 100644
@@ -3724,7 +3724,7 @@ static void ixgbe_sfp_task(struct work_struct *work)
 	if ((hw->phy.type == ixgbe_phy_nl) &&
 	    (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) {
 		s32 ret = hw->phy.ops.identify_sfp(hw);
-		if (ret)
+		if (ret == IXGBE_ERR_SFP_NOT_PRESENT)
 			goto reschedule;
 		ret = hw->phy.ops.reset(hw);
 		if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) {
@@ -4534,13 +4534,17 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work)
 	u32 err;
 
 	adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK;
+
+	/* Time for electrical oscillations to settle down */
+	msleep(100);
 	err = hw->phy.ops.identify_sfp(hw);
+
 	if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
 		dev_err(&adapter->pdev->dev, "failed to initialize because "
 			"an unsupported SFP+ module type was detected.\n"
 			"Reload the driver after installing a supported "
 			"module.\n");
-		ixgbe_down(adapter);
+		unregister_netdev(adapter->netdev);
 		return;
 	}
 	hw->mac.ops.setup_sfp(hw);
drivers/net/ixgbe/ixgbe_phy.c +3 -0
index 453e966..9ecad17 100644
@@ -60,6 +60,7 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
 
 	if (hw->phy.type == ixgbe_phy_unknown) {
 		for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) {
+			hw->phy.mdio.prtad = phy_addr;
 			if (mdio45_probe(&hw->phy.mdio, phy_addr) == 0) {
 				ixgbe_get_phy_id(hw);
 				hw->phy.type =
@@ -68,6 +69,8 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
 				break;
 			}
 		}
+		/* clear value if nothing found */
+		hw->phy.mdio.prtad = 0;
 	} else {
 		status = 0;
 	}
#1 lore raw

PATCH 2/4 ixgbe: fix regression on some 82598 adapters

From: Don Skidmore <[email protected]>

The change to check the SFP+ module again on open() was causing the XFP (non-SFP+) adapters to be rejected. We only want to try and re-identify the SFP+ module if the original probe found that this device was an SFP+ device. So for this code path (driver loaded with SFP module, module inserted, ifconfig up of the device) the type will be ixgbe_phy_unknown for an unidentified SFP+ module. So we only check if that is the case.

This problem also shows up on Copper devices.

---

 drivers/net/ixgbe/ixgbe_main.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +14 -10
index aaf482c..cf39f5a 100644
@@ -2697,19 +2697,23 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
 
 	/*
 	 * For hot-pluggable SFP+ devices, a new SFP+ module may have
-	 * arrived before interrupts were enabled.  We need to kick off
-	 * the SFP+ module setup first, then try to bring up link.
+	 * arrived before interrupts were enabled but after probe.  Such
+	 * devices wouldn't have their type identified yet. We need to
+	 * kick off the SFP+ module setup first, then try to bring up link.
 	 * If we're not hot-pluggable SFP+, we just need to configure link
 	 * and bring it up.
 	 */
-	err = hw->phy.ops.identify(hw);
-	if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
-		dev_err(&adapter->pdev->dev, "failed to initialize because "
-			"an unsupported SFP+ module type was detected.\n"
-			"Reload the driver after installing a supported "
-			"module.\n");
-		ixgbe_down(adapter);
-		return err;
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		err = hw->phy.ops.identify(hw);
+		if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
+			dev_err(&adapter->pdev->dev, "failed to initialize "
+				"because an unsupported SFP+ module type "
+				"was detected.\n"
+				"Reload the driver after installing a "
+				"supported module.\n");
+			ixgbe_down(adapter);
+			return err;
+		}
 	}
 
 	if (ixgbe_is_sfp(hw)) {
maintainer Applied
#2 lore raw

Re: [net-2.6 PATCH 2/4] ixgbe: fix regression on some 82598 adapters

From: Jeff Kirsher <[email protected]>
Date: Thu, 02 Jul 2009 15:50:31 -0700

Quoted 11 lines

From: Don Skidmore <[email protected]>

The change to check the SFP+ module again on open() was causing the XFP (non-SFP+) adapters to be rejected. We only want to try and re-identify the SFP+ module if the original probe found that this device was an SFP+ device. So for this code path (driver loaded with SFP module, module inserted, ifconfig up of the device) the type will be ixgbe_phy_unknown for an unidentified SFP+ module. So we only check if that is the case.

Quoted 5 lines

This problem also shows up on Copper devices.

Applied.

#3 lore raw

PATCH 3/4 ixgbe: fix inconsistent SFP/SFP+ failure results.

In reply to Jeff Kirsher

From: Don Skidmore <[email protected]>

Currently if we loaded the driver, insert an unsupported module, and then attempt to "ifconfig up" the device it will be brought down but the netdev would not be unregistered. This behavior is different than all other code paths. This patch corrects that by down'ing the device and then scheduling the sfp_config_module_task tasklet. The tasklet will detect this condition (like it does with other code paths) and do the unregister_netdev().

I also removed the log message as this condition (an unsupported SFP+ module) will be logged in sfp_config_module_task.

---

 drivers/net/ixgbe/ixgbe_main.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +5 -5
index cf39f5a..a3061aa 100644
@@ -2706,12 +2706,12 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
 	if (hw->phy.type == ixgbe_phy_unknown) {
 		err = hw->phy.ops.identify(hw);
 		if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
-			dev_err(&adapter->pdev->dev, "failed to initialize "
-				"because an unsupported SFP+ module type "
-				"was detected.\n"
-				"Reload the driver after installing a "
-				"supported module.\n");
+			/*
+			 * Take the device down and schedule the sfp tasklet
+			 * which will unregister_netdev and log it.
+			 */
 			ixgbe_down(adapter);
+			schedule_work(&adapter->sfp_config_module_task);
 			return err;
 		}
 	}
maintainer Applied
#4 lore raw

Re: [net-2.6 PATCH 3/4] ixgbe: fix inconsistent SFP/SFP+ failure results.

From: Jeff Kirsher <[email protected]>
Date: Thu, 02 Jul 2009 15:50:52 -0700

Quoted 10 lines

From: Don Skidmore <[email protected]>

Currently if we loaded the driver, insert an unsupported module, and then attempt to "ifconfig up" the device it will be brought down but the netdev would not be unregistered. This behavior is different than all other code paths. This patch corrects that by down'ing the device and then scheduling the sfp_config_module_task tasklet. The tasklet will detect this condition (like it does with other code paths) and do the unregister_netdev().

Quoted 5 lines

I also removed the log message as this condition (an unsupported SFP+ module) will be logged in sfp_config_module_task.

Applied.

#5 lore raw

PATCH 4/4 ixgbe: Not allow 8259x unsupported wol options change from ethtool

In reply to Jeff Kirsher

From: Mallikarjuna R Chilakala <[email protected]>

Wake-on-lan is currently only supported by 82599 KX4 devices, in all other cases return a proper value from ixgbe_wol_exclusion function call. Otherwise from ethtool we will be able to change wol options of unsupported 8259x devices.

---

 drivers/net/ixgbe/ixgbe_ethtool.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/net/ixgbe/ixgbe_ethtool.c +0 -1
index 0f7b6a3..2a97800 100644
@@ -1830,7 +1830,6 @@ static int ixgbe_wol_exclusion(struct ixgbe_adapter *adapter,
 		break;
 	default:
 		wol->supported = 0;
-		retval = 0;
 	}
 
 	return retval;
maintainer Applied
#6 lore raw

Re: [net-2.6 PATCH 4/4] ixgbe: Not allow 8259x unsupported wol options change from ethtool

From: Jeff Kirsher <[email protected]>
Date: Thu, 02 Jul 2009 15:51:10 -0700

Quoted 10 lines

From: Mallikarjuna R Chilakala <[email protected]>

Wake-on-lan is currently only supported by 82599 KX4 devices, in all other cases return a proper value from ixgbe_wol_exclusion function call. Otherwise from ethtool we will be able to change wol options of unsupported 8259x devices.

---

Applied.

maintainer Applied
#7 lore raw
In reply to Jeff Kirsher

From: Jeff Kirsher <[email protected]>
Date: Thu, 02 Jul 2009 15:50:12 -0700

Quoted 10 lines

From: Don Skidmore <[email protected]>

Several small fixes around negative test case of the insertion of a IXGBE_ERR_NOT_SUPPORTED module.

- mdio45_probe call was always failing due to mdio.prtad not being set. The function set to mdio.mdio_read was still working as we just happen to always be at prtad == 0. This will allow us to set the phy_id and phy.type correctly now.

Quoted 8 lines

- There was timing issue with i2c calls when initiated from a tasklet. A small delay was added to allow the electrical oscillation to calm down.

- Logic change in ixgbe_sfp_task that allows NOT_SUPPORTED condition to be recognized.

Applied.