Re: [PATCH net-next v4 1/4] net: dsa: microchip: move max mtu to one location

From: Oleksij Rempel
Date: Fri Nov 11 2022 - 00:27:31 EST


Hi Florian,

On Thu, Nov 10, 2022 at 06:42:03AM -0800, Florian Fainelli wrote:
>
>
> On 11/10/2022 4:22 AM, Oleksij Rempel wrote:
> > There are no HW specific registers, so we can process all of them
> > in one location.
> >
> > Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> > Tested-by: Arun Ramadoss <arun.ramadoss@xxxxxxxxxxxxx> (KSZ9893 and LAN937x)
>
> This looks good to me, just one nit see below
>
> [snip]
>
> > @@ -2500,10 +2499,23 @@ static int ksz_max_mtu(struct dsa_switch *ds, int port)
> > {
> > struct ksz_device *dev = ds->priv;
> > - if (!dev->dev_ops->max_mtu)
> > - return -EOPNOTSUPP;
> > + switch (dev->chip_id) {
> > + case KSZ8563_CHIP_ID:
> > + case KSZ9477_CHIP_ID:
> > + case KSZ9563_CHIP_ID:
> > + case KSZ9567_CHIP_ID:
> > + case KSZ9893_CHIP_ID:
> > + case KSZ9896_CHIP_ID:
> > + case KSZ9897_CHIP_ID:
> > + case LAN9370_CHIP_ID:
> > + case LAN9371_CHIP_ID:
> > + case LAN9372_CHIP_ID:
> > + case LAN9373_CHIP_ID:
> > + case LAN9374_CHIP_ID:
> > + return KSZ9477_MAX_FRAME_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN;
>
> Rename to KSZ_MAX_FRAME_SIZE to denote this is a common constant?

This is not so common. This list is extended by the patch 4, with two
more types of switches with different max frame size.

Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |