[PATCH v3 3/7] net: dsa: mediatek: add support for passthrough mode
Caleb James DeLisle
cjd at cjdns.fr
Wed Oct 28 04:08:29 PDT 2026
Hello,
Thanks for the review.
On 28/10/2026 03:15, Andrew Lunn wrote:
>> @@ -199,6 +199,9 @@ static void mt7530_port_fast_age(struct dsa_switch *ds, int port)
>> u32 val;
>> int ret;
>>
>> + if (priv->is_passthrough)
>> + return;
>> +
>> mutex_lock(&priv->reg_mutex);
>>
>> /* Flush all non-static MAC address entries */
>> @@ -970,6 +973,9 @@ mt7530_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
>> unsigned int age_count;
>> unsigned int age_unit;
>>
>> + if (priv->is_passthrough)
>> + return 0;
>> +
>> @@ -1386,11 +1446,14 @@ mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
>> int length;
>> u32 val;
>>
>> + if (priv->is_passthrough)
>> + return 0;
>> +
> 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 */
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,
};
>
> Is there sufficient code reuse that this makes sense?
>
> Would it be simpler to have a much simpler DSA driver just for pass
> through? Or the mt7530 driver has a second dsa_switch_ops instance
> with all these functions set to NULL?
After sending v2, I discovered that some switch config runs across the
whole switch tree, and NULL configurators causes those ops to log an
error and exit early.
As far as making a "passthrough driver", there are a few things going
against it. As you can see there is still quite a bit of shared code,
also it would be inconvenient to use a different compatible because some
chip packages exclude the MCM switch and have 3x 10/100 ports and 1x
gigabit port, so its better for the DT to pretend that the mt7530 can
simply do full hierarchies, though (per the big commit message) that
doesn't actually work and we're relying on the fact that hardware
integrators will not require something that can't be done.
Lastly, the TRGMII calibration requires poking registers on one switch
and reading values off the other (patch 7) so I think that mess is best
kept all inside of one C file.
Thanks,
Caleb
>
> Andrew
More information about the Linux-mediatek
mailing list