From: Petr Oros <poros@redhat.com>
To: netdev@vger.kernel.org
Cc: Petr Oros <poros@redhat.com>, Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Shuah Khan <shuah@kernel.org>,
Randy Dunlap <rdunlap@infradead.org>,
Jani Nikula <jani.nikula@intel.com>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>,
Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>,
Jiri Pirko <jiri@resnulli.us>, Ivan Vecera <ivecera@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH net-next v2 10/14] selftests: dpll: add pin frequency test
Date: Thu, 5 Nov 2026 16:18:48 +0100 [thread overview]
Message-ID: <20261105151852.1844305-11-poros@redhat.com> (raw)
In-Reply-To: <20261105151852.1844305-1-poros@redhat.com>
Add a test that picks a supported frequency other than the current one
from the frequency-supported list of an input pin, sets it, reads it
back and restores the original value. Both ends of every advertised
range are candidates, so that a pin advertising a single range wider
than one value still has one. It skips when the dpll tool lacks the
frequency keyword of pin set, and the restore is deferred right after
the original value is read so that an interrupted run restores it too.
A pin that reports no frequency or advertises a single frequency only
is a skip on a device provided by the user and a failure on the device
the script created, whose pins advertise several.
The driver may refuse the candidate. A driver without a frequency
setter refuses every value with EOPNOTSUPP, and a driver with
constraints of its own refuses values the advertised ranges allow,
zl3073x for instance wants the frequencies of an output pair to divide
each other. On a device provided by the user a refused set is a skip
that names the reason the tool reported, which the setter keeps in
DPLL_LAST_ERR, on the created device the simulator accepts every
advertised value and the refusal is a failure. Once the set went
through, a refused restore is a failure on either.
Signed-off-by: Petr Oros <poros@redhat.com>
---
.../drivers/net/dpll/dpll_features.sh | 64 +++++++++++++++++++
.../selftests/drivers/net/lib/sh/dpll_lib.sh | 5 ++
2 files changed, 69 insertions(+)
diff --git a/tools/testing/selftests/drivers/net/dpll/dpll_features.sh b/tools/testing/selftests/drivers/net/dpll/dpll_features.sh
index 61003ba280d658..a39098fbf73135 100755
--- a/tools/testing/selftests/drivers/net/dpll/dpll_features.sh
+++ b/tools/testing/selftests/drivers/net/dpll/dpll_features.sh
@@ -17,6 +17,7 @@ source "$SCRIPTDIR/../lib/sh/dpll_lib.sh"
ALL_TESTS="
test_pin_state_transitions
test_pin_priority_get_set
+ test_pin_frequency_set_get
"
##############################################################################
@@ -165,6 +166,69 @@ test_pin_state_transitions()
log_test "DPLL pin state transitions"
}
+test_pin_frequency_set_get()
+{
+ local before target after reason
+
+ RET=0
+
+ if [ -z "$PIN_TUNE_ID" ]; then
+ dpll_log_test_skip_or_fail "DPLL pin frequency set/get" \
+ "no spare input pin"
+ return
+ fi
+ if ! dpll_pin_set_supports frequency; then
+ log_test_skip "DPLL pin frequency set/get" \
+ "dpll tool lacks pin set frequency"
+ return
+ fi
+
+ before=$(dpll_pin_get_frequency "$PIN_TUNE_ID")
+ if [ -z "$before" ]; then
+ dpll_log_test_skip_or_fail "DPLL pin frequency set/get" \
+ "frequency not reported"
+ return
+ fi
+ defer dpll_pin_set_frequency "$PIN_TUNE_ID" "$before"
+
+ # Pick a supported frequency different from the current one. Both
+ # ends of every supported range are candidates, so a pin with a
+ # single range still has an alternative unless it is one value wide.
+ target=$(dpll_pin_json "$PIN_TUNE_ID" | \
+ jq -r --argjson cur "$before" \
+ '[.["frequency-supported"][]? |
+ .["frequency-min"], .["frequency-max"] |
+ numbers | select(. != $cur)][0] // empty')
+ if [ -z "$target" ]; then
+ dpll_log_test_skip_or_fail "DPLL pin frequency set/get" \
+ "no alternative supported frequency"
+ return
+ fi
+
+ # A driver without a frequency setter or with constraints of its own
+ # may refuse the candidate, a skip on a device the user provided, the
+ # simulator accepts every advertised value.
+ if ! dpll_pin_set_frequency "$PIN_TUNE_ID" "$target"; then
+ reason=${DPLL_LAST_ERR%%$'\n'*}
+ dpll_log_test_skip_or_fail "DPLL pin frequency set/get" \
+ "cannot set frequency=$target${reason:+, $reason}"
+ return
+ fi
+ after=$(dpll_pin_get_frequency "$PIN_TUNE_ID")
+ if [ "$after" != "$target" ]; then
+ check_err 1 "frequency expected $target, got '$after'"
+ fi
+
+ dpll_pin_set_frequency "$PIN_TUNE_ID" "$before"
+ check_err $? "cannot restore frequency"
+ after=$(dpll_pin_get_frequency "$PIN_TUNE_ID")
+ if [ "$after" != "$before" ]; then
+ check_err 1 "frequency not restored, got '$after'"
+ fi
+
+ log_test "DPLL pin frequency set/get"
+}
+
##############################################################################
cleanup()
diff --git a/tools/testing/selftests/drivers/net/lib/sh/dpll_lib.sh b/tools/testing/selftests/drivers/net/lib/sh/dpll_lib.sh
index 1c3e27eb09775d..9718d73c60b444 100644
--- a/tools/testing/selftests/drivers/net/lib/sh/dpll_lib.sh
+++ b/tools/testing/selftests/drivers/net/lib/sh/dpll_lib.sh
@@ -412,6 +412,11 @@ dpll_pin_set_prio()
prio "$prio" 2>&1 >/dev/null)
}
+dpll_pin_set_frequency()
+{
+ DPLL_LAST_ERR=$(dpll pin set id "$1" frequency "$2" 2>&1 >/dev/null)
+}
+
##############################################################################
# dpllsim configfs interface
#
--
2.56.0
next prev parent reply other threads:[~2026-11-05 15:20 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 15:18 [PATCH net-next v2 00/14] dpll: add a simulated DPLL device driver Petr Oros
2026-11-05 15:18 ` [PATCH net-next v2 01/14] dpll: dpllsim: Add " Petr Oros
2026-11-06 10:47 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 02/14] selftests: dpll: add test library and device lifecycle tests Petr Oros
2026-11-06 10:48 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 03/14] dpll: dpllsim: Add configurable pins Petr Oros
2026-11-06 10:48 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 04/14] selftests: dpll: add pin enumeration and property tests Petr Oros
2026-11-06 10:48 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 05/14] dpll: dpllsim: Add support to set input pin state Petr Oros
2026-11-06 10:41 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 06/14] selftests: dpll: add pin state tests Petr Oros
2026-11-06 10:49 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 07/14] dpll: dpllsim: Add support to get/set priority on input pins Petr Oros
2026-11-06 10:49 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 08/14] selftests: dpll: add pin priority test Petr Oros
2026-11-06 10:50 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 09/14] dpll: dpllsim: Add support to set frequency on pins Petr Oros
2026-11-06 10:50 ` Ivan Vecera
2026-11-05 15:18 ` Petr Oros [this message]
2026-11-06 10:51 ` [PATCH net-next v2 10/14] selftests: dpll: add pin frequency test Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 11/14] dpll: dpllsim: Add support to adjust phase Petr Oros
2026-11-06 10:51 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 12/14] selftests: dpll: add pin phase adjust test Petr Oros
2026-11-06 10:51 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 13/14] selftests: dpll: add concurrency stress tests Petr Oros
2026-11-06 10:52 ` Ivan Vecera
2026-11-05 15:18 ` [PATCH net-next v2 14/14] selftests: dpll: add reference leak tests Petr Oros
2026-11-06 10:47 ` Ivan Vecera
2026-11-06 12:27 ` [PATCH net-next v2 00/14] dpll: add a simulated DPLL device driver Jiri Pirko
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=20261105151852.1844305-11-poros@redhat.com \
--to=poros@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=arkadiusz.kubalewski@intel.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=ivecera@redhat.com \
--cc=jani.nikula@intel.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rdunlap@infradead.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--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