Re: [PATCH net-next 6/7] net: dsa: netc: add PTP two-step timestamping support

Vadim Fedorenko <[email protected]> Thu, 30 Jul 2026 14:02:19 +0100
Newsgroups dev.linux.lists.imx,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.netdev,org.ozlabs.lists.linuxppc-dev
Message-ID <[email protected]>
On 30/07/2026 02:31, Wei Fang wrote:
>>> +int netc_get_ts_info(struct dsa_switch *ds, int port,
>>> +		     struct kernel_ethtool_ts_info *info)
>>> +{
>>> +	struct netc_switch *priv = ds->priv;
>>> +
>>> +	info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
>>> +				SOF_TIMESTAMPING_RX_SOFTWARE |
>>> +				SOF_TIMESTAMPING_SOFTWARE;
>>
>> SOF_TIMESTAMPING_RX_SOFTWARE and SOF_TIMESTAMPING_SOFTWARE
>> are available
>> by default, no need to add them.
> 
> Yes, you are right, I will remove them.
> 
>>
>> the code doesn't have skb_tx_timestamp() calls, I wonder how is
>> SOF_TIMESTAMPING_TX_SOFTWARE implemented?
> 
> The switch and the conduit port (ENETC) are integrated into the NETC IP,
> so the switch can only connect to the ENETC MAC. And the ENETC driver
> calls skb_tx_timestamp() unconditionally, so I thought
> SOF_TIMESTAMPING_TX_SOFTWARE can be added. I checked the existing
> DSA drivers and found no drivers set this flag, maybe I should remove this
> flag as well. Thanks.

well, you have the hardware, you can actually check if enetc driver 
provides it for you

> 
>>
>>> +
>>> +	info->phc_index = netc_get_phc_index(priv);
>>> +	if (info->phc_index < 0)
>>> +		return 0;
>>> +
>>> +	info->so_timestamping |= SOF_TIMESTAMPING_TX_HARDWARE |
>>> +				 SOF_TIMESTAMPING_RX_HARDWARE |
>>> +				 SOF_TIMESTAMPING_RAW_HARDWARE;
>>> +
>>> +	info->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON);
>>> +
>>> +	info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) |
>>> +			   BIT(HWTSTAMP_FILTER_PTP_V2_EVENT) |
>>> +			   BIT(HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
>>> +			   BIT(HWTSTAMP_FILTER_PTP_V2_L4_EVENT);
>>> +
>>> +	return 0;
>>> +}
>>
>