* [PATCH net v2 1/3] dpaa2-ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
2026-10-09 0:00 [PATCH net v2 0/3] net: freescale: fix PTP_EXTTS_REQUEST2 for QorIQ 1588 Vincent Jardin via B4 Relay
@ 2026-10-09 0:00 ` Vincent Jardin via B4 Relay
2026-10-09 0:00 ` [PATCH net v2 2/3] net: enetc: " Vincent Jardin via B4 Relay
2026-10-09 0:00 ` [PATCH net v2 3/3] ptp: qoriq: " Vincent Jardin via B4 Relay
2 siblings, 0 replies; 8+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-10-09 0:00 UTC (permalink / raw)
To: Yangbo Lu, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Richard Cochran, Jacob Keller,
Kory Maincent, Claudiu Manoil, Vladimir Oltean, Wei Fang,
Clark Wang
Cc: netdev, linux-kernel, imx, Ioana Ciornei, Vincent Jardin
From: Vincent Jardin <vjardin@free.fr>
Commit 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
ptp_clock_info") moved the validation of the external timestamp request
flags into the PTP core. A driver that does not set
.supported_extts_flags still accepts the legacy PTP_EXTTS_REQUEST ioctl,
but every PTP_EXTTS_REQUEST2 request is rejected with -EOPNOTSUPP.
On an LX2160A board, linuxptp ts2phc arms the external timestamp channel
of the 1588 timer with PTP_EXTTS_REQUEST2, gets -EOPNOTSUPP and exits,
so the PHC cannot be disciplined from an external 1PPS.
ptp_qoriq_init() programs TMR_CTRL with ETEP1 and ETEP2 cleared, so the
timer timestamps the rising edge of its external trigger inputs. Declare
that, with PTP_STRICT_FLAGS, so that a falling edge request is rejected
instead of being timestamped on the rising edge.
This also makes the legacy PTP_EXTTS_REQUEST ioctl strict: a request for
the falling edge, or for both edges, now fails with -EOPNOTSUPP instead
of being timestamped on the rising edge. That cannot be avoided: the core
adds PTP_STRICT_FLAGS to every PTP_EXTTS_REQUEST2 request, so a driver
has to declare it to accept them, and once declared it applies to both
ioctls. Commit 3200fdd4021d ("broadcom: fix support for
PTP_EXTTS_REQUEST2 ioctl") made the same change for bcm-phy-ptp.
Fixes: 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to ptp_clock_info")
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c
index 4497e3c0456d..ac2b873dcf8e 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c
@@ -78,6 +78,7 @@ static const struct ptp_clock_info dpaa2_ptp_caps = {
.n_per_out = 3,
.n_pins = 0,
.pps = 1,
+ .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
.adjfine = ptp_qoriq_adjfine,
.adjtime = ptp_qoriq_adjtime,
.gettime64 = ptp_qoriq_gettime,
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net v2 2/3] net: enetc: fix support for PTP_EXTTS_REQUEST2 ioctl
2026-10-09 0:00 [PATCH net v2 0/3] net: freescale: fix PTP_EXTTS_REQUEST2 for QorIQ 1588 Vincent Jardin via B4 Relay
2026-10-09 0:00 ` [PATCH net v2 1/3] dpaa2-ptp: fix support for PTP_EXTTS_REQUEST2 ioctl Vincent Jardin via B4 Relay
@ 2026-10-09 0:00 ` Vincent Jardin via B4 Relay
2026-10-10 2:27 ` Wei Fang
2026-10-09 0:00 ` [PATCH net v2 3/3] ptp: qoriq: " Vincent Jardin via B4 Relay
2 siblings, 1 reply; 8+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-10-09 0:00 UTC (permalink / raw)
To: Yangbo Lu, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Richard Cochran, Jacob Keller,
Kory Maincent, Claudiu Manoil, Vladimir Oltean, Wei Fang,
Clark Wang
Cc: netdev, linux-kernel, imx, Ioana Ciornei, Vincent Jardin
From: Vincent Jardin <vjardin@free.fr>
Commit 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
ptp_clock_info") moved the validation of the external timestamp request
flags into the PTP core. A driver that does not set
.supported_extts_flags still accepts the legacy PTP_EXTTS_REQUEST ioctl,
but every PTP_EXTTS_REQUEST2 request is rejected with -EOPNOTSUPP.
The ENETC timer is the QorIQ 1588 timer, set up by ptp_qoriq_init(), which
programs TMR_CTRL with ETEP1 and ETEP2 cleared, so it timestamps the
rising edge of its external trigger inputs. Declare that, with
PTP_STRICT_FLAGS, so that a falling edge request is rejected instead of
being timestamped on the rising edge.
This also makes the legacy PTP_EXTTS_REQUEST ioctl strict: a request for
the falling edge, or for both edges, now fails with -EOPNOTSUPP instead
of being timestamped on the rising edge. That cannot be avoided: the core
adds PTP_STRICT_FLAGS to every PTP_EXTTS_REQUEST2 request, so a driver
has to declare it to accept them, and once declared it applies to both
ioctls. Commit 3200fdd4021d ("broadcom: fix support for
PTP_EXTTS_REQUEST2 ioctl") made the same change for bcm-phy-ptp.
Fixes: 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to ptp_clock_info")
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
drivers/net/ethernet/freescale/enetc/enetc_ptp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
index 162cbc801730..5ffee882d624 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
@@ -16,6 +16,7 @@ static struct ptp_clock_info enetc_ptp_caps = {
.n_per_out = 0,
.n_pins = 0,
.pps = 1,
+ .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
.adjfine = ptp_qoriq_adjfine,
.adjtime = ptp_qoriq_adjtime,
.gettime64 = ptp_qoriq_gettime,
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* RE: [PATCH net v2 2/3] net: enetc: fix support for PTP_EXTTS_REQUEST2 ioctl
2026-10-09 0:00 ` [PATCH net v2 2/3] net: enetc: " Vincent Jardin via B4 Relay
@ 2026-10-10 2:27 ` Wei Fang
0 siblings, 0 replies; 8+ messages in thread
From: Wei Fang @ 2026-10-10 2:27 UTC (permalink / raw)
To: vjardin@free.fr, Y.B. Lu, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Richard Cochran,
Jacob Keller, Kory Maincent, Claudiu Manoil, Vladimir Oltean,
Clark Wang
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev, Ioana Ciornei
> Commit 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
> ptp_clock_info") moved the validation of the external timestamp request
> flags into the PTP core. A driver that does not set
> .supported_extts_flags still accepts the legacy PTP_EXTTS_REQUEST ioctl,
> but every PTP_EXTTS_REQUEST2 request is rejected with -EOPNOTSUPP.
>
> The ENETC timer is the QorIQ 1588 timer, set up by ptp_qoriq_init(), which
> programs TMR_CTRL with ETEP1 and ETEP2 cleared, so it timestamps the
> rising edge of its external trigger inputs. Declare that, with
> PTP_STRICT_FLAGS, so that a falling edge request is rejected instead of
> being timestamped on the rising edge.
>
> This also makes the legacy PTP_EXTTS_REQUEST ioctl strict: a request for
> the falling edge, or for both edges, now fails with -EOPNOTSUPP instead
> of being timestamped on the rising edge. That cannot be avoided: the core
> adds PTP_STRICT_FLAGS to every PTP_EXTTS_REQUEST2 request, so a driver
> has to declare it to accept them, and once declared it applies to both
> ioctls. Commit 3200fdd4021d ("broadcom: fix support for
> PTP_EXTTS_REQUEST2 ioctl") made the same change for bcm-phy-ptp.
>
> Fixes: 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
> ptp_clock_info")
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
> ---
> drivers/net/ethernet/freescale/enetc/enetc_ptp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
> b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
> index 162cbc801730..5ffee882d624 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
> @@ -16,6 +16,7 @@ static struct ptp_clock_info enetc_ptp_caps = {
> .n_per_out = 0,
> .n_pins = 0,
> .pps = 1,
> + .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
> .adjfine = ptp_qoriq_adjfine,
> .adjtime = ptp_qoriq_adjtime,
> .gettime64 = ptp_qoriq_gettime,
>
> --
> 2.43.0
>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net v2 3/3] ptp: qoriq: fix support for PTP_EXTTS_REQUEST2 ioctl
2026-10-09 0:00 [PATCH net v2 0/3] net: freescale: fix PTP_EXTTS_REQUEST2 for QorIQ 1588 Vincent Jardin via B4 Relay
2026-10-09 0:00 ` [PATCH net v2 1/3] dpaa2-ptp: fix support for PTP_EXTTS_REQUEST2 ioctl Vincent Jardin via B4 Relay
2026-10-09 0:00 ` [PATCH net v2 2/3] net: enetc: " Vincent Jardin via B4 Relay
@ 2026-10-09 0:00 ` Vincent Jardin via B4 Relay
2026-10-10 2:26 ` Wei Fang
2026-10-12 0:02 ` netdev-bot+sashiko
2 siblings, 2 replies; 8+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-10-09 0:00 UTC (permalink / raw)
To: Yangbo Lu, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Richard Cochran, Jacob Keller,
Kory Maincent, Claudiu Manoil, Vladimir Oltean, Wei Fang,
Clark Wang
Cc: netdev, linux-kernel, imx, Ioana Ciornei, Vincent Jardin
From: Vincent Jardin <vjardin@free.fr>
Commit 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
ptp_clock_info") moved the validation of the external timestamp request
flags into the PTP core. A driver that does not set
.supported_extts_flags still accepts the legacy PTP_EXTTS_REQUEST ioctl,
but every PTP_EXTTS_REQUEST2 request is rejected with -EOPNOTSUPP, since
the core always adds PTP_STRICT_FLAGS to it.
ptp_qoriq_init() programs TMR_CTRL with ETEP1 and ETEP2 cleared, so the
timer timestamps the rising edge of its external trigger inputs. Declare
that, with PTP_STRICT_FLAGS, so that a falling edge request is rejected
instead of being timestamped on the rising edge.
This also makes the legacy PTP_EXTTS_REQUEST ioctl strict: a request for
the falling edge, or for both edges, now fails with -EOPNOTSUPP instead
of being timestamped on the rising edge. That cannot be avoided: the core
adds PTP_STRICT_FLAGS to every PTP_EXTTS_REQUEST2 request, so a driver
has to declare it to accept them, and once declared it applies to both
ioctls. Commit 3200fdd4021d ("broadcom: fix support for
PTP_EXTTS_REQUEST2 ioctl") made the same change for bcm-phy-ptp.
Fixes: 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to ptp_clock_info")
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
drivers/ptp/ptp_qoriq.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index 76272e5ac5b8..bcd29104effe 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -355,6 +355,7 @@ static const struct ptp_clock_info ptp_qoriq_caps = {
.n_per_out = 0,
.n_pins = 0,
.pps = 1,
+ .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
.adjfine = ptp_qoriq_adjfine,
.adjtime = ptp_qoriq_adjtime,
.gettime64 = ptp_qoriq_gettime,
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* RE: [PATCH net v2 3/3] ptp: qoriq: fix support for PTP_EXTTS_REQUEST2 ioctl
2026-10-09 0:00 ` [PATCH net v2 3/3] ptp: qoriq: " Vincent Jardin via B4 Relay
@ 2026-10-10 2:26 ` Wei Fang
2026-10-12 0:02 ` netdev-bot+sashiko
1 sibling, 0 replies; 8+ messages in thread
From: Wei Fang @ 2026-10-10 2:26 UTC (permalink / raw)
To: vjardin@free.fr
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev, Ioana Ciornei, Y.B. Lu, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Richard Cochran, Jacob Keller, Kory Maincent, Claudiu Manoil,
Vladimir Oltean, Clark Wang
> From: Vincent Jardin <vjardin@free.fr>
>
> Commit 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
> ptp_clock_info") moved the validation of the external timestamp request
> flags into the PTP core. A driver that does not set
> .supported_extts_flags still accepts the legacy PTP_EXTTS_REQUEST ioctl,
> but every PTP_EXTTS_REQUEST2 request is rejected with -EOPNOTSUPP, since
> the core always adds PTP_STRICT_FLAGS to it.
>
> ptp_qoriq_init() programs TMR_CTRL with ETEP1 and ETEP2 cleared, so the
> timer timestamps the rising edge of its external trigger inputs. Declare
> that, with PTP_STRICT_FLAGS, so that a falling edge request is rejected
> instead of being timestamped on the rising edge.
>
> This also makes the legacy PTP_EXTTS_REQUEST ioctl strict: a request for
> the falling edge, or for both edges, now fails with -EOPNOTSUPP instead
> of being timestamped on the rising edge. That cannot be avoided: the core
> adds PTP_STRICT_FLAGS to every PTP_EXTTS_REQUEST2 request, so a driver
> has to declare it to accept them, and once declared it applies to both
> ioctls. Commit 3200fdd4021d ("broadcom: fix support for
> PTP_EXTTS_REQUEST2 ioctl") made the same change for bcm-phy-ptp.
>
> Fixes: 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
> ptp_clock_info")
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
> ---
> drivers/ptp/ptp_qoriq.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
> index 76272e5ac5b8..bcd29104effe 100644
> --- a/drivers/ptp/ptp_qoriq.c
> +++ b/drivers/ptp/ptp_qoriq.c
> @@ -355,6 +355,7 @@ static const struct ptp_clock_info ptp_qoriq_caps = {
> .n_per_out = 0,
> .n_pins = 0,
> .pps = 1,
> + .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
> .adjfine = ptp_qoriq_adjfine,
> .adjtime = ptp_qoriq_adjtime,
> .gettime64 = ptp_qoriq_gettime,
>
> --
> 2.43.0
>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH net v2 3/3] ptp: qoriq: fix support for PTP_EXTTS_REQUEST2 ioctl
2026-10-09 0:00 ` [PATCH net v2 3/3] ptp: qoriq: " Vincent Jardin via B4 Relay
2026-10-10 2:26 ` Wei Fang
@ 2026-10-12 0:02 ` netdev-bot+sashiko
2026-10-14 17:15 ` Jacob Keller
1 sibling, 1 reply; 8+ messages in thread
From: netdev-bot+sashiko @ 2026-10-12 0:02 UTC (permalink / raw)
To: vjardin
Cc: yangbo.lu, andrew+netdev, davem, edumazet, kuba, pabeni,
richardcochran, jacob.e.keller, kory.maincent, claudiu.manoil,
vladimir.oltean, wei.fang, xiaoning.wang, netdev, linux-kernel,
imx, ioana.ciornei
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The commit message says that making the legacy
PTP_EXTTS_REQUEST ioctl strict "cannot be avoided", because the core…
--
ptp: qoriq: fix support for PTP_EXTTS_REQUEST2 ioctl
This patch sets .supported_extts_flags in ptp_qoriq_caps to
PTP_RISING_EDGE | PTP_STRICT_FLAGS, so that the PTP core stops rejecting
every PTP_EXTTS_REQUEST2 request. Because of this, the legacy
PTP_EXTTS_REQUEST ioctl now also rejects falling-edge and both-edge
requests.
> This also makes the legacy PTP_EXTTS_REQUEST ioctl strict: a request for
> the falling edge, or for both edges, now fails with -EOPNOTSUPP instead
> of being timestamped on the rising edge. That cannot be avoided: the core
> adds PTP_STRICT_FLAGS to every PTP_EXTTS_REQUEST2 request, so a driver
> has to declare it to accept them, and once declared it applies to both
> ioctls.
> diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
> index 76272e5ac5b85..bcd29104effe7 100644
> --- a/drivers/ptp/ptp_qoriq.c
> +++ b/drivers/ptp/ptp_qoriq.c
> @@ -355,6 +355,7 @@ static const struct ptp_clock_info ptp_qoriq_caps = {
> .n_per_out = 0,
> .n_pins = 0,
> .pps = 1,
> + .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
[Severity: Medium]
Is the "cannot be avoided" part of the commit message accurate?
In ptp_extts_request() in drivers/ptp/ptp_chardev.c, the strict bit is
only added for PTP_EXTTS_REQUEST2. For the legacy ioctl it is always
removed by the mask:
drivers/ptp/ptp_chardev.c:ptp_extts_request() {
...
if (cmd == PTP_EXTTS_REQUEST2) {
/* Tell the drivers to check the flags carefully. */
req.extts.flags |= PTP_STRICT_FLAGS;
...
} else {
req.extts.flags &= PTP_EXTTS_V1_VALID_FLAGS;
...
}
PTP_EXTTS_V1_VALID_FLAGS contains only ENABLE, RISING and FALLING. The
.enable callback can therefore tell the two ioctls apart by checking
PTP_STRICT_FLAGS in rq->extts.flags.
Drivers in the tree already do this. mv88e6xxx declares
RISING | FALLING | STRICT and rejects the unsupported edge combination
only for strict requests:
drivers/net/dsa/mv88e6xxx/ptp.c:mv88e6352_ptp_enable_extts() {
...
if ((rq->extts.flags & PTP_STRICT_FLAGS) &&
(rq->extts.flags & PTP_ENABLE_FEATURE) &&
(rq->extts.flags & PTP_EXTTS_EDGES) == PTP_EXTTS_EDGES)
return -EOPNOTSUPP;
...
}
sja1105 does something similar in sja1105_ptp.c.
Could qoriq do the same? It would declare PTP_RISING_EDGE |
PTP_FALLING_EDGE | PTP_STRICT_FLAGS in ptp_qoriq_caps. Then
ptp_qoriq_enable() would return -EOPNOTSUPP when STRICT, ENABLE and
FALLING are all set. That fixes PTP_EXTTS_REQUEST2 and leaves the legacy
ioctl lenient. enetc_ptp.c also uses ptp_qoriq_enable(), so the same
check would cover enetc.
As written, with the Fixes: tag, this is going to stable. Legacy
PTP_EXTTS_REQUEST calls on QorIQ timers that ask for the falling edge or
for both edges now fail with -EOPNOTSUPP. Before this patch they
succeeded and were timestamped on the rising edge. Commit 7c571ac57d9d
calls the legacy edge flags hints that are not expected to be enforced.
testptp hits this path. Running it with -e and -E 2 or -E 3 sends
PTP_EXTTS_REQUEST with PTP_FALLING_EDGE set.
If the stricter legacy behaviour is intended, could the commit message
say that a lenient alternative exists, rather than saying the change
cannot be avoided?
> .adjfine = ptp_qoriq_adjfine,
> .adjtime = ptp_qoriq_adjtime,
> .gettime64 = ptp_qoriq_gettime,
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261009-for-upstream-qoriq-ptp-extts-flags-v2-0-0f4eeff2295d%40free.fr
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH net v2 3/3] ptp: qoriq: fix support for PTP_EXTTS_REQUEST2 ioctl
2026-10-12 0:02 ` netdev-bot+sashiko
@ 2026-10-14 17:15 ` Jacob Keller
0 siblings, 0 replies; 8+ messages in thread
From: Jacob Keller @ 2026-10-14 17:15 UTC (permalink / raw)
To: netdev-bot+sashiko, vjardin
Cc: yangbo.lu, andrew+netdev, davem, edumazet, kuba, pabeni,
richardcochran, kory.maincent, claudiu.manoil, vladimir.oltean,
wei.fang, xiaoning.wang, netdev, linux-kernel, imx, ioana.ciornei
On 10/11/2026 5:02 PM, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] The commit message says that making the legacy
> PTP_EXTTS_REQUEST ioctl strict "cannot be avoided", because the core…
>
> --
>
> ptp: qoriq: fix support for PTP_EXTTS_REQUEST2 ioctl
>
> This patch sets .supported_extts_flags in ptp_qoriq_caps to
> PTP_RISING_EDGE | PTP_STRICT_FLAGS, so that the PTP core stops rejecting
> every PTP_EXTTS_REQUEST2 request. Because of this, the legacy
> PTP_EXTTS_REQUEST ioctl now also rejects falling-edge and both-edge
> requests.
>
>> This also makes the legacy PTP_EXTTS_REQUEST ioctl strict: a request for
>> the falling edge, or for both edges, now fails with -EOPNOTSUPP instead
>> of being timestamped on the rising edge. That cannot be avoided: the core
>> adds PTP_STRICT_FLAGS to every PTP_EXTTS_REQUEST2 request, so a driver
>> has to declare it to accept them, and once declared it applies to both
>> ioctls.
>
>> diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
>> index 76272e5ac5b85..bcd29104effe7 100644
>> --- a/drivers/ptp/ptp_qoriq.c
>> +++ b/drivers/ptp/ptp_qoriq.c
>> @@ -355,6 +355,7 @@ static const struct ptp_clock_info ptp_qoriq_caps = {
>> .n_per_out = 0,
>> .n_pins = 0,
>> .pps = 1,
>> + .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
>
> [Severity: Medium]
> Is the "cannot be avoided" part of the commit message accurate?
>
> In ptp_extts_request() in drivers/ptp/ptp_chardev.c, the strict bit is
> only added for PTP_EXTTS_REQUEST2. For the legacy ioctl it is always
> removed by the mask:
>
> drivers/ptp/ptp_chardev.c:ptp_extts_request() {
> ...
> if (cmd == PTP_EXTTS_REQUEST2) {
> /* Tell the drivers to check the flags carefully. */
> req.extts.flags |= PTP_STRICT_FLAGS;
> ...
> } else {
> req.extts.flags &= PTP_EXTTS_V1_VALID_FLAGS;
> ...
> }
>
> PTP_EXTTS_V1_VALID_FLAGS contains only ENABLE, RISING and FALLING. The
> .enable callback can therefore tell the two ioctls apart by checking
> PTP_STRICT_FLAGS in rq->extts.flags.
>
> Drivers in the tree already do this. mv88e6xxx declares
> RISING | FALLING | STRICT and rejects the unsupported edge combination
> only for strict requests:
>
> drivers/net/dsa/mv88e6xxx/ptp.c:mv88e6352_ptp_enable_extts() {
> ...
> if ((rq->extts.flags & PTP_STRICT_FLAGS) &&
> (rq->extts.flags & PTP_ENABLE_FEATURE) &&
> (rq->extts.flags & PTP_EXTTS_EDGES) == PTP_EXTTS_EDGES)
> return -EOPNOTSUPP;
> ...
> }
>
> sja1105 does something similar in sja1105_ptp.c.
>
> Could qoriq do the same? It would declare PTP_RISING_EDGE |
> PTP_FALLING_EDGE | PTP_STRICT_FLAGS in ptp_qoriq_caps. Then
> ptp_qoriq_enable() would return -EOPNOTSUPP when STRICT, ENABLE and
> FALLING are all set. That fixes PTP_EXTTS_REQUEST2 and leaves the legacy
> ioctl lenient. enetc_ptp.c also uses ptp_qoriq_enable(), so the same
> check would cover enetc.
>
> As written, with the Fixes: tag, this is going to stable. Legacy
> PTP_EXTTS_REQUEST calls on QorIQ timers that ask for the falling edge or
> for both edges now fail with -EOPNOTSUPP. Before this patch they
> succeeded and were timestamped on the rising edge. Commit 7c571ac57d9d
> calls the legacy edge flags hints that are not expected to be enforced.
>
> testptp hits this path. Running it with -e and -E 2 or -E 3 sends
> PTP_EXTTS_REQUEST with PTP_FALLING_EDGE set.
>
> If the stricter legacy behaviour is intended, could the commit message
> say that a lenient alternative exists, rather than saying the change
> cannot be avoided?
>
Hm. The intended behavior had been that legacy ioctl would remain
supporting the non-strict mode. I guess the way its implemented doesn't
quite work. The strict flag is cleared automatically but only from the
req.extts.flags, and not from supported_extts_flags. I guess that might
be an oversight in the ioctl implementation. Its been a while so I can't
remember the specific reason this version was opted for. We could modify
the core to also allow non-strict mode for legacy ioctls..
I'd prefer not to fix this in the driver as the AI suggests here. Either
we accept that both ioctls will be strict in cases where the requested
mode is not listed, or we need to change the core to work this way.
Having each driver have its own variation of policy was one of the
things I aimed to avoid with my refactor :/
>> .adjfine = ptp_qoriq_adjfine,
>> .adjtime = ptp_qoriq_adjtime,
>> .gettime64 = ptp_qoriq_gettime,
>
^ permalink raw reply [flat|nested] 8+ messages in thread