From: Petr Oros <poros@redhat.com>
To: Ivan Vecera <ivecera@redhat.com>, netdev@vger.kernel.org
Cc: David Ahern <dsahern@kernel.org>,
Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: [PATCH iproute2-next 1/2] dpll: add ps unit to phase-related pin attributes
Date: Fri, 1 May 2026 12:20:28 +0200 [thread overview]
Message-ID: <58e72b6f-3e8a-44b7-a74c-0a21f0720ed3@redhat.com> (raw)
In-Reply-To: <20260428152115.2815860-2-ivecera@redhat.com>
On 4/28/26 17:21, Ivan Vecera wrote:
> Display phase-adjust-min, phase-adjust-max and phase-adjust values
> with ps unit. Add DPLL_PR_PHASE_OFFSET macro that properly formats
> phase-offset as fractional picoseconds by dividing the raw kernel
> value by DPLL_PHASE_OFFSET_DIVIDER.
>
> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
> ---
> dpll/dpll.c | 27 ++++++++++++++++++++++-----
> 1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/dpll/dpll.c b/dpll/dpll.c
> index b6ba3283e0ba..e8056ff6a24b 100644
> --- a/dpll/dpll.c
> +++ b/dpll/dpll.c
> @@ -410,6 +410,21 @@ static __s64 mnl_attr_get_sint(const struct nlattr *attr)
> } \
> } while (0)
>
> +/* Phase offset - JSON prints raw sub-ps value, FP prints fractional ps */
> +#define DPLL_PR_PHASE_OFFSET(tb, attr_id) \
> + do { \
> + if (tb[attr_id]) { \
> + __s64 val = mnl_attr_get_sint(tb[attr_id]); \
> + lldiv_t d = lldiv(llabs(val), \
> + DPLL_PHASE_OFFSET_DIVIDER); \
> + print_s64(PRINT_JSON, "phase-offset", NULL, val); \
> + print_string(PRINT_FP, NULL, " phase-offset %s", \
> + val < 0 ? "-" : ""); \
> + print_s64(PRINT_FP, NULL, "%lld.", d.quot); \
> + print_s64(PRINT_FP, NULL, "%03lld ps", d.rem); \
> + } \
> + } while (0)
> +
> /* Generic version with custom format */
> #define DPLL_PR_ENUM_STR_FMT(tb, attr_id, name, format_str, name_func) \
> do { \
> @@ -1507,8 +1522,7 @@ 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_SINT_FMT(tb_parent, DPLL_A_PIN_PHASE_OFFSET,
> - "phase-offset", " phase-offset %" PRId64);
> + DPLL_PR_PHASE_OFFSET(tb_parent, DPLL_A_PIN_PHASE_OFFSET);
>
> print_nl();
> close_json_object();
> @@ -1592,10 +1606,13 @@ static void dpll_pin_print_attrs(struct nlattr **tb)
>
> dpll_pin_print_capabilities(tb[DPLL_A_PIN_CAPABILITIES]);
>
> - DPLL_PR_INT(tb, DPLL_A_PIN_PHASE_ADJUST_MIN, "phase-adjust-min");
> - DPLL_PR_INT(tb, DPLL_A_PIN_PHASE_ADJUST_MAX, "phase-adjust-max");
> + DPLL_PR_INT_FMT(tb, DPLL_A_PIN_PHASE_ADJUST_MIN, "phase-adjust-min",
> + " phase-adjust-min: %d ps\n");
> + DPLL_PR_INT_FMT(tb, DPLL_A_PIN_PHASE_ADJUST_MAX, "phase-adjust-max",
> + " phase-adjust-max: %d ps\n");
> DPLL_PR_UINT(tb, DPLL_A_PIN_PHASE_ADJUST_GRAN, "phase-adjust-gran");
> - DPLL_PR_INT(tb, DPLL_A_PIN_PHASE_ADJUST, "phase-adjust");
> + 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,
Reviewed-by: Petr Oros <poros@redhat.com>
next prev parent reply other threads:[~2026-05-01 10:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 15:21 [PATCH iproute2-next 0/2] dpll: phase unit display and frequency monitoring Ivan Vecera
2026-04-28 15:21 ` [PATCH iproute2-next 1/2] dpll: add ps unit to phase-related pin attributes Ivan Vecera
2026-05-01 10:20 ` Petr Oros [this message]
2026-04-28 15:21 ` [PATCH iproute2-next 2/2] dpll: add frequency monitoring support Ivan Vecera
2026-05-01 10:20 ` Petr Oros
2026-05-02 18:29 ` David Ahern
2026-05-03 15:11 ` Ivan Vecera
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=58e72b6f-3e8a-44b7-a74c-0a21f0720ed3@redhat.com \
--to=poros@redhat.com \
--cc=dsahern@kernel.org \
--cc=ivecera@redhat.com \
--cc=netdev@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox