[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CO1PR11MB5089D3D27BEE4206AB772E04D6122@CO1PR11MB5089.namprd11.prod.outlook.com>
Date: Wed, 8 Jan 2025 18:09:30 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: Jiawen Wu <jiawenwu@...stnetic.com>, 'Richard Cochran'
<richardcochran@...il.com>
CC: "andrew+netdev@...n.ch" <andrew+netdev@...n.ch>, "davem@...emloft.net"
<davem@...emloft.net>, "edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
"linux@...linux.org.uk" <linux@...linux.org.uk>, "horms@...nel.org"
<horms@...nel.org>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"vadim.fedorenko@...ux.dev" <vadim.fedorenko@...ux.dev>,
"mengyuanlou@...-swift.com" <mengyuanlou@...-swift.com>, 'linglingzhang'
<linglingzhang@...-swift.com>
Subject: RE: [PATCH net-next v2 3/4] net: wangxun: Implement do_aux_work of
ptp_clock_info
> -----Original Message-----
> From: Jiawen Wu <jiawenwu@...stnetic.com>
> Sent: Tuesday, January 7, 2025 6:52 PM
> To: Keller, Jacob E <jacob.e.keller@...el.com>; 'Richard Cochran'
> <richardcochran@...il.com>
> Cc: andrew+netdev@...n.ch; davem@...emloft.net; edumazet@...gle.com;
> kuba@...nel.org; pabeni@...hat.com; linux@...linux.org.uk;
> horms@...nel.org; netdev@...r.kernel.org; vadim.fedorenko@...ux.dev;
> mengyuanlou@...-swift.com; 'linglingzhang' <linglingzhang@...-swift.com>
> Subject: RE: [PATCH net-next v2 3/4] net: wangxun: Implement do_aux_work of
> ptp_clock_info
>
> > > > > > +static int wx_ptp_feature_enable(struct ptp_clock_info *ptp,
> > > > > > + struct ptp_clock_request *rq, int on)
> > > > > > +{
> > > > > > + struct wx *wx = container_of(ptp, struct wx, ptp_caps);
> > > > > > +
> > > > > > + /**
> > > > > > + * When PPS is enabled, unmask the interrupt for the ClockOut
> > > > > > + * feature, so that the interrupt handler can send the PPS
> > > > > > + * event when the clock SDP triggers. Clear mask when PPS is
> > > > > > + * disabled
> > > > > > + */
> > > > > > + if (rq->type != PTP_CLK_REQ_PPS || !wx->ptp_setup_sdp)
> > > > > > + return -EOPNOTSUPP;
> > > > >
> > > > > NAK.
> > > > >
> > > > > The logic that you added in patch #4 is a periodic output signal, so
> > > > > your driver will support PTP_CLK_REQ_PEROUT and not
> PTP_CLK_REQ_PPS.
> > > > >
> > > > > Please change the driver to use that instead.
> > > > >
> > > > > Thanks,
> > > > > Richard
> > > >
> > > > This is a common misconception because the industry lingo uses PPS to
> mean
> > > > periodic output. I wonder if there's a place we can put an obvious warning
> > > > about checking if you meant PEROUT... I've had this issue pop up with
> > > > colleagues many times.
> > >
> > > Does a periodic output signal mean that a signal is output every second,
> > > whenever the start time is? But I want to implement that a signal is
> > > output when an integer number of seconds for the clock time.
> > >
> >
> > The periodic output can be configured in a bunch of ways, including periods that
> > are not a full second, when the signal should start, as well as in "one shot"
> mode
> > where it will only trigger once. You should check the possible flags in
> > <uapi/linux/ptp_clock.h> for the various options.
>
> Looks like I need to configure perout.phase {0, 0} to output signal at the closest
> next
> second. And configure perout.period {0, 120 * 1000000} to keep the signal 120ms.
>
> But where should I put these configuration? It used to be:
>
> echo 1 > /sys/class/ptp/ptp0/pps_enable
You can use /sys/class/ptp/ptp0/period (assuming the driver is configured with a periodic output properly). Note that this may not be a fully featured interface. To access the full power of the periodic output support, you need to use the PTP_PEROUT_REQUEST2 ioctl. You can check the code in tools/testing/selftests/ptp/testptp.c or possibly see if there is an example of use in the LinuxPTP project.
Thanks,
Jake
Powered by blists - more mailing lists