Commit beb499af authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnx2: Allow user-specified multiple advertisement speed values.

Remove unnecessary code that works around older versions of ethtool
that can pass down invalid advertisement speed values.  This old
code prevents the user from specifying multiple advertisement values.
The new code uses simple masking to mask out invalid advertisment bits.
Reported-by: default avatarVlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarBenjamin Li <benli@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5726026b
...@@ -6751,32 +6751,15 @@ bnx2_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -6751,32 +6751,15 @@ bnx2_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
if (cmd->autoneg == AUTONEG_ENABLE) { if (cmd->autoneg == AUTONEG_ENABLE) {
autoneg |= AUTONEG_SPEED; autoneg |= AUTONEG_SPEED;
cmd->advertising &= ETHTOOL_ALL_COPPER_SPEED; advertising = cmd->advertising;
if (cmd->port == PORT_TP) {
/* allow advertising 1 speed */ advertising &= ETHTOOL_ALL_COPPER_SPEED;
if ((cmd->advertising == ADVERTISED_10baseT_Half) || if (!advertising)
(cmd->advertising == ADVERTISED_10baseT_Full) ||
(cmd->advertising == ADVERTISED_100baseT_Half) ||
(cmd->advertising == ADVERTISED_100baseT_Full)) {
if (cmd->port == PORT_FIBRE)
goto err_out_unlock;
advertising = cmd->advertising;
} else if (cmd->advertising == ADVERTISED_2500baseX_Full) {
if (!(bp->phy_flags & BNX2_PHY_FLAG_2_5G_CAPABLE) ||
(cmd->port == PORT_TP))
goto err_out_unlock;
} else if (cmd->advertising == ADVERTISED_1000baseT_Full)
advertising = cmd->advertising;
else if (cmd->advertising == ADVERTISED_1000baseT_Half)
goto err_out_unlock;
else {
if (cmd->port == PORT_FIBRE)
advertising = ETHTOOL_ALL_FIBRE_SPEED;
else
advertising = ETHTOOL_ALL_COPPER_SPEED; advertising = ETHTOOL_ALL_COPPER_SPEED;
} else {
advertising &= ETHTOOL_ALL_FIBRE_SPEED;
if (!advertising)
advertising = ETHTOOL_ALL_FIBRE_SPEED;
} }
advertising |= ADVERTISED_Autoneg; advertising |= ADVERTISED_Autoneg;
} }
......
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