Commit 63d6e1d8 authored by Don Skidmore's avatar Don Skidmore Committed by David S. Miller

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

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.
Signed-off-by: default avatarDon Skidmore <donald.c.skidmore@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e332471c
...@@ -3724,7 +3724,7 @@ static void ixgbe_sfp_task(struct work_struct *work) ...@@ -3724,7 +3724,7 @@ static void ixgbe_sfp_task(struct work_struct *work)
if ((hw->phy.type == ixgbe_phy_nl) && if ((hw->phy.type == ixgbe_phy_nl) &&
(hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) {
s32 ret = hw->phy.ops.identify_sfp(hw); s32 ret = hw->phy.ops.identify_sfp(hw);
if (ret) if (ret == IXGBE_ERR_SFP_NOT_PRESENT)
goto reschedule; goto reschedule;
ret = hw->phy.ops.reset(hw); ret = hw->phy.ops.reset(hw);
if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) {
...@@ -4534,13 +4534,17 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work) ...@@ -4534,13 +4534,17 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work)
u32 err; u32 err;
adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK; adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK;
/* Time for electrical oscillations to settle down */
msleep(100);
err = hw->phy.ops.identify_sfp(hw); err = hw->phy.ops.identify_sfp(hw);
if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
dev_err(&adapter->pdev->dev, "failed to initialize because " dev_err(&adapter->pdev->dev, "failed to initialize because "
"an unsupported SFP+ module type was detected.\n" "an unsupported SFP+ module type was detected.\n"
"Reload the driver after installing a supported " "Reload the driver after installing a supported "
"module.\n"); "module.\n");
ixgbe_down(adapter); unregister_netdev(adapter->netdev);
return; return;
} }
hw->mac.ops.setup_sfp(hw); hw->mac.ops.setup_sfp(hw);
......
...@@ -60,6 +60,7 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw) ...@@ -60,6 +60,7 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
if (hw->phy.type == ixgbe_phy_unknown) { if (hw->phy.type == ixgbe_phy_unknown) {
for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) { 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) { if (mdio45_probe(&hw->phy.mdio, phy_addr) == 0) {
ixgbe_get_phy_id(hw); ixgbe_get_phy_id(hw);
hw->phy.type = hw->phy.type =
...@@ -68,6 +69,8 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw) ...@@ -68,6 +69,8 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
break; break;
} }
} }
/* clear value if nothing found */
hw->phy.mdio.prtad = 0;
} else { } else {
status = 0; status = 0;
} }
......
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