Re: [PATCH net-next 01/15] net: dsa: mt7530: always trap frames to active CPU port on MT7530

From: Vladimir Oltean
Date: Sun Nov 19 2023 - 07:30:22 EST


On Sat, Nov 18, 2023 at 03:31:51PM +0300, Arınç ÜNAL wrote:
> +static void
> +mt753x_conduit_state_change(struct dsa_switch *ds,
> + const struct net_device *conduit,
> + bool operational)
> +{
> + struct mt7530_priv *priv = ds->priv;
> + struct dsa_port *cpu_dp = conduit->dsa_ptr;

nitpick: reverse Christmas tree variable ordering

> +
> + /* Set the CPU port to trap frames to for MT7530. Trapped frames will be
> + * forwarded to the numerically smallest CPU port which the DSA conduit
> + * interface its affine to is up.
> + */
> + if (priv->id != ID_MT7530 && priv->id != ID_MT7621)
> + return;
> +
> + if (operational)
> + priv->active_cpu_ports |= BIT(cpu_dp->index);
> + else
> + priv->active_cpu_ports &= ~BIT(cpu_dp->index);
> +
> + if (priv->active_cpu_ports)
> + mt7530_rmw(priv, MT7530_MFC, CPU_EN | CPU_PORT_MASK, CPU_EN |
> + CPU_PORT(__ffs(priv->active_cpu_ports)));
> +}