Subject: Re: [PATCH net-next v2 03/12] net: ethernet: aquantia: Removed unnecessary comparsion "old_mtu == new_mtu".

From: Andrew Lunn <[email-masked]>
Date: Fri, 17 Feb 2017 23:41:57 +0100

On Sat, Feb 18, 2017 at 12:07:25AM +0300, Pavel Belous wrote:
> From: Pavel Belous <[email-masked]>
> 
> This check is not needed. Function aq_ndev_change_mtu wont be called
> if mtu has not changed.
> 
> Signed-off-by: Pavel Belous <[email-masked]>
> ---
>  drivers/net/ethernet/aquantia/atlantic/aq_main.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
> index c17c70a..e5539c8 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
> @@ -102,17 +102,15 @@ static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu)
>  	struct aq_nic_s *aq_nic = netdev_priv(ndev);
>  	int err = 0;
>  
> -	if (new_mtu == ndev->mtu) {
> -		err = 0;
> -		goto err_exit;
> -	}
>  	if (new_mtu < 68) {
>  		err = -EINVAL;
>  		goto err_exit;
>  	}

You can set ndev->min_mtu and the core will do this check for you.

> +
>  	err = aq_nic_set_mtu(aq_nic, new_mtu + ETH_HLEN);
>  	if (err < 0)
>  		goto err_exit;
> +

White space changes should be in a separate patch.

>  	ndev->mtu = new_mtu;

I think __dev_set_mtu() takes care of this for you.

  Andrew