Skip to contentSkip to conversation

dpll: add pin operstate and fractional frequency offset to parent-device

PATCH Applied Ivan Vecera 3 participants 6 messages May 13 – May 15

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover dpll: add pin operstate and fractional frequency offset to parent-device

Add support for two new pin-parent-device nested attributes:

Patch 1 adds pin operstate attribute support with filtering. Patch 2 adds fractional-frequency-offset (PPM/PPT) display in the parent-device context alongside the existing top-level attributes.

Ivan Vecera (2):
dpll: add pin operstate attribute support
dpll: add fractional-frequency-offset to parent-device

 bash-completion/dpll |  7 +++-
 dpll/dpll.c          | 77 ++++++++++++++++++++++++++++++++++++++++----
 man/man8/dpll.8      | 18 +++++++++--
 3 files changed, 93 insertions(+), 9 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH 1/2 dpll: add pin operstate attribute support

Kernel commit 781c8893a5da8 ("dpll: add pin operational state") added the DPLL_A_PIN_OPERSTATE attribute which reports the operational state of a pin with respect to its parent DPLL device. The attribute is nested inside parent-device and can have values: active, standby, no-signal, qual-failed.

Add operstate filtering for pin show command, allowing to filter pins by their operational state on parent device. Update bash-completion and man page accordingly.

---
 bash-completion/dpll |  7 ++++++-
 dpll/dpll.c          | 50 +++++++++++++++++++++++++++++++++++++++++++-
 man/man8/dpll.8      | 16 ++++++++++++--
 3 files changed, 69 insertions(+), 4 deletions(-)
bash-completion/dpll +6 -1
index 7ddcf529d429..9ff38a46c279 100644
@@ -190,10 +190,15 @@ _dpll_pin()
                         "connected disconnected selectable" -- "$cur" ) )
                     return 0
                     ;;
+                operstate)
+                    COMPREPLY=( $( compgen -W \
+                        "active standby no-signal qual-failed" -- "$cur" ) )
+                    return 0
+                    ;;
                 *)
                     COMPREPLY=( $( compgen -W "id parent-device parent-pin \
                         module-name clock-id board-label panel-label \
-                        package-label type direction state" \
+                        package-label type direction state operstate" \
                         -- "$cur" ) )
                     return 0
                     ;;
dpll/dpll.c +49 -1

104 lines not on this page · raw message

man/man8/dpll.8 +14 -2
index c0d4b9caef2a..f4cbcfc005c1 100644
@@ -171,7 +171,10 @@ Device type:
 
 .SH PIN COMMANDS
 
-.SS dpll pin show [ id ID ] [ parent-device DEVICE_ID ] [ parent-pin PIN_ID ] [ module-name NAME ] [ clock-id ID ] [ board-label LABEL ] [ panel-label LABEL ] [ package-label LABEL ] [ type TYPE ] [ direction DIR ] [ state STATE ]
+.SS dpll pin show [ id ID ] [ parent-device DEVICE_ID ] \
+[ parent-pin PIN_ID ] [ module-name NAME ] [ clock-id ID ] \
+[ board-label LABEL ] [ panel-label LABEL ] [ package-label LABEL ] \
+[ type TYPE ] [ direction DIR ] [ state STATE ] [ operstate OPERSTATE ]
 
 Display information about DPLL pins. If no arguments are specified,
 shows all pins in the system.
@@ -229,6 +232,15 @@ When combined with
 .BR parent-device ,
 only the specified parent-device relationship is checked.
 
+.TP
+.BI operstate " OPERSTATE"
+Show only pins that have a parent-device relationship with the specified
+operational state:
+.BR active ", " standby ", " no-signal ", " qual-failed .
+When combined with
+.BR parent-device ,
+only the specified parent-device relationship is checked.
+
 .PP
 Output includes:
 .RS
@@ -251,7 +263,7 @@ Capabilities (state-can-change, priority-can-change, direction-can-change)
 .IP \[bu]
 Phase adjustment range, granularity, and current value
 .IP \[bu]
-Parent device relationships (direction, priority, state, phase offset)
+Parent device relationships (direction, priority, state, operstate, phase offset)
 .IP \[bu]
 Parent pin relationships
 .IP \[bu]
Signature · 1 line
2.53.0
#2 lore raw

PATCH 2/2 dpll: add fractional-frequency-offset to parent-device

In reply to Ivan Vecera

Kernel commit 9c11fcb2e9a54 ("dpll: add fractional frequency offset to pin-parent-device") added fractional-frequency-offset (PPM) and fractional-frequency-offset-ppt (PPT) attributes to the pin-parent-device nested attribute set, alongside the existing top-level pin attributes. Add their display into dpll_pin_print_parent_devices() and add ppm and ppt units to the respective outputs.

Extract dpll_pr_ffo() helper to consolidate the duplicated PPM/PPT fallback logic used in both top-level and parent-device contexts.

---
 dpll/dpll.c     | 27 ++++++++++++++++++++++-----
 man/man8/dpll.8 |  4 +++-
 2 files changed, 25 insertions(+), 6 deletions(-)
dpll/dpll.c +22 -5
index bd9ab3c6033f..1077fc259725 100644
@@ -514,6 +514,26 @@ static void dpll_pr_phase_offset(struct nlattr *attr)
 	print_s64(PRINT_FP, NULL, "%03lld ps", d.rem);
 }
 
+static void dpll_pr_ffo(struct nlattr **tb, bool top_level)
+{
+	const char *fmt;
+
+	if (json || !tb[DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT]) {
+		if (top_level)
+			fmt = "  fractional-frequency-offset: %" PRId64 " ppm\n";
+		else
+			fmt = " fractional-frequency-offset %" PRId64 " ppm";
+		DPLL_PR_SINT_FMT(tb, DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET,
+				 "fractional-frequency-offset", fmt);
+	}
+	if (top_level)
+		fmt = "  fractional-frequency-offset: %" PRId64 " ppt\n";
+	else
+		fmt = " fractional-frequency-offset %" PRId64 " ppt";
+	DPLL_PR_SINT_FMT(tb, DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT,
+			 "fractional-frequency-offset-ppt", fmt);
+}
+
 /* Measured frequency - JSON prints raw mHz value, FP prints fractional Hz */
 static void dpll_pr_measured_frequency(struct nlattr *attr)
 {
@@ -1602,6 +1622,7 @@ static void dpll_pin_print_parent_devices(struct nlattr *attr)
 				     "operstate", " operstate %s",
 				     dpll_pin_operstate_name);
 		dpll_pr_phase_offset(tb_parent[DPLL_A_PIN_PHASE_OFFSET]);
+		dpll_pr_ffo(tb_parent, false);
 
 		print_nl();
 		close_json_object();
@@ -1694,11 +1715,7 @@ static void dpll_pin_print_attrs(struct nlattr **tb)
 	DPLL_PR_INT_FMT(tb, DPLL_A_PIN_PHASE_ADJUST, "phase-adjust",
 			"  phase-adjust: %d ps\n");
 
-	if (json || !tb[DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT])
-		DPLL_PR_SINT(tb, DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET,
-			     "fractional-frequency-offset");
-	DPLL_PR_SINT(tb, DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT,
-		     "fractional-frequency-offset-ppt");
+	dpll_pr_ffo(tb, true);
 
 	DPLL_PR_U64_FMT(tb, DPLL_A_PIN_ESYNC_FREQUENCY, "esync-frequency",
 			"  esync-frequency: %" PRIu64 " Hz\n");
man/man8/dpll.8 +3 -1
index f4cbcfc005c1..f409ba6bb9c5 100644
@@ -263,7 +263,9 @@ Capabilities (state-can-change, priority-can-change, direction-can-change)
 .IP \[bu]
 Phase adjustment range, granularity, and current value
 .IP \[bu]
-Parent device relationships (direction, priority, state, operstate, phase offset)
+Fractional frequency offset in ppm (RX vs TX symbol rate on media)
+.IP \[bu]
+Parent device relationships (direction, priority, state, operstate, phase offset, fractional frequency offset in ppt)
 .IP \[bu]
 Parent pin relationships
 .IP \[bu]
Signature · 1 line
2.53.0
#3 lore raw

Re: [PATCH iproute2-next 2/2] dpll: add fractional-frequency-offset to parent-device

Quoted 8 lines · Ivan Vecera
dpll/dpll.c +8 -0
+static void dpll_pr_ffo(struct nlattr **tb, bool top_level)
+{
+	const char *fmt;
+
+	if (json || !tb[DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT]) {
+		if (top_level)
+			fmt = "  fractional-frequency-offset: %" PRId64 " ppm\n";
+		else

dpll/dpll.c static void dpll_pr_phase_offset(struct nlattr *attr) · line 534

Quoted 10 lines
dpll/dpll.c +10 -0
+			fmt = " fractional-frequency-offset %" PRId64 " ppm";
+		DPLL_PR_SINT_FMT(tb, DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET,
+				 "fractional-frequency-offset", fmt);
+	}
+	if (top_level)
+		fmt = "  fractional-frequency-offset: %" PRId64 " ppt\n";
+	else
+		fmt = " fractional-frequency-offset %" PRId64 " ppt";
+	DPLL_PR_SINT_FMT(tb, DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT,
+			 "fractional-frequency-offset-ppt", fmt);

something is not lining up for me: the attribute is DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT here but the fmt statement is still fractional-frequency-offset and yet name is fractional-frequency-offset-ppt.

Also why the use of DPLL_PR_SINT_FMT instead of DPLL_PR_SINT which avoids the extra fmt argument?

#4 lore raw

Re: [PATCH iproute2-next 2/2] dpll: add fractional-frequency-offset to parent-device

Quoted 16 lines · David Ahern
Quoted 15 lines · Ivan Vecera
dpll/dpll.c +15 -0
+static void dpll_pr_ffo(struct nlattr **tb, bool top_level)
+{
+	const char *fmt;
+
+	if (json || !tb[DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT]) {
+		if (top_level)
+			fmt = "  fractional-frequency-offset: %" PRId64 " ppm\n";
+		else
+			fmt = " fractional-frequency-offset %" PRId64 " ppm";
+		DPLL_PR_SINT_FMT(tb, DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET,
+				 "fractional-frequency-offset", fmt);
+	}
+	if (top_level)
+		fmt = "  fractional-frequency-offset: %" PRId64 " ppt\n";
+	else
Quoted 8 lines

dpll/dpll.c static void dpll_pr_phase_offset(struct nlattr *attr) · line 534

Quoted 3 lines
dpll/dpll.c +3 -0
+		fmt = " fractional-frequency-offset %" PRId64 " ppt";
+	DPLL_PR_SINT_FMT(tb, DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT,
+			 "fractional-frequency-offset-ppt", fmt);

something is not lining up for me: the attribute is DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET_PPT here but the fmt statement is still fractional-frequency-offset and yet name is fractional-frequency-offset-ppt.

Both attributes with and without _PPT suffix is the same, they differ in unit. Logic is following:

For non-JSON (human readable) output:
If both FFO and FFO_PPT are present then only more precise FFO_PPT is printed (with suffix 'ppt').
If only FFO is present then it is printed (with suffix 'ppm').

For JSON output:
Both are printed if they are both present... To distinguish between them in the json output we have to use fractional-frequency-offset and fractional-frequency-offset-ppt.

Quoted 2 lines

Also why the use of DPLL_PR_SINT_FMT instead of DPLL_PR_SINT which avoids the extra fmt argument?

To add correct unit in non-JSON output.

Thanks,
Ivan

#5 lore raw
In reply to Ivan Vecera
This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Hello:

This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:

Quoted 11 lines · On Wed, 13 May 2026 16:51:13 +0200 you wrote:

Add support for two new pin-parent-device nested attributes:

Patch 1 adds pin operstate attribute support with filtering. Patch 2 adds fractional-frequency-offset (PPM/PPT) display in the parent-device context alongside the existing top-level attributes.

Ivan Vecera (2):
dpll: add pin operstate attribute support
dpll: add fractional-frequency-offset to parent-device

[...]

Here is the summary with links:
- [iproute2-next,1/2] dpll: add pin operstate attribute support

    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=55cbf807b378
  - [iproute2-next,2/2] dpll: add fractional-frequency-offset to parent-device
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=dde3f17bc311

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html