RE: [PATCH v6 net-next 04/17] ptp: add debugfs interfaces to loop back the periodic output signal

From: Wei Fang
Date: Wed Aug 27 2025 - 22:04:19 EST


> On Wed, Aug 27, 2025 at 02:33:19PM +0800, Wei Fang wrote:
> > For some PTP devices, they have the capability to loop back the
> > periodic output signal for debugging, such as the ptp_qoriq device. So
> > add the generic interfaces to set the periodic output signal loopback,
> > rather than each vendor having a different implementation.
> >
> > Show how many channels support the periodic output signal loopback:
> > $ cat /sys/kernel/debug/ptp<N>/n_perout_loopback
> >
> > Enable the loopback of the periodic output signal of channel X:
> > $ echo <X> 1 > /sys/kernel/debug/ptp<N>/perout_loopback
>
> Genernally sys interface only 1 input for each entry.
>
> I suggest create one file for each channel.
>
> /sys/kernel/debug/ptp<N>/perout<m>_loopback_enable
>
> echo 1 > /sys/kernel/debug/ptp<N>/perout<m>_loopback_enable
>

There is actually only one parameter, which is a string and is parsed by
the driver. This practice is actually quite common. see:

ixgbe_debugfs.c : ixgbe_dbg_reg_ops_write()
debugfs_sta.c: ath11k_dbg_sta_write_delba()
wil6210/debugfs.c: wil_write_back()
ath10k/debug.c: ath10k_write_htt_max_amsdu_ampdu()