Re: [PATCHv3 3/7] ethtool: Use the full 32 bit speed range inethtool's set_settings

From: Ben Hutchings
Date: Wed Apr 27 2011 - 22:11:00 EST


On Wed, 2011-04-27 at 18:27 -0700, David Decotigny wrote:
> 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.
>
> Tested: make allyesconfig compiles + e1000e and bnx2x work
> Signed-off-by: David Decotigny <decot@xxxxxxxxxx>
Reviewed-by: Ben Hutchings <bhutchings@xxxxxxxxxxxxxx>

*But* this and patch 4 should be applied in the opposite order, so that
this doesn't break:

[...]
> diff --git a/drivers/net/pch_gbe/pch_gbe_ethtool.c b/drivers/net/pch_gbe/pch_gbe_ethtool.c
> index c35d105..21a2a04 100644
> --- a/drivers/net/pch_gbe/pch_gbe_ethtool.c
> +++ b/drivers/net/pch_gbe/pch_gbe_ethtool.c
> @@ -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);
[...]

Ben.

--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/