|
@@ -2851,31 +2851,13 @@ static int mlx5e_set_features(struct net_device *netdev,
|
|
|
return err ? -EINVAL : 0;
|
|
|
}
|
|
|
|
|
|
-#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;
|
|
|
- u16 max_mtu;
|
|
|
- u16 min_mtu;
|
|
|
int err = 0;
|
|
|
bool reset;
|
|
|
|
|
|
- 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 || new_mtu < min_mtu) {
|
|
|
- netdev_err(netdev,
|
|
|
- "%s: Bad MTU (%d), valid range is: [%d..%d]\n",
|
|
|
- __func__, new_mtu, min_mtu, max_mtu);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
mutex_lock(&priv->state_lock);
|
|
|
|
|
|
reset = !priv->params.lro_en &&
|
|
@@ -3835,6 +3817,7 @@ int mlx5e_attach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
|
|
|
{
|
|
|
const struct mlx5e_profile *profile;
|
|
|
struct mlx5e_priv *priv;
|
|
|
+ u16 max_mtu;
|
|
|
int err;
|
|
|
|
|
|
priv = netdev_priv(netdev);
|
|
@@ -3865,6 +3848,11 @@ int mlx5e_attach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
|
|
|
|
|
|
mlx5e_init_l2_addr(priv);
|
|
|
|
|
|
+ /* MTU range: 68 - hw-specific max */
|
|
|
+ netdev->min_mtu = ETH_MIN_MTU;
|
|
|
+ mlx5_query_port_max_mtu(priv->mdev, &max_mtu, 1);
|
|
|
+ netdev->max_mtu = MLX5E_HW2SW_MTU(max_mtu);
|
|
|
+
|
|
|
mlx5e_set_dev_port_mtu(netdev);
|
|
|
|
|
|
if (profile->enable)
|