Re: [PATCH net-next 10/14] net: dsa: mv88e6xxx: rework port mode setup

From: Andrew Lunn
Date: Thu Mar 09 2017 - 19:29:48 EST


Hi Vivien

> +static int mv88e6xxx_set_port_mode_normal(struct mv88e6xxx_chip *chip, int port)
> +{
> + return mv88e6xxx_set_port_mode(chip, port, MV88E6XXX_FRAME_MODE_NORMAL,
> + PORT_CONTROL_EGRESS_UNMODIFIED, 0x9100);

It would be nice to replace this magic number with a #define. How does
the datasheet describe this? 0x9100 is ETH_P_QINQ1. Would that
actually fit?

> +static int mv88e6xxx_setup_port_mode(struct mv88e6xxx_chip *chip, int port)
> +{
> + if (dsa_is_dsa_port(chip->ds, port))
> + return mv88e6xxx_set_port_mode_dsa(chip, port);
> +
> + if (!dsa_is_cpu_port(chip->ds, port))
> + return mv88e6xxx_set_port_mode_normal(chip, port);

Maybe add a dsa_is_normal_port() helper? It just makes the code even
easier to read.

Andrew