🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by netdev-bot+sashiko Sun, 29 Nov 2026 10:38
Re: [PATCH net-next v5 06/14] selftests: dpll: add pin state tests
#24120
Author: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 10:38
179 lines
14382 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] On ice E810-T, test_pin_state_transitions can leave SMA2
  changed and still report PASS when it picks U.FL2 as PIN_TUNE_ID.
- [Low] pin_is_spare() in
  tools/testing/selftests/drivers/dpll/dpll_features.sh reads the two…

--

selftests: dpll: add pin state tests

This adds dpll_features.sh. The script picks a spare input pin on a
dpllsim device or on a device the user names, moves it between
disconnected and selectable in automatic mode, reads each state back and
restores the original state. The library gains a pin state setter, a
device mode getter and a pin set keyword check, and the stress script
gains a test that floods one pin with state changes.

> diff --git a/tools/testing/selftests/drivers/dpll/dpll_features.sh b/tools/testing/selftests/drivers/dpll/dpll_features.sh
> new file mode 100755
> index 0000000000000..61ebfd9e71892
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/dpll/dpll_features.sh
> @@ -0,0 +1,477 @@

[ ... ]

> +	for state in disconnected selectable; do
> +		changed=$TUNE_CHANGED
> +		[ "$state" = "$before" ] || TUNE_CHANGED=1
> +		if ! dpll_pin_set_state "$DPLL_DEV_ID" "$PIN_TUNE_ID" \
> +					"$state"; then

[ ... ]

> +	done

[ ... ]

> +	if ! dpll_pin_set_state "$DPLL_DEV_ID" "$PIN_TUNE_ID" "$before"; then
> +		reason=${DPLL_LAST_ERR%%$'\n'*}
> +		reason=${reason:+, $reason}
> +		if [ "$RET" -eq 0 ]; then
> +			dpll_log_test_skip_or_fail \
> +			    "DPLL pin state transitions" \
> +			    "cannot set pin state to $before$reason"
> +			return
> +		fi
> +		check_err 1 "cannot restore pin state$reason"
> +	else
> +		TUNE_CHANGED=0
> +	fi
> +	# The automatic selection may pick a pin that is selectable again,
> +	# like it may in the loop above.
> +	after=$(dpll_pin_get_state "$DPLL_DEV_ID" "$PIN_TUNE_ID")
> +	if [ -z "$after" ]; then
> +		check_err 1 "cannot read the restored pin state back"
> +	elif [ "$after" != "$before" ] &&
> +	     [ "$may_pick/$before/$after" != 1/selectable/connected ]; then
> +		check_err 1 "pin state not restored, got '$after'"
> +	fi
> +
> +	log_test "DPLL pin state transitions"
> +}

[Severity: Medium]
On ice E810-T, can test_pin_state_transitions() leave SMA2 changed and
still log a pass when U.FL2 is picked as PIN_TUNE_ID?

On a device the user provides, U.FL2 passes pin_is_spare(). It is of type
ext, disconnected by default and has state-can-change. It also passes
pin_ranks_below_refs() whenever SMA2 ranks below the reference, because
U.FL2 reports the priority of the CGU input it shares with SMA2:

drivers/net/ethernet/intel/ice/ice_dpll.c:ice_dpll_sw_input_prio_get() {
    ...
	*prio = d->input_prio[p->input->idx];
    ...
}

In the loop, disconnected does nothing because DIR_EN is clear. Selectable
then does this:

drivers/net/ethernet/intel/ice/ice_dpll.c:ice_dpll_ufl_pin_state_set() {
    ...
	case ICE_DPLL_PIN_SW_2_IDX:
		if (state == DPLL_PIN_STATE_SELECTABLE) {
			data |= ICE_SMA2_DIR_EN;
			data &= ~ICE_SMA2_UFL2_RX_DIS;
			enable = true;
    ...
}

ice_dpll_init_info_sw_pins() sets ICE_SMA2_TX_EN by default. With DIR_EN
also set, the value matches ICE_SMA2_INACTIVE_MASK, so
ice_dpll_sw_pins_update() reports SMA2 as inactive. If TX_EN was clear,
SMA2 is reported as an output instead.

The restore to disconnected only does this:

			data |= ICE_SMA2_UFL2_RX_DIS;
			enable = false;
    ...
		ret = ice_dpll_pin_disable(hw, target, type, extack);

ICE_SMA2_DIR_EN is never cleared, and the CGU input shared with SMA2 is
disabled.

The U.FL2 readback above shows disconnected. The test therefore clears
TUNE_CHANGED, the deferred restore does nothing and the test passes. SMA2
started as an active input and ends up inactive or as an output, with its
CGU input disabled. A backup reference on SMA2 then drops out of
automatic selection without anything reporting it.

The header does say that reconfiguring U.FL2 changes the other pin too.
It also says the tests restore the pin and "leave alone what could change
the input a device uses". Is there a way for the test to detect or avoid
this case? The script is unchanged in this respect at the end of the
series.

[ ... ]

> +pin_is_spare()
> +{
> +	local devs pins
> +
> +	devs=$(dpll device show -j 2>/dev/null) || return 2
> +	pins=$(dpll pin show -j 2>/dev/null) || return 2

[Severity: Low]
Would it be safer to dump the pins before the devices here?

$held is built from the lock-status in the device dump, and $shown from
the pin dump, which is taken afterwards. A parent device can go from
unlocked to locked between the two calls while its new reference shows
only through operstate. The comment above says this is the case for
zl3073x with iproute2 up to 7.1.

In that case the stale unlocked status keeps the device out of $held. The
new reference, still reported selectable, is not in $shown. It then
passes as spare in pick_tune_pin() and in the recheck in pin_tune_spare(),
and test_pin_state_transitions() can set it disconnected.

With the pin dump first, the same transition puts the device in $held but
not in $shown, and every pin on it is rejected. The order is the same at
the end of the series, in "selftests: dpll: add reference leak tests".

> +	jq -e -s --argjson dev "$1" --argjson id "$2" '
> +		(.[0].device? // [.[0]]) as $devs |
> +		(.[1].pin? // [.[1]]) as $pins |
> +		[$pins[] | .["parent-device"][]? |
> +		 select(.direction == "input" and
> +			(.state == "connected" or .operstate == "active")) |
> +		 .["parent-id"]] as $shown |
> +		[$devs[] | select(.["lock-status"] != "unlocked") | .id]
> +		as $held |

[ ... ]

> +		all($on[]; .state != "connected" and
> +			   .operstate != "active" and
> +			   (.["parent-id"] as $p |
> +			    ($shown | index($p)) != null or
> +			    ($held | index($p)) == null))' \
> +		<<< "$devs"$'\n'"$pins" &> /dev/null || return 1
> +}

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125090522.3777494-1-poros%40redhat.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads