netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Jacob Keller <jacob.e.keller@intel.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Kory Maincent <kory.maincent@bootlin.com>
Cc: Richard Cochran <richardcochran@gmail.com>,
	Yaroslav Kolomiiets <yrk@meta.com>, James Clark <jjc@jclark.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 2/3] broadcom: fix support for PTP_EXTTS_REQUEST2 ioctl
Date: Fri, 19 Sep 2025 12:03:33 +0100	[thread overview]
Message-ID: <fedb5429-2e8d-42df-8080-9a8706407ad2@linux.dev> (raw)
In-Reply-To: <20250918-jk-fix-bcm-phy-supported-flags-v1-2-747b60407c9c@intel.com>

On 19/09/2025 01:33, Jacob Keller wrote:
> Commit 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
> ptp_clock_info") modified the PTP core kernel logic to validate the
> supported flags for the PTP_EXTTS_REQUEST ioctls, rather than relying on
> each individual driver correctly checking its flags.
> 
> The bcm_ptp_enable() function implements support for PTP_CLK_REQ_EXTTS, but
> does not check the flags, and does not forward the request structure into
> bcm_ptp_extts_locked().
> 
> When originally converting the bcm-phy-ptp.c code, it was unclear what
> edges the hardware actually timestamped. Thus, no flags were initialized in
> the .supported_extts_flags field. This results in the kernel automatically
> rejecting all userspace requests for the PTP_EXTTS_REQUEST2 ioctl.
> 
> This occurs because the PTP_STRICT_FLAGS is always assumed when operating
> under PTP_EXTTS_REQUEST2. This has been the case since the flags
> introduction by commit 6138e687c7b6 ("ptp: Introduce strict checking of
> external time stamp options.").
> 
> The bcm-phy-ptp.c logic never properly supported strict flag validation,
> as it previously ignored all flags including both PTP_STRICT_FLAGS and the
> PTP_FALLING_EDGE and PTP_RISING_EDGE flags.
> 
> Reports from users in the field prove that the hardware timestamps the
> rising edge. Encode this in the .supported_extts_flags field. This
> re-enables support for the PTP_EXTTS_REQUEST2 ioctl.
> 
> Reported-by: James Clark <jjc@jclark.com>
> Fixes: 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to ptp_clock_info")
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>   drivers/net/phy/bcm-phy-ptp.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/phy/bcm-phy-ptp.c b/drivers/net/phy/bcm-phy-ptp.c
> index 1cf695ac73cc..d3501f8487d9 100644
> --- a/drivers/net/phy/bcm-phy-ptp.c
> +++ b/drivers/net/phy/bcm-phy-ptp.c
> @@ -738,6 +738,7 @@ static const struct ptp_clock_info bcm_ptp_clock_info = {
>   	.n_per_out	= 1,
>   	.n_ext_ts	= 1,
>   	.supported_perout_flags = PTP_PEROUT_DUTY_CYCLE,
> +	.supported_extts_flags = PTP_STRICT_FLAGS | PTP_RISING_EDGE,
>   };
>   
>   static void bcm_ptp_txtstamp(struct mii_timestamper *mii_ts,
> 

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

  reply	other threads:[~2025-09-19 11:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19  0:33 [PATCH net 0/3] broadcom: report the supported flags for ancillary features Jacob Keller
2025-09-19  0:33 ` [PATCH net 1/3] broadcom: fix support for PTP_PEROUT_DUTY_CYCLE Jacob Keller
2025-09-19 11:02   ` Vadim Fedorenko
2025-09-19  0:33 ` [PATCH net 2/3] broadcom: fix support for PTP_EXTTS_REQUEST2 ioctl Jacob Keller
2025-09-19 11:03   ` Vadim Fedorenko [this message]
2025-09-19  0:33 ` [PATCH net 3/3] ptp: document behavior of PTP_STRICT_FLAGS Jacob Keller
2025-09-19 11:04   ` Vadim Fedorenko
2025-09-19  2:56 ` [PATCH net 0/3] broadcom: report the supported flags for ancillary features Richard Cochran
2025-09-19  8:39 ` Kory Maincent
2025-09-20  0:04 ` Jakub Kicinski
2025-09-21  1:26   ` James Clark
2025-09-22 19:30 ` patchwork-bot+netdevbpf

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=fedb5429-2e8d-42df-8080-9a8706407ad2@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jjc@jclark.com \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=yrk@meta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).