sfc: check MTU against minimum threshold
Reported-by: Ma Yuying <yuma@redhat.com> Suggested-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Bert Kenward <bkenward@solarflare.com> Reviewed-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
f1e4ba5b6a
commit
72a31d85a5
@@ -2263,8 +2263,18 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu)
|
||||
rc = efx_check_disabled(efx);
|
||||
if (rc)
|
||||
return rc;
|
||||
if (new_mtu > EFX_MAX_MTU)
|
||||
if (new_mtu > EFX_MAX_MTU) {
|
||||
netif_err(efx, drv, efx->net_dev,
|
||||
"Requested MTU of %d too big (max: %d)\n",
|
||||
new_mtu, EFX_MAX_MTU);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (new_mtu < EFX_MIN_MTU) {
|
||||
netif_err(efx, drv, efx->net_dev,
|
||||
"Requested MTU of %d too small (min: %d)\n",
|
||||
new_mtu, EFX_MIN_MTU);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
netif_dbg(efx, drv, efx->net_dev, "changing MTU to %d\n", new_mtu);
|
||||
|
||||
|
Reference in New Issue
Block a user