summaryrefslogtreecommitdiffstats
path: root/drivers/net/pch_gbe
diff options
context:
space:
mode:
authorDavid Decotigny <decot@google.com>2011-04-27 18:32:39 +0000
committerDavid S. Miller <davem@davemloft.net>2011-04-29 14:03:00 -0700
commit25db0338813a8915457636b1f6abe6a28fa73f8d (patch)
tree29ea39e45de1342beb4e3c58da0cfbc9915b617e /drivers/net/pch_gbe
parent8ae6daca85c8bbd6a32c382db5e2a2a989f8bed2 (diff)
downloadlinux-stable-25db0338813a8915457636b1f6abe6a28fa73f8d.tar.gz
linux-stable-25db0338813a8915457636b1f6abe6a28fa73f8d.tar.bz2
linux-stable-25db0338813a8915457636b1f6abe6a28fa73f8d.zip
ethtool: Use full 32 bit speed range in ethtool's set_settings
This makes sure the ethtool's set_settings() callback of network drivers don't ignore the 16 most significant bits when ethtool calls their set_settings(). All drivers compiled with make allyesconfig on x86_64 have been updated. Signed-off-by: David Decotigny <decot@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pch_gbe')
-rw-r--r--drivers/net/pch_gbe/pch_gbe_ethtool.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/pch_gbe/pch_gbe_ethtool.c b/drivers/net/pch_gbe/pch_gbe_ethtool.c
index c35d105ab285..ea2d8e41887a 100644
--- a/drivers/net/pch_gbe/pch_gbe_ethtool.c
+++ b/drivers/net/pch_gbe/pch_gbe_ethtool.c
@@ -92,7 +92,7 @@ static int pch_gbe_get_settings(struct net_device *netdev,
ecmd->advertising &= ~(ADVERTISED_TP | ADVERTISED_1000baseT_Half);
if (!netif_carrier_ok(adapter->netdev))
- ecmd->speed = -1;
+ ethtool_cmd_speed_set(ecmd, -1);
return ret;
}
@@ -109,12 +109,15 @@ static int pch_gbe_set_settings(struct net_device *netdev,
{
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
struct pch_gbe_hw *hw = &adapter->hw;
+ u32 speed = ethtool_cmd_speed(ecmd);
int ret;
pch_gbe_hal_write_phy_reg(hw, MII_BMCR, BMCR_RESET);
- if (ecmd->speed == USHRT_MAX) {
- ecmd->speed = SPEED_1000;
+ /* when set_settings() is called with a ethtool_cmd previously
+ * filled by get_settings() on a down link, speed is -1: */
+ if (speed == UINT_MAX) {
+ speed = SPEED_1000;
ecmd->duplex = DUPLEX_FULL;
}
ret = mii_ethtool_sset(&adapter->mii, ecmd);
@@ -122,7 +125,7 @@ static int pch_gbe_set_settings(struct net_device *netdev,
pr_err("Error: mii_ethtool_sset\n");
return ret;
}
- hw->mac.link_speed = ecmd->speed;
+ hw->mac.link_speed = speed;
hw->mac.link_duplex = ecmd->duplex;
hw->phy.autoneg_advertised = ecmd->advertising;
hw->mac.autoneg = ecmd->autoneg;