MT7530 bug, forward broadcast and unknown frames to the correct CPU port

Arınç ÜNAL
2023-04-23T15:23:21Z

Hey there folks,

On mt753x_cpu_port_enable() there's code [0] that sets which port to
forward the broadcast, unknown multicast, and unknown unicast frames to.
Since mt753x_cpu_port_enable() runs twice when both CPU ports are
enabled, port 6 becomes the port to forward the frames to. But port 5 is
the active port, so no broadcast frames received from the user ports
will be forwarded to port 5. This breaks network connectivity when
multiple ports are being used as CPU ports.

My testing shows that only after receiving a broadcast ARP frame from
port 5 then forwarding it to the user port, the unicast frames received
from that user port will be forwarded to port 5. I tested this with ping.

Forwarding broadcast and unknown unicast frames to the CPU port was done
with commit 5a30833b9a16 ("net: dsa: mt7530: support MDB and bridge flag
operations"). I suppose forwarding the broadcast frames only to the CPU
port is what "disable flooding" here means.

It’s a mystery to me how the switch classifies multicast and unicast
frames as unknown. Bartel's testing showed LLDP frames fall under this
category.

Until the driver supports changing the DSA conduit, unknown frames
should be forwarded to the active CPU port, not the numerically greater
one. Any ideas how to address this and the "disable flooding" case?

There's also this "set the CPU number" code that runs only for MT7621.
I'm not sure why this is needed or why it's only needed for MT7621.
Greg, could you shed some light on this since you added this code with
commit ddda1ac116c8 ("net: dsa: mt7530: support the 7530 switch on the
Mediatek MT7621 SoC")?

There're more things to discuss after supporting changing the DSA
conduit, such as which CPU port to forward the unknown frames to, when
user ports under different conduits receive unknown frames. What makes
sense to me is, if there are multiple CPU ports being used, forward the
unknown frames to port 6. This is already the case except the code runs
twice. If not, set it to whatever 'int port' is, which is the default
behaviour already.

[0]
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/drivers/net/dsa/mt7530.c#n1005

Arınç