Re: [PATCH v3 3/7] net: dsa: mediatek: add support for passthrough mode
From: Caleb James DeLisle
Date: Thu Oct 29 2026 - 14:50:56 EST
On 28/10/2026 13:35, Andrew Lunn wrote:
Sorry, i did not look at v2.What is actually left?
In v2 I was using special switch ops, and it looked like this:
/* No manipulation of forwarding rules allowed in passthrough mode */I think you should be doing something like this. Either two
static const struct dsa_switch_ops mt7530_passthrough_switch_ops = {
.get_tag_protocol = mtk_get_tag_protocol,
.setup = mt753x_setup,
.teardown = mt753x_teardown,
.preferred_default_local_cpu_port =
mt753x_preferred_default_local_cpu_port,
.get_strings = mt7530_get_strings,
.get_ethtool_stats = mt7530_get_ethtool_stats,
.get_sset_count = mt7530_get_sset_count,
.get_eth_mac_stats = mt7530_get_eth_mac_stats,
.get_rmon_stats = mt7530_get_rmon_stats,
.get_eth_ctrl_stats = mt7530_get_eth_ctrl_stats,
.get_stats64 = mt7530_get_stats64,
.port_enable = mt7530_port_enable,
.port_disable = mt7530_port_disable,
.phylink_get_caps = mt753x_phylink_get_caps,
.support_eee = dsa_supports_eee,
.set_mac_eee = mt753x_set_mac_eee,
.conduit_state_change = mt753x_conduit_state_change,
};
dsa_switch_ops, or you add generic implementations for all the ops,
which then call device specific implementations dependent on the
compatible. This is how many DSA drivers handle different families of
devices in one driver.
I would avoid putting "if (priv->passthrough)" everywhere.
I just send v4 with a separate dsa_switch_ops for passthrough. Instead of "if (priv->passthrough)" it is numerous empty functions because they have to exist and have to do nothing successfully. I'm not such a fan of it, but you certainly know drivers/net/dsa better than me and if this is the canonical solution then I agree to align with it.
Thanks,
Caleb
Andrew