Article View: linux.kernel.netdev
Article #22295Re: [PATCH net v5 4/8] ptp: ocp: handle hardware selectors and combined DPLL input routes
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 04:44
Date: Wed, 25 Nov 2026 04:44
161 lines
13465 bytes
13465 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 1
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] Because of this patch, ptp_ocp_dpll_frequency_get() now
succeeds for input selectors that feed several destinations.
- [Low] The commit message understates the impact of the SMA_SELECT_MASK
change in ptp_ocp_dpll_frequency_get() (drivers/ptp/ptp_ocp.c).
--
ptp: ocp: handle hardware selectors and combined DPLL input routes
This commit changes ptp_ocp_dpll_frequency_set() to pass the selector
table value to ptp_ocp_sma_store_val() instead of the table index. It
also masks the direction enable bit in ptp_ocp_dpll_frequency_get().
For input selectors that feed several destinations, frequency_get now
returns a frequency, or zero, instead of -EINVAL.
Link: https://lore.kernel.org/r/179502617840.3136.12704245716223038161@kernel.org
Link: https://lore.kernel.org/r/179538006772.3135.15875996486888374193@kernel.org
> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> index b16d36c3305f9..df1a428eb2fed 100644
> --- a/drivers/ptp/ptp_ocp.c
> +++ b/drivers/ptp/ptp_ocp.c
[ ... ]
> @@ -5887,6 +5888,7 @@ static int ptp_ocp_dpll_frequency_get(const struct dpll_pin *pin,
> int i;
>
> val = bp->sma_op->get(bp, sma_nr + 1);
> + val &= SMA_SELECT_MASK;
[Severity: Low]
The commit message mentions this mask only briefly:
"and mask the direction enable bit before looking up the frequency."
It then gives the combined-input case (selector 0x000c) as the reason
the get-before-set step and the pin dump fail. Is that the whole impact?
ptp_ocp_sma_fb_get() returns the full 16-bit half-register:
return (ioread32(gpio) >> shift) & 0xffff;
ptp_ocp_sma_store_val() always adds the enable bit when the direction
is not fixed:
if (!sma->fixed_dir)
val |= SMA_ENABLE; /* add enable bit */
ptp_ocp_sma_fb_init() also uses BIT(15) to work out each pin's
direction, so that bit is normally set for the active direction.
Every table value is below BIT(15). Before this patch, wouldn't a
readback such as 0x8001 for PPS1 never match a table entry? That would
make frequency_get return -EINVAL for every SMA pin on FB, ADVA and
ADVA-X1 boards whose direction can change, not only for combined
routes.
If so, DPLL pin-get/dump failed for those pins. dpll_pin_freq_set()
also stopped at "unable to get old frequency value", so frequency
changes never ran either.
Could the commit message state this more directly, since it affects
stable backport priority?
> tbl = bp->sma_op->tbl[sma->mode];
> for (i = 0; tbl[i].name; i++)
> if (val == tbl[i].value) {
> @@ -5894,7 +5896,28 @@ static int ptp_ocp_dpll_frequency_get(const struct dpll_pin *pin,
> return 0;
> }
>
> - return -EINVAL;
> + if (sma->mode == SMA_MODE_OUT)
> + return -EINVAL;
> +
> + /* Inputs can feed several destinations, including timestampers. */
> + *frequency = 0;
> + for (i = 0; tbl[i].name; i++) {
> + if (!(val & tbl[i].value))
> + continue;
> + val &= ~tbl[i].value;
> + if (!tbl[i].frequency)
> + continue;
> + if (*frequency && *frequency != tbl[i].frequency) {
> + *frequency = 0;
> + return 0;
> + }
> + *frequency = tbl[i].frequency;
> + }
> + /* Unknown destinations do not establish a frequency either. */
> + if (val)
> + *frequency = 0;
> +
> + return 0;
[Severity: Medium]
With this change, ptp_ocp_dpll_frequency_get() succeeds for input
selectors that feed several destinations. For example, PPS1|TS1
(0x0005) reports 1 Hz and TS1|TS2 (0x000c) reports 0 Hz.
These selectors used to return -EINVAL, so dpll_pin_freq_set() stopped
before reaching frequency_set:
drivers/dpll/dpll_netlink.c:dpll_pin_freq_set() {
...
ret = ops->frequency_get(pin, ..., &old_freq, extack);
if (ret) {
NL_SET_ERR_MSG(extack, "unable to get old frequency value");
return ret;
}
if (freq == old_freq)
return 0;
ret = ops->frequency_set(...);
...
}
Now the set runs. ptp_ocp_dpll_frequency_set() takes the first table
entry with the requested frequency and stores only that value:
return ptp_ocp_sma_store_val(bp, tbl[i].value,
sma->mode, sma_nr + 1);
ptp_ocp_sma_fb_set_inputs() and ptp_ocp_sma_adva_set_inputs() then
replace the pin's whole 16-bit selector half:
reg = (reg & mask) | (val << shift);
Does this silently drop TS1..TS4 or FREQ1..FREQ4 routes that were set
up through sysfs?
For example, after "IN: PPS1 TS1" is written to the smaN attribute, a
DPLL pin-set to 10 MHz would store 0x0000. That removes the TS1 route,
so EXTTS timestamping on that input stops and no error is reported.
The get path treats timestamp and counter destinations as not
constraining the frequency, but the set path throws them away. Should
ptp_ocp_dpll_frequency_set() keep the destination bits that carry no
frequency, or reject the change when the input has a combined route?
> }
>
> static const struct dpll_device_ops dpll_ops = {
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123-timecard-common-v5-d669cfa034-0-ahmadexp%40gmail.com
Technical Details
Message-ID:
<179558188666.3135.18134824042622584333@kernel.org>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371026-linux-kernel-netdev=dewy.ruReferences:
<20261123-timecard-common-v5-d669cfa034-4-ahmadexp@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371026-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v5 4/8] ptp: ocp: handle hardware selectors and combined DPLL input routes Date: Wed, 25 Nov 2026 04:44:46 +0000 Organization: Usenet Network Message-ID: <179558188666.3135.18134824042622584333@kernel.org> References: <20261123-timecard-common-v5-d669cfa034-4-ahmadexp@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="113025"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:T/AN3qCQVn42pffT3gobpGb7M78= sha256:hra4c5EKOg5cYiCZB4F19I1BQf7JoVDjv6m1xIOoKYM= sha1:orgar4DNKZzIQ6B9l9FI3Djfrw4= sha256:vL8gmzYdT2HhhbM1gbd3ZGs2nFi2eFAGcyXTV5hSbfo= 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 7905F125E37; Wed, 25 Nov 2026 07:45:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.5 X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31 tests=[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 RDhPK85qwsDJ; Wed, 25 Nov 2026 07:45:03 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371026-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 B6419125E3A; Wed, 25 Nov 2026 07:44:53 +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 C0EF434311; Wed, 25 Nov 2026 04:44:49 +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=1795581889; b=1lOaTqH8U8p6TU0v1VYKcQWCSRVVdD7SwPikuwhKgVH/c9HeQVCQfkhrcKnAUMtzWpd0 akrCAxDnMnIlgrPwKd9XszlFS5/+CCeQ/84mF3LnoNmXrdsjnsv7zDQteEpz31Txgh/4v wfY5v3xi4dvEO9TLhi0ki1MvytxnmKqdQ7GK9Y2mwcHDnPVb+U7hLwuJodGyel1xZJCOi zT8MOkJPI1LQQQH9KJvly7nglvoXb4uOu2yuEREPUYZjO58a4eI3HXWAJ+FVzMfRo7+Xs XUX+6eZi81ckdZmFqdGaqhvqFimp1mTqKnN2K/nGHeb0kIDaTW6vnpCobOVqWbszDKQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795581889; 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=6IdGK5WInaBvMsUprt+v9M83CkD3NbHR9SVF1D0/8Tc=; b=xkiWPw4Txmljj/EQA8nsWNBBC9eyzvYOsK8PzRfiObzUFiVnDNgS2+Atsfi2gzNjnBop OwhRcZfPE6dwkKfhYJsH7uAxiUuWWU4qimt0vUj9w8MKAZ4e3Mgmm/+cIAzh6j5C5tC6R jB7+G+OYwe/9zITmD+c6AX0Bti4c93Jzi67pdvWPVzRpL9bmiU8AfhF/3x7YRrwl6y1rw oalRunJvdReKbGvU4JIeTqg0n8OaWlyBYY8Sjnhwrkda4uCaWWEBCzsQhSmy3+rfE43zu nfJ5CFRlTy35a7RKcL5TIzLgh55a4RnM0CU2/x6dllh2uwafWn3/GjG1qRh8SMTeepQ== 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=RH6YgMHi; 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 4066E606A330; Wed, 25 Nov 2026 04:44:49 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RH6YgMHi 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=1795581888; b=qDAUy1G2rdTAQs+0f2Pl1FZHAWnKeYhyxU4FQMYPS5aDVJdAEqq3zR0HJzVsG35kpz4g oYRyXjRF6E8mesjYB6DE8yRnN7jII7zpJUAKXV+nvxDxb1z1oJwQoeYXiFuSO5aeZles7 ejULdBwidWKXnyX8R4Ck4+OAAj8ZQudnSQc8fMAYl6w6gUyFH+l3q9HbhbZK4Wvv1hdMA /FRfO9FcqtUsnescBxx6m8POKHUhQnA1rS2kfVwicFbpuJOKO4Xv2MfGWGgzHs/ZRDxqv 03BuChRK2Vl8R7gT3ve651sEwBGSDHQeqCywZ9xHfHapQrQJjmz32xT6KAQolIF/DsA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795581888; 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=6IdGK5WInaBvMsUprt+v9M83CkD3NbHR9SVF1D0/8Tc=; b=SiFs/lof67HDcw9k9a+AqzRbpzdCdt8DtDFgMNJH//VSVxfFYb5kh6tZKPDFXPNHXJ3w IyKj34Enlf8wALygCYT4DX0P9CSw5G8ODoG+eYsrO/CGKyPes/HIzRzG3wfWgDx7wqNkj MxDwBi02ERETD9041Vg/jMU0LPBy1SjxFG1ILs8R9wkRp892ZG8FHtIVUnpcv1Rob8zru xQUjjhKTfWEpjPfz8D2vx6lawjiAPMFYF+dpc3lsjGiOLwjuAni6VF321qVzrRn9roxxG HkQm/BMleWhGk596P779S34Lxnq5tN+f4aFOWqcz9m2vcB5N6DpufWOQt207zFvhl/g== 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=RH6YgMHi; 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 62F8F606A335; Wed, 25 Nov 2026 04:44:48 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1364F1F000C6; Wed, 25 Nov 2026 04:44:47 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795581887; bh=6IdGK5WInaBvMsUprt+v9M83CkD3NbHR9SVF1D0/8Tc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=RH6YgMHiIhY4wiIG/po72R0idyuh+Xjosr0Ly02FnUcH4mdzrn0R6YU2vLzM6UlCb LXaK9wBw0GeflhsjIsB9/vbdiI4N5AZfbvco29TAubA/q3dsPV9OGkCYtCy74ijmD5 3a/fy8cshHHtGS7jd5Mt7wIC1CgU33iTBSNkBeBjlZXo92Xchg5+PP/j2qR3lKgmmF imsaVyOK52aTZuMLTWm8CjcWAdgn7sjm9myYC+npMKl8lXy8FUPR1jvbGUZC+BOsg0 QD5tw4jMbZ0YsvoeLbZGQepJWJYM3Nx01e8A1PpSw6ArAkWkQRYh0flgVBR21qEfDU TsygpXEUDvtCQ== X-Cc: netdev@vger.kernel.org, andrew@lunn.ch, arkadiusz.kubalewski@intel.com, arnd@arndb.de, davem@davemloft.net, edumazet@kernel.org, jiri@resnulli.us, john.stultz@linaro.org, jonathan.lemon@gmail.com, kuba@kernel.org, linux-kernel@vger.kernel.org, olteanv@gmail.com, pabeni@redhat.com, richardcochran@gmail.com, rmk+kernel@armlinux.org.uk, vadim.fedorenko@linux.dev X-In-Reply-To: <20261123-timecard-common-v5-d669cfa034-4-ahmadexp@gmail.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