net: dsa: realtek: rtl8365mb: use dsa helpers for port iteration
authorLuiz Angelo Daros de Luca <luizluca@gmail.com>
Sat, 6 Jun 2026 08:29:27 +0000 (05:29 -0300)
committerJakub Kicinski <kuba@kernel.org>
Wed, 10 Jun 2026 02:35:41 +0000 (19:35 -0700)
commit51a4a22301b023610a1321614e8dc61251ef9064
tree502fea9d47f96768e1ac761f5bd96f5fc549cb28
parent36c572fd60d6bf2f9631088833c162203907c9ca
net: dsa: realtek: rtl8365mb: use dsa helpers for port iteration

Convert open-coded port iteration loops to use the DSA helpers and
restructure rtl8365mb_setup() into clear blocking, user, and
CPU port phases.

As part of this refactoring, unused ports are explicitly placed into a
blocked, isolated state with learning disabled, ensuring safe default
hardware behavior. The driver also does not allocate a virtual IRQ
mapping for unused ports. To accommodate this, a guard check is added to
the interrupt handler (rtl8365mb_irq) to safely skip ports without a
valid IRQ mapping. The irq domain teardown, however, does clean all
ports as external PHYs may still map the IRQ.

Furthermore, since the new initialization loop starts with all ports
administratively isolated by default, CPU port forwarding and isolation
masks are explicitly configured at the end of the setup phase to prevent
egress traffic from being blocked.

Suggested-by: Abdulkader Alrezej <abdulkader.alrezej@gmail.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Link: https://patch.msgid.link/20260606-realtek_forward-v13-3-b9e409687cbe@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/realtek/rtl8365mb.c