Subject: Re: [PATCH net-next v5 16/16] net: dsa: vsc73xx: start treating the BR_LEARNING flag

From: Simon Horman <[email-masked]>
Date: Tue, 27 Feb 2024 19:30:09 +0000

On Fri, Feb 23, 2024 at 10:00:46PM +0100, Pawel Dembicki wrote:
> This patch implements .port_pre_bridge_flags() and .port_bridge_flags(),
> which are required for properly treating the BR_LEARNING flag. Also,
> .port_stp_state_set() is tweaked and now disables learning for standalone
> ports.
> 
> Disabling learning for standalone ports is required to avoid situations
> where one port sees traffic originating from another, which could cause
> invalid operations.
> 
> Signed-off-by: Pawel Dembicki <[email-masked]>

...

> +static int vsc73xx_port_bridge_flags(struct dsa_switch *ds, int port,
> +				     struct switchdev_brport_flags flags,
> +				     struct netlink_ext_ack *extack)
> +{
> +	if (flags.mask & BR_LEARNING) {
> +		struct vsc73xx *vsc = ds->priv;
> +		u32 val = flags.val & BR_LEARNING ? BIT(port) : 0;

Hi Pawel,

as it seems there will be a new revision anyway,
please consider arranging local variables in reverse xmas tree order -
longest line to shortest.

> +
> +		return vsc73xx_update_bits(vsc, VSC73XX_BLOCK_ANALYZER, 0,
> +					   VSC73XX_LEARNMASK, BIT(port), val);
> +	}
> +
> +	return 0;
> +}
> +
>  static int vsc73xx_port_bridge_join(struct dsa_switch *ds, int port,
>  				    struct dsa_bridge bridge,
>  				    bool *tx_fwd_offload,

...