Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In drivers/net/dsa/motorcomm/chip.c,
yt921x_userport_standalone() now writes YT921X_PORTn_ISOLATION(port) =…
--
net: dsa: motorcomm: Do not block hairpins on standalone ports
The patch clears the port's own bit in YT921X_PORTn_ISOLATION(port) for
standalone user ports. The goal is to allow ACL rules that redirect a
frame back to its ingress port. The commit message says port isolation
is applied after the REDIR decision, so these rules were blocked before.
> diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
> index c96512faeca25..6e57c9262c681 100644
> --- a/drivers/net/dsa/motorcomm/chip.c
> +++ b/drivers/net/dsa/motorcomm/chip.c
> @@ -1261,7 +1261,7 @@ static int yt921x_userport_standalone(struct yt921x_priv *priv, int port)
> u32 ctrl;
> int res;
>
> - ctrl = ~dsa_cpu_ports(ds);
> + ctrl = ~(dsa_cpu_ports(ds) | BIT(port));
> res = yt921x_reg_write(priv, YT921X_PORTn_ISOLATION(port), ctrl);
[Severity: Medium]
Does this change turn on hairpin for all hardware-forwarded traffic on
standalone ports, and not only for ACL redirect-to-self?
The driver already uses this same bit as its general hairpin control in
yt921x_bridge():
/* to itself when non-hairpin */
if (!pp->hairpin)
ctrl |= BIT(port);
else
ctrl &= ~BIT(port);
Broadcasts don't seem to be trapped on this switch. yt921x_chip_setup_dsa()
programs YT921X_ACT_UNK_ACTn_TRAP only for unknown unicast and unknown
multicast. YT921X_FILTER_BCAST is never written, and yt921x_bridge_flags()
notes:
/* BR_BCAST_FLOOD: we can filter bcast, but cannot trap them */
This means the comment further down in yt921x_userport_standalone()
doesn't hold for broadcasts:
/* Unrelated since learning is off and all packets are trapped;
* set it anyway
*/
So a broadcast arriving on a standalone port is flooded in hardware,
limited only by the isolation register. Before this patch it could only
reach the CPU port. With the self bit cleared, could the switch also
send ARP or DHCP broadcasts back out of the port they arrived on?
If that happens, an upstream switch would see the sender's MAC arrive
from the yt921x link and could move its FDB entry there, which would
blackhole that host. Two such ports in a loop could also cause a
broadcast storm.
This path runs at port setup and on every yt921x_bridge_leave(). Also,
yt921x_isolate() only sets this port's bit in other ports' registers,
never in the port's own register.
All of this depends on how the hardware floods. The reflection only
happens if the switch has no separate source-port suppression for
flooded frames. The BR_HAIRPIN_MODE offload in yt921x_bridge() seems to
assume there is none.
Later patches in the series keep the same behaviour. The new helper
yt921x_isolation_calc_ports() also computes the standalone mask as:
isolation_masks[port] = ~(BIT(port) | cpu_ports_mask);
Could the self bit stay set for normal forwarding, and redirect-to-self
be handled another way? One option is trapping it to the CPU, as the
later commit "net: dsa: motorcomm: Reject isolated redirect targets"
does for other isolated targets.
> if (res)
> return res;
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40gmail.com