From: Ivan Vecera <ivecera@redhat.com>
To: netdev@vger.kernel.org
Cc: Petr Oros <poros@redhat.com>, David Ahern <dsahern@kernel.org>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2-next 1/2] dpll: add pin operstate attribute support
Date: Wed, 13 May 2026 16:51:14 +0200 [thread overview]
Message-ID: <20260513145115.174597-2-ivecera@redhat.com> (raw)
In-Reply-To: <20260513145115.174597-1-ivecera@redhat.com>
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
next prev parent reply other threads:[~2026-05-13 14:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-05-13 14:51 ` [PATCH iproute2-next 2/2] dpll: add fractional-frequency-offset " Ivan Vecera
2026-05-15 15:58 ` David Ahern
2026-05-15 16:57 ` Ivan Vecera
2026-05-15 19:30 ` [PATCH iproute2-next 0/2] dpll: add pin operstate and fractional frequency offset " patchwork-bot+netdevbpf
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=20260513145115.174597-2-ivecera@redhat.com \
--to=ivecera@redhat.com \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=poros@redhat.com \
--cc=stephen@networkplumber.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.