]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/q_taprio.c
vdpa: add .gitignore
[mirror_iproute2.git] / tc / q_taprio.c
index aad055d8797d315cc44cf39709d9ab07f47b4b32..e43db9d0e952113732726bda5167bea50debfb80 100644 (file)
@@ -47,13 +47,14 @@ static const struct static_clockid {
 
 static void explain(void)
 {
-       fprintf(stderr, "Usage: ... taprio clockid CLOCKID\n");
-       fprintf(stderr, "                  [num_tc NUMBER] [map P0 P1 ...] ");
-       fprintf(stderr, "                  [queues COUNT@OFFSET COUNT@OFFSET COUNT@OFFSET ...] ");
-       fprintf(stderr, "                  [ [sched-entry index cmd gate-mask interval] ... ] ");
-       fprintf(stderr, "                  [base-time time] ");
-       fprintf(stderr, "\nCLOCKID must be a valid SYS-V id (i.e. CLOCK_TAI)");
-       fprintf(stderr, "\n");
+       fprintf(stderr,
+               "Usage: ... taprio clockid CLOCKID\n"
+               "               [num_tc NUMBER] [map P0 P1 ...] "
+               "               [queues COUNT@OFFSET COUNT@OFFSET COUNT@OFFSET ...] "
+               "               [ [sched-entry index cmd gate-mask interval] ... ] "
+               "               [base-time time] [txtime-delay delay]"
+               "\n"
+               "CLOCKID must be a valid SYS-V id (i.e. CLOCK_TAI)\n");
 }
 
 static void explain_clockid(const char *val)
@@ -158,6 +159,8 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
        __s64 cycle_time_extension = 0;
        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;
@@ -280,6 +283,28 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
                                explain_clockid(*argv);
                                return -1;
                        }
+               } else if (strcmp(*argv, "flags") == 0) {
+                       NEXT_ARG();
+                       if (taprio_flags) {
+                               fprintf(stderr, "taprio: duplicate \"flags\" specification\n");
+                               return -1;
+                       }
+                       if (get_u32(&taprio_flags, *argv, 0)) {
+                               PREV_ARG();
+                               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;
@@ -296,9 +321,15 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
        if (clockid != CLOCKID_INVALID)
                addattr_l(n, 1024, TCA_TAPRIO_ATTR_SCHED_CLOCKID, &clockid, sizeof(clockid));
 
+       if (taprio_flags)
+               addattr_l(n, 1024, TCA_TAPRIO_ATTR_FLAGS, &taprio_flags, sizeof(taprio_flags));
+
        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));
 
@@ -337,7 +368,7 @@ static int print_sched_list(FILE *f, struct rtattr *list)
 
        open_json_array(PRINT_JSON, "schedule");
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        for (item = RTA_DATA(list); RTA_OK(item, rem); item = RTA_NEXT(item, rem)) {
                struct rtattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1];
@@ -365,7 +396,7 @@ static int print_sched_list(FILE *f, struct rtattr *list)
                print_uint(PRINT_ANY, "interval", " interval %u", interval);
                close_json_object();
 
-               print_string(PRINT_FP, NULL, "%s", _SL_);
+               print_nl();
        }
 
        close_json_array(PRINT_ANY, "");
@@ -423,7 +454,7 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
                print_uint(PRINT_ANY, NULL, " %u", qopt->prio_tc_map[i]);
        close_json_array(PRINT_ANY, "");
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        open_json_array(PRINT_ANY, "queues");
        for (i = 0; i < qopt->num_tc; i++) {
@@ -434,13 +465,27 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
        }
        close_json_array(PRINT_ANY, "");
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        if (tb[TCA_TAPRIO_ATTR_SCHED_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;
+
+               flags = rta_getattr_u32(tb[TCA_TAPRIO_ATTR_FLAGS]);
+               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]) {