From: Ivan Vecera <ivecera@redhat.com>
To: Vadim Fedorenko <vadim.fedorenko@linux.dev>, netdev@vger.kernel.org
Cc: Michal Schmidt <mschmidt@redhat.com>,
Petr Oros <poros@redhat.com>,
Prathosh Satish <Prathosh.Satish@microchip.com>,
Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>,
Jiri Pirko <jiri@resnulli.us>, Jonathan Corbet <corbet@lwn.net>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Donald Hunter <donald.hunter@gmail.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 1/2] dpll: add phase-adjust-gran pin attribute
Date: Wed, 29 Oct 2025 12:17:52 +0100 [thread overview]
Message-ID: <d397e88f-acb5-4e0f-aaae-8f6eddf60164@redhat.com> (raw)
In-Reply-To: <2e878c19-077c-4e2f-8065-fe62296a5094@linux.dev>
On 10/29/25 11:20 AM, Vadim Fedorenko wrote:
> On 24/10/2025 15:49, Ivan Vecera wrote:
>> Phase-adjust values are currently limited by a min-max range. Some
>> hardware requires, for certain pin types, that values be multiples of
>> a specific granularity, as in the zl3073x driver.
>>
>> Add a `phase-adjust-gran` pin attribute and an appropriate field in
>> dpll_pin_properties. If set by the driver, use its value to validate
>> user-provided phase-adjust values.
>>
>> Reviewed-by: Michal Schmidt <mschmidt@redhat.com>
>> Reviewed-by: Petr Oros <poros@redhat.com>
>> Tested-by: Prathosh Satish <Prathosh.Satish@microchip.com>
>> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
>> ---
>> Documentation/driver-api/dpll.rst | 36 +++++++++++++++------------
>> Documentation/netlink/specs/dpll.yaml | 7 ++++++
>> drivers/dpll/dpll_netlink.c | 12 ++++++++-
>> include/linux/dpll.h | 1 +
>> include/uapi/linux/dpll.h | 1 +
>> 5 files changed, 40 insertions(+), 17 deletions(-)
>>
>> @@ -1261,7 +1265,13 @@ dpll_pin_phase_adj_set(struct dpll_pin *pin,
>> struct nlattr *phase_adj_attr,
>> if (phase_adj > pin->prop.phase_range.max ||
>> phase_adj < pin->prop.phase_range.min) {
>> NL_SET_ERR_MSG_ATTR(extack, phase_adj_attr,
>> - "phase adjust value not supported");
>> + "phase adjust value of out range");
>> + return -EINVAL;
>> + }
>> + if (pin->prop.phase_gran && phase_adj % pin->prop.phase_gran) {
>> + NL_SET_ERR_MSG_ATTR_FMT(extack, phase_adj_attr,
>> + "phase adjust value not multiple of %u",
>> + pin->prop.phase_gran);
>
> That is pretty strict on the uAPI input. Maybe it's better to allow any
> value, but report back the one that is really applied based on driver's
> understanding of hardware? I mean the driver is doing some math before
> applying the math, it can potentially round any value to the closest
> acceptable and report it back?
I’d prefer to use the same approach as for phase-adjust-{min,max}.
Because we could treat them the same way - the user sets a value
above/below the max/min, and the driver clamps it.
Would it be better? I don't think so.
Let’s say the granularity is 1000, and the user sets a value of 499...
then the driver rounds it and sets it to 0. The user then reads the
current value via pin-get and finds that it hasn’t changed - quite
confusing, I’d say. If the user knows the granularity in advance,
they can adjust accordingly.
IMHO, strict behavior is better than smart behavior.
Ivan
next prev parent reply other threads:[~2025-10-29 11:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 14:49 [PATCH net-next 0/2] dpll: Add support for phase adjustment granularity Ivan Vecera
2025-10-24 14:49 ` [PATCH net-next 1/2] dpll: add phase-adjust-gran pin attribute Ivan Vecera
2025-10-29 1:39 ` Jakub Kicinski
2025-10-29 7:44 ` Ivan Vecera
2025-10-29 14:20 ` Jiri Pirko
2025-10-29 15:00 ` Ivan Vecera
2025-10-29 10:20 ` Vadim Fedorenko
2025-10-29 11:17 ` Ivan Vecera [this message]
2025-10-24 14:49 ` [PATCH net-next 2/2] dpll: zl3073x: Specify phase adjustment granularity for pins Ivan Vecera
2025-10-29 1:36 ` [PATCH net-next 0/2] dpll: Add support for phase adjustment granularity Jakub Kicinski
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=d397e88f-acb5-4e0f-aaae-8f6eddf60164@redhat.com \
--to=ivecera@redhat.com \
--cc=Prathosh.Satish@microchip.com \
--cc=arkadiusz.kubalewski@intel.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mschmidt@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=poros@redhat.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