Netdev List
 help / color / mirror / Atom feed
* [PATCH iproute2-next 0/2] dpll: add pin operstate and fractional frequency offset to parent-device
@ 2026-05-13 14:51 Ivan Vecera
  2026-05-13 14:51 ` [PATCH iproute2-next 1/2] dpll: add pin operstate attribute support Ivan Vecera
  2026-05-13 14:51 ` [PATCH iproute2-next 2/2] dpll: add fractional-frequency-offset to parent-device Ivan Vecera
  0 siblings, 2 replies; 3+ messages in thread
From: Ivan Vecera @ 2026-05-13 14:51 UTC (permalink / raw)
  To: netdev; +Cc: Petr Oros, David Ahern, Stephen Hemminger

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(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH iproute2-next 1/2] dpll: add pin operstate attribute support
  2026-05-13 14:51 [PATCH iproute2-next 0/2] dpll: add pin operstate and fractional frequency offset to parent-device Ivan Vecera
@ 2026-05-13 14:51 ` Ivan Vecera
  2026-05-13 14:51 ` [PATCH iproute2-next 2/2] dpll: add fractional-frequency-offset to parent-device Ivan Vecera
  1 sibling, 0 replies; 3+ messages in thread
From: Ivan Vecera @ 2026-05-13 14:51 UTC (permalink / raw)
  To: netdev; +Cc: Petr Oros, David Ahern, Stephen Hemminger

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.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 bash-completion/dpll |  7 ++++++-
 dpll/dpll.c          | 50 +++++++++++++++++++++++++++++++++++++++++++-
 man/man8/dpll.8      | 16 ++++++++++++--
 3 files changed, 69 insertions(+), 4 deletions(-)

diff --git a/bash-completion/dpll b/bash-completion/dpll
index 7ddcf529d429..9ff38a46c279 100644
--- a/bash-completion/dpll
+++ b/bash-completion/dpll
@@ -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
                     ;;
diff --git a/dpll/dpll.c b/dpll/dpll.c
index febf2a5d1fbd..bd9ab3c6033f 100644
--- a/dpll/dpll.c
+++ b/dpll/dpll.c
@@ -59,6 +59,16 @@ static struct str_num_map pin_state_map[] = {
 	},
 };
 
+static struct str_num_map pin_operstate_map[] = {
+	{ .str = "active", .num = DPLL_PIN_OPERSTATE_ACTIVE },
+	{ .str = "standby", .num = DPLL_PIN_OPERSTATE_STANDBY },
+	{ .str = "no-signal", .num = DPLL_PIN_OPERSTATE_NO_SIGNAL },
+	{ .str = "qual-failed", .num = DPLL_PIN_OPERSTATE_QUAL_FAILED },
+	{
+		.str = NULL,
+	},
+};
+
 static struct str_num_map pin_type_map[] = {
 	{ .str = "mux", .num = DPLL_PIN_TYPE_MUX },
 	{ .str = "ext", .num = DPLL_PIN_TYPE_EXT },
@@ -162,6 +172,17 @@ static int str_to_dpll_pin_state(const char *state_str, __u32 *state)
 	return 0;
 }
 
+static int str_to_dpll_pin_operstate(const char *str, __u32 *operstate)
+{
+	int num;
+
+	num = str_map_lookup_str(pin_operstate_map, str);
+	if (num < 0)
+		return num;
+	*operstate = num;
+	return 0;
+}
+
 static int str_to_dpll_pin_direction(const char *dir_str, __u32 *direction)
 {
 	int num;
@@ -968,6 +989,7 @@ static bool dpll_device_dump_filter(struct dpll_device_filter *filter,
 #define DPLL_FILTER_PIN_PARENT_PIN	BIT(7)
 #define DPLL_FILTER_PIN_DIRECTION	BIT(8)
 #define DPLL_FILTER_PIN_STATE		BIT(9)
+#define DPLL_FILTER_PIN_OPERSTATE	BIT(10)
 
 struct dpll_pin_filter {
 	uint64_t present;
@@ -981,6 +1003,7 @@ struct dpll_pin_filter {
 	__u32 parent_pin_id;
 	__u32 direction;
 	__u32 state;
+	__u32 operstate;
 };
 
 static bool filter_match_nested_id(const struct nlmsghdr *nlh,
@@ -1030,6 +1053,11 @@ static bool filter_match_nested_parent_device(const struct nlmsghdr *nlh,
 				      filter->state))
 			continue;
 
+		if ((filter->present & DPLL_FILTER_PIN_OPERSTATE) &&
+		    !filter_match_u32(tb_nest[DPLL_A_PIN_OPERSTATE],
+				      filter->operstate))
+			continue;
+
 		return true;
 	}
 	return false;
@@ -1063,7 +1091,8 @@ static bool dpll_pin_dump_filter(struct dpll_pin_filter *filter,
 		return false;
 	if ((filter->present & (DPLL_FILTER_PIN_PARENT_DEVICE |
 				DPLL_FILTER_PIN_DIRECTION |
-				DPLL_FILTER_PIN_STATE)) &&
+				DPLL_FILTER_PIN_STATE |
+				DPLL_FILTER_PIN_OPERSTATE)) &&
 	    !filter_match_nested_parent_device(nlh, filter))
 		return false;
 	if ((filter->present & DPLL_FILTER_PIN_PARENT_PIN) &&
@@ -1426,6 +1455,14 @@ static const char *dpll_pin_state_name(__u32 state)
 	return str ? str : "unknown";
 }
 
+static const char *dpll_pin_operstate_name(__u32 operstate)
+{
+	const char *str;
+
+	str = str_map_lookup_uint(pin_operstate_map, operstate);
+	return str ? str : "unknown";
+}
+
 static const char *dpll_pin_direction_name(__u32 direction)
 {
 	const char *str;
@@ -1561,6 +1598,9 @@ static void dpll_pin_print_parent_devices(struct nlattr *attr)
 				 " prio %u");
 		DPLL_PR_ENUM_STR_FMT(tb_parent, DPLL_A_PIN_STATE, "state",
 				     " state %s", dpll_pin_state_name);
+		DPLL_PR_ENUM_STR_FMT(tb_parent, DPLL_A_PIN_OPERSTATE,
+				     "operstate", " operstate %s",
+				     dpll_pin_operstate_name);
 		dpll_pr_phase_offset(tb_parent[DPLL_A_PIN_PHASE_OFFSET]);
 
 		print_nl();
@@ -1992,6 +2032,14 @@ static int cmd_pin_show(struct dpll *dpll)
 						   str_to_dpll_pin_state,
 						   "connected/disconnected/selectable"))
 				return -EINVAL;
+		} else if (dpll_argv_match(dpll, "operstate")) {
+			if (dpll_filter_parse_enum(dpll, "operstate",
+						   &filter.operstate,
+						   &filter.present,
+						   DPLL_FILTER_PIN_OPERSTATE,
+						   str_to_dpll_pin_operstate,
+						   "active/standby/no-signal/qual-failed"))
+				return -EINVAL;
 		} else {
 			pr_err("unknown option: %s\n", dpll_argv(dpll));
 			return -EINVAL;
diff --git a/man/man8/dpll.8 b/man/man8/dpll.8
index c0d4b9caef2a..f4cbcfc005c1 100644
--- a/man/man8/dpll.8
+++ b/man/man8/dpll.8
@@ -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]
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH iproute2-next 2/2] dpll: add fractional-frequency-offset to parent-device
  2026-05-13 14:51 [PATCH iproute2-next 0/2] dpll: add pin operstate and fractional frequency offset to parent-device Ivan Vecera
  2026-05-13 14:51 ` [PATCH iproute2-next 1/2] dpll: add pin operstate attribute support Ivan Vecera
@ 2026-05-13 14:51 ` Ivan Vecera
  1 sibling, 0 replies; 3+ messages in thread
From: Ivan Vecera @ 2026-05-13 14:51 UTC (permalink / raw)
  To: netdev; +Cc: Petr Oros, David Ahern, Stephen Hemminger

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.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 dpll/dpll.c     | 27 ++++++++++++++++++++++-----
 man/man8/dpll.8 |  4 +++-
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/dpll/dpll.c b/dpll/dpll.c
index bd9ab3c6033f..1077fc259725 100644
--- a/dpll/dpll.c
+++ b/dpll/dpll.c
@@ -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");
diff --git a/man/man8/dpll.8 b/man/man8/dpll.8
index f4cbcfc005c1..f409ba6bb9c5 100644
--- a/man/man8/dpll.8
+++ b/man/man8/dpll.8
@@ -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]
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-13 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 14:51 [PATCH iproute2-next 0/2] dpll: add pin operstate and fractional frequency offset to parent-device Ivan Vecera
2026-05-13 14:51 ` [PATCH iproute2-next 1/2] dpll: add pin operstate attribute support Ivan Vecera
2026-05-13 14:51 ` [PATCH iproute2-next 2/2] dpll: add fractional-frequency-offset to parent-device Ivan Vecera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox