Re: [PATCH 4/5] ethtool: Use the full 32 bit speed range inethtool's set_settings

From: Ben Hutchings
Date: Sat Apr 16 2011 - 22:02:51 EST


On Sat, 2011-04-16 at 17:54 -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 the driver compiled with make allyesconfig on x86_64 have been
> updated.

You missed one generic function, mdio45_ethtool_gset_npage() in
drivers/net/mdio.c.

[...]
> diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
> index c05db60..ba6c151 100644
> --- a/drivers/net/dl2k.c
> +++ b/drivers/net/dl2k.c
> @@ -1219,11 +1219,11 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
> } else {
> np->an_enable = 0;
> if (np->speed == 1000) {
> - cmd->speed = SPEED_100;
> + ethtool_cmd_speed_set(cmd, SPEED_100);
> cmd->duplex = DUPLEX_FULL;
> printk("Warning!! Can't disable Auto negotiation in 1000Mbps, change to Manual 100Mbps, Full duplex.\n");
> }
> - switch(cmd->speed + cmd->duplex) {
> + switch (ethtool_cmd_speed(cmd) + cmd->duplex) {
[...]

If you're going to stop these drivers ignoring speed_hi, maybe you
should also stop them ignoring the difference between speed and duplex!
Currently the user can ask for 99 Mbit/s full-duplex and get 100 Mbit/s
half-duplex.

There are several others that use this trick.

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/