Subject: Re: [PATCH net-next] net/mlx4_en: ethtool force speed when asking for autoneg=off

From: Sergei Shtylyov <[email-masked]>
Date: Sun, 07 Dec 2014 14:55:03 +0300

Hello.

On 12/7/2014 11:07 AM, Amir Vadai wrote:

> From: Saeed Mahameed <[email-masked]>

> Use cmd->autoneg == AUTONEG_DISABLE as a user hint to force specific speed.
> We don't want to rely on ethtool to calculate advertised link modes when
> forcing specific speed, a user can request a specific speed and specify
> "autoneg off" in ethtool command to give a hint for forcing this speed.

> Move en_warn("port reset..") inside the "port reset" block.

> Fixes: d48b3ab ("net/mlx4_en: Use PTYS register to set ethtool settings (Speed)")
> Signed-off-by: Saeed Mahameed <[email-masked]>
> Signed-off-by: Amir Vadai <[email-masked]>
> ---
>   drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)

> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> index c45e06a..3045582 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> @@ -771,13 +771,13 @@ static int mlx4_en_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
>   	}
>
>   	proto_admin = cpu_to_be32(ptys_adv);
> -	if (speed >= 0 && speed != priv->port_state.link_speed)
> +	if (speed >= 0 && ((speed != priv->port_state.link_speed) ||
> +			   (cmd->autoneg == AUTONEG_DISABLE)))

    You're using () rather inconsistently. In fact, () around == and != are 
not needed.

[...]

WBR, Sergei