* [PATCH net-next 1/2] net: dsa: mv88e6xxx: Implement MTU change
2020-07-11 20:32 [PATCH net-next 0/2] Fix MTU warnings for fec/mv886xxx combo Andrew Lunn
@ 2020-07-11 20:32 ` Andrew Lunn
2020-07-11 23:29 ` Marek Behun
2020-07-11 20:32 ` [PATCH net-next 2/2] net: fec: Set max MTU size to allow the MTU to be changed Andrew Lunn
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2020-07-11 20:32 UTC (permalink / raw)
To: David Miller
Cc: netdev, Vivien Didelot, Russell King, Chris Healy, Fugang Duan,
Andrew Lunn
The Marvell Switches support jumbo packages. So implement the
callbacks needed for changing the MTU.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/dsa/mv88e6xxx/chip.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
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,
--
2.27.0.rc2
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Implement MTU change
2020-07-11 20:32 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Implement MTU change Andrew Lunn
@ 2020-07-11 23:29 ` Marek Behun
2020-07-11 23:52 ` Andrew Lunn
0 siblings, 1 reply; 8+ messages in thread
From: Marek Behun @ 2020-07-11 23:29 UTC (permalink / raw)
To: Andrew Lunn
Cc: David Miller, netdev, Vivien Didelot, Russell King, Chris Healy,
Fugang Duan
On Sat, 11 Jul 2020 22:32:05 +0200
Andrew Lunn <andrew@lunn.ch> wrote:
> The Marvell Switches support jumbo packages. So implement the
> callbacks needed for changing the MTU.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Hi Andrew,
maybe this could be sent to net, not only net-next. Or maybe even
better, with a Fixes tag to some commit - DSA now prints warnings on
some systems when initializing switch interfaces, that MTU cannot be
changed, so maybe we could look at this patch as a fix and get it
backported...
Marek
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Implement MTU change
2020-07-11 23:29 ` Marek Behun
@ 2020-07-11 23:52 ` Andrew Lunn
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2020-07-11 23:52 UTC (permalink / raw)
To: Marek Behun
Cc: David Miller, netdev, Vivien Didelot, Russell King, Chris Healy,
Fugang Duan
On Sun, Jul 12, 2020 at 01:29:44AM +0200, Marek Behun wrote:
> On Sat, 11 Jul 2020 22:32:05 +0200
> Andrew Lunn <andrew@lunn.ch> wrote:
>
> > The Marvell Switches support jumbo packages. So implement the
> > callbacks needed for changing the MTU.
> >
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
>
> Hi Andrew,
>
> maybe this could be sent to net, not only net-next. Or maybe even
> better, with a Fixes tag to some commit - DSA now prints warnings on
> some systems when initializing switch interfaces, that MTU cannot be
> changed, so maybe we could look at this patch as a fix and get it
> backported...
Hi Marek
It does not really 'fix' anything. The warning clearly says it is nonfatal
[ 2.091447] mv88e6085 0.1:00: nonfatal error -95 setting MTU on port 1
[ 2.123378] mv88e6085 0.1:00: nonfatal error -95 setting MTU on port 2
[ 2.144035] mv88e6085 0.1:00: nonfatal error -95 setting MTU on port 3
[ 2.165546] mv88e6085 0.1:00: nonfatal error -95 setting MTU on port 4
[ 2.189840] mv88e6085 0.2:00: nonfatal error -95 setting MTU on port 1
[ 2.213373] mv88e6085 0.2:00: nonfatal error -95 setting MTU on port 2
[ 2.232762] mv88e6085 0.2:00: nonfatal error -95 setting MTU on port 3
[ 2.253840] mv88e6085 0.2:00: nonfatal error -95 setting MTU on port 4
[ 2.275925] mv88e6085 0.2:00: nonfatal error -95 setting MTU on port 9
and the switch works as before. As such, i don't think this patch
meets the requirements of stable:
Documentation/process/stable-kernel-rules.rst
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next 2/2] net: fec: Set max MTU size to allow the MTU to be changed
2020-07-11 20:32 [PATCH net-next 0/2] Fix MTU warnings for fec/mv886xxx combo Andrew Lunn
2020-07-11 20:32 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Implement MTU change Andrew Lunn
@ 2020-07-11 20:32 ` Andrew Lunn
2020-07-11 21:26 ` [PATCH net-next 0/2] Fix MTU warnings for fec/mv886xxx combo Russell King - ARM Linux admin
2020-07-12 22:23 ` David Miller
3 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2020-07-11 20:32 UTC (permalink / raw)
To: David Miller
Cc: netdev, Vivien Didelot, Russell King, Chris Healy, Fugang Duan,
Andrew Lunn
The FEC allocates 2K buffers, but looses some of it due to
alignment. It can however support an MTU bigger than the default. This
is particularly interesting when used in combination with Ethernet
switches supporting DSA, which have extra headers. The DSA core will
try to increase the MTU to support these extra headers. If the max
size defaults to that of standard Ethernet we get a warning. By
setting the max to what the driver actually supports, we avoid this
warning.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/ethernet/freescale/fec_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 9f80a33c5b16..8047dda947f2 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3710,6 +3710,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;
--
2.27.0.rc2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 0/2] Fix MTU warnings for fec/mv886xxx combo
2020-07-11 20:32 [PATCH net-next 0/2] Fix MTU warnings for fec/mv886xxx combo Andrew Lunn
2020-07-11 20:32 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Implement MTU change Andrew Lunn
2020-07-11 20:32 ` [PATCH net-next 2/2] net: fec: Set max MTU size to allow the MTU to be changed Andrew Lunn
@ 2020-07-11 21:26 ` Russell King - ARM Linux admin
2020-07-11 22:48 ` Andrew Lunn
2020-07-12 22:23 ` David Miller
3 siblings, 1 reply; 8+ messages in thread
From: Russell King - ARM Linux admin @ 2020-07-11 21:26 UTC (permalink / raw)
To: Andrew Lunn
Cc: David Miller, netdev, Vivien Didelot, Chris Healy, Fugang Duan
On Sat, Jul 11, 2020 at 10:32:04PM +0200, Andrew Lunn wrote:
> 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.
It's not just the fec/mv88e6xxx combo - I've been getting them on
Clearfog too. It just hasn't been important enough to report yet.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 0/2] Fix MTU warnings for fec/mv886xxx combo
2020-07-11 21:26 ` [PATCH net-next 0/2] Fix MTU warnings for fec/mv886xxx combo Russell King - ARM Linux admin
@ 2020-07-11 22:48 ` Andrew Lunn
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2020-07-11 22:48 UTC (permalink / raw)
To: Russell King - ARM Linux admin
Cc: David Miller, netdev, Vivien Didelot, Chris Healy, Fugang Duan
On Sat, Jul 11, 2020 at 10:26:18PM +0100, Russell King - ARM Linux admin wrote:
> On Sat, Jul 11, 2020 at 10:32:04PM +0200, Andrew Lunn wrote:
> > 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.
>
> It's not just the fec/mv88e6xxx combo - I've been getting them on
> Clearfog too. It just hasn't been important enough to report yet.
Hi Russell
That is the combination i have tested. mvneta has support for changing
its MTU. So this should stop the warnings on clearfog as well.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 0/2] Fix MTU warnings for fec/mv886xxx combo
2020-07-11 20:32 [PATCH net-next 0/2] Fix MTU warnings for fec/mv886xxx combo Andrew Lunn
` (2 preceding siblings ...)
2020-07-11 21:26 ` [PATCH net-next 0/2] Fix MTU warnings for fec/mv886xxx combo Russell King - ARM Linux admin
@ 2020-07-12 22:23 ` David Miller
3 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2020-07-12 22:23 UTC (permalink / raw)
To: andrew; +Cc: netdev, vivien.didelot, rmk+kernel, cphealy, fugang.duan
From: Andrew Lunn <andrew@lunn.ch>
Date: Sat, 11 Jul 2020 22:32:04 +0200
> 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.
Series applied, thanks Andrew.
^ permalink raw reply [flat|nested] 8+ messages in thread