]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
taprio: don't print the clockid if invalid
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 4 Oct 2022 12:00:27 +0000 (15:00 +0300)
committerDavid Ahern <dsahern@kernel.org>
Sun, 9 Oct 2022 19:41:57 +0000 (13:41 -0600)
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 <vladimir.oltean@nxp.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
tc/q_taprio.c

index e43db9d0e952113732726bda5167bea50debfb80..e3af3f3fa0472dedcb33046a452732db8c8f5430 100644 (file)
@@ -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;