diff options
author | David S. Miller <davem@davemloft.net> | 2020-07-12 15:22:14 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-12 15:22:47 -0700 |
commit | 2faf34ba505bd8c7a30c4a16f2255939da74182f (patch) | |
tree | 6eb00fdb90a68d0b0d021c9891fc1355f7dadd1a | |
parent | 94339443686b36d3223bc032b7947267474e2679 (diff) | |
parent | 5919305351475dda04c0f6f28f388c89ffafcd2b (diff) | |
download | linux-2faf34ba505bd8c7a30c4a16f2255939da74182f.tar.gz linux-2faf34ba505bd8c7a30c4a16f2255939da74182f.tar.bz2 linux-2faf34ba505bd8c7a30c4a16f2255939da74182f.zip |
Merge branch 'Fix-MTU-warnings-for-fec-mv886xxx-combo'
Andrew Lunn says:
====================
Fix MTU warnings for fec/mv886xxx combo
Since changing the MTU of dsa slave interfaces was implemented, the
fec/mv88e6xxx combo has been giving warnings:
[ 2.275925] mv88e6085 0.2:00: nonfatal error -95 setting MTU on port 9
[ 2.284306] eth1: mtu greater than device maximum
[ 2.287759] fec 400d1000.ethernet eth1: error -22 setting MTU to include DSA overhead
This patchset adds support for changing the MTU on mv88e6xxx switches,
which do support jumbo frames. And it modifies the FEC driver to
support its true MTU range, which is larger than the default Ethernet
MTU.
====================
Tested-by: Chris Healy <cphealy@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/chip.c | 27 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/fec_main.c | 2 |
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index d995f5bf0d40..6f019955ae42 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -2693,6 +2693,31 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) return mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_DEFAULT_VLAN, 0); } +static int mv88e6xxx_get_max_mtu(struct dsa_switch *ds, int port) +{ + struct mv88e6xxx_chip *chip = ds->priv; + + if (chip->info->ops->port_set_jumbo_size) + return 10240; + return 1522; +} + +static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu) +{ + struct mv88e6xxx_chip *chip = ds->priv; + int ret = 0; + + mv88e6xxx_reg_lock(chip); + if (chip->info->ops->port_set_jumbo_size) + ret = chip->info->ops->port_set_jumbo_size(chip, port, new_mtu); + else + if (new_mtu > 1522) + ret = -EINVAL; + mv88e6xxx_reg_unlock(chip); + + return ret; +} + static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port, struct phy_device *phydev) { @@ -5525,6 +5550,8 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = { .get_sset_count = mv88e6xxx_get_sset_count, .port_enable = mv88e6xxx_port_enable, .port_disable = mv88e6xxx_port_disable, + .port_max_mtu = mv88e6xxx_get_max_mtu, + .port_change_mtu = mv88e6xxx_change_mtu, .get_mac_eee = mv88e6xxx_get_mac_eee, .set_mac_eee = mv88e6xxx_set_mac_eee, .get_eeprom_len = mv88e6xxx_get_eeprom_len, diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 795693874e31..a93381284f08 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -3678,6 +3678,8 @@ fec_probe(struct platform_device *pdev) fec_enet_clk_enable(ndev, false); pinctrl_pm_select_sleep_state(&pdev->dev); + ndev->max_mtu = PKT_MAXBUF_SIZE - ETH_HLEN - ETH_FCS_LEN; + ret = register_netdev(ndev); if (ret) goto failed_register; |