Re: [PATCH net-next 01/18] net: dsa: mv88e6xxx: add max VID to info

From: Andrew Lunn
Date: Wed Apr 26 2017 - 12:04:50 EST


On Wed, Apr 26, 2017 at 11:53:19AM -0400, Vivien Didelot wrote:
> Some chips don't have a VLAN Table Unit, most of them do have a 4K
> table, some others as the 88E6390 family has a 13th bit for the VID.
>
> Add a new max_vid member to the info structure, used to check the
> presence of a VTU as well as the value used to iterate from in VTU
> GetNext operations.
>
> This makes the MV88E6XXX_FLAG_VTU obsolete, thus remove it.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@xxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/net/dsa/mv88e6xxx/chip.c | 38 ++++++++++++++++++++++++++---------
> drivers/net/dsa/mv88e6xxx/mv88e6xxx.h | 13 ++----------
> 2 files changed, 31 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index 44ba8cff5631..e45ddf3e90e8 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -1440,7 +1440,7 @@ static int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port,
> u16 pvid;
> int err;
>
> - if (!mv88e6xxx_has(chip, MV88E6XXX_FLAG_VTU))
> + if (!chip->info->max_vid)
> return -EOPNOTSUPP;
>
> mutex_lock(&chip->reg_lock);
> @@ -1478,7 +1478,7 @@ static int mv88e6xxx_port_vlan_dump(struct dsa_switch *ds, int port,
> err = cb(&vlan->obj);
> if (err)
> break;
> - } while (next.vid < GLOBAL_VTU_VID_MASK);
> + } while (next.vid < chip->info->max_vid);

This change in itself is worth it. We should not be using a mask for
this sort of comparison.

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

Andrew