2020-07-06 14:28:30

by Sergey Organov

[permalink] [raw]
Subject: [PATCH 2/5] net: fec: enable to use PPS feature without time stamping

PPS feature could be useful even when hardware time stamping
of network packets is not in use, so remove offending check
for this condition from fec_ptp_enable_pps().

Signed-off-by: Sergey Organov <[email protected]>
---
drivers/net/ethernet/freescale/fec_ptp.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index f8a592c..4a12086 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -103,11 +103,6 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable)
u64 ns;
val = 0;

- if (!(fep->hwts_tx_en || fep->hwts_rx_en)) {
- dev_err(&fep->pdev->dev, "No ptp stack is running\n");
- return -EINVAL;
- }
-
if (fep->pps_enable == enable)
return 0;

--
2.10.0.1.g57b01a3


2020-07-07 04:06:40

by Andy Duan

[permalink] [raw]
Subject: RE: [EXT] [PATCH 2/5] net: fec: enable to use PPS feature without time stamping

From: Sergey Organov <[email protected]> Sent: Monday, July 6, 2020 10:26 PM
> PPS feature could be useful even when hardware time stamping of network
> packets is not in use, so remove offending check for this condition from
> fec_ptp_enable_pps().

If hardware time stamping of network packets is not in use, PPS is based on local
clock, what is the use case ?

>
> Signed-off-by: Sergey Organov <[email protected]>
> ---
> drivers/net/ethernet/freescale/fec_ptp.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_ptp.c
> b/drivers/net/ethernet/freescale/fec_ptp.c
> index f8a592c..4a12086 100644
> --- a/drivers/net/ethernet/freescale/fec_ptp.c
> +++ b/drivers/net/ethernet/freescale/fec_ptp.c
> @@ -103,11 +103,6 @@ static int fec_ptp_enable_pps(struct
> fec_enet_private *fep, uint enable)
> u64 ns;
> val = 0;
>
> - if (!(fep->hwts_tx_en || fep->hwts_rx_en)) {
> - dev_err(&fep->pdev->dev, "No ptp stack is running\n");
> - return -EINVAL;
> - }
> -
> if (fep->pps_enable == enable)
> return 0;
>
> --
> 2.10.0.1.g57b01a3

2020-07-07 14:30:36

by Sergey Organov

[permalink] [raw]
Subject: Re: [EXT] [PATCH 2/5] net: fec: enable to use PPS feature without time stamping

Andy Duan <[email protected]> writes:

> From: Sergey Organov <[email protected]> Sent: Monday, July 6, 2020 10:26 PM
>> PPS feature could be useful even when hardware time stamping of network
>> packets is not in use, so remove offending check for this condition from
>> fec_ptp_enable_pps().
>
> If hardware time stamping of network packets is not in use, PPS is
> based on local
> clock, what is the use case ?

First, having special code to disable something that does no harm seems
to be wrong idea in general. In this particular case, if PPS is not
needed, it is still disabled by default, and one is still free not to
use it.

Then, as I'm not aware of a rule that renders PPS based on local clock
useless, I'm to assume it might be useful.

Finally, as an attempt to give direct answer to your question, suppose I
have external device that is capable to time stamp PPS against known
time scale (such as GPS system time) with high precision. Now I can get
nice estimations of local time drifts and feed, say, "chrony", with the
data to adjust my local clock accordingly.

Thanks,
-- Sergey