Thread View: linux.kernel.netdev
6 messages
6 total messages
Started by James Clark
Wed, 04 Nov 2026 05:25
[PATCH net] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
Author: James Clark
Date: Wed, 04 Nov 2026 05:25
Date: Wed, 04 Nov 2026 05:25
53 lines
13283 bytes
13283 bytes
Commit 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
ptp_clock_info") modified the PTP core to validate the supported flags
of external timestamp requests, rather than relying on each driver to
check them.
stmmac_enable() and dwmac1000_ptp_enable() ignore the flags, and
neither stmmac_ptp_clock_ops nor dwmac1000_ptp_clock_ops was given any
.supported_extts_flags. Since PTP_EXTTS_REQUEST2 always implies
PTP_STRICT_FLAGS, the core now rejects every PTP_EXTTS_REQUEST2 for
this driver with -EOPNOTSUPP, where before that commit the same
requests succeeded. Only the PTP_EXTTS_REQUEST ioctl still works.
Tests on an NXP i.MX 8M Plus (FRDM-IMX8MPLUS, GMAC 5.10a) show that the
auxiliary snapshot inputs timestamp just the rising edge. The reference
manuals for the STM32MP13 (GMAC 4.20a) and the Cyclone V HPS (GMAC
3.70a, which uses dwmac1000_ptp_clock_ops) say the same.
Encode this in .supported_extts_flags. A PTP_EXTTS_REQUEST2 for the
rising edge then succeeds, and one for the falling edge or for both
edges fails with -EOPNOTSUPP.
Fixes: 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to ptp_clock_info")
Cc: stable@vger.kernel.org
Signed-off-by: James Clark <jjc@jclark.com>
---
I used an LLM coding assistant to help prepare this patch.
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index a37405534beb..31a66e855d6b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -277,6 +277,7 @@ const struct ptp_clock_info stmmac_ptp_clock_ops = {
.n_per_out = 0, /* will be overwritten in stmmac_ptp_register */
.n_pins = 0,
.pps = 0,
+ .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
.adjfine = stmmac_adjust_freq,
.adjtime = stmmac_adjust_time,
.gettimex64 = stmmac_get_timex,
@@ -294,6 +295,7 @@ const struct ptp_clock_info dwmac1000_ptp_clock_ops = {
.n_per_out = 0,
.n_pins = 0,
.pps = 0,
+ .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
.adjfine = stmmac_adjust_freq,
.adjtime = stmmac_adjust_time,
.gettimex64 = stmmac_get_timex,
--
2.56.0
Re: [PATCH net] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
Author: Lorenzo Bianconi
Date: Wed, 04 Nov 2026 09:06
Date: Wed, 04 Nov 2026 09:06
79 lines
18364 bytes
18364 bytes
--SZJ/srcPBu4OL5we
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
> Commit 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
> ptp_clock_info") modified the PTP core to validate the supported flags
> of external timestamp requests, rather than relying on each driver to
> check them.
>=20
> stmmac_enable() and dwmac1000_ptp_enable() ignore the flags, and
> neither stmmac_ptp_clock_ops nor dwmac1000_ptp_clock_ops was given any
> .supported_extts_flags. Since PTP_EXTTS_REQUEST2 always implies
> PTP_STRICT_FLAGS, the core now rejects every PTP_EXTTS_REQUEST2 for
> this driver with -EOPNOTSUPP, where before that commit the same
> requests succeeded. Only the PTP_EXTTS_REQUEST ioctl still works.
>=20
> Tests on an NXP i.MX 8M Plus (FRDM-IMX8MPLUS, GMAC 5.10a) show that the
> auxiliary snapshot inputs timestamp just the rising edge. The reference
> manuals for the STM32MP13 (GMAC 4.20a) and the Cyclone V HPS (GMAC
> 3.70a, which uses dwmac1000_ptp_clock_ops) say the same.
>=20
> Encode this in .supported_extts_flags. A PTP_EXTTS_REQUEST2 for the
> rising edge then succeeds, and one for the falling edge or for both
> edges fails with -EOPNOTSUPP.
>=20
> Fixes: 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to ptp_c=
lock_info")
> Cc: stable@vger.kernel.org
> Signed-off-by: James Clark <jjc@jclark.com>
Reviewed-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> ---
> I used an LLM coding assistant to help prepare this patch.
>=20
> drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 ++
> 1 file changed, 2 insertions(+)
>=20
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/n=
et/ethernet/stmicro/stmmac/stmmac_ptp.c
> index a37405534beb..31a66e855d6b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
> @@ -277,6 +277,7 @@ const struct ptp_clock_info stmmac_ptp_clock_ops =3D {
> .n_per_out =3D 0, /* will be overwritten in stmmac_ptp_register */
> .n_pins =3D 0,
> .pps =3D 0,
> + .supported_extts_flags =3D PTP_RISING_EDGE | PTP_STRICT_FLAGS,
> .adjfine =3D stmmac_adjust_freq,
> .adjtime =3D stmmac_adjust_time,
> .gettimex64 =3D stmmac_get_timex,
> @@ -294,6 +295,7 @@ const struct ptp_clock_info dwmac1000_ptp_clock_ops =
=3D {
> .n_per_out =3D 0,
> .n_pins =3D 0,
> .pps =3D 0,
> + .supported_extts_flags =3D PTP_RISING_EDGE | PTP_STRICT_FLAGS,
> .adjfine =3D stmmac_adjust_freq,
> .adjtime =3D stmmac_adjust_time,
> .gettimex64 =3D stmmac_get_timex,
> --=20
> 2.56.0
>=20
>=20
--SZJ/srcPBu4OL5we
Content-Type: application/pgp-signature; name=signature.asc
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCaur1ngAKCRA6cBh0uS2t
rF0OAQCBQ4Jznbj+YmV/bTgLSjoDCUuZ+PomAAi2n95oMB8GFgEAu1dSRv/ORtKN
Qbwi4a7nP3qZRg0fNZrxJwojDXqy9wk=
=YZZD
-----END PGP SIGNATURE-----
--SZJ/srcPBu4OL5we--
Re: [PATCH net] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
Author: Jacob Keller
Date: Wed, 04 Nov 2026 21:12
Date: Wed, 04 Nov 2026 21:12
52 lines
18955 bytes
18955 bytes
On 11/4/2026 12:58 AM, Maxime Chevallier wrote:
>> Fixes: 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to ptp_clock_info")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: James Clark <jjc@jclark.com>
>
> funny this wasn't noticed before, this looks good to me :)
>
A lot of programs still use the older PTP_EXTTS_REQUEST ioctl which is
permissive and doesn't enforce the edge request, so i suspect a lot of
software just doesn't trigger this.
> I've tested this on cyclone V, stm32mp157 and imx8mp,
>
Great, thanks!
> Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
>
> Thanks,
>
> Maxime
>
>> ---
>> I used an LLM coding assistant to help prepare this patch.
>>
>> drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
>> index a37405534beb..31a66e855d6b 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
>> @@ -277,6 +277,7 @@ const struct ptp_clock_info stmmac_ptp_clock_ops = {
>> .n_per_out = 0, /* will be overwritten in stmmac_ptp_register */
>> .n_pins = 0,
>> .pps = 0,
>> + .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
>> .adjfine = stmmac_adjust_freq,
>> .adjtime = stmmac_adjust_time,
>> .gettimex64 = stmmac_get_timex,
>> @@ -294,6 +295,7 @@ const struct ptp_clock_info dwmac1000_ptp_clock_ops = {
>> .n_per_out = 0,
>> .n_pins = 0,
>> .pps = 0,
>> + .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
>> .adjfine = stmmac_adjust_freq,
>> .adjtime = stmmac_adjust_time,
>> .gettimex64 = stmmac_get_timex,
>
Re: [PATCH net] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
Author: netdev-bot+sashiko
Date: Thu, 05 Nov 2026 10:08
Date: Thu, 05 Nov 2026 10:08
97 lines
11739 bytes
11739 bytes
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] This patch adds PTP_STRICT_FLAGS to .supported_extts_flags in
stmmac_ptp_clock_ops and dwmac1000_ptp_clock_ops…
--
net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
This patch sets .supported_extts_flags to PTP_RISING_EDGE | PTP_STRICT_FLAGS
in stmmac_ptp_clock_ops and dwmac1000_ptp_clock_ops. The goal is to make
PTP_EXTTS_REQUEST2 work again for the rising edge, after the core started
validating extts flags.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
> index a37405534bebf..31a66e855d6b1 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
> @@ -277,6 +277,7 @@ const struct ptp_clock_info stmmac_ptp_clock_ops = {
> .n_per_out = 0, /* will be overwritten in stmmac_ptp_register */
> .n_pins = 0,
> .pps = 0,
> + .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
[Severity: Medium]
Does setting PTP_STRICT_FLAGS here also change how the legacy
PTP_EXTTS_REQUEST (v1) ioctl behaves on stmmac? The same applies to the
identical line added to dwmac1000_ptp_clock_ops.
For v1, ptp_extts_request() in drivers/ptp/ptp_chardev.c masks the flags
to PTP_EXTTS_V1_VALID_FLAGS, which still includes PTP_FALLING_EDGE. It
only treats the edge bits as hints when the driver does not set
PTP_STRICT_FLAGS:
drivers/ptp/ptp_chardev.c:ptp_extts_request() {
...
} else {
req.extts.flags &= PTP_EXTTS_V1_VALID_FLAGS;
memset(req.extts.rsv, 0, sizeof(req.extts.rsv));
}
...
if (!(supported_extts_flags & PTP_STRICT_FLAGS))
supported_extts_flags |= PTP_EXTTS_EDGES;
/* Reject unsupported flags */
if (req.extts.flags & ~supported_extts_flags)
return -EOPNOTSUPP;
...
}
Before this patch, supported_extts_flags was 0. Every v1 edge combination
therefore reached stmmac_enable() or dwmac1000_ptp_enable(), and both of
them ignore the edge bits.
After this patch, a v1 request with PTP_FALLING_EDGE set returns
-EOPNOTSUPP. That covers falling only and rising plus falling. It also
covers a v1 disable request that carries edge bits, because the check
runs whether or not PTP_ENABLE_FEATURE is set.
The in-tree tools/testing/selftests/ptp/testptp.c sends exactly these
requests for -E 2 and -E 3:
extts_request.flags = PTP_ENABLE_FEATURE | edge;
if (ioctl(fd, PTP_EXTTS_REQUEST, &extts_request)) {
Those calls appear to succeed today on stmmac and fail after this patch.
The commit message says:
Only the PTP_EXTTS_REQUEST ioctl still works.
That suggests v1 behaviour is unchanged. Could the commit message
describe the v1 change explicitly, since the patch is tagged for stable?
This does seem to be an unavoidable side effect of making
PTP_EXTTS_REQUEST2 work. The kernel-doc for supported_extts_flags in
include/linux/ptp_clock_kernel.h requires PTP_STRICT_FLAGS for
PTP_EXTTS_REQUEST2. Several other drivers already use PTP_RISING_EDGE |
PTP_STRICT_FLAGS, including ptp_qoriq, enetc, dpaa2, bnxt and am65-cpts.
> .adjfine = stmmac_adjust_freq,
> .adjtime = stmmac_adjust_time,
> .gettimex64 = stmmac_get_timex,
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261104052504.1886335-1-jjc%40jclark.com
Re: [PATCH net] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
Author: James Clark
Date: Thu, 05 Nov 2026 10:25
Date: Thu, 05 Nov 2026 10:25
13 lines
11785 bytes
11785 bytes
On Thu, 05 Nov 2026 10:08:43 +0000, netdev-bot+sashiko@kernel.org wrote: > The commit message says: > > Only the PTP_EXTTS_REQUEST ioctl still works. > > That suggests v1 behaviour is unchanged. Could the commit message > describe the v1 change explicitly, since the patch is tagged for stable? Sashiko made the same point on the equivalent am65-cpts fix, which was applied unchanged as e3aaeebbef56. My reply there applies here too: https://lore.kernel.org/all/20261022035226.1388675-1-jjc@jclark.com/
Re: [PATCH net] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
Author: patchwork-bot+netdevbpf
Date: Tue, 10 Nov 2026 18:40
Date: Tue, 10 Nov 2026 18:40
29 lines
9137 bytes
9137 bytes
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 4 Nov 2026 12:25:04 +0700 you wrote:
> Commit 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
> ptp_clock_info") modified the PTP core to validate the supported flags
> of external timestamp requests, rather than relying on each driver to
> check them.
>
> stmmac_enable() and dwmac1000_ptp_enable() ignore the flags, and
> neither stmmac_ptp_clock_ops nor dwmac1000_ptp_clock_ops was given any
> .supported_extts_flags. Since PTP_EXTTS_REQUEST2 always implies
> PTP_STRICT_FLAGS, the core now rejects every PTP_EXTTS_REQUEST2 for
> this driver with -EOPNOTSUPP, where before that commit the same
> requests succeeded. Only the PTP_EXTTS_REQUEST ioctl still works.
>
> [...]
Here is the summary with links:
- [net] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
https://git.kernel.org/netdev/net/c/b66fca408bf8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads