From: Nicolai Buchwitz <nb@tipi-net.de>
To: kimwooseok <5mghybrid@khu.ac.kr>
Cc: netdev@vger.kernel.org, theo.lebrun@bootlin.com,
conor.dooley@microchip.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, richardcochran@gmail.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net RESEND 1/2] net: macb: Preserve one-step mode on rejected timestamp requests
Date: Fri, 11 Sep 2026 11:51:07 +0200 [thread overview]
Message-ID: <6928c282c12e03e4487f75afef4f0080@tipi-net.de> (raw)
In-Reply-To: <178911388614.25348.8892025153904636456.macb-resend-1@khu.ac.kr>
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
next prev parent reply other threads:[~2026-09-11 9:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 1/2] net: macb: Preserve one-step mode on rejected timestamp requests kimwooseok
2026-09-11 9:51 ` Nicolai Buchwitz [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6928c282c12e03e4487f75afef4f0080@tipi-net.de \
--to=nb@tipi-net.de \
--cc=5mghybrid@khu.ac.kr \
--cc=andrew+netdev@lunn.ch \
--cc=conor.dooley@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=theo.lebrun@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.