]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
taprio: add support for setting txtime_delay.
authorVedang Patel <vedang.patel@intel.com>
Thu, 18 Jul 2019 19:55:41 +0000 (12:55 -0700)
committerDavid Ahern <dsahern@gmail.com>
Thu, 18 Jul 2019 22:46:36 +0000 (15:46 -0700)
This adds support for setting the txtime_delay parameter which is useful
for the txtime offload mode of taprio.

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
tc/q_taprio.c

index 1db2aba6efe71ed020b0882ed8c66e25b4ce1f6c..b9954436b0f9fd66fbf788559dd10b42673da5d9 100644 (file)
@@ -52,7 +52,7 @@ static void explain(void)
                "               [num_tc NUMBER] [map P0 P1 ...] "
                "               [queues COUNT@OFFSET COUNT@OFFSET COUNT@OFFSET ...] "
                "               [ [sched-entry index cmd gate-mask interval] ... ] "
-               "               [base-time time] "
+               "               [base-time time] [txtime-delay delay]"
                "\n"
                "CLOCKID must be a valid SYS-V id (i.e. CLOCK_TAI)\n");
 }
@@ -160,6 +160,7 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
        struct list_head sched_entries;
        struct rtattr *tail, *l;
        __u32 taprio_flags = 0;
+       __u32 txtime_delay = 0;
        __s64 cycle_time = 0;
        __s64 base_time = 0;
        int err, idx;
@@ -293,6 +294,17 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
                                return -1;
                        }
 
+               } else if (strcmp(*argv, "txtime-delay") == 0) {
+                       NEXT_ARG();
+                       if (txtime_delay != 0) {
+                               fprintf(stderr, "taprio: duplicate \"txtime-delay\" specification\n");
+                               return -1;
+                       }
+                       if (get_u32(&txtime_delay, *argv, 0)) {
+                               PREV_ARG();
+                               return -1;
+                       }
+
                } else if (strcmp(*argv, "help") == 0) {
                        explain();
                        return -1;
@@ -315,6 +327,9 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
        if (opt.num_tc > 0)
                addattr_l(n, 1024, TCA_TAPRIO_ATTR_PRIOMAP, &opt, sizeof(opt));
 
+       if (txtime_delay)
+               addattr_l(n, 1024, TCA_TAPRIO_ATTR_TXTIME_DELAY, &txtime_delay, sizeof(txtime_delay));
+
        if (base_time)
                addattr_l(n, 1024, TCA_TAPRIO_ATTR_SCHED_BASE_TIME, &base_time, sizeof(base_time));
 
@@ -464,6 +479,13 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
                print_0xhex(PRINT_ANY, "flags", " flags %#x", flags);
        }
 
+       if (tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]) {
+               __u32 txtime_delay;
+
+               txtime_delay = rta_getattr_s32(tb[TCA_TAPRIO_ATTR_TXTIME_DELAY]);
+               print_uint(PRINT_ANY, "txtime_delay", " txtime delay %d", txtime_delay);
+       }
+
        print_schedule(f, tb);
 
        if (tb[TCA_TAPRIO_ATTR_ADMIN_SCHED]) {