aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/marvell/sky2.c
diff options
context:
space:
mode:
authorJarod Wilson <jarod@redhat.com>2016-10-17 15:54:06 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-18 11:34:19 -0400
commit5777987e0f4bf83c874b538d6be4029f4597878a (patch)
tree19e8032818b84253d0f72e8bf49b86cb31e677bf /drivers/net/ethernet/marvell/sky2.c
parentethernet/intel: use core min/max MTU checking (diff)
downloadlinux-dev-5777987e0f4bf83c874b538d6be4029f4597878a.tar.xz
linux-dev-5777987e0f4bf83c874b538d6be4029f4597878a.zip
ethernet/marvell: use core min/max MTU checking
mvneta: min_mtu 68, max_mtu 9676 - mtu validation routine mostly did range check, merge back into mvneta_change_mtu for simplicity mvpp2: min_mtu 68, max_mtu 9676 - mtu validation routine mostly did range check, merge back into mvpp2_change_mtu for simplicity pxa168_eth: min_mtu 68, max_mtu 9500 skge: min_mtu 60, max_mtu 9000 sky2: min_mtu 68, max_mtu 1500 or 9000, depending on hw CC: netdev@vger.kernel.org CC: Mirko Lindner <mlindner@marvell.com> CC: Stephen Hemminger <stephen@networkplumber.org> CC: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell/sky2.c')
-rw-r--r--drivers/net/ethernet/marvell/sky2.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index f05ea56dcff2..aa60f4dcddd8 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -2398,16 +2398,6 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
u16 ctl, mode;
u32 imask;
- /* MTU size outside the spec */
- if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
- return -EINVAL;
-
- /* MTU > 1500 on yukon FE and FE+ not allowed */
- if (new_mtu > ETH_DATA_LEN &&
- (hw->chip_id == CHIP_ID_YUKON_FE ||
- hw->chip_id == CHIP_ID_YUKON_FE_P))
- return -EINVAL;
-
if (!netif_running(dev)) {
dev->mtu = new_mtu;
netdev_update_features(dev);
@@ -4808,6 +4798,14 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
dev->features |= dev->hw_features;
+ /* MTU range: 60 - 1500 or 9000 */
+ dev->min_mtu = ETH_ZLEN;
+ if (hw->chip_id == CHIP_ID_YUKON_FE ||
+ hw->chip_id == CHIP_ID_YUKON_FE_P)
+ dev->max_mtu = ETH_DATA_LEN;
+ else
+ dev->max_mtu = ETH_JUMBO_MTU;
+
/* try to get mac address in the following order:
* 1) from device tree data
* 2) from internal registers set by bootloader