🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11578

Re: [PATCH net] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl

#11578
From: netdev-bot+sashiko
Date: Thu, 05 Nov 2026 10:08
97 lines
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
Technical Details
Message-ID: <179387332308.488856.2315265262072517836@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357209-linux-kernel-netdev=dewy.ru
References: <20261104052504.1886335-1-jjc@jclark.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357209-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
Date: Thu, 05 Nov 2026 10:08:43 +0000
Organization: Usenet Network
Message-ID: <179387332308.488856.2315265262072517836@kernel.org>
References: <20261104052504.1886335-1-jjc@jclark.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3611382"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:7P20YAialUjO79ehZX7WPRN2NSU= sha256:/4n9hAPFCsxDiAR5Ocfsil4NS1yzALiylM864vIcWoU=
	sha1:rtEcEI1eSxP6DQz7dhk9rMdDMSk= sha256:BxHVnPbn/cmLe1By1e+CTPVXEd6d3xfF5A55YToHKJI=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 89AD7112F06; Thu,  5 Nov 2026 13:23:42 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id ELPHraIgKMlg;
	Thu,  5 Nov 2026 13:23:38 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-357209-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 91F5E112EB4; Thu,  5 Nov 2026 13:23:29 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id D953947018; Thu,  5 Nov 2026 10:13:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793873335;
	b=Igq+ysoOFqKE5TRs+rd8ZsLV3abuHGiSZqAmQjW2L73bNHFGeiFUxPNzDW/0vgtze3kg
	 BCqnFrBTa3okYU4i+RBjGwfJjlOJNS/jiKWPmeREy560KMYW82XVjfYvh66ibMLEKcywB
	 sue70dUX1nqnKNdI6LOMzWJtr2M8LQIzZoSUX/u3etSa7VavOAG6gDyjvvEKFWZXHllF9
	 ATTtZP6OknSd+0FQGJza4sXzHK9sEwxZPlsiJfrzX907BDe3+4XzsDZuUkf4wHP/oIPP7
	 Vcf0M6s3tinr/aaAt6TvuX0nm60WLy69Rw93DyRxwR0xMs0p+SP8KMn9lzj5GwGL8/w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793873335;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=9ljaJUV/TRI3RGVt/rJLh+4MvxHbKlzUwSPpPMcnbiI=;
	b=cW5o+rRrhF5GTELiunD9wUBq178P6KUOKahYmCEBNqBMhVVmaNKYiJyRPGUs+LSft0Zh
	 coXFo7C/0QfV+CJmvfaRUauLeTSSKFE4wXlBlPQbiZuc9VQWjsiPfTe2Ea4kBbRkDG8V4
	 Pk7pW+BljOQZf/TOqrHHE2CAfXFWE9r2MWeU+R9lN6Kf4/2dFws8KeZYrFzAUVzoBMwGH
	 zerk0SiAiCTl33ZHEcm0CkHmIAuv90hm3WSt1A37PIVB3ohP9DAGbAqQ42SZ4n1RsWdaI
	 OupaXGUs3cPtBXBAZfYE9mxH7HEaRSfSiztqPtnUTXtHMGzqIpew9hC45t8ZD+7fmQA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Kfh5lukI;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A91E360A5BDC;
	Thu,  5 Nov 2026 10:08:55 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Kfh5lukI
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793873324;
	b=o0DRN+fx4PtiTaXy4ICOGV7Uy7k14wGarrNzwZejUsAo7wL+NAFAT+StUlm9OEoI4jrQ
	 G1VQ7dKwo6fW+BPtVBhbBrp/MklB+DU7k20mL9aJ0EsfhSG1e29rxIrB3hoxbrP3ev4fe
	 zXUZsczd9SV/xSf32D6w47Nz/bYwNXa8HQ44OzRCaMu7saics1CHWnEr1yY5ti/YFC/Mh
	 7DFQE3fo+fp1lhE0ckDA6MeRNKyJHbnkozpRwy2tS9TpnKmzFRlw4WU3ZDWbFT4Ws9Qts
	 3uiigu9UuTXeWp5NlLRYfgejhlzODU2m/UI6RPqTe3S77og+US7iy7FAl7/sXFN5shA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793873324;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=9ljaJUV/TRI3RGVt/rJLh+4MvxHbKlzUwSPpPMcnbiI=;
	b=x4wKSPQvBqdRmgiGwpZq8ZuBiFhaldqO70I4B8nnrzmWpQ+/1gAQ9kkFATmPYkM323Bg
	 rmyEYr3vUtTUT7sk5adHZ44AqGABAXbkU7O4XtFschFqK56VM9154vg4TBtXjoyugnZMY
	 FbvImnl67JadzppxHOdLgZq1fVZsDJX/x2IAB8Lv2vgLBlynq1+1l7TNtOvdSwUAoKm1n
	 sE5aVrhiI7NCukq97gcsFv2iMBalQTYGD7F5KzpD90g71KBlzkaUn0fSGpPUpf4CVhE5i
	 rV8bjoP/jezskKJqiY/c5Jzuu10LHxDviva9QF4Tcv/rQ4EOKPuhnDuJpDdMM5nZErw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Kfh5lukI;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82D3360A5BCD;
	Thu,  5 Nov 2026 10:08:44 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 840021F000C1;
	Thu,  5 Nov 2026 10:08:43 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793873324;
	bh=9ljaJUV/TRI3RGVt/rJLh+4MvxHbKlzUwSPpPMcnbiI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Kfh5lukIX7pVtv1xSFtvpTVcpEoqZsZgwQsy2Tru1YL6WykZorV+WeEYAklBQSgfZ
	 n3vpbj6/maJRSXTTJ4TyPIzzI2KbB6fpG4v/aEBp3dQlUCYhrjFcgM3VYNeBYzhdp2
	 +GyfKtcNrQsO01IfZysFLpbtp8RUl3ZCOxUPyeBGdz6e3nF8/5J3gvbOsvo0X7pJml
	 NJikJt3f3XHlm+uLnhaNYVkc9LsgmXVs6z8Xl4sWm/+fHZe1/uZh3iNLRdj8jzodAO
	 QuKhO8ZQxq5d1MdJEH2lboCSWtXgjfjGdexF3+8LRyevRGw4o8JELix19Yx0fAOj67
	 34+CZOAiP+VIQ==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, maxime.chevallier@bootlin.com,
 mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com,
 richardcochran@gmail.com, jacob.e.keller@intel.com, kory.maincent@bootlin.com,
 netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
 linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261104052504.1886335-1-jjc@jclark.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list