提交 33f9e6f5 编写于 作者: Y Yaniv Rosner 提交者: David S. Miller

bnx2x: Fix generic option settings

When user tried to change generic options using "ethtool -s" command, while SFP
module is plugged out or during module detection, the command would have failed
with "Unsupported port type" message. The fix is to ignore the port option in
case it's same as the current port configuration.
Signed-off-by: NYaniv Rosner <yanivr@broadcom.com>
Signed-off-by: NAriel Elior <ariele@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7fceb4de
...@@ -358,49 +358,47 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -358,49 +358,47 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cfg_idx = bnx2x_get_link_cfg_idx(bp); cfg_idx = bnx2x_get_link_cfg_idx(bp);
old_multi_phy_config = bp->link_params.multi_phy_config; old_multi_phy_config = bp->link_params.multi_phy_config;
switch (cmd->port) { if (cmd->port != bnx2x_get_port_type(bp)) {
case PORT_TP: switch (cmd->port) {
if (bp->port.supported[cfg_idx] & SUPPORTED_TP) case PORT_TP:
break; /* no port change */ if (!(bp->port.supported[0] & SUPPORTED_TP ||
bp->port.supported[1] & SUPPORTED_TP)) {
if (!(bp->port.supported[0] & SUPPORTED_TP || DP(BNX2X_MSG_ETHTOOL,
bp->port.supported[1] & SUPPORTED_TP)) { "Unsupported port type\n");
DP(BNX2X_MSG_ETHTOOL, "Unsupported port type\n"); return -EINVAL;
return -EINVAL; }
} bp->link_params.multi_phy_config &=
bp->link_params.multi_phy_config &= ~PORT_HW_CFG_PHY_SELECTION_MASK;
~PORT_HW_CFG_PHY_SELECTION_MASK; if (bp->link_params.multi_phy_config &
if (bp->link_params.multi_phy_config & PORT_HW_CFG_PHY_SWAPPED_ENABLED)
PORT_HW_CFG_PHY_SWAPPED_ENABLED) bp->link_params.multi_phy_config |=
bp->link_params.multi_phy_config |= PORT_HW_CFG_PHY_SELECTION_SECOND_PHY;
PORT_HW_CFG_PHY_SELECTION_SECOND_PHY; else
else bp->link_params.multi_phy_config |=
bp->link_params.multi_phy_config |= PORT_HW_CFG_PHY_SELECTION_FIRST_PHY;
PORT_HW_CFG_PHY_SELECTION_FIRST_PHY; break;
break; case PORT_FIBRE:
case PORT_FIBRE: case PORT_DA:
case PORT_DA: if (!(bp->port.supported[0] & SUPPORTED_FIBRE ||
if (bp->port.supported[cfg_idx] & SUPPORTED_FIBRE) bp->port.supported[1] & SUPPORTED_FIBRE)) {
break; /* no port change */ DP(BNX2X_MSG_ETHTOOL,
"Unsupported port type\n");
if (!(bp->port.supported[0] & SUPPORTED_FIBRE || return -EINVAL;
bp->port.supported[1] & SUPPORTED_FIBRE)) { }
bp->link_params.multi_phy_config &=
~PORT_HW_CFG_PHY_SELECTION_MASK;
if (bp->link_params.multi_phy_config &
PORT_HW_CFG_PHY_SWAPPED_ENABLED)
bp->link_params.multi_phy_config |=
PORT_HW_CFG_PHY_SELECTION_FIRST_PHY;
else
bp->link_params.multi_phy_config |=
PORT_HW_CFG_PHY_SELECTION_SECOND_PHY;
break;
default:
DP(BNX2X_MSG_ETHTOOL, "Unsupported port type\n"); DP(BNX2X_MSG_ETHTOOL, "Unsupported port type\n");
return -EINVAL; return -EINVAL;
} }
bp->link_params.multi_phy_config &=
~PORT_HW_CFG_PHY_SELECTION_MASK;
if (bp->link_params.multi_phy_config &
PORT_HW_CFG_PHY_SWAPPED_ENABLED)
bp->link_params.multi_phy_config |=
PORT_HW_CFG_PHY_SELECTION_FIRST_PHY;
else
bp->link_params.multi_phy_config |=
PORT_HW_CFG_PHY_SELECTION_SECOND_PHY;
break;
default:
DP(BNX2X_MSG_ETHTOOL, "Unsupported port type\n");
return -EINVAL;
} }
/* Save new config in case command complete successfully */ /* Save new config in case command complete successfully */
new_multi_phy_config = bp->link_params.multi_phy_config; new_multi_phy_config = bp->link_params.multi_phy_config;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册