* [PATCH net RESEND 0/2] net: macb: Fix PTP timestamp configuration handling
@ 2026-09-11 8:04 kimwooseok
2026-09-11 8:04 ` [PATCH net RESEND 2/2] net: macb: Use all-frame timestamping for PTPv1 RX filters kimwooseok
2026-09-11 8:04 ` [PATCH net RESEND 1/2] net: macb: Preserve one-step mode on rejected timestamp requests kimwooseok
0 siblings, 2 replies; 5+ messages in thread
From: kimwooseok @ 2026-09-11 8:04 UTC (permalink / raw)
To: netdev, theo.lebrun
Cc: conor.dooley, andrew+netdev, davem, edumazet, kuba, pabeni,
richardcochran, linux-kernel
Resending the series as plain text to correct the previous multipart
webmail submission and the quoted and rewrapped patch bodies. There are
no code changes; the Assisted-by trailers now name the tool.
This series fixes two timestamp configuration problems in gem_set_hwtst().
A rejected RX-filter request can change the active TX one-step mode
while leaving the cached configuration unchanged. Patch 1 defers the
one-step mode update until both TX type and RX filter are validated.
The two specific PTPv1 RX filters currently succeed with RX timestamping
disabled. Patch 2 routes HWTSTAMP_FILTER_PTP_V1_L4_SYNC and
HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ through the existing all-frame
fallback and reports HWTSTAMP_FILTER_ALL to userspace. Both defects
originate in ab91f0a9b5f4 ("net: macb: Add hardware PTP support").
Both defects were reproduced on a Raspberry Pi 5 Model B Rev 1.1 with
macb eth0. Before the fixes, rejected requests changed OSSMODE in both
directions; each specific PTPv1 filter produced zero hardware timestamps
for 61 packets of its requested type. On 6.18.46-macb-ptp-functional-rt+,
both rejected requests preserved cached settings and the full NCR, and
each PTPv1 filter returned ALL and timestamped 60/60 Sync and 60/60
Delay_Req fixtures. ALL/NONE controls and all nine configuration cases
passed. The board was subsequently returned to its original kernel.
Additional validation:
- net 7f26a5e8040b: ARM64 allmodconfig and allyesconfig full targets
passed with GCC 14.2.0, W=1 and CONFIG_WERROR=n. After applying the
series, incremental builds of the same full targets passed with
identical configurations and no new warnings. Both rebuilt macb_ptp.o.
- Pi board configuration: Image.gz, modules and dtbs built with W=1;
the resulting kernel booted and passed the hardware tests above.
- Both final patches passed strict checkpatch including sign-off checks,
and standalone/series application checks on the net base.
The RX tests check raw hardware timestamp presence, not absolute
timestamp accuracy or PHC synchronization.
An LLM assisted with source analysis, preparation of the fixes and test
helpers, and drafting the descriptions. Results are from the recorded
board tests and build logs.
Assisted-by: GPT-6 Astra
kimwooseok (2):
net: macb: Preserve one-step mode on rejected timestamp requests
net: macb: Use all-frame timestamping for PTPv1 RX filters
base-commit: 7f26a5e8040b4957ef4dbdfcde6cc7ba2db53937
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net RESEND 1/2] net: macb: Preserve one-step mode on rejected timestamp requests
2026-09-11 8:04 [PATCH net RESEND 0/2] net: macb: Fix PTP timestamp configuration handling kimwooseok
2026-09-11 8:04 ` [PATCH net RESEND 2/2] net: macb: Use all-frame timestamping for PTPv1 RX filters kimwooseok
@ 2026-09-11 8:04 ` kimwooseok
2026-09-11 9:51 ` Nicolai Buchwitz
1 sibling, 1 reply; 5+ messages in thread
From: kimwooseok @ 2026-09-11 8:04 UTC (permalink / raw)
To: netdev, theo.lebrun
Cc: conor.dooley, andrew+netdev, davem, edumazet, kuba, pabeni,
richardcochran, linux-kernel
gem_set_hwtst() programs NCR.OSSMODE while processing tx_type, before
validating rx_filter. An unsupported receive filter can therefore cause
the operation to return -ERANGE after changing the active transmit mode.
The cached configuration is not updated, so a subsequent SIOCGHWTSTAMP
reports the previous transmit mode even though the hardware has changed.
For example, configure HWTSTAMP_TX_ON with HWTSTAMP_FILTER_ALL, then
request HWTSTAMP_TX_ONESTEP_SYNC with HWTSTAMP_FILTER_NTP_ALL. The latter
request fails but enables one-step synchronization. The reverse
transition can clear one-step mode despite returning the same error.
Defer programming the one-step mode until both the transmit type and
receive filter have been validated. Rejected receive filters then leave
the active transmit mode unchanged.
Fixes: ab91f0a9b5f4 ("net: macb: Add hardware PTP support")
Assisted-by: GPT-6 Astra
Signed-off-by: kimwooseok <5mghybrid@khu.ac.kr>
---
Resending as plain text because the previous webmail submission included
HTML and quoted and rewrapped the patch. No code changes; the Assisted-by
trailer now names the tool.
drivers/net/ethernet/cadence/macb_ptp.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c
index e5195d7..51659bb 100644
--- a/drivers/net/ethernet/cadence/macb_ptp.c
+++ b/drivers/net/ethernet/cadence/macb_ptp.c
@@ -418,11 +418,9 @@ int gem_set_hwtst(struct net_device *netdev,
case HWTSTAMP_TX_OFF:
break;
case HWTSTAMP_TX_ONESTEP_SYNC:
- gem_ptp_set_one_step_sync(bp, 1);
tx_bd_control = TSTAMP_ALL_FRAMES;
break;
case HWTSTAMP_TX_ON:
- gem_ptp_set_one_step_sync(bp, 0);
tx_bd_control = TSTAMP_ALL_FRAMES;
break;
default:
@@ -460,6 +458,11 @@ int gem_set_hwtst(struct net_device *netdev,
return -ERANGE;
}
+ if (tstamp_config->tx_type == HWTSTAMP_TX_ONESTEP_SYNC)
+ gem_ptp_set_one_step_sync(bp, 1);
+ else if (tstamp_config->tx_type == HWTSTAMP_TX_ON)
+ gem_ptp_set_one_step_sync(bp, 0);
+
bp->tstamp_config = *tstamp_config;
if (gem_ptp_set_ts_mode(bp, tx_bd_control, rx_bd_control) != 0)
--
2.53.0.windows.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net RESEND 2/2] net: macb: Use all-frame timestamping for PTPv1 RX filters
2026-09-11 8:04 [PATCH net RESEND 0/2] net: macb: Fix PTP timestamp configuration handling kimwooseok
@ 2026-09-11 8:04 ` kimwooseok
2026-09-11 9:55 ` Nicolai Buchwitz
2026-09-11 8:04 ` [PATCH net RESEND 1/2] net: macb: Preserve one-step mode on rejected timestamp requests kimwooseok
1 sibling, 1 reply; 5+ messages in thread
From: kimwooseok @ 2026-09-11 8:04 UTC (permalink / raw)
To: netdev, theo.lebrun
Cc: conor.dooley, andrew+netdev, davem, edumazet, kuba, pabeni,
richardcochran, linux-kernel
gem_set_hwtst() accepts HWTSTAMP_FILTER_PTP_V1_L4_SYNC and
HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ without changing rx_bd_control from
TSTAMP_DISABLED. A successful request thus disables receive timestamping
while reporting the requested nonempty filter to userspace.
Handle these two filters through the existing all-frame fallback used
for HWTSTAMP_FILTER_PTP_V1_L4_EVENT. This enables receive timestamping
for a superset of the requested packets and returns HWTSTAMP_FILTER_ALL
to describe the configuration actually selected.
Fixes: ab91f0a9b5f4 ("net: macb: Add hardware PTP support")
Assisted-by: GPT-6 Astra
Signed-off-by: kimwooseok <5mghybrid@khu.ac.kr>
---
Resending as plain text because the previous webmail submission included
HTML and quoted and rewrapped the patch. No code changes; the Assisted-by
trailer now names the tool.
drivers/net/ethernet/cadence/macb_ptp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c
index 51659bb..2ffc46b 100644
--- a/drivers/net/ethernet/cadence/macb_ptp.c
+++ b/drivers/net/ethernet/cadence/macb_ptp.c
@@ -430,10 +430,6 @@ int gem_set_hwtst(struct net_device *netdev,
switch (tstamp_config->rx_filter) {
case HWTSTAMP_FILTER_NONE:
break;
- case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
- break;
- case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
- break;
case HWTSTAMP_FILTER_PTP_V2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
@@ -448,6 +444,8 @@ int gem_set_hwtst(struct net_device *netdev,
regval = macb_readl(bp, NCR);
macb_writel(bp, NCR, (regval | MACB_BIT(SRTSM)));
break;
+ case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
+ case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
case HWTSTAMP_FILTER_ALL:
rx_bd_control = TSTAMP_ALL_FRAMES;
--
2.53.0.windows.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net RESEND 1/2] net: macb: Preserve one-step mode on rejected timestamp requests
2026-09-11 8:04 ` [PATCH net RESEND 1/2] net: macb: Preserve one-step mode on rejected timestamp requests kimwooseok
@ 2026-09-11 9:51 ` Nicolai Buchwitz
0 siblings, 0 replies; 5+ messages in thread
From: Nicolai Buchwitz @ 2026-09-11 9:51 UTC (permalink / raw)
To: kimwooseok
Cc: netdev, theo.lebrun, conor.dooley, andrew+netdev, davem, edumazet,
kuba, pabeni, richardcochran, linux-kernel
Hi Kimwoo
On 11.9.2026 10:04, kimwooseok wrote:
> gem_set_hwtst() programs NCR.OSSMODE while processing tx_type, before
> validating rx_filter. An unsupported receive filter can therefore cause
> the operation to return -ERANGE after changing the active transmit
> mode.
> The cached configuration is not updated, so a subsequent SIOCGHWTSTAMP
> reports the previous transmit mode even though the hardware has
> changed.
>
> For example, configure HWTSTAMP_TX_ON with HWTSTAMP_FILTER_ALL, then
> request HWTSTAMP_TX_ONESTEP_SYNC with HWTSTAMP_FILTER_NTP_ALL. The
> latter
> request fails but enables one-step synchronization. The reverse
> transition can clear one-step mode despite returning the same error.
>
> Defer programming the one-step mode until both the transmit type and
> receive filter have been validated. Rejected receive filters then leave
> the active transmit mode unchanged.
>
> Fixes: ab91f0a9b5f4 ("net: macb: Add hardware PTP support")
> Assisted-by: GPT-6 Astra
> Signed-off-by: kimwooseok <5mghybrid@khu.ac.kr>
> ---
> Resending as plain text because the previous webmail submission
> included
> HTML and quoted and rewrapped the patch. No code changes; the
> Assisted-by
> trailer now names the tool.
>
> drivers/net/ethernet/cadence/macb_ptp.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb_ptp.c
> b/drivers/net/ethernet/cadence/macb_ptp.c
> index e5195d7..51659bb 100644
> --- a/drivers/net/ethernet/cadence/macb_ptp.c
> +++ b/drivers/net/ethernet/cadence/macb_ptp.c
> @@ -418,11 +418,9 @@ int gem_set_hwtst(struct net_device *netdev,
> case HWTSTAMP_TX_OFF:
> break;
> case HWTSTAMP_TX_ONESTEP_SYNC:
> - gem_ptp_set_one_step_sync(bp, 1);
> tx_bd_control = TSTAMP_ALL_FRAMES;
> break;
> case HWTSTAMP_TX_ON:
> - gem_ptp_set_one_step_sync(bp, 0);
> tx_bd_control = TSTAMP_ALL_FRAMES;
> break;
> default:
> @@ -460,6 +458,11 @@ int gem_set_hwtst(struct net_device *netdev,
> return -ERANGE;
> }
>
> + if (tstamp_config->tx_type == HWTSTAMP_TX_ONESTEP_SYNC)
> + gem_ptp_set_one_step_sync(bp, 1);
> + else if (tstamp_config->tx_type == HWTSTAMP_TX_ON)
> + gem_ptp_set_one_step_sync(bp, 0);
> +
> bp->tstamp_config = *tstamp_config;
>
> if (gem_ptp_set_ts_mode(bp, tx_bd_control, rx_bd_control) != 0)
Reviewed-by: Nicolai Buchwitz <nb@tip-net.de>
Tested-by: Nicolai Buchwitz <nb@tipi-net.de> # Raspberry Pi CM5
Thanks,
Nicolai
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net RESEND 2/2] net: macb: Use all-frame timestamping for PTPv1 RX filters
2026-09-11 8:04 ` [PATCH net RESEND 2/2] net: macb: Use all-frame timestamping for PTPv1 RX filters kimwooseok
@ 2026-09-11 9:55 ` Nicolai Buchwitz
0 siblings, 0 replies; 5+ messages in thread
From: Nicolai Buchwitz @ 2026-09-11 9:55 UTC (permalink / raw)
To: kimwooseok
Cc: netdev, theo.lebrun, conor.dooley, andrew+netdev, davem, edumazet,
kuba, pabeni, richardcochran, linux-kernel
Hi Kimwoo
On 11.9.2026 10:04, kimwooseok wrote:
> gem_set_hwtst() accepts HWTSTAMP_FILTER_PTP_V1_L4_SYNC and
> HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ without changing rx_bd_control from
> TSTAMP_DISABLED. A successful request thus disables receive
> timestamping
> while reporting the requested nonempty filter to userspace.
>
> Handle these two filters through the existing all-frame fallback used
> for HWTSTAMP_FILTER_PTP_V1_L4_EVENT. This enables receive timestamping
> for a superset of the requested packets and returns HWTSTAMP_FILTER_ALL
> to describe the configuration actually selected.
>
> Fixes: ab91f0a9b5f4 ("net: macb: Add hardware PTP support")
> Assisted-by: GPT-6 Astra
> Signed-off-by: kimwooseok <5mghybrid@khu.ac.kr>
> ---
> Resending as plain text because the previous webmail submission
> included
> HTML and quoted and rewrapped the patch. No code changes; the
> Assisted-by
> trailer now names the tool.
>
> drivers/net/ethernet/cadence/macb_ptp.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb_ptp.c
> b/drivers/net/ethernet/cadence/macb_ptp.c
> index 51659bb..2ffc46b 100644
> --- a/drivers/net/ethernet/cadence/macb_ptp.c
> +++ b/drivers/net/ethernet/cadence/macb_ptp.c
> @@ -430,10 +430,6 @@ int gem_set_hwtst(struct net_device *netdev,
> switch (tstamp_config->rx_filter) {
> case HWTSTAMP_FILTER_NONE:
> break;
> - case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
> - break;
> - case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
> - break;
> case HWTSTAMP_FILTER_PTP_V2_EVENT:
> case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
> case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
> @@ -448,6 +444,8 @@ int gem_set_hwtst(struct net_device *netdev,
> regval = macb_readl(bp, NCR);
> macb_writel(bp, NCR, (regval | MACB_BIT(SRTSM)));
> break;
> + case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
> + case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
> case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
> case HWTSTAMP_FILTER_ALL:
> rx_bd_control = TSTAMP_ALL_FRAMES;
Reviewed-by: Nicolai Buchwitz <nb@tip-net.de>
Tested-by: Nicolai Buchwitz <nb@tipi-net.de> # Raspberry Pi CM5
Thanks,
Nicolai
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-11 9:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-11 8:04 [PATCH net RESEND 0/2] net: macb: Fix PTP timestamp configuration handling kimwooseok
2026-09-11 8:04 ` [PATCH net RESEND 2/2] net: macb: Use all-frame timestamping for PTPv1 RX filters kimwooseok
2026-09-11 9:55 ` Nicolai Buchwitz
2026-09-11 8:04 ` [PATCH net RESEND 1/2] net: macb: Preserve one-step mode on rejected timestamp requests kimwooseok
2026-09-11 9:51 ` Nicolai Buchwitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox