From: Vladimir Oltean Date: Tue, 4 Oct 2022 12:00:27 +0000 (+0300) Subject: taprio: don't print the clockid if invalid X-Git-Tag: v6.2.0~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a23a6eff9c0c3e888170424f5d743f99fbc0116d;p=thirdparty%2Fiproute2.git taprio: don't print the clockid if invalid The clockid will not be reported by the kernel if the qdisc is fully offloaded, since it is implicitly the PTP Hardware Clock of the device. Currently "tc qdisc show" points us to a "clockid invalid" for a qdisc created with "flags 0x2", let's hide that attribute instead. Signed-off-by: Vladimir Oltean Signed-off-by: David Ahern --- diff --git a/tc/q_taprio.c b/tc/q_taprio.c index e43db9d0e..e3af3f3fa 100644 --- a/tc/q_taprio.c +++ b/tc/q_taprio.c @@ -434,7 +434,6 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) { struct rtattr *tb[TCA_TAPRIO_ATTR_MAX + 1]; struct tc_mqprio_qopt *qopt = 0; - __s32 clockid = CLOCKID_INVALID; int i; if (opt == NULL) @@ -467,10 +466,13 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) print_nl(); - if (tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID]) - clockid = rta_getattr_s32(tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID]); + if (tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID]) { + __s32 clockid; - print_string(PRINT_ANY, "clockid", "clockid %s", get_clock_name(clockid)); + clockid = rta_getattr_s32(tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID]); + print_string(PRINT_ANY, "clockid", "clockid %s", + get_clock_name(clockid)); + } if (tb[TCA_TAPRIO_ATTR_FLAGS]) { __u32 flags;