NAK: [PATCH] [xenial] [PATCH] (upstream) net/mlx5e: Fix minimum MTU

Kamal Mostafa kamal at canonical.com
Tue May 10 18:02:11 UTC 2016


NAK, because applying this patch (d8edd24) to Xenial results in this warning:

..........
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:
In function 'mlx5e_change_mtu':
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:1905:32:
warning: passing argument 2 of 'mlx5_query_port_max_mtu' from
incompatible pointer type [-Wincompatible-pointer-types]
  mlx5_query_port_max_mtu(mdev, &max_mtu, 1);
				^
In file included from
include/linux/mlx5/flow_table.h:36:0,
		 from
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:33:
include/linux/mlx5/driver.h:815:6:
note: expected 'int *' but argument is of type 'u16 * {aka short unsigned int *}'
 void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu, u8 port);
      ^
..........

It looks like this would probably also need (at least):

  [mainline] 046339e net/mlx5e: Device's mtu field is u16 and not int

Please test and re-submit.  Thanks!

 -Kamal


On Tue, May 10, 2016 at 03:51:42PM +0300, Talat Batheesh wrote:
> From: Saeed Mahameed <saeedm at mellanox.com>
> 
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1528466
> 
> Minimum MTU that can be set in Connectx4 device is 68.
> 
> This fixes the case where a user wants to set invalid MTU,
> the driver will fail to satisfy this request and the interface
> will stay down.
> 
> It is better to report an error and continue working with old
> mtu.
> 
> Signed-off-by: Saeed Mahameed <saeedm at mellanox.com>
> Signed-off-by: David S. Miller <davem at davemloft.net>
> (cherry picked from commit d8edd2469ace550db707798180d1c84d81f93bca upstream)
> Signed-off-by: Talat Batheesh <talatb at mellanox.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> index 9923450..5feb124 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -1890,22 +1890,27 @@ static int mlx5e_set_features(struct net_device *netdev,
>  	return err;
>  }
>  
> +#define MXL5_HW_MIN_MTU 64
> +#define MXL5E_MIN_MTU (MXL5_HW_MIN_MTU + ETH_FCS_LEN)
> +
>  static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu)
>  {
>  	struct mlx5e_priv *priv = netdev_priv(netdev);
>  	struct mlx5_core_dev *mdev = priv->mdev;
>  	bool was_opened;
> -	int max_mtu;
> +	u16 max_mtu;
> +	u16 min_mtu;
>  	int err = 0;
>  
>  	mlx5_query_port_max_mtu(mdev, &max_mtu, 1);
>  
>  	max_mtu = MLX5E_HW2SW_MTU(max_mtu);
> +	min_mtu = MLX5E_HW2SW_MTU(MXL5E_MIN_MTU);
>  
> -	if (new_mtu > max_mtu) {
> +	if (new_mtu > max_mtu || new_mtu < min_mtu) {
>  		netdev_err(netdev,
> -			   "%s: Bad MTU (%d) > (%d) Max\n",
> -			   __func__, new_mtu, max_mtu);
> +			   "%s: Bad MTU (%d), valid range is: [%d..%d]\n",
> +			   __func__, new_mtu, min_mtu, max_mtu);
>  		return -EINVAL;
>  	}
>  
> -- 
> 2.5.0
> 
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team




More information about the kernel-team mailing list