diff mbox series

[3/4] net: dsa: mv88e6xxx: Implement .port_change_mtu/.port_max_mtu

Message ID 20200723035942.23988-4-chris.packham@alliedtelesis.co.nz
State Changes Requested
Delegated to: David Miller
Headers show
Series net: dsa: mv88e6xxx: port mtu support | expand

Commit Message

Chris Packham July 23, 2020, 3:59 a.m. UTC
Add implementations for the mv88e6xxx switches to connect with the
generic dsa operations for configuring the port MTU.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

Andrew Lunn July 23, 2020, 1:31 p.m. UTC | #1
On Thu, Jul 23, 2020 at 03:59:41PM +1200, Chris Packham wrote:
> Add implementations for the mv88e6xxx switches to connect with the
> generic dsa operations for configuring the port MTU.

Hi Chris

What tree is this against?

commit 2a550aec36543b20f087e4b3063882e9465f7175
Author: Andrew Lunn <andrew@lunn.ch>
Date:   Sat Jul 11 22:32:05 2020 +0200

    net: dsa: mv88e6xxx: Implement MTU change
    
    The Marvell Switches support jumbo packages. So implement the
    callbacks needed for changing the MTU.
    
    Signed-off-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>

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)
+{
...
	Andrew
Chris Packham July 23, 2020, 8:50 p.m. UTC | #2
On 24/07/20 1:31 am, Andrew Lunn wrote:
> On Thu, Jul 23, 2020 at 03:59:41PM +1200, Chris Packham wrote:
>> Add implementations for the mv88e6xxx switches to connect with the
>> generic dsa operations for configuring the port MTU.
> Hi Chris
>
> What tree is this against?
$ git config remote.origin.url
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
$ git describe `git merge-base HEAD origin/master`
v5.8-rc6-3-g4fa640dc5230

> commit 2a550aec36543b20f087e4b3063882e9465f7175
> Author: Andrew Lunn <andrew@lunn.ch>
> Date:   Sat Jul 11 22:32:05 2020 +0200
>
>      net: dsa: mv88e6xxx: Implement MTU change
>      
>      The Marvell Switches support jumbo packages. So implement the
>      callbacks needed for changing the MTU.
>      
>      Signed-off-by: Andrew Lunn <andrew@lunn.ch>
>      Signed-off-by: David S. Miller <davem@davemloft.net>
>
> 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)
> +{
> ...
Snap. I created my series because I need it on an internal 5.7 based 
kernel. So I'm happy to drop mine and back-port your implementation.
Andrew Lunn July 23, 2020, 9:02 p.m. UTC | #3
On Thu, Jul 23, 2020 at 08:50:27PM +0000, Chris Packham wrote:
> 
> On 24/07/20 1:31 am, Andrew Lunn wrote:
> > On Thu, Jul 23, 2020 at 03:59:41PM +1200, Chris Packham wrote:
> >> Add implementations for the mv88e6xxx switches to connect with the
> >> generic dsa operations for configuring the port MTU.
> > Hi Chris
> >
> > What tree is this against?
> $ git config remote.origin.url
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> $ git describe `git merge-base HEAD origin/master`

Hi Chris

Networking patches are expected to be against net-next. Or net if they
are fixes. Please don't submit patches to netdev against other trees.

	   Andrew
Chris Packham July 23, 2020, 9:16 p.m. UTC | #4
On 24/07/20 9:02 am, Andrew Lunn wrote:
> On Thu, Jul 23, 2020 at 08:50:27PM +0000, Chris Packham wrote:
>> On 24/07/20 1:31 am, Andrew Lunn wrote:
>>> On Thu, Jul 23, 2020 at 03:59:41PM +1200, Chris Packham wrote:
>>>> Add implementations for the mv88e6xxx switches to connect with the
>>>> generic dsa operations for configuring the port MTU.
>>> Hi Chris
>>>
>>> What tree is this against?
>> $ git config remote.origin.url
>> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>> $ git describe `git merge-base HEAD origin/master`
> Hi Chris
>
> Networking patches are expected to be against net-next. Or net if they
> are fixes. Please don't submit patches to netdev against other trees.

OK. I'll try to remember that for next time. For this series in 
particular it's a little hard for me to test net-next because the 
hardware in question relies on a bunch of code that is not upstream.
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index c2a4ac99545d..04e4a7291d14 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -2841,6 +2841,30 @@  static int mv88e6xxx_devlink_param_set(struct dsa_switch *ds, u32 id,
 	return err;
 }
 
+static int mv88e6xxx_port_change_mtu(struct dsa_switch *ds, int port,
+				     int new_mtu)
+{
+	struct mv88e6xxx_chip *chip = ds->priv;
+	int err = -EOPNOTSUPP;
+
+	mv88e6xxx_reg_lock(chip);
+	if (chip->info->ops->port_set_jumbo_size)
+		err = chip->info->ops->port_set_jumbo_size(chip, port, new_mtu);
+	mv88e6xxx_reg_unlock(chip);
+
+	return err;
+}
+
+static int mv88e6xxx_port_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 1518;
+}
+
 static const struct devlink_param mv88e6xxx_devlink_params[] = {
 	DSA_DEVLINK_PARAM_DRIVER(MV88E6XXX_DEVLINK_PARAM_ID_ATU_HASH,
 				 "ATU_hash", DEVLINK_PARAM_TYPE_U8,
@@ -5562,6 +5586,8 @@  static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
 	.get_ts_info		= mv88e6xxx_get_ts_info,
 	.devlink_param_get	= mv88e6xxx_devlink_param_get,
 	.devlink_param_set	= mv88e6xxx_devlink_param_set,
+	.port_change_mtu	= mv88e6xxx_port_change_mtu,
+	.port_max_mtu		= mv88e6xxx_port_max_mtu,
 };
 
 static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip)