Subject: Re: [DSA] fallback PTP to master port when switch does not support it

From: Andrew Lunn <[email-masked]>
Date: Tue, 5 Apr 2022 00:04:30 +0200

On Mon, Apr 04, 2022 at 09:28:08PM +0200, Matej Zachar wrote:
>  Hi,
> 
> in my embedded setup I have CPU (master) port with full PTP support
> connected to the onboard switch (without PTP support) through
> DSA. As the ioctl and ts_info is passed to the switch driver I made
> small change to fallback to the master net_device.

Did you try just running PTP on the master device? I'm wondering if
the DSA headers get in the way?

What i don't like about your proposed fallback is that it gives the
impression the slave ports actually support PTP, when they do not. And
maybe you want to run different ports in different modes, one upstream
towards a grand master and one downstream? I suspect the errors you
get are not obvious. Where as if you just run PTP on the master, the
errors would be more obvious.

> This however requires that the switch which does not support PTP
> must not implement .get_ts_info and .port_hwtstamp_get/set from
> dsa_switch_ops struct.

And this is another advantage of just using master directly. You can
even use master when the switch ports do support PTP.

       Andrew