Re: [net-next PATCH v4 2/8] net: dsa: realtek: rtl8365mb: use dsa helpers for port iteration

From: Mieczyslaw Nalewaj

Date: Sun May 17 2026 - 03:04:04 EST


On 5/16/2026 5:46 AM, Luiz Angelo Daros de Luca wrote:
> Use dsa_switch_for_each_*() whenever possible.
>
> For port setup(), a new blocking setup phase was added for all ports,
> including unused ones, before the user and CPU port setup.
>
> CPU isolation includes all user ports as traffic was being blocked in
> some scenarios (suggested by Abdulkader Alrezej).
>
> The driver bails out if a DSA port is detected as the driver was not
> tested in a cascading setup.
>
> Suggested-by: Abdulkader Alrezej <abdulkader.alrezej@xxxxxxxxx>
> Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
> Signed-off-by: Luiz Angelo Daros de Luca <luizluca@xxxxxxxxx>
> ---> [...]> @@ -1974,46 +1978,83 @@ static int rtl8365mb_setup(struct dsa_switch *ds)
> else if (ret)
> dev_info(priv->dev, "no interrupt support\n");
>
> - /* Configure CPU tagging */
> - dsa_switch_for_each_cpu_port(cpu_dp, ds) {
> - cpu->mask |= BIT(cpu_dp->index);
> + /* Start with all ports blocked, including unused ports */
> + dsa_switch_for_each_port(dp, ds) {
> + struct rtl8365mb_port *p = &mb->ports[dp->index];
>
> - if (cpu->trap_port == RTL8365MB_MAX_NUM_PORTS)
> - cpu->trap_port = cpu_dp->index;
> - }
> - cpu->enable = cpu->mask > 0;
> - ret = rtl8365mb_cpu_config(priv);
> - if (ret)
> - goto out_teardown_irq;
> -
> - /* Configure ports */
> - for (i = 0; i < priv->num_ports; i++) {
> - struct rtl8365mb_port *p = &mb->ports[i];
> + if (dsa_port_is_dsa(dp)) {
> + dev_err(ds->dev, "Cascading (DSA links) not supported");
> + return -EOPNOTSUPP;
> + }
>
Missing trailing \n in the format string. Kernel dev_err() messages aren't auto-newlined by the logging machinery — without one, this line will be glued to whatever subsequent printk follows. Every other dev_err/dev_info in this driver (e.g. the dev_info(priv->dev, "no interrupt support\n"); a few lines above) terminates with \n