2 * q_skbprio.c SKB PRIORITY QUEUE.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * Authors: Nishanth Devarajan, <ndev2021@gmail.com>
18 #include <sys/socket.h>
19 #include <netinet/in.h>
20 #include <arpa/inet.h>
26 static void explain(void)
28 fprintf(stderr
, "Usage: ... <skbprio> [ limit NUMBER ]\n");
31 static int skbprio_parse_opt(struct qdisc_util
*qu
, int argc
, char **argv
,
32 struct nlmsghdr
*n
, const char *dev
)
35 struct tc_skbprio_qopt opt
= {};
38 if (strcmp(*argv
, "limit") == 0) {
40 if (get_size(&opt
.limit
, *argv
)) {
42 "%s: Illegal \"limit\" value:\"%s\"\n",
48 else if (strcmp(*argv
, "help") == 0) {
53 "%s: unknown parameter \"%s\"\n",
62 addattr_l(n
, 1024, TCA_OPTIONS
, &opt
, sizeof(opt
));
66 static int skbprio_print_opt(struct qdisc_util
*qu
, FILE *f
, struct rtattr
*opt
)
68 struct tc_skbprio_qopt
*qopt
;
73 if (RTA_PAYLOAD(opt
) < sizeof(*qopt
))
77 print_uint(PRINT_ANY
, "limit", "limit %u ", qopt
->limit
);
81 struct qdisc_util skbprio_qdisc_util
= {
83 .parse_qopt
= skbprio_parse_opt
,
84 .print_qopt
= skbprio_print_opt
,