From: Jacob Keller <jacob.e.keller@intel.com>
To: "Paolo Abeni" <pabeni@redhat.com>,
"Tony Nguyen" <anthony.l.nguyen@intel.com>,
"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Richard Cochran" <richardcochran@gmail.com>,
"Ruud Bos" <kernel.hbk@gmail.com>,
"Paul Barker" <paul.barker.ct@bp.renesas.com>,
"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Bryan Whitehead" <bryan.whitehead@microchip.com>,
UNGLinuxDriver@microchip.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>,
"Jonathan Lemon" <jonathan.lemon@gmail.com>,
"Lasse Johnsen" <l@ssejohnsen.me>,
"Vadim Fedorenko" <vadim.fedorenko@linux.dev>,
"Michal Swiatkowski" <michal.swiatkowski@linux.intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH net v2 0/5] net: ptp: fix egregious supported flag checks
Date: Wed, 19 Mar 2025 16:56:47 -0700 [thread overview]
Message-ID: <f4a88a97-e655-4e39-a8fc-667223e217a3@intel.com> (raw)
In-Reply-To: <4cfeb80e-8799-44dc-9b8b-7b7e0e329541@redhat.com>
On 3/19/2025 2:21 PM, Paolo Abeni wrote:
> On 3/12/25 11:15 PM, Jacob Keller wrote:
>> In preparation for adding .supported_extts_flags and
>> .supported_perout_flags to the ptp_clock_info structure, fix a couple of
>> places where drivers get existing flag gets grossly incorrect.
>>
>> The igb driver claims 82580 supports strictly validating PTP_RISING_EDGE
>> and PTP_FALLING_EDGE, but doesn't actually check the flags. Fix the driver
>> to require that the request match both edges, as this is implied by the
>> datasheet description.
>>
>> The renesas driver also claims to support strict flag checking, but does
>> not actually check the flags either. I do not have the data sheet for this
>> device, so I do not know what edge it timestamps. For simplicity, just
>> reject all requests with PTP_STRICT_FLAGS. This essentially prevents the
>> PTP_EXTTS_REQUEST2 ioctl from working. Updating to correctly validate the
>> flags will require someone who has the hardware to confirm the behavior.
>>
>> The lan743x driver supports (and strictly validates) that the request is
>> either PTP_RISING_EDGE or PTP_FALLING_EDGE but not both. However, it does
>> not check the flags are one of the known valid flags. Thus, requests for
>> PTP_EXT_OFF (and any future flag) will be accepted and misinterpreted. Add
>> the appropriate check to reject unsupported PTP_EXT_OFF requests and future
>> proof against new flags.
>>
>> The broadcom PHY driver checks that PTP_PEROUT_PHASE is not set. This
>> appears to be an attempt at rejecting unsupported flags. It is not robust
>> against flag additions such as the PTP_PEROUT_ONE_SHOT, or anything added
>> in the future. Fix this by instead checking against the negation of the
>> supported PTP_PEROUT_DUTY_CYCLE instead.
>>
>> The ptp_ocp driver supports PTP_PEROUT_PHASE and PTP_PEROUT_DUTY_CYCLE, but
>> does not check unsupported flags. Add the appropriate check to ensure
>> PTP_PEROUT_ONE_SHOT and any future flags are rejected as unsupported.
>>
>> These are changes compile-tested, but I do not have hardware to validate the
>> behavior.
>>
>> There are a number of other drivers which enable periodic output or
>> external timestamp requests, but which do not check flags at all. We could
>> go through each of these drivers one-by-one and meticulously add a flag
>> check. Instead, these drivers will be covered only by the upcoming
>> .supported_extts_flags and .supported_perout_flags checks in a net-next
>> series.
>>
>> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
>
> I admit I'm the most significant source of latency, but this series is
> IMHO a bit risky to land this late in the cycle in the net tree,
> especially considering the lack of H/W testing for the BCM phy.
>
> What about applying this to net-next instead?
>
> Thanks,
>
> Paolo
>
I am fine with that. I only sent to net originally because I thought
some folks might consider these worthy of backports due to the potential
for user-error. However, given the minimal testing it may make sense to
go ahead with next. Obviously no real users have complained about the
situation, and this is more in preparation to make the kernel more
resilient to such mistakes in the future with the .supported_*_flags
modifications coming next cycle.
Thanks,
Jake
next prev parent reply other threads:[~2025-03-19 23:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-12 22:15 [PATCH net v2 0/5] net: ptp: fix egregious supported flag checks Jacob Keller
2025-03-12 22:15 ` [PATCH net v2 1/5] igb: reject invalid external timestamp requests for 82580-based HW Jacob Keller
2025-03-18 14:06 ` Simon Horman
2025-03-12 22:15 ` [PATCH net v2 2/5] renesas: reject PTP_STRICT_FLAGS as unsupported Jacob Keller
2025-03-13 9:45 ` Niklas Söderlund
2025-03-18 14:07 ` Simon Horman
2025-03-12 22:15 ` [PATCH net v2 3/5] net: lan743x: reject unsupported external timestamp requests Jacob Keller
2025-03-18 14:08 ` Simon Horman
2025-03-12 22:15 ` [PATCH net v2 4/5] broadcom: fix supported flag check in periodic output function Jacob Keller
2025-03-18 14:09 ` Simon Horman
2025-03-12 22:15 ` [PATCH net v2 5/5] ptp: ocp: reject unsupported periodic output flags Jacob Keller
2025-03-18 14:10 ` Simon Horman
2025-03-19 21:21 ` [PATCH net v2 0/5] net: ptp: fix egregious supported flag checks Paolo Abeni
2025-03-19 23:56 ` Jacob Keller [this message]
2025-03-20 8:20 ` 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=f4a88a97-e655-4e39-a8fc-667223e217a3@intel.com \
--to=jacob.e.keller@intel.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bryan.whitehead@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jonathan.lemon@gmail.com \
--cc=kernel.hbk@gmail.com \
--cc=kuba@kernel.org \
--cc=l@ssejohnsen.me \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=pabeni@redhat.com \
--cc=paul.barker.ct@bp.renesas.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=richardcochran@gmail.com \
--cc=vadim.fedorenko@linux.dev \
/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).